@nativestudio/sdk 0.3.0-rc.21 → 0.3.0-rc.27

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 (103) hide show
  1. package/COMPATIBILITY.json +4 -4
  2. package/dist/_chunks/chunk-65Q3RST6.js +1 -0
  3. package/dist/_chunks/{chunk-K3TIFCD3.js → chunk-7VBZYNHE.js} +1 -1
  4. package/dist/_chunks/chunk-B5QT3BVS.js +1 -0
  5. package/dist/_chunks/chunk-KONHIJPZ.js +1 -0
  6. package/dist/_chunks/{chunk-WNXKJRZ6.js → chunk-RUWGYN4N.js} +1 -1
  7. package/dist/_chunks/{chunk-QVP4AMRJ.js → chunk-SCY6PJRK.js} +1 -1
  8. package/dist/_chunks/chunk-XPDAOUQ7.js +1 -0
  9. package/dist/_types/contracts/artifact.d.ts +2 -0
  10. package/dist/_types/contracts/component-status.d.ts +9 -0
  11. package/dist/_types/contracts/device-openai-asr.d.ts +479 -0
  12. package/dist/_types/contracts/device-render.d.ts +6 -0
  13. package/dist/_types/contracts/external-agent-access.d.ts +7 -0
  14. package/dist/_types/contracts/index.d.ts +3 -0
  15. package/dist/_types/contracts/interface/media-output.d.ts +4 -1
  16. package/dist/_types/contracts/interface/operation.d.ts +44 -0
  17. package/dist/_types/contracts/interface/production-snapshot.d.ts +39 -0
  18. package/dist/_types/contracts/interface/query.d.ts +38 -0
  19. package/dist/_types/contracts/local-execution/backup-retirement.d.ts +162 -0
  20. package/dist/_types/contracts/local-execution/claim-resolution.d.ts +1470 -0
  21. package/dist/_types/contracts/local-execution/components.d.ts +1 -1
  22. package/dist/_types/contracts/local-execution/cpu-preparation.d.ts +23 -0
  23. package/dist/_types/contracts/local-execution/credential-request.d.ts +20 -0
  24. package/dist/_types/contracts/local-execution/external-generation.d.ts +59 -2
  25. package/dist/_types/contracts/local-execution/index.d.ts +12 -0
  26. package/dist/_types/contracts/local-execution/ipc.d.ts +27 -0
  27. package/dist/_types/contracts/local-execution/library-command.d.ts +303 -5
  28. package/dist/_types/contracts/local-execution/library-result.d.ts +217 -3
  29. package/dist/_types/contracts/local-execution/lifecycle.d.ts +35 -0
  30. package/dist/_types/contracts/local-execution/local-navigation.d.ts +3 -0
  31. package/dist/_types/contracts/local-execution/management.d.ts +12 -12
  32. package/dist/_types/contracts/local-execution/model-cleanup.d.ts +60 -0
  33. package/dist/_types/contracts/local-execution/model-inspection.d.ts +365 -0
  34. package/dist/_types/contracts/local-execution/openai-asr.d.ts +105 -0
  35. package/dist/_types/contracts/local-execution/openai-realtime-speech.d.ts +151 -0
  36. package/dist/_types/contracts/local-execution/preview.d.ts +15 -4
  37. package/dist/_types/contracts/local-execution/processor-capability.d.ts +6 -0
  38. package/dist/_types/contracts/local-execution/processor-direct.d.ts +140 -4
  39. package/dist/_types/contracts/local-execution/processor-outcomes.d.ts +145 -0
  40. package/dist/_types/contracts/local-execution/processor-recipes.d.ts +163 -3
  41. package/dist/_types/contracts/local-execution/processor.d.ts +2422 -322
  42. package/dist/_types/contracts/local-execution/project-source-direct.d.ts +1 -0
  43. package/dist/_types/contracts/local-execution/provider-inspection.d.ts +58 -0
  44. package/dist/_types/contracts/local-execution/provider-release.d.ts +53 -0
  45. package/dist/_types/contracts/local-execution/provider-selection.d.ts +58 -0
  46. package/dist/_types/contracts/local-execution/recognition.d.ts +30 -0
  47. package/dist/_types/contracts/local-execution/speech.d.ts +1 -1
  48. package/dist/_types/contracts/local-execution/versions.d.ts +2 -0
  49. package/dist/_types/contracts/media-observation.d.ts +56 -0
  50. package/dist/_types/contracts/native-speech-http.d.ts +15 -0
  51. package/dist/_types/contracts/navigation-context.d.ts +144 -0
  52. package/dist/_types/contracts/navigation-groups.d.ts +1 -1
  53. package/dist/_types/contracts/navigation.d.ts +2 -0
  54. package/dist/_types/contracts/observation-profile.d.ts +12 -0
  55. package/dist/_types/contracts/openai-asr.d.ts +55 -0
  56. package/dist/_types/contracts/provider-catalog.d.ts +44 -0
  57. package/dist/_types/contracts/provider-models.d.ts +115 -3
  58. package/dist/_types/contracts/provider.d.ts +93 -7
  59. package/dist/_types/contracts/render-readiness.d.ts +74 -1
  60. package/dist/_types/contracts/repair-strategy.d.ts +1 -1
  61. package/dist/_types/contracts/resourcesdk.d.ts +231 -0
  62. package/dist/_types/contracts/sound-making-plan.d.ts +41 -0
  63. package/dist/_types/contracts/source-workspace.d.ts +2 -0
  64. package/dist/_types/contracts/speech-cost.d.ts +129 -0
  65. package/dist/_types/contracts/speech.d.ts +50 -0
  66. package/dist/_types/contracts/transcription.d.ts +11 -0
  67. package/dist/_types/sdk/catalog/carriers.d.ts +40 -0
  68. package/dist/_types/sdk/catalog/core.d.ts +164 -4
  69. package/dist/_types/sdk/catalog/device-library.d.ts +360 -4
  70. package/dist/_types/sdk/catalog/device-management.d.ts +16 -6
  71. package/dist/_types/sdk/catalog/imported-visual.d.ts +990 -22
  72. package/dist/_types/sdk/catalog/mcp.d.ts +12 -0
  73. package/dist/_types/sdk/catalog/media-observation.d.ts +630 -18
  74. package/dist/_types/sdk/catalog/navigation.d.ts +241 -4
  75. package/dist/_types/sdk/catalog/provider.d.ts +272 -98
  76. package/dist/_types/sdk/catalog/reference-preview.d.ts +52 -0
  77. package/dist/_types/sdk/catalog/resourcesdk.d.ts +573 -0
  78. package/dist/_types/sdk/catalog/speech.d.ts +98 -8
  79. package/dist/_types/sdk/client.d.ts +28 -1
  80. package/dist/_types/sdk/device-renders.d.ts +4 -1
  81. package/dist/_types/sdk/direct-source.d.ts +47 -1
  82. package/dist/_types/sdk/index.d.ts +2 -0
  83. package/dist/_types/sdk/local-runtime/components.d.ts +6 -0
  84. package/dist/_types/sdk/local-runtime-client.d.ts +35 -23
  85. package/dist/_types/sdk/navigation-client.d.ts +2 -0
  86. package/dist/_types/sdk/navigation-facade.d.ts +113 -0
  87. package/dist/_types/sdk/observe.d.ts +26 -0
  88. package/dist/_types/sdk/resource-data-plane.d.ts +108 -0
  89. package/dist/_types/sdk/resource-ingress.d.ts +18 -0
  90. package/dist/_types/sdk/transport/http.d.ts +1 -0
  91. package/dist/account.js +1 -1
  92. package/dist/host-protocol.js +1 -1
  93. package/dist/index.d.ts +2 -2
  94. package/dist/index.js +1 -1
  95. package/dist/local-runtime.js +1 -1
  96. package/dist/mcp-discovery.js +1 -1
  97. package/dist/runtime-authority.js +1 -1
  98. package/package.json +3 -2
  99. package/dist/_chunks/chunk-2QDPFLIO.js +0 -1
  100. package/dist/_chunks/chunk-7DXSLHXW.js +0 -1
  101. package/dist/_chunks/chunk-ASUZJSEP.js +0 -1
  102. package/dist/_chunks/chunk-Q53Q74OP.js +0 -1
  103. package/dist/_chunks/chunk-UKPD77FB.js +0 -1
@@ -1 +0,0 @@
1
- import{canonicalFederationCatalogJson,canonicalFederationJson,canonicalFederationReadJson,inboundSignalChangesMatch}from"./chunk-VXBIT7XN.js";import{HumanTenantSchema}from"./chunk-V636KA7B.js";import{NativeRuntimePublicKeySchema}from"./chunk-NNDKZ5H5.js";import{ArtifactIdSchema,ArtifactRelationIdSchema,ArtifactRepresentationIdSchema,BriefIdSchema,BriefVersionIdSchema,CapabilityVersionMismatchSchema,ContinuationSchema,ContinuityEdgeIdSchema,DeliveryOutputProfileSchema,HumanLinksSchema,OperationIdSchema,PrincipalIdSchema,ProductionIdSchema,ProjectIdSchema,QueryLimitSchema,QueryPageInfoSchema,SceneIdSchema,SceneShotPlanIdSchema,SceneShotPlanVersionIdSchema,ShotIdSchema,StoryIdSchema,StoryVersionIdSchema,TenantIdSchema,finalProfileIds}from"./chunk-AFUVP2DC.js";import{NativeStudioSdkError}from"./chunk-TT7IA5HB.js";import{z}from"zod";var LocalIdSchema=z.uuid().overwrite(v=>v.toLowerCase());var LocalDigestSchema=z.string().length(64).regex(/^[0-9a-f]{64}$/);var LocalRevisionSchema=z.int().positive();var LocalTimeSchema=z.iso.datetime({offset:true});var LocalPackageVersionSchema=z.string().max(120).regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/).refine(v=>v===v.trim());var LocalProjectScopeSchema=z.strictObject({tenantId:LocalIdSchema,projectId:LocalIdSchema});var LocalWorkScopeSchema=LocalProjectScopeSchema.extend({productionId:LocalIdSchema,runtimeJobId:LocalIdSchema});var LocalPlacementPolicySchema=z.discriminatedUnion("mode",[z.strictObject({mode:z.literal("local-only"),deviceId:LocalIdSchema}),z.strictObject({mode:z.literal("local-preferred"),deviceId:LocalIdSchema}),z.strictObject({mode:z.literal("cloud-only")})]);var LocalPlacementAvailabilitySchema=z.discriminatedUnion("status",[z.strictObject({status:z.literal("AVAILABLE"),deviceId:LocalIdSchema}),z.strictObject({status:z.literal("UNAVAILABLE"),deviceId:LocalIdSchema,reason:z.enum(["OFFLINE","UNQUALIFIED","BUSY"])}),z.strictObject({status:z.literal("DENIED"),reason:z.enum(["FORBIDDEN","APPROVAL_REQUIRED","INVALID_INPUT"])})]);import{z as z2}from"zod";var LocalDevicePlatformSchema=z2.strictObject({os:z2.enum(["darwin","linux","win32"]),architecture:z2.enum(["x64","arm64"])});var EnrollLocalDeviceSchema=z2.strictObject({tenantId:LocalIdSchema,requestId:LocalIdSchema,expectedPrincipalId:LocalIdSchema.optional(),label:z2.string().trim().min(1).max(120),platform:LocalDevicePlatformSchema,runtimeVersion:LocalPackageVersionSchema,publicKey:NativeRuntimePublicKeySchema});var LocalDeviceViewSchema=EnrollLocalDeviceSchema.omit({requestId:true,expectedPrincipalId:true}).extend({deviceId:LocalIdSchema,revision:LocalRevisionSchema,enrolledByPrincipalId:LocalIdSchema,createdAt:LocalTimeSchema,verifiedAt:LocalTimeSchema.nullable(),revokedAt:LocalTimeSchema.nullable()}).refine(v=>[v.verifiedAt,v.revokedAt].every(time=>time===null||Date.parse(time)>=Date.parse(v.createdAt)));var LocalDeviceChallengeSchema=z2.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema,deviceRevision:LocalRevisionSchema,challengeId:LocalIdSchema,audience:z2.string().min(1).max(2048),issuedAt:LocalTimeSchema,expiresAt:LocalTimeSchema}).refine(v=>{const ttl=Date.parse(v.expiresAt)-Date.parse(v.issuedAt);return ttl>0&&ttl<=3e5});var LocalDeviceProofClaimsSchema=z2.strictObject({protocol:z2.literal("NVS_LOCAL_DEVICE_PROOF_V1"),tenantId:LocalIdSchema,deviceId:LocalIdSchema,deviceRevision:LocalRevisionSchema,challengeId:LocalIdSchema,audience:z2.string().min(1).max(2048),jti:LocalIdSchema,iat:z2.int().nonnegative(),exp:z2.int().positive()}).refine(v=>v.exp>v.iat&&v.exp-v.iat<=60);var ProveLocalDeviceSchema=z2.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema,deviceRevision:LocalRevisionSchema,challengeId:LocalIdSchema,assertion:z2.string().max(4096).regex(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/).meta({writeOnly:true})});var RevokeLocalDeviceSchema=z2.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema,requestId:LocalIdSchema,expectedRevision:LocalRevisionSchema});import{z as z3}from"zod";var processorFamilies={IMPORTED_VISUAL_NORMALIZE:"ARTIFACT_INGEST",SOURCE_SYNC_AUDIO:"ARTIFACT_INGEST",TEMPORAL_SAMPLE:"TEMPORAL_SAMPLE",DELIVERY_VALIDATE:"DELIVERY_VALIDATE",COMPOSITION_RENDER:"COMPOSITION_RENDER",IMPORT_ORIGINAL:"ARTIFACT_INGEST",LOCAL_MEDIA_INSPECT:"OBSERVE",LOCAL_MEDIA_PUBLISH:"ARTIFACT_INGEST",IMPORT_PROJECT_SOURCE:"ARTIFACT_INGEST",REGISTER_VISUAL_SEQUENCE:"ARTIFACT_INGEST",REFERENCE_PREVIEW:"PLANNING_MATERIALIZE",SPEECH_SYNTHESIZE:"AUDIO_GENERATE",SPEECH_SYNTHESIZE_CPU:"AUDIO_GENERATE",SPEECH_EXTERNAL_QWEN:"AUDIO_GENERATE",TRANSCRIBE_AUDIO:"OBSERVE",TRANSCRIBE_EXTERNAL_QWEN:"OBSERVE",KEYFRAME_GENERATE:"KEYFRAME_GENERATE",VIDEO_GENERATE:"VIDEO_GENERATE"};var TenantProcessorKindSchema=z3.enum(Object.keys(processorFamilies));var referenceThumbnailProfile={processor:"REFERENCE_PREVIEW",format:"PNG_480_INSIDE_V1",maxDimension:480,maxBytes:1024*1024};import{z as z5}from"zod";import{z as z4}from"zod";var InventoryArguments=z4.strictObject({tenantId:z4.uuid()});var DeviceSetupRecoverySchema=z4.strictObject({reason:z4.enum(["NO_REGISTERED_DEVICE","NO_SUITABLE_DEVICE","CAPABILITY_MISSING","DEVICE_DISCONNECTED","DEVICE_BUSY","INCOMPLETE_INVENTORY"]),action:z4.enum(["PREPARE_OR_REPAIR_HOST","RECONNECT_EXISTING_HOST","WAIT","INSPECT_EXISTING"]),inspect:z4.discriminatedUnion("tool",[z4.strictObject({tool:z4.literal("workspace_caller"),arguments:InventoryArguments}),z4.strictObject({tool:z4.literal("studio_capability_query"),arguments:z4.strictObject({tenantId:z4.uuid(),tool:z4.literal("workspace_devices_list"),arguments:InventoryArguments})})]),guidance:z4.string().min(1).max(1e3)}).superRefine((value2,ctx)=>{const action=value2.reason==="DEVICE_BUSY"?"WAIT":value2.reason==="INCOMPLETE_INVENTORY"||value2.reason==="NO_SUITABLE_DEVICE"?"INSPECT_EXISTING":value2.reason==="DEVICE_DISCONNECTED"?"RECONNECT_EXISTING_HOST":"PREPARE_OR_REPAIR_HOST";const tool=action==="WAIT"||action==="INSPECT_EXISTING"?"studio_capability_query":"workspace_caller";if(value2.action!==action||value2.inspect.tool!==tool)ctx.addIssue({code:"custom",message:"Recovery must match the observed device condition"});if(value2.inspect.tool==="studio_capability_query"&&value2.inspect.arguments.tenantId.toLowerCase()!==value2.inspect.arguments.arguments.tenantId.toLowerCase())ctx.addIssue({code:"custom",message:"Recovery scope must match the inventory target"})});var validationMode=z5.literal("TENANT_TRUSTED_VALIDATOR").optional();var DeviceRenderTargetSchema=z5.strictObject({mode:z5.literal("tenant-device-only"),deviceId:z5.uuid().optional(),validationMode});var DeviceRenderReceiptSchema=z5.strictObject({mode:z5.literal("tenant-device-only"),deviceId:z5.uuid(),runtimeJobId:z5.uuid(),validationMode});var projectDeviceScope=z5.strictObject({tenantId:z5.uuid(),projectId:z5.uuid(),kind:z5.enum(["preview","final","library",...TenantProcessorKindSchema.options])});var ProjectDeviceListInputSchema=projectDeviceScope.extend({deviceId:z5.uuid().optional()});var ProjectDeviceListSchema=projectDeviceScope.extend({items:z5.array(z5.strictObject({deviceId:z5.uuid(),label:z5.string().trim().min(1).max(120),availability:z5.enum(["AVAILABLE","BUSY","OFFLINE","UNQUALIFIED"])})).max(50),truncated:z5.boolean(),validationMode:z5.literal("TENANT_TRUSTED_VALIDATOR").nullable(),recovery:DeviceSetupRecoverySchema.optional()});import{z as z7}from"zod";import{z as z6}from"zod";var MediaCategorySchema=z6.enum(["IMAGE","VIDEO","AUDIO","DOCUMENT"]);function mediaCategoryOf(contentType){if(contentType.startsWith("image/"))return"IMAGE";if(contentType.startsWith("video/"))return"VIDEO";if(contentType.startsWith("audio/"))return"AUDIO";return"DOCUMENT"}var localLibraryProfile={protocol:"NVS_LOCAL_LIBRARY_V1",inspection:"LOCAL_FILE_DECODE_V1",publication:"COMMITTED_SOURCE_READBACK_V1"};var LocalLibraryContentTypeSchema=z7.enum(["video/mp4","image/png","image/jpeg","image/webp","audio/wav","text/plain","application/json","application/pdf","application/octet-stream"]);var LocalLibraryVersionSchema=z7.strictObject({fileId:LocalIdSchema,versionId:LocalIdSchema,checksumSha256:LocalDigestSchema,byteSize:z7.int().nonnegative().max(128*1024*1024),contentType:LocalLibraryContentTypeSchema});var LocalLibraryReferenceSchema=LocalProjectScopeSchema.extend({deviceId:LocalIdSchema,...LocalLibraryVersionSchema.shape});var LocalLibraryMetadataSchema=z7.strictObject({label:z7.string().trim().min(1).max(255)});var LocalLibraryAccessCommandSchema=z7.strictObject({reference:LocalLibraryReferenceSchema,requestId:LocalIdSchema,expectedRevision:z7.int().nonnegative(),metadata:LocalLibraryMetadataSchema.nullable(),allowInspect:z7.boolean(),allowPublish:z7.boolean(),expiresAt:LocalTimeSchema});var LocalLibraryAccessReceiptSchema=LocalLibraryAccessCommandSchema.extend({revision:z7.int().positive(),recordedAt:LocalTimeSchema});var LocalLibraryAccessQuerySchema=z7.strictObject({reference:LocalLibraryReferenceSchema,requestId:LocalIdSchema});var LocalLibraryAccessCurrentSchema=z7.strictObject({reference:LocalLibraryReferenceSchema});var LocalLibraryAccessStateSchema=z7.strictObject({state:z7.enum(["LOCAL_ONLY","PENDING","SYNCED","UNKNOWN","REJECTED"]),desired:LocalLibraryAccessCommandSchema.nullable(),confirmed:LocalLibraryAccessReceiptSchema.nullable()});var LocalLibraryItemSchema=z7.strictObject({reference:LocalLibraryReferenceSchema,ownerKey:LocalDigestSchema,title:z7.string().trim().min(1).max(255),createdAt:LocalTimeSchema,revision:z7.int().positive(),access:LocalLibraryAccessStateSchema});var pageFields={after:LocalDigestSchema.nullable().default(null),limit:z7.int().min(1).max(16).default(16)};var LocalLibraryQuerySchema=LocalProjectScopeSchema.extend({projectId:LocalIdSchema.optional(),deviceId:LocalIdSchema,ownerKey:LocalDigestSchema.optional(),search:z7.string().trim().min(1).max(200).optional(),mediaCategory:MediaCategorySchema.optional(),...pageFields});var LocalLibraryPageSchema=z7.strictObject({items:z7.array(LocalLibraryItemSchema).max(16),nextCursor:LocalDigestSchema.nullable()});var LocalLibraryProjectionSchema=z7.strictObject({reference:LocalLibraryReferenceSchema,metadata:LocalLibraryMetadataSchema.nullable(),accessRevision:z7.int().positive(),allowInspect:z7.boolean(),allowPublish:z7.boolean(),expiresAt:LocalTimeSchema});var LocalLibraryProjectionPageSchema=z7.strictObject({items:z7.array(LocalLibraryProjectionSchema).max(16),nextCursor:LocalDigestSchema.nullable()});var LocalLibraryProjectionQuerySchema=LocalLibraryQuerySchema.omit({ownerKey:true}).extend({projectId:LocalIdSchema});var LocalLibraryImportSchema=z7.strictObject({requestId:LocalIdSchema,reference:LocalLibraryReferenceSchema,ownerKey:LocalDigestSchema,title:z7.string().trim().min(1).max(255)});var LocalLibraryImportReceiptQuerySchema=LocalProjectScopeSchema.extend({deviceId:LocalIdSchema,requestId:LocalIdSchema,ownerKey:LocalDigestSchema.optional()});var LocalLibraryReadSchema=z7.strictObject({reference:LocalLibraryReferenceSchema,ownerKey:LocalDigestSchema.optional(),offset:z7.int().nonnegative(),length:z7.int().min(1).max(128*1024)});var LocalLibraryReadReplySchema=z7.strictObject({reference:LocalLibraryReferenceSchema,offset:z7.int().nonnegative(),contentBase64:z7.string().max(174764).regex(/^[A-Za-z0-9+/]*={0,2}$/),complete:z7.boolean()});var LocalLibraryGetSchema=z7.strictObject({reference:LocalLibraryReferenceSchema,ownerKey:LocalDigestSchema.optional()});var LocalLibraryAccessInputSchema=z7.strictObject({command:LocalLibraryAccessCommandSchema,expectedLocalRevision:z7.int().positive(),ownerKey:LocalDigestSchema.optional()});var LocalLibraryCallSchema=z7.discriminatedUnion("action",[LocalLibraryQuerySchema.extend({action:z7.literal("list")}),LocalLibraryGetSchema.extend({action:z7.literal("get")}),LocalLibraryProjectionQuerySchema.extend({action:z7.literal("scoped-list")}),z7.strictObject({action:z7.literal("scoped-get"),reference:LocalLibraryReferenceSchema}),z7.strictObject({action:z7.literal("usage"),ownerKey:LocalDigestSchema.optional()}),LocalLibraryReadSchema.extend({action:z7.literal("read")}),LocalLibraryAccessInputSchema.extend({action:z7.literal("access")}),LocalLibraryAccessQuerySchema.extend({action:z7.literal("sync"),ownerKey:LocalDigestSchema.optional()}),LocalLibraryAccessQuerySchema.extend({action:z7.literal("resume-access"),ownerKey:LocalDigestSchema.optional()}),LocalLibraryImportReceiptQuerySchema.extend({action:z7.literal("import-receipt")})]);var LocalLibraryCapabilitySchema=z7.strictObject({protocol:z7.literal("NVS_LOCAL_LIBRARY_V1"),available:z7.boolean(),profileDigest:LocalDigestSchema});var LocalLibraryUsageSchema=z7.strictObject({fileCount:z7.int().nonnegative(),totalBytes:z7.int().nonnegative(),quotaBytes:z7.int().positive(),availableDiskBytes:z7.int().nonnegative()});import{z as z8}from"zod";var whisperCppRecognitionProfile=Object.freeze({id:"WHISPER_CPP_TINY_EN_Q5_1_PCM16K_V1",sourceRevision:"2eeeba56e9edd762b4b38467bab96c2517163158",modelSha256:"c77c5766f1cef09b6b7d47f21b546cbddd4157886b3b5d6d4f709e91e66c7c2b",language:"en",sampleRateHz:16e3,maxDurationMs:6e4});var LocalWhisperIdentitySchema=z8.strictObject({profileId:z8.literal(whisperCppRecognitionProfile.id),binarySha256:LocalDigestSchema,modelSha256:z8.literal(whisperCppRecognitionProfile.modelSha256)});var LocalWhisperToolSelectionSchema=z8.strictObject({binaryPath:z8.string().min(1).max(4096),binarySha256:LocalDigestSchema,modelPath:z8.string().min(1).max(4096)});function canonicalLocalJson(value2){if(value2===null||typeof value2==="string"||typeof value2==="boolean")return JSON.stringify(value2);if(typeof value2==="number"&&Number.isFinite(value2))return JSON.stringify(value2);if(Array.isArray(value2))return"["+value2.map(canonicalLocalJson).join(",")+"]";if(typeof value2==="object")return"{"+Object.entries(value2).filter(([,v])=>v!==void 0).sort(([a],[b])=>a<b?-1:a>b?1:0).map(([k,v])=>JSON.stringify(k)+":"+canonicalLocalJson(v)).join(",")+"}";throw new Error("Fingerprint input must be finite JSON data")}import{z as z67}from"zod";import{z as z28}from"zod";import{z as z26}from"zod";import{z as z9}from"zod";var offset=z9.int().min(0).max(4094).multipleOf(2);var dimension=z9.int().min(2).max(4096).multipleOf(2);var ClipFramingSchema=z9.strictObject({algorithm:z9.literal("CROP_PAD_V1"),crop:z9.strictObject({x:offset,y:offset,width:dimension,height:dimension}),anchorXPermille:z9.int().min(0).max(1e3),anchorYPermille:z9.int().min(0).max(1e3)});var PicturePolicySchema=z9.literal("CROP_PAD_V1");import{z as z10}from"zod";var ClipTransitionSchema=z10.union([z10.literal("CUT"),z10.strictObject({kind:z10.literal("CROSS_DISSOLVE_V1"),durationFrames:z10.int().min(2).max(30)})]);import{z as z11}from"zod";var sha=z11.string().regex(/^[0-9a-f]{64}$/);var GraphicPlacementSchema=z11.strictObject({startFrame:z11.int().nonnegative().max(1800),endFrame:z11.int().positive().max(1800),anchor:z11.enum(["TOP_LEFT","TOP_RIGHT","BOTTOM_LEFT","BOTTOM_RIGHT"]),widthPermille:z11.int().min(50).max(400),marginXPermille:z11.int().min(0).max(100),marginYPermille:z11.int().min(0).max(100),opacityPermille:z11.int().min(100).max(1e3)}).refine(v=>v.endFrame>v.startFrame,"Graphic frame interval must advance");var TimelineGraphicInputSchema=z11.strictObject({artifactId:ArtifactIdSchema,placement:GraphicPlacementSchema});var TimelineGraphicSourceSchema=z11.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema.nullable(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:sha,contentType:z11.enum(["image/png","image/webp"]),byteSize:z11.int().positive().max(16*1024*1024),width:z11.int().positive().max(8192),height:z11.int().positive().max(8192)});var TimelineGraphicSchema=z11.strictObject({source:TimelineGraphicSourceSchema,placement:GraphicPlacementSchema});import{z as z13}from"zod";import{z as z12}from"zod";var id=z12.uuid().toLowerCase();var hash=z12.string().regex(/^[0-9a-f]{64}$/);var CaptionTranscriptPlacementSchema=z12.discriminatedUnion("kind",[z12.strictObject({kind:z12.literal("AUDIO_TRACK"),purpose:z12.enum(["VOICEOVER","MUSIC"])}),z12.strictObject({kind:z12.literal("SPEECH_CUE"),cueId:z12.string().regex(/^[a-z][a-z0-9_-]{0,63}$/)}),z12.strictObject({kind:z12.literal("TIMELINE_OUTPUT")})]);var CaptionTranscriptPlanSchema=z12.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,timelineVersionId:id,language:z12.string().regex(/^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/).max(60),sources:z12.array(z12.strictObject({observationId:id,placement:CaptionTranscriptPlacementSchema,granularity:z12.enum(["word","segment"])})).min(1).max(64)});var AuthorTranscriptCaptionsSchema=CaptionTranscriptPlanSchema.extend({expectedProductionRevision:z12.int().positive(),expectedCaptionVersion:z12.int().nonnegative(),idempotencyKey:z12.string().trim().min(1).max(200)});var CaptionTranscriptProvenanceSchema=z12.strictObject({schemaVersion:z12.literal(1),advisory:z12.literal(true),timing:z12.literal("PROVIDER_REPORTED"),timelineVersionId:id,timingFingerprint:hash,sources:z12.array(z12.strictObject({observationId:id,artifactId:id,representationId:id,checksumSha256:hash,placement:CaptionTranscriptPlacementSchema,granularity:z12.enum(["word","segment"]),sourceInMs:z12.int().nonnegative(),sourceOutMs:z12.int().positive(),startMs:z12.int().nonnegative(),spanIndices:z12.array(z12.int().nonnegative().max(1199)).min(1).max(120),excludedSpans:z12.int().nonnegative().max(1200)})).min(1).max(64)});var sha2=z13.string().regex(/^[0-9a-f]{64}$/);var CaptionContentSchema=z13.strictObject({language:z13.string().regex(/^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/).max(60),durationMs:z13.int().min(3e4).max(6e4),cues:z13.array(z13.strictObject({startMs:z13.int().nonnegative().max(59999),endMs:z13.int().positive().max(6e4),text:z13.string().min(1).max(240)})).min(1).max(120)});var CaptionScopeSchema=z13.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var AuthorCaptionsSchema=CaptionScopeSchema.extend({expectedProductionRevision:z13.int().positive(),expectedCaptionVersion:z13.int().nonnegative(),idempotencyKey:z13.string().trim().min(1).max(200),content:CaptionContentSchema});var CaptionGetSchema=CaptionScopeSchema.extend({versionId:z13.uuid()});var CaptionQuerySchema=CaptionScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var CaptionRepresentationSchema=z13.strictObject({id:z13.uuid(),checksumSha256:sha2,byteSize:z13.int().positive().max(131072)});var CaptionVersionSchema=CaptionScopeSchema.extend({transcriptProvenance:CaptionTranscriptProvenanceSchema.optional(),id:z13.uuid(),captionId:z13.uuid(),projectId:z13.uuid(),version:z13.int().positive(),artifactId:z13.uuid(),content:CaptionContentSchema,fingerprint:sha2,original:CaptionRepresentationSchema,subtitle:CaptionRepresentationSchema,previousVersionId:z13.uuid().nullable(),createdByPrincipalId:z13.uuid(),createdAt:z13.iso.datetime({offset:true})});var CaptionViewSchema=z13.strictObject({version:CaptionVersionSchema,isCurrent:z13.boolean(),availability:z13.enum(["AVAILABLE","UNAVAILABLE"])});var CaptionReceiptSchema=z13.strictObject({semanticStatus:z13.literal("SUCCESS"),version:CaptionVersionSchema,productionRevision:z13.int().positive()});var CaptionBasisSchema=CaptionScopeSchema.extend({productionRevision:z13.int().positive(),currentVersion:z13.int().nonnegative(),currentVersionId:z13.uuid().nullable(),authorable:z13.boolean()});var CaptionPageSchema=z13.strictObject({items:z13.array(CaptionViewSchema).max(200),page:QueryPageInfoSchema});var CaptionExportSchema=CaptionGetSchema.extend({format:z13.enum(["JSON","SRT"])});var CaptionSnapshotSchema=z13.strictObject({currentVersion:z13.int().positive().nullable(),currentVersionId:z13.uuid().nullable(),artifactId:z13.uuid().nullable(),availability:z13.enum(["NONE","AVAILABLE","UNAVAILABLE"]),cueCount:z13.int().nonnegative().max(120),durationMs:z13.int().min(3e4).max(6e4).nullable(),attachedToTimeline:z13.boolean(),attachedCaptionVersionId:z13.uuid().nullable().optional(),attachedTimelineVersionId:z13.uuid().nullable().optional()});var CaptionTranscriptDraftSchema=z13.strictObject({content:CaptionContentSchema,provenance:CaptionTranscriptProvenanceSchema});import{z as z14}from"zod";var LegacyCaptionRenderStyleSchema=z14.strictObject({id:z14.literal("PLAIN_TEXT_NOTO_SANS_SC_V1"),fontSha256:z14.literal("a3041811a78c361b1de50f953c805e0244951c21c5bd412f7232ef0d899af0da"),framePolicy:z14.literal("PTS_HALF_OPEN_CEIL_V1")});var RegularCaptionRenderStyleSchema=z14.strictObject({id:z14.literal("PLAIN_TEXT_NATIVE_SC_REGULAR_V2"),fontSha256:z14.literal("e5a51f41fc1b827da651afee3975e07a182ff4f8e04d9dfc0a3cecd6177a52b6"),framePolicy:z14.literal("PTS_HALF_OPEN_CEIL_V1")});var CaptionRenderStyleSchema=z14.discriminatedUnion("id",[LegacyCaptionRenderStyleSchema,RegularCaptionRenderStyleSchema]);import{z as z17}from"zod";import{z as z16}from"zod";import{z as z15}from"zod";var VoiceProfileRefSchema=z15.strictObject({ownerSystem:z15.string().regex(/^[a-z][a-z0-9-]{1,79}$/),ownerTenantRef:z15.string().trim().min(1).max(160),voiceProfileRef:z15.string().trim().min(1).max(160),version:z15.int().positive(),digest:z15.string().regex(/^[a-f0-9]{64}$/)});var VoiceLocaleSchema=z15.string().min(2).max(35).refine(value2=>{try{return value2.toLowerCase()!=="auto"&&Intl.getCanonicalLocales(value2).length===1}catch{return false}},"A concrete BCP 47 language is required").describe("Concrete BCP 47 tag, for example zh or en-US; auto is not a language");var VoiceProfileUseSchema=z15.strictObject({ref:VoiceProfileRefSchema,bindingKey:z15.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),language:VoiceLocaleSchema,usage:z15.enum(["AUDITION","PRODUCTION"])});var sha3=z16.string().regex(/^[0-9a-f]{64}$/);var AudioPurposeSchema=z16.enum(["VOICEOVER","MUSIC"]);var AudioProductionScopeSchema=z16.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var AudioScopeSchema=AudioProductionScopeSchema.extend({purpose:AudioPurposeSchema});var AudioMaterialPurposeSchema=z16.enum(["VOICEOVER","MUSIC","VOICE_SAMPLE"]);var AudioReadScopeSchema=AudioScopeSchema.extend({purpose:AudioMaterialPurposeSchema});var AudioMediaSchema=z16.strictObject({profile:z16.literal("PCM_S16LE_48000_V1"),audioCodec:z16.literal("pcm_s16le"),sampleRateHz:z16.literal(48e3),audioChannels:z16.union([z16.literal(1),z16.literal(2)]),sampleCount:z16.int().min(4800).max(288e4),durationMs:z16.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:z16.int().positive(),expectedAudioVersion:z16.int().nonnegative(),idempotencyKey:z16.string().trim().min(1).max(200),contentType:z16.literal("audio/wav"),originalName:z16.string().trim().min(1).max(255).regex(/^[^\p{Cc}]*$/u).optional()});var AudioImportRequestSchema=AudioImportSchema.extend({contentBase64:z16.string().min(60).max(16777216).regex(/^[A-Za-z0-9+/]*={0,2}$/)});var AudioPublicationSchema=AudioImportSchema.extend({purpose:AudioMaterialPurposeSchema});var AudioGetSchema=AudioReadScopeSchema.extend({versionId:z16.uuid()});var AudioQuerySchema=AudioReadScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var AudioRepresentationSchema=z16.strictObject({id:z16.uuid(),checksumSha256:sha3,byteSize:z16.int().min(44).max(12582912)});var AudioVersionSchema=AudioReadScopeSchema.extend({id:z16.uuid(),audioId:z16.uuid(),projectId:z16.uuid(),version:z16.int().positive(),artifactId:z16.uuid(),original:AudioRepresentationSchema,media:AudioMediaSchema,originalName:z16.string().trim().min(1).max(255).regex(/^[^\p{Cc}]*$/u).nullable(),previousVersionId:z16.uuid().nullable(),createdByPrincipalId:z16.uuid(),createdAt:z16.iso.datetime({offset:true}),generation:z16.strictObject({generationId:z16.uuid(),voiceProfile:VoiceProfileUseSchema.optional(),executionClass:z16.enum(["LIVE","TEST_ONLY"]),executionTarget:z16.literal("TENANT_DEVICE").optional(),sourceArtifactId:z16.uuid(),sourceRepresentationId:z16.uuid(),sourceChecksumSha256:sha3,sourceByteSize:z16.int().min(44).max(12582912),sourceMedia:z16.strictObject({sampleRateHz:z16.int().positive().max(48e3),audioChannels:z16.union([z16.literal(1),z16.literal(2)]),sampleCount:z16.int().positive()}),normalizationVersion:z16.literal("SPEECH_PCM_V1"),padSamples:z16.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=z16.strictObject({version:AudioVersionSchema,isCurrent:z16.boolean(),availability:z16.enum(["AVAILABLE","UNAVAILABLE"])});var ProductionAudioVersionSchema=AudioVersionSchema.safeExtend({purpose:AudioPurposeSchema});var AudioReceiptSchema=z16.strictObject({semanticStatus:z16.literal("SUCCESS"),version:AudioVersionSchema,productionRevision:z16.int().positive()});var AudioBasisSchema=AudioReadScopeSchema.extend({productionRevision:z16.int().positive(),currentVersion:z16.int().nonnegative(),currentVersionId:z16.uuid().nullable(),importable:z16.boolean()});var AudioPageSchema=z16.strictObject({items:z16.array(AudioViewSchema).max(200),page:QueryPageInfoSchema});var AudioSnapshotSchema=z16.strictObject({tracks:z16.array(z16.strictObject({purpose:AudioPurposeSchema,currentVersion:z16.int().positive().nullable(),currentVersionId:z16.uuid().nullable(),artifactId:z16.uuid().nullable(),availability:z16.enum(["NONE","AVAILABLE","UNAVAILABLE"]),durationMs:z16.int().min(100).max(6e4).nullable(),audioChannels:z16.union([z16.literal(1),z16.literal(2)]).nullable(),attachedToTimeline:z16.boolean()})).length(2)});var placement={sourceInMs:z17.int().nonnegative().max(6e4),sourceOutMs:z17.int().positive().max(6e4),startMs:z17.int().nonnegative().max(6e4),gainPermille:z17.int().nonnegative().max(1e3)};var TimelineAudioInputSchema=z17.strictObject({tracks:z17.array(z17.strictObject({purpose:AudioPurposeSchema,versionId:z17.uuid(),...placement})).min(1).max(2),duckingMusicPermille:z17.int().nonnegative().max(1e3).default(1e3)}).superRefine((audio2,ctx)=>{if(new Set(audio2.tracks.map(t=>t.purpose)).size!==audio2.tracks.length||audio2.tracks.some(t=>t.sourceOutMs<=t.sourceInMs)||audio2.duckingMusicPermille<1e3&&audio2.tracks.length!==2)ctx.addIssue({code:"custom",message:"Distinct purposes, advancing trims and explicit ducking pair required"})});var AudioMixProfileSchema=z17.strictObject({id:z17.literal("PCM_WINDOW_MIX_AAC_V1"),sampleRateHz:z17.literal(48e3),audioChannels:z17.literal(2),audioCodec:z17.literal("aac"),bitrate:z17.literal(192e3),peakPermille:z17.literal(950),duckingMusicPermille:z17.int().nonnegative().max(1e3)});var TimelineAudioCompositionSchema=z17.strictObject({mix:AudioMixProfileSchema,tracks:z17.array(z17.strictObject({source:ProductionAudioVersionSchema,...placement})).min(1).max(2)}).superRefine((audio2,ctx)=>{if(new Set(audio2.tracks.map(t=>t.source.purpose)).size!==audio2.tracks.length||audio2.tracks.some(t=>t.sourceOutMs<=t.sourceInMs||t.sourceOutMs>t.source.media.durationMs)||audio2.mix.duckingMusicPermille<1e3&&audio2.tracks.length!==2)ctx.addIssue({code:"custom",message:"Invalid exact audio composition"})});var RenderedAudioSchema=z17.strictObject({audioCodec:z17.literal("aac"),sampleRateHz:z17.literal(48e3),audioChannels:z17.literal(2),sampleCount:z17.int().positive().max(288e4)});import{z as z18}from"zod";var Fingerprint=z18.string().regex(/^[0-9a-f]{64}$/);var AcceptedShotReferenceSchema=z18.strictObject({acceptanceId:z18.uuid(),reviewId:z18.uuid(),generationId:z18.uuid(),candidateId:z18.uuid(),shotId:ShotIdSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint,artifactChecksumSha256:Fingerprint,preparationId:z18.uuid(),contractId:z18.uuid(),contractFingerprint:Fingerprint,planVersionId:SceneShotPlanVersionIdSchema,planVersion:z18.int().positive(),shotPlanningRevision:z18.int().positive(),executionClass:z18.enum(["LIVE","TEST_ONLY"]),reviewResult:z18.enum(["PASS","WARNING"])});import{z as z20}from"zod";import{z as z19}from"zod";var ProviderIdSchema=z19.enum(["QWEN_CN","VOLCENGINE_CN","GEMINI","OPENAI","XAI"]);var ProviderConnectionIdSchema=z19.uuid().brand();var ModelProfileIdSchema=z19.string().regex(/^[a-z][a-z0-9-]{1,79}$/);var GeometryPolicySchema=z19.enum(["STRICT","PAD_TO_ASPECT"]);var ProviderSelectionSchema=z19.strictObject({connectionId:ProviderConnectionIdSchema,modelProfileId:ModelProfileIdSchema});var TenantProviderExecutionGrantSchema=z19.strictObject({projectId:z19.uuid(),modelProfileId:ModelProfileIdSchema,modelProfileVersion:z19.int().positive(),workload:z19.enum(["KEYFRAME_GENERATE","VIDEO_GENERATE","SPEECH_SYNTHESIS","TRANSCRIPTION","AUDIO_OBSERVATION","VIDEO_OBSERVATION"]),disclosure:z19.enum(["TEXT_ONLY","IMMUTABLE_PROJECT_INPUTS"]),expiresAt:z19.iso.datetime({offset:true}),maxPerRequestMicros:z19.int().min(0).max(1e9),maxTotalMicros:z19.int().min(0).max(1e9),maxSubmissions:z19.int().min(1).max(1e4)}).refine(v=>v.maxPerRequestMicros<=v.maxTotalMicros);var providerConfigurationFields={providerId:ProviderIdSchema,label:z19.string().trim().min(1).max(100),allowedModelProfileIds:z19.array(ModelProfileIdSchema).min(1).max(16),qwenEndpoint:z19.literal("QIANWEN_PLATFORM").optional(),credentialService:z19.enum(["ARK","DOUBAO_SPEECH"]).optional(),qwenWorkspaceId:z19.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/).optional(),geometryPolicy:GeometryPolicySchema.default("STRICT")};var ProviderConfigurationSchema=z19.strictObject({...providerConfigurationFields,tenantExecution:z19.array(TenantProviderExecutionGrantSchema).min(1).max(64).optional()}).superRefine((v,c)=>{if(new Set(v.allowedModelProfileIds).size!==v.allowedModelProfileIds.length)c.addIssue({code:"custom",message:"Duplicate model profile"});const grants=v.tenantExecution??[];const keys=new Set(grants.map(g=>[g.projectId.toLowerCase(),g.modelProfileId,g.workload].join(":")));if(keys.size!==grants.length||grants.some(g=>!v.allowedModelProfileIds.includes(g.modelProfileId)))c.addIssue({code:"custom",message:"Invalid tenant execution scope",path:["tenantExecution"]});if(v.qwenWorkspaceId&&v.providerId!=="QWEN_CN")c.addIssue({code:"custom",message:"Workspace only applies to Qwen China"});if(v.credentialService&&v.providerId!=="VOLCENGINE_CN")c.addIssue({code:"custom",message:"Credential service applies to Volcengine"});if(v.qwenEndpoint&&(v.providerId!=="QWEN_CN"||v.qwenWorkspaceId))c.addIssue({code:"custom",message:"Qianwen platform requires an exact Qwen route without a workspace"})});var ConfigureProviderInputSchema=z19.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,expectedVersion:z19.int().nonnegative(),configuration:ProviderConfigurationSchema,apiKey:z19.string().min(8).max(4096).regex(/^[!-~]+$/)});var ProviderConnectionViewSchema=z19.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,version:z19.int().positive(),enabled:z19.boolean(),credentialConfigured:z19.boolean(),configuration:z19.object(providerConfigurationFields),createdByPrincipalId:PrincipalIdSchema,updatedAt:z19.iso.datetime({offset:true})});var ProviderConnectionCommandSchema=z19.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,expectedVersion:z19.int().positive()});var ProviderCredentialRevokeSchema=z19.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,version:z19.int().positive()});var SetKeyframeDefaultSchema=z19.strictObject({tenantId:TenantIdSchema,selection:ProviderSelectionSchema,expectedRevision:z19.int().nonnegative()});var ProviderExecutionBindingSchema=z19.strictObject({tenantId:TenantIdSchema,connectionId:ProviderConnectionIdSchema,connectionVersion:z19.int().positive(),providerId:ProviderIdSchema,modelProfileId:ModelProfileIdSchema,modelProfileVersion:z19.int().positive(),modelId:z19.string().min(1).max(160),credentialRef:z19.uuid(),credentialVersion:z19.int().positive(),geometryPolicy:GeometryPolicySchema,qwenEndpoint:z19.literal("QIANWEN_PLATFORM").optional()}).refine(binding=>!binding.qwenEndpoint||binding.providerId==="QWEN_CN",{message:"Qianwen platform binding requires Qwen China"});var GenerationCostVariantSchema=z20.strictObject({mode:z20.enum(["REFERENCE_TO_IMAGE","REFERENCE_TO_VIDEO","FIRST_FRAME_TO_VIDEO","FIRST_LAST_FRAME_TO_VIDEO"]),aspectRatio:z20.enum(["16:9","9:16"]),workingWidth:z20.int().min(0).max(4096),workingHeight:z20.int().min(0).max(4096),hasAudio:z20.boolean(),references:z20.int().min(0).max(24),durationSeconds:z20.number().finite().min(0).max(30)});var GenerationCostPolicySchema=z20.strictObject({currency:z20.literal("USD"),sourceUrl:z20.url({protocol:/^https$/}).max(2e3),rationale:z20.string().trim().min(1).max(2e3),validUntil:z20.iso.datetime({offset:true}),rules:z20.array(z20.strictObject({id:z20.string().regex(/^[a-zA-Z0-9_-]{1,80}$/),variant:GenerationCostVariantSchema,upperBoundMicros:z20.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=z20.strictObject({connectionVersion:z20.int().positive(),modelProfileVersion:z20.int().positive(),quoteValidUntil:z20.iso.datetime({offset:true})});var GenerationCostQuoteSchema=z20.strictObject({currency:z20.literal("USD"),upperBoundMicros:z20.int().nonnegative().max(1e9),selection:ProviderSelectionSchema,expectedExecution:ExpectedGenerationExecutionSchema,sourceUrl:z20.url({protocol:/^https$/}).max(2e3),ruleIds:z20.array(z20.string()).min(1).max(64),preparationId:z20.uuid(),contractFingerprint:z20.string().regex(/^[a-f0-9]{64}$/)});import{z as z25}from"zod";import{z as z21}from"zod";var id2=z21.uuid().toLowerCase();var hash2=z21.string().regex(/^[0-9a-f]{64}$/);var NativeVideoAudioMetadataSchema=z21.strictObject({normalizationVersion:z21.literal("VIDEO_AUDIO_PCM_V1"),sourceCodec:z21.literal("aac"),sourceSampleRateHz:z21.int().min(8e3).max(96e3),sourceChannels:z21.union([z21.literal(1),z21.literal(2)]),sourceFrameRateHz:z21.union([z21.literal(24),z21.literal(30)]),sourceFrameCount:z21.int().positive().max(905),sourceStartOffsetMs:z21.number().finite().min(-500).max(5e3),sourceDeclaredDurationMs:z21.number().positive().max(31e3),alignment:z21.literal("TRIM_PAD_PCM_TO_VIDEO_ZERO_V1"),media:z21.strictObject({profile:z21.literal("PCM_S16LE_48000_NATIVE_VIDEO_V1"),audioCodec:z21.literal("pcm_s16le"),sampleRateHz:z21.literal(48e3),audioChannels:z21.union([z21.literal(1),z21.literal(2)]),sampleCount:z21.int().positive().max(1448e3),durationMs:z21.number().positive().max(30200)}).refine(m=>m.durationMs===m.sampleCount/48),checksumSha256:hash2}).superRefine((v,ctx)=>{if(v.media.sampleCount!==v.sourceFrameCount*(48e3/v.sourceFrameRateHz)||v.media.audioChannels!==v.sourceChannels)ctx.addIssue({code:"custom",message:"Native PCM must follow the exact source video frame clock"})});var NativeVideoSoundReferenceSchema=z21.strictObject({id:id2,tenantId:id2,projectId:id2,productionId:id2,shotId:id2,generationId:id2,videoArtifactId:id2,videoRepresentationId:id2,videoChecksumSha256:hash2,artifactId:id2,representationId:id2,checksumSha256:hash2,byteSize:z21.int().min(44).max(12582912),metadata:NativeVideoAudioMetadataSchema,executionClass:z21.enum(["LIVE","TEST_ONLY"])});import{z as z22}from"zod";var KeyframePurposeSchema=z22.enum(["START_FRAME","END_FRAME","SUBJECT_REFERENCE"]);var AcceptedKeyframeReferenceSchema=z22.strictObject({acceptanceId:z22.uuid(),reviewId:z22.uuid(),generationId:z22.uuid(),candidateId:z22.uuid(),shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:z22.string().regex(/^[0-9a-f]{64}$/),artifactChecksumSha256:z22.string().regex(/^[0-9a-f]{64}$/),planVersionId:SceneShotPlanVersionIdSchema,planVersion:z22.int().positive(),shotPlanningRevision:z22.int().positive(),executionClass:z22.enum(["LIVE","TEST_ONLY"])});import{z as z24}from"zod";import{z as z23}from"zod";var ConsistencyReviewScaleSchema=z23.enum(["INTRA_SHOT","INTER_SHOT","PRODUCTION"]);var State=z23.string().trim().min(1).max(300);var StoryTime=z23.int().nonnegative().max(31536e8);var position=z23.int().min(1).max(999);var StateChange=z23.strictObject({atPermille:position,from:State,to:State,reason:State});var TimeJump=z23.strictObject({atPermille:position,fromMs:StoryTime,toMs:StoryTime,reason:State});var ContinuityExpectationSchema=z23.discriminatedUnion("kind",[z23.strictObject({kind:z23.literal("STATE"),mode:z23.enum(["PRESERVE","PLANNED_TRANSITIONS"]),entry:State,exit:State,changes:z23.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"})}),z23.strictObject({kind:z23.literal("TIME"),mode:z23.enum(["MONOTONIC","PLANNED_JUMPS"]),entryMs:StoryTime,exitMs:StoryTime,jumps:z23.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=z23.strictObject({atMs:z23.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=z23.array(ContinuitySampleSchema).min(3).max(64);var PreparationIdSchema=z24.uuid().brand();var GenerationContractIdSchema=z24.uuid().brand();var ContentFingerprintSchema=z24.string().regex(/^[0-9a-f]{64}$/);var PreparationTargetSchema=z24.discriminatedUnion("mediaType",[z24.strictObject({mediaType:z24.literal("IMAGE"),purpose:z24.enum(["KEYFRAME","REFERENCE_FRAME"]),framePurpose:z24.enum(["START_FRAME","END_FRAME","SUBJECT_REFERENCE"])}),z24.strictObject({mediaType:z24.literal("VIDEO"),purpose:z24.literal("SHOT_CANDIDATE")})]);var PreparationBasisSchema=z24.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,sceneId:SceneIdSchema,shotId:ShotIdSchema,productionRevision:z24.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z24.int().positive(),storyVersionId:StoryVersionIdSchema,storyVersion:z24.int().positive(),planVersionId:SceneShotPlanVersionIdSchema,planVersion:z24.int().positive(),shotPlanningRevision:z24.int().positive(),resolverVersion:z24.literal("w7-product-preflight-v1"),consistencyProfile:z24.strictObject({id:z24.uuid(),version:z24.int().positive(),effectiveFingerprint:ContentFingerprintSchema}).optional()});var ReferenceRoleSchema=z24.enum(["PRODUCT_IDENTITY","PRODUCT_PACKSHOT","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","START_FRAME_ANCHOR","END_FRAME_ANCHOR"]);var ReferenceBindingInputSchema=z24.strictObject({keyframeAcceptanceId:z24.uuid().optional(),role:ReferenceRoleSchema,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:ContentFingerprintSchema,reason:z24.string().trim().min(1).max(500)});var ExactEvidenceReferenceSchema=z24.strictObject({artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:ContentFingerprintSchema,artifactChecksumSha256:ContentFingerprintSchema});var ResolvedReferenceSchema=ReferenceBindingInputSchema.extend({artifactChecksumSha256:ContentFingerprintSchema,contentType:z24.enum(["image/png","image/jpeg","image/webp"]),acceptedKeyframe:AcceptedKeyframeReferenceSchema.optional(),consistencyRuleId:z24.uuid().optional(),subjectId:z24.uuid().optional(),authority:z24.enum(["BRIEF_SOURCE_AND_EXPLICIT_BINDING","EXPLICIT_SHOT_BINDING","CANONICAL_PROFILE_MASTER","ACCEPTED_KEYFRAME_AND_EXPLICIT_BINDING"])});var ResolvedConstraintSchema=z24.strictObject({continuity:ContinuityExpectationSchema.optional(),reviewScales:z24.array(ConsistencyReviewScaleSchema).min(1).max(3).optional(),key:z24.string().min(1).max(200),family:z24.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","SHOT_INTENT","BOUNDARY_CONTINUITY"]),scope:z24.enum(["PROJECT","PRODUCTION","SCENE","SHOT","CONTINUITY_EDGE"]),subjectId:z24.uuid().optional(),dimension:z24.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/).optional(),enforcement:z24.enum(["LOCKED","REQUIRED","PREFERRED"]),expected:z24.string().min(1).max(1e3),source:z24.strictObject({kind:z24.enum(["BRIEF","SCENE","SHOT","CONTINUITY_EDGE","CONSISTENCY_PROFILE"]),id:z24.uuid(),version:z24.int().positive()})});var PreparationBlockerSchema=z24.strictObject({code:z24.enum(["MISSING_PRODUCT_REFERENCE","CANONICAL_SOURCE_UNAVAILABLE","CONSTRAINT_CONFLICT","PREVIOUS_SHOT_EVIDENCE_UNAVAILABLE","GENERATED_KEYFRAME_REQUIRED"]),summary:z24.string().min(1).max(1e3),relatedShotId:ShotIdSchema.optional(),edgeId:ContinuityEdgeIdSchema.optional()});var ConstraintSetSchema=z24.strictObject({preparationId:PreparationIdSchema,version:z24.int().positive(),fingerprint:ContentFingerprintSchema,items:z24.array(ResolvedConstraintSchema).max(2048)});var ReferenceSetSchema=z24.strictObject({preparationId:PreparationIdSchema,version:z24.int().positive(),fingerprint:ContentFingerprintSchema,bindings:z24.array(ResolvedReferenceSchema).max(12)});var VideoGenerationIdSchema=z25.uuid().brand();var VideoProviderProfileSchema=z25.strictObject({id:z25.string().regex(/^[a-z][a-z0-9-]{1,79}$/),adapterVersion:z25.string().min(1).max(80),model:z25.string().min(1).max(160),executionClass:z25.enum(["LIVE","TEST_ONLY"]),mediaType:z25.literal("VIDEO"),modes:z25.array(z25.enum(["REFERENCE_TO_VIDEO","FIRST_FRAME_TO_VIDEO","FIRST_LAST_FRAME_TO_VIDEO"])).min(1).max(3),referenceRoles:z25.array(ReferenceRoleSchema).min(1).max(8),aspectRatios:z25.array(z25.enum(["16:9","9:16"])).min(1).max(2),minDurationSeconds:z25.int().min(1),maxDurationSeconds:z25.int().max(30),maxReferences:z25.int().min(1).max(10),combineAnchorsAndReferences:z25.boolean(),workingWidth:z25.int().positive().max(4096),workingHeight:z25.int().positive().max(4096),frameRate:z25.union([z25.literal(24),z25.literal(30)]),sourceFormat:z25.strictObject({videoCodec:z25.literal("hevc"),pixelFormat:z25.literal("yuv420p10le")}).optional(),hasAudio:z25.boolean(),nativeAudioChannels:z25.union([z25.literal(1),z25.literal(2)]).optional(),correlationStrategy:z25.literal("PROVIDER_TASK_ID")});var VideoOptionsInputSchema=z25.strictObject({tenantId:TenantIdSchema});var VideoStartInputSchema=z25.strictObject({expectedExecution:ExpectedGenerationExecutionSchema.optional(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,selection:ProviderSelectionSchema,idempotencyKey:z25.string().trim().min(1).max(200)});var VideoDeviceStartInputSchema=VideoStartInputSchema.omit({selection:true,expectedExecution:true}).extend({deviceId:z25.uuid(),approvedQuote:GenerationCostQuoteSchema});var VideoGetInputSchema=z25.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:VideoGenerationIdSchema});var VideoQueryInputSchema=z25.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema.optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var VideoAdmissionSchema=z25.strictObject({semanticStatus:z25.literal("ACCEPTED"),generationId:VideoGenerationIdSchema,operationId:OperationIdSchema,productionId:ProductionIdSchema,contractId:GenerationContractIdSchema,executionClass:z25.enum(["LIVE","TEST_ONLY"])});var VideoTechnicalMetadataSchema=z25.strictObject({contentType:z25.literal("video/mp4"),checksumSha256:ContentFingerprintSchema,byteSize:z25.int().positive().max(128*1024*1024),width:z25.int().positive().max(4096),height:z25.int().positive().max(4096),durationMs:z25.int().min(1).max(30150),frameRate:z25.number().positive().max(120),videoCodec:z25.enum(["h264","hevc"]),pixelFormat:z25.literal("yuv420p10le").optional(),hasAudio:z25.boolean(),nativeAudio:NativeVideoAudioMetadataSchema.optional()});var VideoPosterSchema=z25.strictObject({representationId:ArtifactRepresentationIdSchema,contentType:z25.literal("image/png"),checksumSha256:ContentFingerprintSchema,byteSize:z25.int().positive().max(2*1024*1024),width:z25.int().positive().max(320),height:z25.int().positive().max(320)});var VideoCandidateSchema=VideoTechnicalMetadataSchema.extend({nativeSound:NativeVideoSoundReferenceSchema.optional(),id:z25.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,poster:VideoPosterSchema,availability:z25.enum(["AVAILABLE","INVALID"]),observation:z25.enum(["NOT_OBSERVED","OBSERVED"]),evaluation:z25.enum(["UNREVIEWED","PASS","WARNING","FAIL"]),accepted:z25.boolean(),reviewId:z25.uuid().optional(),reviewVersion:z25.int().positive().optional(),acceptanceDecisionId:z25.uuid().optional(),freshness:z25.enum(["CURRENT_BASIS","STALE_BASIS"])});var VideoGenerationViewSchema=z25.strictObject({generationId:VideoGenerationIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,connection:z25.strictObject({connectionId:z25.uuid(),connectionVersion:z25.int().positive(),modelProfileId:z25.string(),modelProfileVersion:z25.int().positive()}),operationId:OperationIdSchema,provider:VideoProviderProfileSchema,runtimeStatus:z25.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z25.enum(["NOT_SUBMITTED","SUBMITTING","PENDING","UNKNOWN","SUCCEEDED","FAILED"]),freshness:z25.enum(["CURRENT_BASIS","STALE_BASIS"]),cancellationRequested:z25.boolean(),candidate:VideoCandidateSchema.nullable(),createdByPrincipalId:PrincipalIdSchema,createdAt:z25.iso.datetime({offset:true})});var VideoQueryPageSchema=z25.strictObject({items:z25.array(VideoGenerationViewSchema),page:QueryPageInfoSchema});var VideoSummarySchema=z25.strictObject({generations:z25.int().nonnegative(),running:z25.int().nonnegative(),waiting:z25.int().nonnegative(),registeredCandidates:z25.int().nonnegative(),testCandidates:z25.int().nonnegative(),liveCandidates:z25.int().nonnegative()});var TimelineDurationSchema=z26.strictObject({totalMs:z26.int().positive().max(603e4),targetMs:z26.int().min(3e4).max(6e4),minMs:z26.literal(3e4),maxMs:z26.literal(6e4),deltaTargetMs:z26.int(),classification:z26.enum(["TOO_SHORT","WITHIN_TARGET","TOO_LONG"])});var TimelineClipSchema=z26.strictObject({ordinal:z26.int().positive().max(200),source:AcceptedShotReferenceSchema,technical:VideoTechnicalMetadataSchema,sourceInMs:z26.int().nonnegative(),sourceOutMs:z26.int().positive(),startMs:z26.int().nonnegative(),durationMs:z26.int().positive(),transition:ClipTransitionSchema,framing:ClipFramingSchema.optional()});var TimelineManifestSchema=z26.strictObject({schemaVersion:z26.literal(1),caption:CaptionVersionSchema.optional(),captionStyle:CaptionRenderStyleSchema.optional(),audio:TimelineAudioCompositionSchema.optional(),graphics:z26.array(TimelineGraphicSchema).max(8).optional(),basis:z26.strictObject({briefVersionId:BriefVersionIdSchema,briefVersion:z26.int().positive(),storyVersion:z26.int().positive(),planVersionId:SceneShotPlanVersionIdSchema,planVersion:z26.int().positive()}),output:z26.strictObject({aspectRatio:z26.enum(["16:9","9:16"]),profile:DeliveryOutputProfileSchema}),clips:z26.array(TimelineClipSchema).min(1).max(200),duration:TimelineDurationSchema,missingPlannedShotIds:z26.array(ShotIdSchema).max(200),executionClass:z26.enum(["LIVE","TEST_ONLY"])});var TimelineVersionIdentityShape={id:z26.uuid(),timelineId:z26.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z26.int().positive(),fingerprint:z26.string().regex(/^[0-9a-f]{64}$/),createdByPrincipalId:PrincipalIdSchema,createdAt:z26.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 z27}from"zod";var RoughCutProfileIdSchema=z27.enum(["PREVIEW_H264_480P_V1","PREVIEW_H264_720P_V1","PREVIEW_H264_1080P_V1"]);var RoughCutProfileSchema=z27.strictObject({captionPolicy:z27.literal("BURN_IN").optional(),captionStyle:CaptionRenderStyleSchema.optional(),graphicsPolicy:z27.literal("OVERLAY_V1").optional(),id:RoughCutProfileIdSchema,algorithm:z27.enum(["ORDERED_TRIM_CUT_V1","ORDERED_COMPOSE_V2"]),picturePolicy:PicturePolicySchema.optional(),width:z27.union([z27.literal(854),z27.literal(480),z27.literal(1280),z27.literal(720),z27.literal(1920),z27.literal(1080)]),height:z27.union([z27.literal(854),z27.literal(480),z27.literal(1280),z27.literal(720),z27.literal(1920),z27.literal(1080)]),frameRate:z27.literal(30),codec:z27.literal("h264"),pixelFormat:z27.literal("yuv420p"),fit:z27.literal("PAD"),hasAudio:z27.boolean(),audioMix:AudioMixProfileSchema.optional(),framePolicy:z27.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"})});var RoughCutManifestSchema=z28.strictObject({schemaVersion:z28.literal(1),timeline:TimelineVersionSchema,profile:RoughCutProfileSchema,frames:z28.array(z28.strictObject({ordinal:z28.int().positive().max(200),startFrame:z28.int().nonnegative().max(1800),frameCount:z28.int().positive().max(1800),overlapFrames:z28.int().nonnegative().max(30).default(0)})).min(1).max(200),totalFrames:z28.int().min(900).max(1800)});import{z as z54}from"zod";import{z as z52}from"zod";import{z as z50}from"zod";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 z49}from"zod";import{z as z31}from"zod";import{z as z30}from"zod";var id3=z30.uuid().toLowerCase();var hash3=z30.string().regex(/^[0-9a-f]{64}$/);var ImportedSynchronousAudioPurposeSchema=z30.literal("SOURCE_SYNC");var SourceSyncPcmMediaSchema=z30.strictObject({profile:z30.literal("PCM_S16LE_48000_SOURCE_SYNC_V1"),audioCodec:z30.literal("pcm_s16le"),sampleRateHz:z30.literal(48e3),audioChannels:z30.union([z30.literal(1),z30.literal(2)]),sampleCount:z30.int().min(1600).max(576e3),durationMs:z30.number().positive().max(12e3)}).refine(m=>m.sampleCount%1600===0&&m.durationMs===m.sampleCount/48);var ImportedSynchronousAudioExtractionSchema=z30.strictObject({schemaVersion:z30.literal(1),purpose:ImportedSynchronousAudioPurposeSchema,tenantId:id3,projectId:id3,productionId:id3,shotId:id3,sourceId:id3,sourceVersionId:id3,normalizationId:id3,originalArtifactId:id3,originalRepresentationId:id3,originalChecksumSha256:hash3,sourceRange:z30.strictObject({clock:z30.literal("SOURCE_ZERO_BASED_CFR30"),startFrame:z30.int().nonnegative().max(1799),endFrame:z30.int().positive().max(1800)}),destinationStartSample:z30.literal(0)}).refine(v=>v.sourceRange.endFrame>v.sourceRange.startFrame&&v.sourceRange.endFrame-v.sourceRange.startFrame<=360);var ImportedSynchronousAudioSourceSchema=z30.strictObject({schemaVersion:z30.literal(1),purpose:ImportedSynchronousAudioPurposeSchema,tenantId:id3,projectId:id3,productionId:id3,shotId:id3,sourceId:id3,sourceVersionId:id3,normalizationId:id3,originalArtifactId:id3,originalRepresentationId:id3,originalChecksumSha256:hash3,sourceRange:z30.strictObject({clock:z30.literal("SOURCE_ZERO_BASED_CFR30"),startFrame:z30.int().nonnegative(),endFrame:z30.int().positive()}),destinationStartSample:z30.int().nonnegative(),media:z30.union([AudioMediaSchema,SourceSyncPcmMediaSchema]),wavChecksumSha256:hash3,wavByteSize:z30.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 id4=z31.uuid().toLowerCase();var key=z31.string().trim().min(1).max(200);var SourceSyncAudioStartSchema=z31.strictObject({tenantId:id4,productionId:id4,normalizationId:id4,expectedProductionRevision:z31.int().positive(),expectedVersion:z31.int().nonnegative(),idempotencyKey:key});var SourceSyncAudioGetSchema=z31.strictObject({tenantId:id4,productionId:id4,shotId:id4,versionId:id4});var SourceSyncAudioVersionSchema=z31.strictObject({schemaVersion:z31.literal(1),purpose:z31.literal("SOURCE_SYNC"),id:id4,audioId:id4,version:z31.int().positive(),tenantId:id4,projectId:id4,productionId:id4,shotId:id4,normalizationId:id4,artifactId:id4,representationId:id4,provenance:ImportedSynchronousAudioSourceSchema,previousVersionId:id4.nullable(),executionClass:z31.enum(["LIVE","TEST_ONLY"]),createdByPrincipalId:id4,createdAt:z31.iso.datetime({offset:true})});var SourceSyncAudioReceiptSchema=z31.strictObject({semanticStatus:z31.literal("SUCCESS"),version:SourceSyncAudioVersionSchema,productionRevision:z31.int().positive()});var SourceSyncAudioViewSchema=z31.strictObject({version:SourceSyncAudioVersionSchema,status:z31.enum(["CURRENT","STALE"]),availability:z31.enum(["AVAILABLE","UNAVAILABLE"])});import{z as z32}from"zod";var SourceSoundTreatmentSchema=z32.strictObject({policy:z32.enum(["KEEP","MUTE","DUCK"]),gainPermille:z32.int().min(0).max(1e3),duckingPermille:z32.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 z35}from"zod";import{z as z33}from"zod";var SpeechParameterValueSchema=z33.union([z33.string().max(4096),z33.number().finite(),z33.boolean(),z33.array(z33.string().max(4096)).max(100),z33.record(z33.string().min(1).max(100),z33.string().max(4096)).refine(v=>Object.keys(v).length<=100)]);var SpeechParameterRuleSchema=z33.strictObject({label:z33.string().trim().min(1).max(100).regex(/^[^\p{Cc}]*$/u),type:z33.enum(["NUMBER","INTEGER","STRING","BOOLEAN","STRING_ARRAY","STRING_MAP"]),required:z33.boolean().default(false),min:z33.number().optional(),max:z33.number().optional(),maxLength:z33.int().positive().max(4096).optional(),options:z33.array(z33.string().min(1).max(100)).max(100).optional(),default:SpeechParameterValueSchema.optional(),unit:z33.string().max(40).optional(),description:z33.string().max(500).optional(),maxItems:z33.int().positive().max(100).optional(),maxKeyLength:z33.int().positive().max(100).optional()});var SpeechParametersSchema=z33.record(z33.string().regex(/^[a-z][a-z0-9_]{0,49}$/),SpeechParameterValueSchema).refine(p=>Object.keys(p).length<=24);var SpeechVoiceSchema=z33.strictObject({id:z33.string().min(1).max(100),label:z33.string().min(1).max(100),languages:z33.array(z33.string().min(2).max(20)).min(1).max(32).optional(),parameterDefaults:SpeechParametersSchema.optional(),parameterOptions:z33.record(z33.string(),z33.array(z33.string().min(1).max(100)).min(1).max(100)).optional(),unsupportedParameters:z33.array(z33.string()).max(24).optional()});import{z as z34}from"zod";var cpuSpeechResources={schemaVersion:1,wrapper:{name:"sherpa-onnx-node",url:"https://registry.npmjs.org/sherpa-onnx-node/-/sherpa-onnx-node-1.12.33.tgz",byteSize:10289,sha256:"c56a08c884dcd3ec4b4d815edea4aabbff62fbcd1b0176e88480b5d9b920fa03"},engines:[{platform:"linux-x64",package:"sherpa-onnx-linux-x64",url:"https://registry.npmjs.org/sherpa-onnx-linux-x64/-/sherpa-onnx-linux-x64-1.12.33.tgz",byteSize:10137208,sha256:"651f529869249628c3e304744ab21d658f880be3684e8ead93702f2055bfb5d1",engineDigest:"dbc8c7bcdcd9dc24183894eabb945001ae001fe69cd16c427f01cf41e598c33a",fileCount:25,unpackedBytes:30623890},{platform:"linux-arm64",package:"sherpa-onnx-linux-arm64",url:"https://registry.npmjs.org/sherpa-onnx-linux-arm64/-/sherpa-onnx-linux-arm64-1.12.33.tgz",byteSize:12826691,sha256:"fec1be880a3e6a79e30db4075690759218a28923fafda51983649bcae3efdfbf",engineDigest:"447387941363150362e034f0e8bceb11922b95f11d8553882b7386ad24f1e92f",fileCount:25,unpackedBytes:37679333},{platform:"darwin-x64",package:"sherpa-onnx-darwin-x64",url:"https://registry.npmjs.org/sherpa-onnx-darwin-x64/-/sherpa-onnx-darwin-x64-1.12.33.tgz",byteSize:25289549,sha256:"137082336fa9bf721385c85828b29766dd0d8e0ce67dcc8691d9a5daa7171ce9",engineDigest:"a298b1bd79b690a7cc26eed975980ff69262967627340525a9ef66a8ca45b091",fileCount:26,unpackedBytes:85413811},{platform:"darwin-arm64",package:"sherpa-onnx-darwin-arm64",url:"https://registry.npmjs.org/sherpa-onnx-darwin-arm64/-/sherpa-onnx-darwin-arm64-1.12.33.tgz",byteSize:22164444,sha256:"c5d96d89deadb042f603a83dd0b93b9f147ca635ae3316e83718cd5566c0b61a",engineDigest:"f409d0ef9b864983c784b27369b40a20a988347ecfdbc27a34ea8a8533ccb589",fileCount:26,unpackedBytes:75969095}],model:{url:"https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/kokoro-int8-multi-lang-v1_1.tar.bz2",byteSize:147052523,sha256:"259c9c8bc906d6078e4e0570421885dabb68b539c2f970fcbb890a58eeaf3e9c",directory:"kokoro-int8-multi-lang-v1_1",treeDigest:"ebd0959580940e20dbb10a55775ec94e47229c7c503f65932403fe0764667126",fileCount:377,unpackedBytes:215227172}};var kokoroCpuProfile=Object.freeze({id:"KOKORO_INT8_ZH_EN_V1",adapter:"KOKORO_ONNX_CPU_V1",engineVersion:"1.12.33",engineDigest:"f409d0ef9b864983c784b27369b40a20a988347ecfdbc27a34ea8a8533ccb589",modelDigest:"ebd0959580940e20dbb10a55775ec94e47229c7c503f65932403fe0764667126",modelArchiveSha256:"259c9c8bc906d6078e4e0570421885dabb68b539c2f970fcbb890a58eeaf3e9c",sampleRateHz:24e3,speakerCount:103,maxCharacters:600,maxDurationMs:6e4});var CpuSpeechToolSelectionSchema=z34.strictObject({engineDirectory:z34.string().min(1).max(4096),modelDirectory:z34.string().min(1).max(4096)});var CpuSpeechInputSchema=z34.strictObject({text:z34.string().min(1).max(kokoroCpuProfile.maxCharacters).refine(s=>s.trim().length>0&&!new RegExp("\\p{Cc}","u").test(s.replace(/[\t\n]/g,""))&&new TextEncoder().encode(s).length<=2400),voiceId:z34.int().min(0).max(kokoroCpuProfile.speakerCount-1),language:z34.enum(["zh","en"]),speed:z34.number().min(.5).max(2).default(1)});var SpeechDeliverySchema=z34.discriminatedUnion("mode",[z34.strictObject({mode:z34.literal("NON_STREAMING"),output:z34.literal("COMPLETE_AUDIO")}),z34.strictObject({mode:z34.literal("SENTENCE_CHUNKED"),output:z34.literal("ORDERED_SENTENCES")}),z34.strictObject({mode:z34.literal("TRUE_STREAMING"),output:z34.literal("CONTINUOUS_AUDIO")})]);var CpuSpeechIdentitySchema=z34.strictObject({profileId:z34.literal(kokoroCpuProfile.id),adapter:z34.literal(kokoroCpuProfile.adapter),platform:z34.strictObject({os:z34.enum(["darwin","linux"]),architecture:z34.enum(["arm64","x64"])}),engineVersion:z34.literal(kokoroCpuProfile.engineVersion),engineDigest:LocalDigestSchema,modelDigest:z34.literal(kokoroCpuProfile.modelDigest),bridgeSha256:LocalDigestSchema,nodeSha256:LocalDigestSchema}).refine(v=>cpuSpeechResources.engines.some(e=>e.platform===v.platform.os+"-"+v.platform.architecture&&e.engineDigest===v.engineDigest));var CpuSpeechObservationSchema=z34.strictObject({inputSha256:LocalDigestSchema,voiceId:CpuSpeechInputSchema.shape.voiceId,language:CpuSpeechInputSchema.shape.language,outputSha256:LocalDigestSchema,outputBytes:z34.int().min(4844).max(2880044),sampleRateHz:z34.literal(kokoroCpuProfile.sampleRateHz),sampleCount:z34.int().min(2400).max(144e4),durationMs:z34.number().min(100).max(kokoroCpuProfile.maxDurationMs),modelLoadMs:z34.number().nonnegative(),synthesisMs:z34.number().nonnegative(),outputReadyMs:z34.number().positive(),realTimeFactor:z34.number().nonnegative(),cpuMs:z34.number().nonnegative(),peakRssBytes:z34.int().positive()});var CpuSpeechQualificationSchema=z34.strictObject({identity:CpuSpeechIdentitySchema,delivery:z34.strictObject({mode:z34.literal("NON_STREAMING"),output:z34.literal("COMPLETE_AUDIO")}),cancellation:z34.literal("OWNED_PROCESS"),technicalStatus:z34.literal("TECHNICALLY_OBSERVED"),listeningStatus:z34.literal("NOT_PROVEN"),observations:z34.array(CpuSpeechObservationSchema).min(3).max(24),observedAt:z34.iso.datetime({offset:true})});var CpuSpeechCapabilitySchema=z34.strictObject({identity:CpuSpeechIdentitySchema,voices:z34.array(z34.strictObject({voiceId:CpuSpeechInputSchema.shape.voiceId,languages:z34.array(CpuSpeechInputSchema.shape.language).min(1).max(2).refine(v=>new Set(v).size===v.length)})).min(1).max(8).refine(v=>new Set(v.map(s=>s.voiceId)).size===v.length)});var CpuSpeechInstallationSchema=CpuSpeechToolSelectionSchema.extend({voiceIds:z34.array(CpuSpeechInputSchema.shape.voiceId).min(1).max(8).refine(v=>new Set(v).size===v.length)});var NativeSpeechExecutionSchema=z35.strictObject({schemaVersion:z35.literal(1),profileId:z35.literal(kokoroCpuProfile.id),modelDigest:z35.literal(kokoroCpuProfile.modelDigest)});var speed=SpeechParameterRuleSchema.safeExtend({type:z35.literal("NUMBER"),min:z35.number().min(.5).max(2),max:z35.number().min(.5).max(2),default:z35.number().min(.5).max(2).default(1)}).refine(r=>r.min<=r.max&&r.default>=r.min&&r.default<=r.max);var voice=SpeechVoiceSchema.safeExtend({id:z35.string().regex(/^(?:[0-9]|[1-9][0-9]|10[0-2])$/),languages:z35.array(z35.enum(["zh","en"])).min(1).max(2).optional()});var NativeSpeechModelProfileSchema=z35.strictObject({id:ModelProfileIdSchema,version:z35.int().positive(),label:z35.string().trim().min(1).max(100).regex(/^[^\p{Cc}]*$/u),protocol:z35.literal(kokoroCpuProfile.adapter),execution:NativeSpeechExecutionSchema,textMaxCharacters:z35.int().min(1).max(kokoroCpuProfile.maxCharacters),languages:z35.array(z35.enum(["zh","en"])).min(1).max(2).refine(v=>new Set(v).size===v.length),voices:z35.array(voice).min(1).max(kokoroCpuProfile.speakerCount).refine(v=>new Set(v.map(voice2=>voice2.id)).size===v.length),parameters:z35.strictObject({speed}),sourceUrl:z35.literal("https://k2-fsa.github.io/sherpa/onnx/tts/pretrained_models/kokoro.html"),output:z35.literal("PCM_S16LE_48000_V1"),normalizationVersion:z35.literal("SPEECH_PCM_V1")});import{z as z48}from"zod";import{z as z39}from"zod";import{z as z37}from"zod";import{z as z36}from"zod";var receiptId=z36.string().regex(/^[A-Za-z0-9_.:-]{1,500}$/);var resultHost="dashscope-result-bj.oss-cn-beijing.aliyuncs.com";var maxQwenTtsAudioBytes=12*1024*1024;var QwenTtsReceiptSchema=z36.strictObject({providerRequestId:receiptId,audioId:receiptId,audioUrl:z36.url().max(8192).meta({writeOnly:true}),expiresAt:z36.iso.datetime(),usage:z36.strictObject({characters:z36.int().min(0).max(6e3)}).optional()}).refine(({audioUrl,expiresAt})=>{try{const url=new URL(audioUrl);const expires=url.searchParams.getAll("Expires");return url.href===audioUrl&&url.protocol==="https:"&&url.hostname===resultHost&&!url.username&&!url.password&&!url.port&&!url.hash&&url.pathname.endsWith(".wav")&&(expires.length===0||expires.length===1&&/^\d{1,12}$/.test(expires[0])&&Number(expires[0])*1e3===Date.parse(expiresAt))}catch{return false}},"Invalid Qwen TTS audio receipt");var QwenSpeechProviderStateSchema=z36.discriminatedUnion("state",[z36.strictObject({state:z36.literal("RECEIVED"),receipt:QwenTtsReceiptSchema}),z36.strictObject({state:z36.literal("UNKNOWN")}),z36.strictObject({state:z36.literal("REJECTED")})]);var MacSpeechIdentitySchema=z37.strictObject({adapter:z37.literal("MACOS_SAY_V1"),voiceId:z37.literal("com.apple.speech.synthesis.voice.Albert"),locale:z37.literal("en-US"),systemBuild:z37.string().regex(/^[A-Za-z0-9]{1,40}$/),saySha256:LocalDigestSchema,sandboxSha256:LocalDigestSchema,synthesizerSha256:LocalDigestSchema,voiceCatalogSha256:LocalDigestSchema,voiceProbeSha256:LocalDigestSchema});var MacSpeechInputSchema=z37.strictObject({text:z37.string().min(1).max(2e3).refine(text=>text.trim().length>0&&!text.includes("[[")&&!new RegExp("\\p{Cc}","u").test(text)&&new TextEncoder().encode(text).length<=4096),rateWordsPerMinute:z37.int().min(80).max(240)});var SpeechSynthesisRecipeSchema=MacSpeechInputSchema.extend({processor:z37.literal("SPEECH_SYNTHESIZE"),identity:MacSpeechIdentitySchema});var audioObject=z37.strictObject({checksumSha256:LocalDigestSchema,byteSize:z37.int().min(44).max(12*1024*1024)});var SpeechSynthesisEvidenceSchema=z37.strictObject({processor:z37.literal("SPEECH_SYNTHESIZE"),source:audioObject,normalized:audioObject,sourceMedia:z37.strictObject({sampleRateHz:z37.literal(22050),audioChannels:z37.literal(1),sampleCount:z37.int().min(2205).max(1323e3)}),media:AudioMediaSchema.refine(value2=>value2.audioChannels===1),padSamples:z37.int().min(0).max(47)});var QwenSpeechRecipeSchema=z37.strictObject({processor:z37.literal("SPEECH_EXTERNAL_QWEN"),generationId:LocalIdSchema,quoteFingerprint:LocalDigestSchema});var QwenSpeechEvidenceSchema=SpeechSynthesisEvidenceSchema.extend({processor:z37.literal("SPEECH_EXTERNAL_QWEN"),providerRequestId:QwenTtsReceiptSchema.shape.providerRequestId,audioId:QwenTtsReceiptSchema.shape.audioId,sourceMedia:z37.strictObject({sampleRateHz:z37.literal([8e3,12e3,16e3,22050,24e3,32e3,44100,48e3]),audioChannels:z37.union([z37.literal(1),z37.literal(2)]),sampleCount:z37.int().min(800).max(288e4)}).refine(({sampleRateHz,sampleCount})=>sampleCount>=sampleRateHz/10&&sampleCount<=sampleRateHz*60)});import{z as z38}from"zod";var NativeSpeechOptionsSchema=z38.strictObject({schemaVersion:z38.literal(1),models:z38.array(z38.strictObject({modelProfileId:ModelProfileIdSchema,modelProfileVersion:z38.int().positive(),label:z38.string().min(1).max(100),profileId:z38.literal(kokoroCpuProfile.id),textMaxCharacters:z38.int().min(1).max(kokoroCpuProfile.maxCharacters)})).max(20),devices:z38.array(z38.strictObject({deviceId:z38.uuid(),label:z38.string().min(1).max(120),profileId:z38.literal(kokoroCpuProfile.id),voices:CpuSpeechCapabilitySchema.shape.voices})).max(50),possiblyTruncated:z38.boolean()});var SpeechModelProfileSchema=z39.strictObject({id:ModelProfileIdSchema,version:z39.int().positive(),providerId:ProviderIdSchema,modelId:z39.string().min(1).max(160).nullable(),protocol:z39.enum(["QWEN_TTS","QWEN_AUDIO_TTS","OPENAI_TTS","XAI_TTS","GEMINI_INTERACTIONS_TTS","VOLCENGINE_TTS"]),label:z39.string().trim().min(1).max(100).regex(/^[^\p{Cc}]*$/u),textMaxCharacters:z39.int().positive().max(6e3),requestTimeoutMs:z39.int().positive().max(3e5),workspaceRequired:z39.boolean(),voices:z39.array(SpeechVoiceSchema).min(1).max(100),languages:z39.array(z39.string().min(2).max(20)).min(1).max(32),parameters:z39.record(z39.string().regex(/^[a-z][a-z0-9_]{0,49}$/),SpeechParameterRuleSchema),sourceUrl:z39.url().max(2048),verifiedAt:z39.iso.date(),providerTextMaxCharacters:z39.int().positive().nullable(),resourceId:z39.string().min(1).max(100).nullable(),output:z39.literal("PCM_S16LE_48000_V1"),normalizationVersion:z39.literal("SPEECH_PCM_V1")});var SpeechScopeSchema=z39.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var SpeechExecutionBindingSchema=z39.strictObject({tenantId:TenantIdSchema,connectionId:z39.uuid(),connectionVersion:z39.int().positive(),credentialRef:z39.uuid(),credentialVersion:z39.int().positive(),profile:SpeechModelProfileSchema,executionClass:z39.enum(["LIVE","TEST_ONLY"])});var SpeechStartSchema=SpeechScopeSchema.extend({voiceProfile:VoiceProfileUseSchema.optional(),soundCue:z39.strictObject({soundPlanVersionId:z39.uuid(),cueId:z39.string().regex(/^[a-z][a-z0-9_-]{0,63}$/)}).optional(),expectedProductionRevision:z39.int().positive(),expectedAudioVersion:z39.int().nonnegative(),expectedModelProfileVersion:z39.int().positive(),idempotencyKey:z39.string().trim().min(1).max(200),selection:ProviderSelectionSchema,text:z39.string().min(1).max(6e3).refine(s=>s.trim().length>0&&!s.includes("\0")),voice:z39.string().min(1).max(100),parameters:SpeechParametersSchema.default({})});var SpeechGetSchema=SpeechScopeSchema.extend({generationId:z39.uuid()});var SpeechAdmissionSchema=z39.strictObject({humanLinks:HumanLinksSchema.optional(),semanticStatus:z39.literal("ACCEPTED"),generationId:z39.uuid(),runtimeJobId:z39.uuid(),productionRevision:z39.int().positive(),executionClass:z39.enum(["LIVE","TEST_ONLY"])});var SpeechGenerationViewSchema=SpeechAdmissionSchema.omit({semanticStatus:true}).extend({tenantId:TenantIdSchema,productionId:ProductionIdSchema,soundCue:SpeechStartSchema.shape.soundCue,voiceProfile:VoiceProfileUseSchema.optional(),text:z39.string().min(1).max(6e3),voice:z39.string().min(1).max(100),parameters:SpeechParametersSchema,profile:SpeechModelProfileSchema,connectionId:z39.uuid(),connectionVersion:z39.int().positive(),runtimeStatus:z39.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z39.enum(["NOT_SUBMITTED","SUBMITTING","UNKNOWN","SUCCEEDED","REJECTED"]),cancellationRequested:z39.boolean(),result:AudioReceiptSchema.nullable(),createdAt:z39.iso.datetime({offset:true})});var localSpeechBody=z39.strictObject({expectedProductionRevision:SpeechStartSchema.shape.expectedProductionRevision,expectedAudioVersion:SpeechStartSchema.shape.expectedAudioVersion,idempotencyKey:SpeechStartSchema.shape.idempotencyKey,text:SpeechStartSchema.shape.text,rateWordsPerMinute:MacSpeechInputSchema.shape.rateWordsPerMinute.optional(),voiceProfile:VoiceProfileUseSchema.optional(),soundCue:SpeechStartSchema.shape.soundCue,deviceExecution:z39.strictObject({deviceId:z39.uuid().optional()})});function refineLocalSpeech(v,ctx){const valid=v.voiceProfile?v.rateWordsPerMinute===void 0&&CpuSpeechInputSchema.shape.text.safeParse(v.text).success&&(v.voiceProfile.usage!=="AUDITION"||!v.soundCue):false;const systemValid=!v.voiceProfile&&!v.soundCue&&MacSpeechInputSchema.safeParse({text:v.text,rateWordsPerMinute:v.rateWordsPerMinute}).success;if(!(v.voiceProfile?valid:systemValid))ctx.addIssue({code:"custom",message:"Exact saved CPU voice or anonymous system voice required"})}var LocalSpeechBodySchema=localSpeechBody.superRefine(refineLocalSpeech);var LocalSpeechStartSchema=SpeechScopeSchema.extend(localSpeechBody.shape).superRefine(refineLocalSpeech);var NativeSpeechBindingSchema=z39.strictObject({profile:NativeSpeechModelProfileSchema,voice:z39.string().min(1).max(100),parameters:SpeechParametersSchema});var NativeSpeechBasisSchema=z39.strictObject({schemaVersion:z39.literal(1),modelProfileId:ModelProfileIdSchema,modelProfileVersion:z39.int().positive(),label:z39.string().min(1).max(100),voice:z39.string().min(1).max(100),parameters:SpeechParametersSchema,execution:NativeSpeechExecutionSchema});var LocalSpeechBindingSchema=z39.strictObject({target:z39.literal("TENANT_DEVICE"),tenantId:TenantIdSchema,deviceId:z39.uuid(),identity:z39.union([MacSpeechIdentitySchema,CpuSpeechIdentitySchema]),native:NativeSpeechBindingSchema.optional(),executionClass:z39.literal("LIVE")}).refine(v=>v.identity.adapter==="KOKORO_ONNX_CPU_V1"===!!v.native);var localSpeechExecution=z39.strictObject({target:z39.literal("TENANT_DEVICE"),deviceId:z39.uuid(),identity:LocalSpeechBindingSchema.shape.identity});var LocalSpeechAdmissionSchema=SpeechAdmissionSchema.extend({executionClass:z39.literal("LIVE"),deviceExecution:localSpeechExecution});var LocalSpeechGenerationViewSchema=SpeechGenerationViewSchema.omit({voiceProfile:true,soundCue:true,parameters:true,profile:true,voice:true,connectionId:true,connectionVersion:true,providerStatus:true}).extend({executionClass:z39.literal("LIVE"),deviceExecution:localSpeechExecution,rateWordsPerMinute:MacSpeechInputSchema.shape.rateWordsPerMinute.optional(),voiceProfile:VoiceProfileUseSchema.optional(),soundCue:SpeechStartSchema.shape.soundCue,nativeBasis:NativeSpeechBasisSchema.optional()});var SpeechOptionsSchema=SpeechScopeSchema.extend({native:NativeSpeechOptionsSchema.optional(),options:z39.array(z39.strictObject({selection:ProviderSelectionSchema,profile:SpeechModelProfileSchema,connectionLabel:z39.string().min(1).max(100),connectionVersion:z39.int().positive(),executionTarget:z39.literal("TENANT_DEVICE").optional()})).max(100),possiblyTruncated:z39.boolean()});import{z as z47}from"zod";import{z as z44}from"zod";import{z as z40}from"zod";var KeyframeGenerationIdSchema=z40.uuid().brand();var KeyframeProviderProfileSchema=z40.strictObject({id:z40.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,79}$/),adapterVersion:z40.string().min(1).max(80),model:z40.string().min(1).max(120),executionClass:z40.enum(["LIVE","TEST_ONLY"]),mediaType:z40.literal("IMAGE"),mode:z40.literal("REFERENCE_TO_IMAGE"),referenceRoles:z40.array(ReferenceRoleSchema).min(1).max(6),aspectRatios:z40.array(z40.enum(["16:9","9:16"])).min(1).max(2),maxReferences:z40.int().min(1).max(12),correlationLookup:z40.boolean()});var KeyframeStartInputSchema=z40.strictObject({expectedExecution:ExpectedGenerationExecutionSchema.optional(),selection:ProviderSelectionSchema.optional(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,idempotencyKey:z40.string().trim().min(1).max(200)});var KeyframeDeviceStartInputSchema=KeyframeStartInputSchema.omit({selection:true,expectedExecution:true}).extend({deviceId:z40.uuid(),approvedQuote:GenerationCostQuoteSchema});var KeyframeGetInputSchema=z40.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:KeyframeGenerationIdSchema});var KeyframeQueryInputSchema=z40.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema.optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var KeyframeAdmissionSchema=z40.strictObject({semanticStatus:z40.literal("ACCEPTED"),generationId:KeyframeGenerationIdSchema,operationId:OperationIdSchema,productionId:ProductionIdSchema,contractId:GenerationContractIdSchema,executionClass:z40.enum(["LIVE","TEST_ONLY"])});var KeyframeCandidateSchema=z40.strictObject({id:z40.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,availability:z40.enum(["AVAILABLE","INVALID"]),observation:z40.enum(["NOT_OBSERVED","OBSERVED"]),evaluation:z40.enum(["UNREVIEWED","PASS","WARNING","FAIL"]),accepted:z40.boolean(),reviewId:z40.uuid().optional(),reviewVersion:z40.int().positive().optional(),acceptanceDecisionId:z40.uuid().optional(),freshness:z40.enum(["CURRENT_BASIS","STALE_BASIS"]),checksumSha256:ContentFingerprintSchema,contentType:z40.enum(["image/png","image/jpeg","image/webp"]),byteSize:z40.int().positive(),width:z40.int().positive(),height:z40.int().positive()});var KeyframeGenerationViewSchema=z40.strictObject({connection:z40.strictObject({connectionId:z40.uuid(),connectionVersion:z40.int().positive(),modelProfileId:z40.string(),modelProfileVersion:z40.int().positive()}).optional(),generationId:KeyframeGenerationIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,preparationId:PreparationIdSchema,contractId:GenerationContractIdSchema,contractFingerprint:ContentFingerprintSchema,operationId:OperationIdSchema,provider:KeyframeProviderProfileSchema,runtimeStatus:z40.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z40.enum(["NOT_SUBMITTED","SUBMITTING","PENDING","UNKNOWN","SUCCEEDED","FAILED"]),freshness:z40.enum(["CURRENT_BASIS","STALE_BASIS"]),cancellationRequested:z40.boolean(),candidate:KeyframeCandidateSchema.nullable(),createdByPrincipalId:PrincipalIdSchema,createdAt:z40.iso.datetime({offset:true})});var KeyframeQueryPageSchema=z40.strictObject({items:z40.array(KeyframeGenerationViewSchema),page:QueryPageInfoSchema});var KeyframeMediaSchema=z40.strictObject({contentType:z40.enum(["image/png","image/jpeg","image/webp"]),checksumSha256:ContentFingerprintSchema,byteSize:z40.int().positive().max(8*1024*1024),contentBase64:z40.string().min(4).max(4*Math.ceil(8*1024*1024/3))});var KeyframeSummarySchema=z40.strictObject({generations:z40.int().nonnegative(),running:z40.int().nonnegative(),waiting:z40.int().nonnegative(),registeredCandidates:z40.int().nonnegative(),testCandidates:z40.int().nonnegative(),liveCandidates:z40.int().nonnegative()});import{z as z43}from"zod";import{z as z42}from"zod";import{z as z41}from"zod";var MatrixParameterRuleSchema=SpeechParameterRuleSchema.extend({numberOptions:z41.array(z41.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"})});var AsrProfileSchema=z42.strictObject({id:ModelProfileIdSchema,version:z42.int().positive(),providerId:ProviderIdSchema,sourceUrl:z42.url().max(2048),verifiedAt:z42.iso.date(),modelId:z42.string().min(1).max(160),label:z42.string().min(1).max(100),protocol:z42.enum(["OPENAI_TRANSCRIPTION_V1","OPENAI_WHISPER_TRANSCRIPTION_V1","QWEN_ASR_V1"]),modes:z42.tuple([z42.literal("TRANSCRIPTION")]),inputKinds:z42.array(z42.enum(["AUDIO","VIDEO"])).min(1).max(2),requestTimeoutMs:z42.int().min(1e3).max(18e4),maxBytes:z42.int().positive().max(12582912),maxDurationMs:z42.int().positive().max(6e4),parameters:z42.record(z42.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(([key3,rule])=>fields[key3]!==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:z42.literal(1),text:z42.string().max(6e4),languages:z42.array(z42.string().min(2).max(40)).max(32)};var TimedText=z42.strictObject({text:z42.string().min(1).max(2500),startMs:z42.int().nonnegative().max(6e4),endMs:z42.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs,"Transcript interval must advance");var TranscriptSchema=z42.discriminatedUnion("timing",[z42.strictObject({...TranscriptText,timing:z42.literal("UNAVAILABLE")}),z42.strictObject({...TranscriptText,timing:z42.literal("PROVIDER_REPORTED"),timeBase:z42.literal("ORIGINAL_MEDIA_MS"),granularities:z42.array(z42.enum(["word","segment"])).min(1).max(2),words:z42.array(TimedText).max(1200),segments:z42.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"})}})]);var ObservationModeSchema=z43.enum(["AUDIO","AUDIOVISUAL","VIDEO","VIDEO_ALL_FRAMES","TRANSCRIPTION"]);var ObservationParametersSchema=SpeechParametersSchema;var VisualObservationProfileSchema=z43.strictObject({id:ModelProfileIdSchema,version:z43.int().positive(),providerId:ProviderIdSchema,sourceUrl:z43.url().max(2048),modelId:z43.string().min(1).max(160),label:z43.string().min(1).max(100),protocol:z43.enum(["GEMINI_INTERACTIONS_V1","QIANWEN_VIDEO_V1"]),modes:z43.array(z43.enum(["AUDIO","AUDIOVISUAL","VIDEO","VIDEO_ALL_FRAMES"])).min(1).max(4),requestTimeoutMs:z43.int().min(1e3).max(18e4),maxBytes:z43.int().positive().max(12582912),maxDurationMs:z43.int().positive().max(6e4),parameters:z43.record(z43.string(),z43.strictObject({type:z43.enum(["NUMBER","INTEGER","BOOLEAN","STRING"]),min:z43.number().optional(),max:z43.number().optional(),options:z43.array(z43.string()).max(20).optional(),default:z43.union([z43.number().finite(),z43.boolean(),z43.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=z43.union([VisualObservationProfileSchema,AsrProfileSchema]);var ProviderTenantInputSchema=z44.strictObject({tenantId:TenantIdSchema});var ImageModelProfileSchema=z44.strictObject({referenceRoles:z44.array(ReferenceRoleSchema.exclude(["START_FRAME_ANCHOR","END_FRAME_ANCHOR"])).min(1).max(6).optional(),id:ModelProfileIdSchema,version:z44.int().positive(),providerId:ProviderIdSchema,modelId:z44.string().min(1).max(160),protocol:z44.enum(["QWEN_EDIT","ARK_IMAGE","GEMINI_IMAGE","OPENAI_IMAGE","XAI_IMAGE"]),maxReferences:z44.int().positive(),promptMaxUtf8Bytes:z44.int().positive(),requestTimeoutMs:z44.int().positive(),workingWidth:z44.int().nonnegative(),workingHeight:z44.int().nonnegative()});var VideoModelProfileSchema=z44.strictObject({id:ModelProfileIdSchema,version:z44.int().positive(),providerId:ProviderIdSchema,modelId:z44.string().min(1).max(160),protocol:z44.enum(["QWEN_VIDEO","VOLCENGINE_VIDEO"]),requestTimeoutMs:z44.int().positive(),promptMaxCharacters:z44.int().positive(),resolution:z44.enum(["720P","1080P"]),adapterVersion:z44.string().min(1).max(80),capabilities:VideoProviderProfileSchema.omit({id:true,adapterVersion:true,model:true,executionClass:true})});var ProviderDefaultViewSchema=z44.strictObject({selection:ProviderSelectionSchema,revision:z44.int().positive()});var scan=z44.strictObject({limit:z44.literal(100),possiblyTruncated:z44.boolean()});var ProviderConnectionPageSchema=scan.extend({items:z44.array(ProviderConnectionViewSchema).max(100)});var ProviderModelsViewSchema=z44.strictObject({catalog:z44.array(ImageModelProfileSchema).max(100),videoCatalog:z44.array(VideoModelProfileSchema).max(100),speechCatalog:z44.array(SpeechModelProfileSchema).max(100).default([]),observationCatalog:z44.array(ObservationProfileSchema).max(100).default([]),available:z44.array(z44.strictObject({selection:ProviderSelectionSchema,profile:KeyframeProviderProfileSchema})).max(1600),defaultSelection:ProviderDefaultViewSchema.nullable(),connectionScan:scan});import{z as z45}from"zod";var key2=z45.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,99}$/);var value=z45.union([z45.string().max(160),z45.number().finite(),z45.boolean()]);var ModelAudioCapabilitySchema=z45.enum(["SYNCHRONIZED_AUDIO","SPEECH_GENERATION","SPEECH_RECOGNITION","TRANSCRIPT_TIMESTAMPS","VOICE_REFERENCE","AUDIO_REFERENCE","AUDIO_DRIVEN_VIDEO","LIP_SYNCHRONIZATION","AUDIO_EDITING","SEPARATE_STEMS"]);var ModelCapabilityMatrixSchema=z45.strictObject({schemaVersion:z45.literal(1),service:key2,lifecycle:z45.enum(["ACTIVE","DEPRECATED","RETIRED"]),sources:z45.array(z45.strictObject({url:z45.url().max(2048),checkedAt:z45.iso.date()})).min(1).max(8),modes:z45.array(key2).min(1).max(16),claims:z45.array(z45.strictObject({capability:ModelAudioCapabilitySchema,modes:z45.array(key2).min(1).max(16),support:z45.enum(["SUPPORTED","UNSUPPORTED","UNKNOWN"]),control:z45.enum(["PARAMETER","PROMPT","ALWAYS_ON","MEDIA_INPUT","NONE"]),parameterPath:key2.optional(),access:z45.enum(["PUBLIC","QUALIFIED_ACCOUNT"]).default("PUBLIC"),description:z45.string().max(600).optional()})).max(64),parameters:z45.record(key2,MatrixParameterRuleSchema),constraints:z45.array(z45.strictObject({modes:z45.array(key2).min(1).max(16),when:z45.strictObject({parameter:key2,equals:value}).optional(),require:z45.array(key2).max(16).default([]),forbid:z45.array(key2).max(16).default([]),requireValues:z45.record(key2,value).default({}),reason:z45.string().min(1).max(300)})).max(32),references:z45.array(z45.strictObject({kind:z45.enum(["VOICE_ID","AUDIO_REFERENCE","DRIVING_AUDIO"]),modes:z45.array(key2).min(1).max(16),parameterPath:key2,maxItems:z45.int().min(1).max(10),minDurationMs:z45.int().positive().optional(),maxDurationMs:z45.int().positive().max(6e4).optional(),maxTotalDurationMs:z45.int().positive().max(6e4).optional(),maxBytes:z45.int().positive().max(67108864).optional(),formats:z45.array(z45.enum(["WAV","MP3"])).max(2),requiresVisual:z45.boolean(),access:z45.enum(["PUBLIC","QUALIFIED_ACCOUNT"])})).max(16),outputAudioChannels:z45.union([z45.literal(1),z45.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 z46}from"zod";var rate=z46.int().positive().max(1e9);var ruleId=z46.string().regex(/^[a-zA-Z0-9_-]{1,80}$/);var sourceUrl=z46.url({protocol:/^https$/}).max(2e3).refine(value2=>{const url=new URL(value2);return!url.username&&!url.password&&!url.search});function speechCostUpperBoundMicros(characters,microsPerMillion){return Math.ceil(characters*microsPerMillion/1e6)}var SpeechCostPolicySchema=z46.strictObject({currency:z46.literal("USD"),unit:z46.literal("INPUT_CHARACTER"),ruleId,upperBoundMicrosPerMillionCharacters:rate,sourceUrl,validUntil:z46.iso.datetime({offset:true})});var SpeechCostQuoteSchema=z46.strictObject({workload:z46.literal("SPEECH_SYNTHESIS"),currency:z46.literal("USD"),projectId:ProjectIdSchema,selection:ProviderSelectionSchema,expectedExecution:ExpectedGenerationExecutionSchema.extend({credentialVersion:z46.int().positive()}),intentFingerprint:z46.string().regex(/^[a-f0-9]{64}$/),textCharacters:z46.int().min(1).max(600),billableCharactersUpperBound:z46.int().min(1).max(2400),upperBoundMicros:z46.int().positive().max(1e9),upperBoundMicrosPerMillionCharacters:rate,ruleId,sourceUrl}).refine(value2=>value2.billableCharactersUpperBound>=value2.textCharacters&&value2.billableCharactersUpperBound<=value2.textCharacters*4&&value2.upperBoundMicros===speechCostUpperBoundMicros(value2.billableCharactersUpperBound,value2.upperBoundMicrosPerMillionCharacters),"Speech quote must match its exact character bound and rate");var SpeechDeviceStartSchema=SpeechStartSchema.extend({deviceId:z46.uuid().optional(),approvedQuote:SpeechCostQuoteSchema});var cost={costPolicy:GenerationCostPolicySchema.optional()};var matrix={matrix:ModelCapabilityMatrixSchema.optional()};var ProviderModelDefinitionSchema=z47.discriminatedUnion("family",[z47.strictObject({family:z47.literal("NATIVE_SPEECH"),profile:NativeSpeechModelProfileSchema}),z47.strictObject({family:z47.literal("IMAGE"),profile:ImageModelProfileSchema,...matrix,...cost}),z47.strictObject({family:z47.literal("VIDEO"),profile:VideoModelProfileSchema,...matrix,...cost}),z47.strictObject({family:z47.literal("SPEECH"),profile:SpeechModelProfileSchema,...matrix}),z47.strictObject({family:z47.literal("OBSERVATION"),profile:ObservationProfileSchema,...matrix}),z47.strictObject({family:z47.literal("DECLARED"),profile:z47.strictObject({id:ModelProfileIdSchema,version:z47.int().positive(),providerId:ProviderIdSchema,modelId:z47.string().min(1).max(160),protocol:z47.literal("DOCUMENTED_ONLY")}),matrix:ModelCapabilityMatrixSchema})]);var ProviderModelViewSchema=z47.strictObject({tenantId:TenantIdSchema,id:ModelProfileIdSchema,version:z47.int().positive(),enabled:z47.boolean(),definition:ProviderModelDefinitionSchema}).refine(v=>v.id===v.definition.profile.id&&v.version===v.definition.profile.version,{message:"Model version identity mismatch"});var ConfigureProviderModelSchema=z47.strictObject({tenantId:TenantIdSchema,expectedVersion:z47.int().nonnegative(),definition:ProviderModelDefinitionSchema,speechCostPolicy:SpeechCostPolicySchema.optional()}).refine(v=>!v.speechCostPolicy||v.definition.family==="SPEECH",{message:"Speech cost policy requires a speech model"}).refine(v=>v.definition.profile.version===v.expectedVersion+1,{message:"Next model version required"}).refine(v=>new TextEncoder().encode(JSON.stringify(v.definition)).length<=65536,{message:"Model definition too large"});var DisableProviderModelSchema=z47.strictObject({tenantId:TenantIdSchema,id:ModelProfileIdSchema,expectedVersion:z47.int().positive()});var ProviderModelPageSchema=z47.strictObject({items:z47.array(ProviderModelViewSchema).max(100),possiblyTruncated:z47.boolean()});var ProviderModelGetSchema=z47.strictObject({tenantId:TenantIdSchema,id:ModelProfileIdSchema,version:z47.int().positive().optional()});var id5=z48.uuid().toLowerCase();var SoundPlanScopeSchema=z48.strictObject({tenantId:id5,productionId:id5});var SoundPlanBasisSchema=z48.strictObject({briefVersionId:id5,briefVersion:z48.int().positive(),storyVersionId:id5,storyVersion:z48.int().positive(),planVersionId:id5,planVersion:z48.int().positive()});var SoundPlanModelSchema=z48.strictObject({modelProfileId:z48.string().regex(/^[a-z][a-z0-9-]{1,79}$/),modelProfileVersion:z48.int().positive(),connectionId:id5});var SoundPlanNativeSpeechSchema=SoundPlanModelSchema.omit({connectionId:true}).extend({schemaVersion:z48.literal(1),execution:NativeSpeechExecutionSchema});var SoundMakingPlanContentSchema=z48.strictObject({visuals:z48.array(z48.strictObject({shotId:id5,method:z48.enum(["CODE","GENERATED","IMPORTED"]),model:SoundPlanModelSchema.optional(),nativeAudio:z48.boolean().optional(),sourceSound:SourceSoundTreatmentSchema,rationale:z48.string().trim().min(1).max(600)})).min(1).max(200),cues:z48.array(z48.strictObject({id:z48.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),role:z48.enum(["NARRATION","DIALOGUE","MUSIC","AMBIENCE","SOUND_EFFECT"]),source:z48.enum(["TTS","NATIVE_VIDEO","IMPORTED_AUDIO","EXISTING_AUDIO"]),shotIds:z48.array(id5).min(1).max(200),startMs:z48.int().min(0).max(6e4),endMs:z48.int().positive().max(6e4),text:z48.string().trim().min(1).max(6e3).optional(),voice:z48.string().min(1).max(100).optional(),voiceProfile:VoiceProfileUseSchema.extend({usage:z48.literal("PRODUCTION")}).optional(),model:SoundPlanModelSchema.optional(),nativeModel:SoundPlanNativeSpeechSchema.optional(),parameters:SpeechParametersSchema.optional(),audio:z48.strictObject({purpose:z48.enum(["VOICEOVER","MUSIC"]),versionId:z48.uuid()}).optional(),lipSync:z48.enum(["REQUIRED","NONE"]),exactSpeech:z48.boolean()})).max(64),unknowns:z48.array(z48.string().trim().min(1).max(300)).max(16)}).superRefine((v,c)=>{if(new Set(v.visuals.map(s=>s.shotId)).size!==v.visuals.length||new Set(v.cues.map(s=>s.id)).size!==v.cues.length)c.addIssue({code:"custom",message:"Visual Shot and cue identities must be unique"});for(const s of v.visuals)if(s.method==="GENERATED"!==!!s.model||s.method==="GENERATED"&&s.nativeAudio===void 0||s.method!=="GENERATED"&&s.nativeAudio!==void 0||s.method==="CODE"&&s.sourceSound.policy!=="MUTE")c.addIssue({code:"custom",message:"Generated visuals require a model; CODE has no native sound"});for(const cue of v.cues)if(cue.endMs<=cue.startMs||new Set(cue.shotIds).size!==cue.shotIds.length||cue.source==="TTS"&&(!cue.text||!cue.voice||!!cue.model===!!cue.nativeModel||cue.nativeModel&&!cue.voiceProfile||!["NARRATION","DIALOGUE"].includes(cue.role))||cue.exactSpeech&&!cue.text||["NARRATION","DIALOGUE"].includes(cue.role)&&!cue.text||["IMPORTED_AUDIO","EXISTING_AUDIO"].includes(cue.source)!==!!cue.audio||cue.audio&&((["NARRATION","DIALOGUE"].includes(cue.role)?"VOICEOVER":"MUSIC")!==cue.audio.purpose||!["NARRATION","DIALOGUE","MUSIC"].includes(cue.role))||cue.source!=="TTS"&&(!!cue.voice||!!cue.model||!!cue.nativeModel||!!cue.parameters||!!cue.voiceProfile)||cue.source==="NATIVE_VIDEO"&&["NARRATION","DIALOGUE"].includes(cue.role)&&cue.shotIds.length!==1||cue.lipSync==="REQUIRED"&&(cue.source!=="NATIVE_VIDEO"||cue.shotIds.length!==1))c.addIssue({code:"custom",message:"Invalid speech, cue timing or synchronization intent"})});var SoundPlanVersionSchema=SoundPlanScopeSchema.extend({id:id5,soundPlanId:id5,projectId:id5,version:z48.int().positive(),basis:SoundPlanBasisSchema,content:SoundMakingPlanContentSchema,createdByPrincipalId:id5,createdAt:z48.iso.datetime({offset:true})});var SoundPlanValidateSchema=SoundPlanScopeSchema.extend({expectedProductionRevision:z48.int().positive(),basis:SoundPlanBasisSchema,content:SoundMakingPlanContentSchema});var SoundPlanAcceptSchema=SoundPlanValidateSchema.extend({expectedVersion:z48.int().nonnegative(),idempotencyKey:z48.string().trim().min(1).max(200)});var SoundPlanGetSchema=SoundPlanScopeSchema.extend({versionId:id5.optional()});var SoundPlanDiagnosticSchema=z48.strictObject({severity:z48.enum(["ERROR","WARNING"]),code:z48.string().regex(/^[A-Z][A-Z0-9_]{0,79}$/),shotId:id5.optional(),cueId:z48.string().max(64).optional(),message:z48.string().max(500)});var SoundPlanValidationSchema=z48.strictObject({executable:z48.boolean(),diagnostics:z48.array(SoundPlanDiagnosticSchema).max(256),semantics:z48.literal("PLAN_VALIDATION_NOT_CREATIVE_OR_LISTENING_APPROVAL")});var SoundPlanViewSchema=z48.strictObject({version:SoundPlanVersionSchema,current:z48.boolean(),freshness:z48.enum(["CURRENT_BASIS","STALE_BASIS"])});var SoundPlanReceiptSchema=z48.strictObject({semanticStatus:z48.literal("SUCCESS"),version:SoundPlanVersionSchema,productionRevision:z48.int().positive()});var SoundPlanContextSchema=SoundPlanScopeSchema.extend({projectId:id5,productionRevision:z48.int().positive(),runnable:z48.boolean(),basis:SoundPlanBasisSchema.nullable(),targetDurationMs:z48.int().positive().nullable(),shots:z48.array(z48.strictObject({shotId:id5,durationMs:z48.int().positive()})).max(200),currentVersion:z48.int().nonnegative(),currentVersionId:id5.nullable(),capabilities:z48.strictObject({models:z48.array(ProviderModelViewSchema).max(100),video:z48.array(z48.strictObject({selection:ProviderSelectionSchema,profile:VideoProviderProfileSchema})).max(1600),speech:SpeechOptionsSchema.shape.options,audio:z48.array(AudioViewSchema).max(64)})});var TimelineSourceSoundInputSchema=z49.strictObject({duckingMusicPermille:z49.int().nonnegative().max(1e3).optional(),soundPlanVersionId:z49.uuid(),clips:z49.array(z49.strictObject({ordinal:z49.int().min(1).max(200),treatment:SourceSoundTreatmentSchema,importedAudioVersionId:z49.uuid().optional()})).min(1).max(200),speechCues:z49.array(z49.strictObject({cueId:z49.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),audioVersionId:z49.uuid()})).max(64)});var TimelineSourceSoundSourceSchema=z49.discriminatedUnion("kind",[z49.strictObject({kind:z49.literal("NATIVE_GENERATED"),version:NativeVideoSoundReferenceSchema}),z49.strictObject({kind:z49.literal("IMPORTED_SYNC"),version:SourceSyncAudioVersionSchema})]);var TimelineSourceSoundCompositionSchema=z49.strictObject({schemaVersion:z49.literal(1),soundPlanVersionId:z49.uuid(),soundPlanFingerprint:z49.string().regex(/^[0-9a-f]{64}$/),plannedCues:SoundMakingPlanContentSchema.shape.cues,mix:AudioMixProfileSchema,clips:z49.array(z49.strictObject({ordinal:z49.int().min(1).max(200),treatment:SourceSoundTreatmentSchema,source:TimelineSourceSoundSourceSchema.optional(),sourceInSample:z49.int().nonnegative().max(288e4),sourceOutSample:z49.int().nonnegative().max(288e4),startSample:z49.int().nonnegative().max(288e4),outputSampleCount:z49.int().positive().max(288e4)})).min(1).max(200),speechCues:z49.array(z49.strictObject({cueId:z49.string().regex(/^[a-z][a-z0-9_-]{0,63}$/),source:ProductionAudioVersionSchema,sourceInMs:z49.literal(0),sourceOutMs:z49.int().positive().max(6e4),startMs:z49.int().nonnegative().max(6e4),gainPermille:z49.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"})});var TimelineV2ClipSchema=TimelineManifestSchema.shape.clips.element.extend({source:AcceptedVisualSourceReferenceSchema});var TimelineV2ManifestSchema=TimelineManifestSchema.extend({schemaVersion:z50.literal(2),clips:z50.array(TimelineV2ClipSchema).min(1).max(200),sourceSound:TimelineSourceSoundCompositionSchema.optional()});var TimelineV2VersionSchema=TimelineV2ManifestSchema.extend(TimelineVersionIdentityShape).superRefine(validateTimelineAttachments);import{z as z51}from"zod";var sha4=z51.string().regex(/^[0-9a-f]{64}$/);var VisualFrameSequenceSchema=z51.strictObject({schemaVersion:z51.literal(1),profileId:z51.literal("RGBA_PNG_SEQUENCE_30_V1"),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema.nullable(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:sha4,width:z51.int().min(1).max(1920),height:z51.int().min(1).max(1920),frameRate:z51.literal(30),frameCount:z51.int().min(1).max(360),alpha:z51.literal("STRAIGHT_RGBA"),frames:z51.array(z51.strictObject({ordinal:z51.int().min(0).max(359),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:sha4,byteSize:z51.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=z51.strictObject({xPermille:z51.int().min(0).max(1e3),yPermille:z51.int().min(0).max(1e3),widthPermille:z51.int().min(1).max(1e3),heightPermille:z51.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=z51.strictObject({id:z51.uuid(),source:VisualFrameSequenceSchema,sourceInFrame:z51.int().min(0).max(359),sourceOutFrame:z51.int().min(1).max(360),startFrame:z51.int().min(0).max(1799),zIndex:z51.int().min(0).max(7),opacityPermille:z51.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=z51.strictObject({schemaVersion:z51.literal(1),profileId:z51.literal("STRAIGHT_ALPHA_FRAME_OVERLAY_30_V1"),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,totalFrames:z51.int().min(1).max(1800),layers:z51.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 source3=layer.source;const body=JSON.stringify(source3);for(const frame2 of source3.frames){const identity3=JSON.stringify({artifactId:frame2.artifactId,checksumSha256:frame2.checksumSha256,byteSize:frame2.byteSize,width:source3.width,height:source3.height});if(frames.has(frame2.representationId)&&frames.get(frame2.representationId)!==identity3)context.addIssue({code:"custom",message:"Shared frame representation has inconsistent facts"});frames.set(frame2.representationId,identity3)}if(source3.tenantId!==v.tenantId||source3.projectId!==v.projectId||source3.productionId!==null&&source3.productionId!==v.productionId||layer.startFrame+layer.sourceOutFrame-layer.sourceInFrame>v.totalFrames||sources.has(source3.representationId)&&sources.get(source3.representationId)!==body)context.addIssue({code:"custom",message:"Layer source scope/identity/output bounds mismatch"});if(!sources.has(source3.representationId))bytes+=source3.frames.reduce((n,f)=>n+f.byteSize,0);sources.set(source3.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"})});var TimelineVisualLayerInputSchema=z52.strictObject({id:z52.uuid(),artifactId:ArtifactIdSchema,sourceInFrame:z52.int().min(0).max(359),sourceOutFrame:z52.int().min(1).max(360),startFrame:z52.int().min(0).max(1799),zIndex:z52.int().min(0).max(7),opacityPermille:z52.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:z52.literal(3),visualLayers:VisualLayerCompositionSchema});var TimelineV3VersionSchema=TimelineV3ManifestSchema.extend(TimelineVersionIdentityShape).superRefine((timeline,context)=>{validateTimelineAttachments(timeline,context);validateTimelineVisualLayerClock(timeline,context)});function validateTimelineVisualLayerClock(timeline,context){const composition2=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&&composition2.tenantId!==timeline.tenantId||timeline.projectId!==void 0&&composition2.projectId!==timeline.projectId||timeline.productionId!==void 0&&composition2.productionId!==timeline.productionId||composition2.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 z53}from"zod";var FinalRenderProfileIdSchema=z53.enum(["FINAL_H264_720P_V1","FINAL_H264_1080P_V1","FINAL_H264_480P_V1"]);var FinalRenderProfileSchema=z53.strictObject({id:FinalRenderProfileIdSchema,algorithm:z53.enum(["ORDERED_TRIM_CUT_V1","ORDERED_COMPOSE_V2"]),picturePolicy:PicturePolicySchema.optional(),width:z53.union([z53.literal(1280),z53.literal(720),z53.literal(1920),z53.literal(1080),z53.literal(854),z53.literal(480)]),height:z53.union([z53.literal(1280),z53.literal(720),z53.literal(1920),z53.literal(1080),z53.literal(854),z53.literal(480)]),frameRate:z53.literal(30),codec:z53.literal("h264"),pixelFormat:z53.literal("yuv420p"),fit:z53.literal("PAD"),hasAudio:z53.boolean(),audioMix:AudioMixProfileSchema.optional(),framePolicy:z53.literal("CUMULATIVE_NEAREST_FRAME"),encoder:z53.literal("libx264"),crf:z53.literal(18),preset:z53.literal("veryfast"),gopFrames:z53.literal(30),bFrames:z53.literal(0),audioPolicy:z53.enum(["SILENT","MIXED"]),captionPolicy:z53.enum(["NONE","BURN_IN"]),sourceQualityPolicy:z53.literal("NO_UPSCALE_V1"),captionStyle:CaptionRenderStyleSchema.optional(),graphicsPolicy:z53.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"})});var VisualLayerPolicySchema=z54.enum(["STRAIGHT_ALPHA_FRAME_OVERLAY_30_V1","STRAIGHT_ALPHA_FRAME_OVERLAY_30_V2"]);var VisualLayerPreviewProfileSchema=RoughCutProfileSchema.safeExtend({visualLayerPolicy:VisualLayerPolicySchema});var VisualLayerFinalProfileSchema=FinalRenderProfileSchema.safeExtend({visualLayerPolicy:VisualLayerPolicySchema,visualLayerSourceQualityPolicy:z54.literal("NO_UPSCALE_V1")});var shape={schemaVersion:z54.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=z54.union([VisualLayerPreviewManifestSchema,VisualLayerFinalManifestSchema]);import{z as z57}from"zod";import{z as z56}from"zod";import{z as z55}from"zod";var TimelineVersionReaderSchema=z55.discriminatedUnion("schemaVersion",[TimelineVersionSchema,TimelineV2VersionSchema,TimelineV3VersionSchema]);var TimelineManifestReaderSchema=z55.discriminatedUnion("schemaVersion",[TimelineManifestSchema,TimelineV2ManifestSchema,TimelineV3ManifestSchema.superRefine(validateTimelineVisualLayerClock)]);var TimelineScopeSchema=z56.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var TimelineClipInputSchema=z56.strictObject({shotId:ShotIdSchema,acceptanceId:z56.uuid(),framing:ClipFramingSchema.optional(),transition:ClipTransitionSchema.optional(),sourceInMs:z56.int().nonnegative().max(30150),sourceOutMs:z56.int().positive().max(30150)}).refine(v=>v.sourceOutMs>v.sourceInMs,"Clip source range must advance");var BuildTimelineShapeSchema=TimelineScopeSchema.extend({schemaVersion:z56.union([z56.literal(2),z56.literal(3)]).optional(),expectedProductionRevision:z56.int().positive(),expectedTimelineVersion:z56.int().nonnegative(),idempotencyKey:z56.string().trim().min(1).max(200),clips:z56.array(TimelineClipInputSchema).min(1).max(200),captionVersionId:z56.uuid().optional(),audio:TimelineAudioInputSchema.optional(),sourceSound:TimelineSourceSoundInputSchema.optional(),graphics:z56.array(TimelineGraphicInputSchema).max(8).optional(),visualLayers:z56.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=z56.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=z56.strictObject({version:TimelineVersionReaderSchema,isCurrent:z56.boolean(),freshness:z56.enum(["CURRENT_BASIS","STALE_BASIS"]),staleReasons:z56.array(TimelineStaleReasonSchema).max(13),assemblyStatus:z56.enum(["DRAFT","ASSEMBLY_READY"])});var TimelineGetSchema=TimelineScopeSchema.extend({versionId:z56.uuid()});var TimelineQuerySchema=TimelineScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var TimelinePageSchema=z56.strictObject({items:z56.array(TimelineViewSchema),page:QueryPageInfoSchema});var TimelineBuildReceiptSchema=z56.strictObject({semanticStatus:z56.literal("SUCCESS"),version:TimelineVersionReaderSchema,productionRevision:z56.int().positive()});var TimelineBasisSchema=TimelineScopeSchema.extend({productionRevision:z56.int().positive(),currentTimelineVersion:z56.int().nonnegative(),runnable:z56.boolean(),planningReady:z56.boolean(),output:TimelineManifestSchema.shape.output.nullable(),targetDurationMs:z56.int().positive().nullable(),shots:z56.array(z56.strictObject({shotId:ShotIdSchema,ordinal:z56.int().positive(),acceptanceStatus:z56.enum(["NONE","CURRENT","STALE"]),source:AcceptedVisualSourceReferenceSchema.nullable(),technical:VideoTechnicalMetadataSchema.nullable()})).max(200)});var TimelineSnapshotSchema=z56.strictObject({currentVersion:z56.int().positive().nullable(),stale:z56.boolean(),timelineId:z56.uuid().nullable(),versionId:z56.uuid().nullable(),assemblyStatus:z56.enum(["DRAFT","ASSEMBLY_READY"]).nullable(),totalDurationMs:z56.int().positive().nullable(),durationClassification:TimelineDurationSchema.shape.classification.nullable(),missingPlannedShots:z56.int().nonnegative(),staleReasons:z56.array(TimelineStaleReasonSchema).max(13)});var sha5=z57.string().regex(/^[0-9a-f]{64}$/);var RoughCutStartSchema=TimelineScopeSchema.extend({deviceExecution:DeviceRenderTargetSchema.optional(),timelineVersionId:z57.uuid(),timelineFingerprint:sha5,expectedProductionRevision:z57.int().positive(),profileId:RoughCutProfileIdSchema,idempotencyKey:z57.string().trim().min(1).max(200)});var RoughCutGetSchema=TimelineScopeSchema.extend({renderId:z57.uuid()});var RoughCutQuerySchema=TimelineScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var RoughCutV2ManifestSchema=RoughCutManifestSchema.extend({schemaVersion:z57.literal(2),timeline:TimelineV2VersionSchema});var RoughCutManifestReaderSchema=z57.discriminatedUnion("schemaVersion",[RoughCutManifestSchema,RoughCutV2ManifestSchema,VisualLayerPreviewManifestSchema]);var RoughCutTechnicalSchema=VideoTechnicalMetadataSchema.extend({hasAudio:z57.boolean(),audio:RenderedAudioSchema.optional(),durationMs:z57.int().min(29983).max(60017),frameRate:z57.literal(30),frameCount:z57.int().min(900).max(1800),engineVersion:z57.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:z57.uuid(),representationId:z57.uuid(),version:z57.int().positive(),poster:VideoPosterSchema,availability:z57.enum(["AVAILABLE","INVALID"]),reviewState:z57.enum(["UNREVIEWED","PASS","WARNING","FAIL"])});var RoughCutAdmissionSchema=z57.strictObject({humanLinks:HumanLinksSchema.optional(),deviceExecution:DeviceRenderReceiptSchema.optional(),semanticStatus:z57.literal("ACCEPTED"),renderId:z57.uuid(),operationId:OperationIdSchema,productionId:z57.uuid(),timelineVersionId:z57.uuid(),timelineFingerprint:sha5,executionClass:z57.enum(["LIVE","TEST_ONLY"]),manifestFingerprint:sha5,productionRevision:z57.int().positive()});var RoughCutViewSchema=TimelineScopeSchema.extend({humanLinks:HumanLinksSchema.optional(),renderId:z57.uuid(),projectId:ProjectIdSchema,runtimeJobId:z57.uuid(),operationId:OperationIdSchema,manifest:RoughCutManifestReaderSchema,manifestFingerprint:sha5,runtimeStatus:VideoGenerationViewSchema.shape.runtimeStatus,cancellationRequested:z57.boolean(),isCurrentTimeline:z57.boolean(),freshness:z57.enum(["CURRENT_BASIS","STALE_BASIS"]),staleReasons:z57.array(z57.string().min(1).max(120)).max(16),executionClass:z57.enum(["LIVE","TEST_ONLY"]),roughCut:RoughCutArtifactSchema.nullable(),createdByPrincipalId:PrincipalIdSchema,createdAt:z57.iso.datetime({offset:true})});var RoughCutPageSchema=z57.strictObject({items:z57.array(RoughCutViewSchema),page:QueryPageInfoSchema});var RoughCutSnapshotSchema=z57.strictObject({latestVersion:z57.int().positive().nullable(),reviewState:z57.enum(["UNREVIEWED","PASS","WARNING","FAIL"]).nullable(),latestRenderId:z57.uuid().nullable(),runtimeStatus:VideoGenerationViewSchema.shape.runtimeStatus.nullable(),currentRenderId:z57.uuid().nullable(),currentArtifactId:z57.uuid().nullable(),currentTimelineVersionId:z57.uuid().nullable(),stale:z57.boolean()});import{z as z61}from"zod";import{z as z59}from"zod";import{z as z58}from"zod";var sha6=z58.string().regex(/^[0-9a-f]{64}$/);var DeliveryPolicySchema=z58.strictObject({schemaVersion:z58.literal(1),requiredAudio:z58.boolean(),requiredCaptions:z58.boolean(),requiredGraphics:z58.boolean(),finalApproval:z58.enum(["AUTOMATIC","HUMAN"])});var DeliveryPolicyInputSchema=DeliveryPolicySchema.extend({requiredAudio:z58.boolean().default(false),requiredCaptions:z58.boolean().default(false),requiredGraphics:z58.boolean().default(false),finalApproval:z58.enum(["AUTOMATIC","HUMAN"]).default("AUTOMATIC")});var DeliveryCompositionSchema=z58.strictObject({hasAudio:z58.boolean(),hasCaptions:z58.boolean(),hasGraphics:z58.boolean()});var DeliveryTargetSchema=z58.strictObject({tenantId:z58.uuid(),projectId:z58.uuid(),productionId:z58.uuid(),renderId:z58.uuid(),timelineVersionId:z58.uuid(),timelineFingerprint:sha6,selectionId:z58.uuid(),selectionVersion:z58.int().positive(),renderManifestFingerprint:sha6,artifactId:z58.uuid(),representationId:z58.uuid(),checksumSha256:sha6,byteSize:z58.int().positive().max(128*1024*1024),executionClass:z58.enum(["LIVE","TEST_ONLY"])});var deliveryPhysicalCheckKeys=["FILE_READABLE","CHECKSUM","CONTAINER_PROFILE","DURATION","VIDEO_DECODE","AUDIO_DECODE","REQUIRED_AUDIO","REQUIRED_CAPTIONS","REQUIRED_GRAPHICS","MISSING_MEDIA","BLACK_FRAMES"];var DeliveryCheckKeySchema=z58.enum([...deliveryPhysicalCheckKeys,"ARTIFACT_REGISTRATION","PROVENANCE","MANIFEST_INTEGRITY","EXACT_BASIS","BLOCKING_FINDINGS"]);var DeliveryCheckSchema=z58.strictObject({key:DeliveryCheckKeySchema,status:z58.enum(["PASS","FAIL","UNVERIFIED","NOT_APPLICABLE"]),detail:z58.string().trim().min(1).max(1e3)});var DeliveryPhysicalChecksSchema=z58.array(DeliveryCheckSchema.extend({key:z58.enum(deliveryPhysicalCheckKeys)})).length(deliveryPhysicalCheckKeys.length).refine(checks=>new Set(checks.map(check=>check.key)).size===deliveryPhysicalCheckKeys.length,"Exact physical media checks required");var DeliveryValidationReviewSchema=z58.strictObject({id:z58.uuid(),target:DeliveryTargetSchema,policy:DeliveryPolicySchema,policyFingerprint:sha6,composition:DeliveryCompositionSchema,checks:z58.array(DeliveryCheckSchema).length(DeliveryCheckKeySchema.options.length),result:z58.enum(["PASS","FAIL"]),blockingChecks:z58.array(DeliveryCheckKeySchema).max(DeliveryCheckKeySchema.options.length),createdAt:z58.iso.datetime({offset:true})}).superRefine((review2,ctx)=>{const seen=new Set;const blocked=new Set;const{policy,composition:composition2}=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"&&!composition2.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&&!composition2.hasAudio)blocked.add("REQUIRED_AUDIO");if(policy.requiredCaptions&&!composition2.hasCaptions)blocked.add("REQUIRED_CAPTIONS");if(policy.requiredGraphics&&!composition2.hasGraphics)blocked.add("REQUIRED_GRAPHICS");const expected=DeliveryCheckKeySchema.options.filter(key3=>blocked.has(key3));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"})});var sha7=z59.string().regex(/^[0-9a-f]{64}$/);function sameTarget(a,b){return Object.keys(DeliveryTargetSchema.shape).every(key3=>a[key3]===b[key3])}var DeliveryApprovalSchema=z59.strictObject({id:z59.uuid(),reviewId:z59.uuid(),target:DeliveryTargetSchema,policyFingerprint:sha7,authority:z59.literal("HUMAN"),action:z59.enum(["APPROVE","REJECT"]),principalId:z59.uuid(),createdAt:z59.iso.datetime({offset:true})});var DeliveryManifestLinkSchema=z59.strictObject({id:z59.uuid(),checksumSha256:sha7,target:DeliveryTargetSchema,policyFingerprint:sha7,reviewId:z59.uuid()});var FinalDeliveryReceiptSchema=z59.strictObject({id:z59.uuid(),deliveryRole:z59.literal("FINAL_ARTIFACT"),review:DeliveryValidationReviewSchema,manifest:DeliveryManifestLinkSchema,approval:DeliveryApprovalSchema.nullable(),productionRevision:z59.int().positive(),completedAt:z59.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 z60}from"zod";var sha8=z60.string().regex(/^[0-9a-f]{64}$/);var DecideFinalReadySchema=TimelineScopeSchema.extend({renderId:z60.uuid(),reviewId:z60.uuid(),basisFingerprint:sha8,action:z60.enum(["SELECT","REJECT"]),acknowledgeWarnings:z60.boolean().default(false),expectedProductionRevision:z60.int().positive(),expectedFinalReadyVersion:z60.int().nonnegative(),reason:z60.string().trim().min(1).max(2500),idempotencyKey:z60.string().trim().min(1).max(200)});var RevokeFinalReadySchema=TimelineScopeSchema.extend({selectionId:z60.uuid(),expectedFinalReadyVersion:z60.int().positive(),expectedProductionRevision:z60.int().positive(),reason:z60.string().trim().min(1).max(2500),idempotencyKey:z60.string().trim().min(1).max(200)});var FinalReadyDecisionSchema=TimelineScopeSchema.extend({id:z60.uuid(),projectId:ProjectIdSchema,version:z60.int().positive(),action:z60.enum(["SELECT","REJECT","REVOKE"]),renderId:z60.uuid(),reviewId:z60.uuid(),basisFingerprint:sha8,timelineVersionId:z60.uuid(),timelineFingerprint:sha8,artifactId:z60.uuid(),representationId:z60.uuid(),checksumSha256:sha8,outputProfile:DeliveryOutputProfileSchema,executionClass:z60.enum(["LIVE","TEST_ONLY"]),previousSelectionId:z60.uuid().nullable(),acknowledgeWarnings:z60.boolean(),warningKeys:z60.array(z60.string()).max(300),reason:z60.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z60.iso.datetime({offset:true})});var FinalReadyViewSchema=TimelineScopeSchema.extend({version:z60.int().nonnegative(),status:z60.enum(["NONE","CURRENT","STALE"]),selection:FinalReadyDecisionSchema.nullable(),staleReasons:z60.array(z60.string()).max(24)});var FinalReadyQuerySchema=TimelineScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var FinalReadyPageSchema=z60.strictObject({items:z60.array(FinalReadyDecisionSchema),page:QueryPageInfoSchema});var FinalReadyReceiptSchema=z60.strictObject({semanticStatus:z60.literal("SUCCESS"),decision:FinalReadyDecisionSchema,productionRevision:z60.int().positive()});var RoughCutReviewSnapshotSchema=z60.strictObject({currentRenderId:z60.uuid().nullable(),latestReviewId:z60.uuid().nullable(),reviewVersion:z60.int().nonnegative(),result:z60.enum(["PASS","WARNING","FAIL"]).nullable(),current:z60.boolean(),inspectable:z60.boolean(),executionClass:z60.enum(["LIVE","TEST_ONLY"]).nullable(),findings:z60.strictObject({open:z60.int().nonnegative(),blocking:z60.int().nonnegative(),warnings:z60.int().nonnegative()}),finalReady:FinalReadyViewSchema,latestDecision:FinalReadyDecisionSchema.nullable()});var sha9=z61.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:z61.uuid(),expectedFinalReadyVersion:z61.int().positive(),timelineVersionId:z61.uuid(),timelineFingerprint:sha9,expectedProductionRevision:z61.int().positive(),profileId:FinalRenderProfileIdSchema,audioPolicy:z61.enum(["SILENT","MIXED"]),captionPolicy:z61.enum(["NONE","BURN_IN"]),idempotencyKey:z61.string().trim().min(1).max(200)});var FinalRenderGetSchema=RoughCutGetSchema;var FinalRenderQuerySchema=RoughCutQuerySchema;var finalManifestShape={selection:FinalReadyDecisionSchema.refine(v=>v.action==="SELECT"),selectionVersion:z61.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=z61.discriminatedUnion("schemaVersion",[FinalRenderManifestSchema,FinalRenderV2ManifestSchema,FinalRenderV3ManifestSchema]);var FinalRenderTechnicalSchema=RoughCutTechnicalSchema;var FinalRenderArtifactSchema=RoughCutArtifactSchema.safeExtend({reviewState:z61.literal("UNREVIEWED"),deliveryRole:z61.literal("NONE")});var FinalRenderAdmissionSchema=RoughCutAdmissionSchema.extend({selectionId:z61.uuid(),selectionVersion:z61.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:z61.array(z61.string().min(1).max(120)).max(24)});var FinalRenderPageSchema=z61.strictObject({items:z61.array(FinalRenderViewSchema).max(200),page:QueryPageInfoSchema});var FinalRenderSourceBlockerSchema=z61.strictObject({code:z61.enum(["SOURCE_RESOLUTION_INSUFFICIENT","SOURCE_MEDIA_UNSUPPORTED"]),shotId:z61.uuid(),ordinal:z61.int().positive().max(200),actualWidth:z61.int().positive().max(4096),actualHeight:z61.int().positive().max(4096),requiredWidth:z61.int().positive().max(4096),requiredHeight:z61.int().positive().max(4096)});var FinalRenderEligibilitySchema=TimelineScopeSchema.extend({productionRevision:z61.int().positive(),finalReady:FinalReadyViewSchema,profile:z61.union([FinalRenderProfileSchema,VisualLayerFinalProfileSchema]).nullable(),renderable:z61.boolean(),blockers:z61.array(z61.string().min(1).max(120)).max(24),sourceBlockers:z61.array(FinalRenderSourceBlockerSchema).max(200),supportedAudioPolicy:z61.enum(["SILENT","MIXED"]),supportedCaptionPolicy:z61.enum(["NONE","BURN_IN"])});var FinalRenderSnapshotSchema=z61.strictObject({latestRenderId:z61.uuid().nullable(),runtimeStatus:RoughCutViewSchema.shape.runtimeStatus.nullable(),currentRenderId:z61.uuid().nullable(),currentArtifactId:z61.uuid().nullable(),stale:z61.boolean(),eligibility:FinalRenderEligibilitySchema});import{z as z63}from"zod";import{z as z62}from"zod";var maxMediaObjectBytes=128*1024*1024;var mediaObjectTransferPath="/v1/object-transfers";var mediaBrowserReadPath=mediaObjectTransferPath+"/browser-read";var MediaBrowserContentTypeSchema=z62.enum(["image/png","image/jpeg","image/webp","video/mp4","audio/wav","audio/mpeg","application/json","text/plain","application/x-subrip"]);var MediaObjectVersionSchema=LocalProjectScopeSchema.extend({versionId:LocalIdSchema,role:z62.enum(["SOURCE","VIDEO","POSTER","AUDIO","FRAME","SHEET","MANIFEST"]),byteSize:z62.int().min(1).max(maxMediaObjectBytes),checksumSha256:LocalDigestSchema});var MediaTransferGrantSchema=z62.strictObject({protocol:z62.literal("NVS_MEDIA_TRANSFER_V1"),storageId:z62.string().regex(/^[A-Za-z0-9_-]{1,100}$/),method:z62.enum(["GET","PUT","HEAD"]),object:MediaObjectVersionSchema,issuedAt:LocalTimeSchema,expiresAt:LocalTimeSchema});var MediaObjectTicketSchema=z62.strictObject({endpoint:z62.url().max(2048),credential:z62.string().regex(/^[A-Za-z0-9_-]{1,2048}\.[A-Za-z0-9_-]{43}$/).meta({writeOnly:true}),method:z62.enum(["GET","PUT"]),object:MediaObjectVersionSchema});var MediaBrowserReadGrantSchema=z62.strictObject({protocol:z62.literal("NVS_MEDIA_BROWSER_READ_V1"),storageId:z62.string().regex(/^[A-Za-z0-9_-]{1,100}$/),object:MediaObjectVersionSchema,contentType:MediaBrowserContentTypeSchema,representationId:LocalIdSchema,attachment:z62.boolean(),issuedAt:LocalTimeSchema,expiresAt:LocalTimeSchema});var MediaBrowserReadTicketSchema=z62.strictObject({url:z62.url().max(4096).refine(value2=>{const url=new URL(value2);return(url.protocol==="https:"||url.protocol==="http:"&&url.hostname==="127.0.0.1")&&!url.username&&!url.password&&!url.hash&&url.pathname===mediaBrowserReadPath&&url.searchParams.size===1&&/^[A-Za-z0-9_-]{1,3072}\.[A-Za-z0-9_-]{43}$/.test(url.searchParams.get("ticket")??"")}),expiresAt:LocalTimeSchema,object:MediaObjectVersionSchema,contentType:MediaBrowserContentTypeSchema});var QwenDeviceCredentialScopeSchema=z63.strictObject({tenantId:LocalIdSchema,connectionId:LocalIdSchema,connectionVersion:z63.int().positive(),workspace:z63.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/)});var QwenDeviceCredentialIdentitySchema=QwenDeviceCredentialScopeSchema.extend({proofSha256:LocalDigestSchema});var QwenDeviceCredentialSelectionSchema=QwenDeviceCredentialScopeSchema.extend({privateKeyFile:z63.string().min(1).max(4096)});var qwenSource=ResolvedReferenceSchema.pick({artifactId:true,representationId:true,checksumSha256:true,contentType:true,role:true}).extend({byteSize:MediaObjectVersionSchema.shape.byteSize.max(8*1024*1024)});var keyframeBytes=z63.strictObject({checksumSha256:LocalDigestSchema,byteSize:MediaObjectVersionSchema.shape.byteSize.max(8*1024*1024),width:z63.int().positive().max(4096),height:z63.int().positive().max(4096)});var externalKeyframe=z63.literal("KEYFRAME_GENERATE");var QwenKeyframeRecipeSchema=z63.strictObject({processor:externalKeyframe,generationId:LocalIdSchema,credential:QwenDeviceCredentialIdentitySchema,quoteFingerprint:LocalDigestSchema,prompt:z63.string().trim().min(1).refine(value2=>new TextEncoder().encode(value2).length<=1300),aspectRatio:z63.enum(["16:9","9:16"]),sources:z63.array(qwenSource).min(1).max(3)});var QwenKeyframeEvidenceSchema=z63.strictObject({processor:externalKeyframe,providerExecutionId:z63.string().regex(/^[A-Za-z0-9_.:-]{1,500}$/),providerResultId:LocalDigestSchema,image:keyframeBytes});var QwenVideoRecipeSchema=QwenKeyframeRecipeSchema.extend({processor:z63.literal("VIDEO_GENERATE"),prompt:z63.string().trim().min(1).max(2e4),mode:z63.enum(["REFERENCE_TO_VIDEO","FIRST_FRAME_TO_VIDEO","FIRST_LAST_FRAME_TO_VIDEO"]),durationSeconds:z63.int().min(2).max(30),sources:z63.array(qwenSource).min(1).max(10)});var QwenVideoTaskIdSchema=z63.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var QwenVideoEvidenceSchema=z63.strictObject({processor:z63.literal("VIDEO_GENERATE"),providerExecutionId:QwenVideoTaskIdSchema,providerResultId:QwenVideoTaskIdSchema,video:VideoTechnicalMetadataSchema.extend({videoCodec:z63.literal("h264"),frameRate:z63.literal(30),hasAudio:z63.literal(false),frameCount:z63.int().positive().max(902)}),poster:keyframeBytes});var ExternalGenerationReservationMarkerSchema=z63.strictObject({protocol:z63.literal("NVS_TENANT_EXTERNAL_GENERATION_V1"),tenantId:LocalIdSchema,projectId:LocalIdSchema,productionId:LocalIdSchema,runtimeJobId:LocalIdSchema,shotId:LocalIdSchema,preparationId:LocalIdSchema,contractId:LocalIdSchema,workload:z63.enum(["KEYFRAME_GENERATE","VIDEO_GENERATE"]),policyRevision:z63.int().positive(),contractFingerprint:LocalDigestSchema,originRequestFingerprint:LocalDigestSchema,bindingFingerprint:LocalDigestSchema,inputsFingerprint:LocalDigestSchema,quoteFingerprint:LocalDigestSchema});import{z as z66}from"zod";import{z as z64}from"zod";var pixel=z64.int().nonnegative().max(4096);var dimension2=z64.int().positive().max(4096);var frame=z64.int().nonnegative().max(1800);var sample=z64.int().nonnegative().max(288e4);var rectangle=z64.strictObject({x:pixel,y:pixel,width:dimension2,height:dimension2});var window=z64.strictObject({start:sample,count:sample});var source=z64.strictObject({representationId:z64.uuid(),checksum:LocalDigestSchema,byteSize:z64.int().positive().max(134217728)});var LocalMediaRecipeSchema=z64.strictObject({protocol:z64.literal("NVS_RESOLVED_MEDIA_RECIPE_V2"),family:z64.enum(["ROUGH_CUT_RENDER","FINAL_RENDER"]),width:dimension2,height:dimension2,totalFrames:z64.int().min(900).max(1800),crf:z64.union([z64.literal(18),z64.literal(23)]),algorithm:z64.enum(["ORDERED_TRIM_CUT_V1","ORDERED_COMPOSE_V2"]),clips:z64.array(z64.strictObject({representationId:z64.uuid(),technical:VideoTechnicalMetadataSchema,sourceInMs:z64.int().nonnegative().max(6e4),sourceOutMs:z64.int().positive().max(6e4),startFrame:frame,frameCount:z64.int().positive().max(1800),overlapFrames:frame,crop:rectangle.nullable(),viewport:rectangle})).min(1).max(32),caption:z64.strictObject({style:CaptionRenderStyleSchema,references:z64.array(z64.strictObject({representationId:z64.uuid(),expectedUtf8:z64.string().max(65536)})).length(2),cues:z64.array(z64.strictObject({ordinal:z64.int().nonnegative().max(512),startFrame:frame,endFrame:frame,fontSize:z64.int().min(16).max(256),margin:pixel,text:z64.string().min(1).max(2e3)})).min(1).max(512)}).nullable(),audio:z64.strictObject({algorithm:z64.literal("PCM_WINDOW_MIX_AAC_V1"),tracks:z64.array(source.extend({channels:z64.union([z64.literal(1),z64.literal(2)]),sampleCount:z64.int().positive().max(288e4),sourceIn:sample,sourceOut:sample,start:sample,count:sample,gain:z64.int().nonnegative().max(1e3),duck:z64.int().nonnegative().max(1e3),duckWindows:z64.array(window).max(512)})).min(1).max(266)}).nullable(),graphics:z64.array(source.extend({contentType:z64.enum(["image/png","image/webp"]),sourceWidth:dimension2,sourceHeight:dimension2,width:dimension2,height:dimension2,x:pixel,y:pixel,startFrame:frame,endFrame:frame,opacity:z64.number().min(.1).max(1)})).max(8),visual:z64.strictObject({policy:VisualLayerPolicySchema.optional(),composition:VisualLayerCompositionSchema,plans:z64.array(z64.strictObject({id:z64.uuid(),startFrame:frame,endFrame:frame,width:dimension2,height:dimension2,x:pixel,y:pixel,opacityPermille:z64.int().min(0).max(1e3)})).max(8)}).nullable()}).superRefine((r,ctx)=>{if(r.width%2||r.height%2||r.clips.some(c=>c.viewport.x+c.viewport.width>r.width||c.viewport.y+c.viewport.height>r.height||c.sourceOutMs<=c.sourceInMs)||r.audio?.tracks.some(t=>t.sourceIn>=t.sourceOut||t.sourceOut>t.sampleCount||t.start+t.count>r.totalFrames*1600))ctx.addIssue({code:"custom",message:"Invalid bounded execution geometry or sample window"})});import{z as z65}from"zod";var identity={deviceId:LocalIdSchema,deviceRevision:LocalRevisionSchema};var WorkspaceDeviceAuthoritySchema=z65.strictObject({...identity,authority:z65.literal("WORKSPACE_DEVICE_V1")});var LocalDeviceExecutionTargetSchema=z65.discriminatedUnion("kind",[WorkspaceDeviceAuthoritySchema.extend({kind:z65.literal("DEVICE")}),z65.strictObject({kind:z65.literal("SERVER")})]);var TenantDeviceTargetSchema=WorkspaceDeviceAuthoritySchema.extend({keyFingerprint:LocalDigestSchema});function sameDeviceAuthority(a,b){return a.deviceId===b.deviceId&&a.deviceRevision===b.deviceRevision&&a.authority===b.authority}var previewProfile=z66.strictObject({kind:z66.literal("ROUGH_CUT_PREVIEW_V1"),profileId:z66.literal("PREVIEW_H264_480P_V1"),contractDigest:LocalDigestSchema});var studioProfile=z66.strictObject({kind:z66.literal("STUDIO_MEDIA_V2"),profileId:z66.literal("STUDIO_MEDIA_V2"),contractDigest:LocalDigestSchema});var audioProfile=z66.strictObject({kind:z66.literal("AUDIO_MEDIA_V1"),profileId:z66.literal("AUDIO_MEDIA_V1"),contractDigest:LocalDigestSchema});var LocalExecutionProfileSchema=z66.discriminatedUnion("kind",[previewProfile,studioProfile,audioProfile]);var LocalToolchainSchema=z66.strictObject({platform:LocalDevicePlatformSchema,rendererVersion:LocalPackageVersionSchema,rendererDigest:LocalDigestSchema,ffmpeg:z66.strictObject({version:z66.string().min(1).max(160),binaryDigest:LocalDigestSchema}),ffprobe:z66.strictObject({version:z66.string().min(1).max(160),binaryDigest:LocalDigestSchema}),profile:LocalExecutionProfileSchema,supported:z66.array(z66.strictObject({profile:LocalExecutionProfileSchema,rendererVersion:LocalPackageVersionSchema,rendererDigest:LocalDigestSchema})).max(4).optional()});function selectLocalToolchain(raw,contractDigest){const parsed=LocalToolchainSchema.safeParse(raw);if(!parsed.success)return null;const value2=parsed.data;if(value2.profile.contractDigest===contractDigest){return value2.supported&&value2.profile.kind!=="AUDIO_MEDIA_V1"?{...value2,supported:value2.supported.filter(s=>s.profile.kind!=="AUDIO_MEDIA_V1")}:value2}const selected=value2.supported?.find(s=>s.profile.contractDigest===contractDigest);if(!selected)return null;const{supported,...base2}=value2;void supported;return LocalToolchainSchema.parse({...base2,...selected})}var frozen=LocalWorkScopeSchema.extend({protocol:z66.literal("NVS_LOCAL_WORK_V1"),operationId:OperationIdSchema,renderId:LocalIdSchema,productionRevision:LocalRevisionSchema,executionClass:z66.enum(["LIVE","TEST_ONLY"]),policy:LocalPlacementPolicySchema,profile:previewProfile,manifest:RoughCutManifestReaderSchema,manifestFingerprint:LocalDigestSchema,sources:z66.array(z66.strictObject({artifactId:LocalIdSchema,representationId:LocalIdSchema,checksumSha256:LocalDigestSchema,byteSize:z66.int().positive(),contentType:z66.string().min(1).max(100)})).min(1).max(512)});var studio=frozen.extend({protocol:z66.literal("NVS_LOCAL_WORK_V2"),profile:studioProfile,manifest:z66.union([RoughCutManifestReaderSchema,FinalRenderManifestReaderSchema]),recipe:LocalMediaRecipeSchema,recipeFingerprint:LocalDigestSchema});var LocalFrozenWorkSchema=z66.discriminatedUnion("protocol",[frozen,studio]).superRefine((v,ctx)=>{const t=v.manifest.timeline;if(t.tenantId!==v.tenantId||t.projectId!==v.projectId||t.productionId!==v.productionId||t.executionClass!==v.executionClass)ctx.addIssue({code:"custom",message:"Frozen manifest scope/class mismatch"});if(v.protocol==="NVS_LOCAL_WORK_V2"&&(v.manifest.schemaVersion===3!==!!v.recipe.visual||v.manifest.schemaVersion===3&&v.manifest.profile.visualLayerPolicy!==(v.recipe.visual?.policy??"STRAIGHT_ALPHA_FRAME_OVERLAY_30_V1")))ctx.addIssue({code:"custom",message:"Recipe must preserve the frozen visual policy"});if(new Set(v.sources.map(s=>s.representationId)).size!==v.sources.length)ctx.addIssue({code:"custom",message:"Duplicate source representation"});if(v.protocol==="NVS_LOCAL_WORK_V2"&&(v.recipe.width!==v.manifest.profile.width||v.recipe.height!==v.manifest.profile.height||v.recipe.totalFrames!==v.manifest.totalFrames||v.recipe.family==="FINAL_RENDER"!=="selection"in v.manifest))ctx.addIssue({code:"custom",message:"Recipe must match its native render family and geometry"})});var LocalLeaseBindingSchema=LocalWorkScopeSchema.extend({attemptId:LocalIdSchema,assignmentRevision:LocalRevisionSchema,workerId:z66.string().min(1).max(200),workFingerprint:LocalDigestSchema,toolchainFingerprint:LocalDigestSchema});var target=LocalDeviceExecutionTargetSchema;var LocalExecutionLeaseSchema=LocalLeaseBindingSchema.extend({target,issuedAt:LocalTimeSchema,expiresAt:LocalTimeSchema}).refine(v=>Date.parse(v.expiresAt)>Date.parse(v.issuedAt));var LocalWorkAssignmentSchema=z66.strictObject({work:LocalFrozenWorkSchema,lease:LocalExecutionLeaseSchema,toolchain:LocalToolchainSchema,tenantMediaValidation:z66.literal(true).optional()}).superRefine(({work,lease,toolchain,tenantMediaValidation},ctx)=>{if(["tenantId","projectId","productionId","runtimeJobId"].some(k=>work[k]!==lease[k]))ctx.addIssue({code:"custom",message:"Assignment work scope mismatch"});if(tenantMediaValidation&&(work.protocol!=="NVS_LOCAL_WORK_V2"||work.policy.mode!=="local-only"))ctx.addIssue({code:"custom",message:"Invalid tenant validation assignment"});const p=work.policy,t=lease.target;if(p.mode==="cloud-only"&&t.kind!=="SERVER"||p.mode==="local-only"&&t.kind!=="DEVICE"||t.kind==="DEVICE"&&(p.mode==="cloud-only"||p.deviceId!==t.deviceId))ctx.addIssue({code:"custom",message:"Assignment contradicts placement policy"});if(work.profile.contractDigest!==toolchain.profile.contractDigest)ctx.addIssue({code:"custom",message:"Unqualified execution profile"})});function checkProcessorDeclaration(enabled,kinds,context){if(enabled!==!!kinds?.length||kinds&&new Set(kinds).size!==kinds.length)context.addIssue({code:"custom",path:["processorCapabilities"],message:"Explicit unique processor capabilities must match processing enablement"})}var StartLocalPreviewSchema=RoughCutStartSchema.omit({deviceExecution:true}).extend({placement:LocalPlacementPolicySchema,localProfile:z67.literal("STUDIO_MEDIA_V2").optional()});var LocalDeviceScopeSchema=z67.strictObject({tenantId:LocalIdSchema,deviceId:LocalIdSchema});var LocalDeviceSessionSchema=z67.strictObject({...LocalDeviceScopeSchema.shape,expiresAt:LocalTimeSchema,credential:z67.string().length(43).regex(/^[A-Za-z0-9_-]+$/).meta({writeOnly:true})});var LocalDeviceHeartbeatSchema=LocalDeviceScopeSchema.extend({runtimeVersion:LocalPackageVersionSchema,toolchain:LocalToolchainSchema,available:z67.boolean(),maxConcurrentJobs:z67.int().min(1).max(2).optional(),validationProfileDigest:LocalDigestSchema.optional(),processorProfileDigest:LocalDigestSchema.optional(),localLibraryProfileDigest:LocalDigestSchema.optional(),macSpeechIdentity:MacSpeechIdentitySchema.optional(),cpuSpeech:CpuSpeechCapabilitySchema.optional(),whisperIdentity:LocalWhisperIdentitySchema.optional(),qwenIdentities:z67.array(QwenDeviceCredentialIdentitySchema).min(1).max(16).optional(),processorCapabilities:z67.array(TenantProcessorKindSchema).min(1).max(TenantProcessorKindSchema.options.length).optional()}).superRefine((value2,context)=>checkProcessorDeclaration(!!value2.processorProfileDigest,value2.processorCapabilities,context));var ClaimLocalPreviewSchema=LocalProjectScopeSchema.extend({requestId:LocalIdSchema,deviceId:LocalIdSchema,tenantMediaValidation:z67.literal(true).optional()});var LocalOutputStageSchema=LocalLeaseBindingSchema.extend({uploadRequestId:LocalIdSchema,role:z67.enum(["VIDEO","POSTER"]),checksumSha256:LocalDigestSchema,byteSize:z67.int().positive().max(128*1024*1024)});var LocalOutputTicketSchema=z67.strictObject({receiptId:LocalIdSchema,role:z67.enum(["VIDEO","POSTER"]),checksumSha256:LocalDigestSchema,byteSize:z67.int().positive(),uploaded:z67.boolean()});var LocalSourceRequestSchema=LocalLeaseBindingSchema.extend({representationId:LocalIdSchema});var LocalProofChallengeRequestSchema=LocalDeviceScopeSchema.extend({deviceRevision:z67.int().positive()});var LocalPreviewPlacementViewSchema=z67.strictObject({target:z67.enum(["DEVICE","SERVER"]),reason:z67.enum(["LOCAL_AVAILABLE","CLOUD_ONLY","OFFLINE","UNQUALIFIED","BUSY","LEASE_RECOVERY"]),policy:LocalPlacementPolicySchema});var LocalDeviceTransportConfigurationSchema=z67.strictObject({endpoint:z67.string().url().max(2048),tenantId:LocalIdSchema,deviceId:LocalIdSchema,deviceRevision:z67.int().positive(),privateKeyFile:z67.string().min(1).max(4096),platform:LocalDevicePlatformSchema,tenantMediaValidation:z67.literal(true).optional(),tenantMediaProcessing:z67.literal(true).optional(),processorCapabilities:z67.array(TenantProcessorKindSchema).min(1).max(TenantProcessorKindSchema.options.length).optional(),compositionBrowser:z67.string().min(1).max(4096).optional(),macSpeechIdentity:MacSpeechIdentitySchema.optional(),cpuSpeech:CpuSpeechCapabilitySchema.optional(),cpuSpeechTools:CpuSpeechToolSelectionSchema.optional(),whisperIdentity:LocalWhisperIdentitySchema.optional(),whisperTools:LocalWhisperToolSelectionSchema.optional(),qwenDeviceCredentials:z67.array(QwenDeviceCredentialSelectionSchema).max(16).optional(),qwenIdentities:LocalDeviceHeartbeatSchema.shape.qwenIdentities}).superRefine((value2,context)=>checkProcessorDeclaration(value2.tenantMediaProcessing===true,value2.processorCapabilities,context));var LocalPreviewAdmissionSchema=RoughCutAdmissionSchema.extend({placement:LocalPreviewPlacementViewSchema});var StartLocalFinalRenderSchema=FinalRenderStartSchema.omit({deviceExecution:true}).extend({placement:LocalPlacementPolicySchema});var LocalFinalRenderAdmissionSchema=FinalRenderAdmissionSchema.extend({placement:LocalPreviewPlacementViewSchema});var LocalClaimReceiptSchema=z67.strictObject({found:z67.boolean(),assignment:LocalWorkAssignmentSchema.nullable()});var LocalWorkStateSchema=z67.strictObject({binding:LocalLeaseBindingSchema,status:z67.enum(["ACTIVE","FENCED","OUTCOME_UNKNOWN"]),assignment:LocalWorkAssignmentSchema.nullable()});import{z as z68}from"zod";var LocalManagementCommandSchema=z68.discriminatedUnion("kind",[z68.strictObject({kind:z68.literal("ENROLL"),input:EnrollLocalDeviceSchema}),z68.strictObject({kind:z68.literal("REVOKE_DEVICE"),input:RevokeLocalDeviceSchema}),z68.strictObject({kind:z68.literal("PREVIEW"),input:StartLocalPreviewSchema}),z68.strictObject({kind:z68.literal("FINAL_RENDER"),input:StartLocalFinalRenderSchema})]);var LocalManagementResultSchema=z68.union([LocalDeviceViewSchema,LocalPreviewAdmissionSchema,LocalFinalRenderAdmissionSchema,z68.strictObject({semanticStatus:z68.literal("SUCCESS")})]);var LocalManagementReceiptSchema=z68.strictObject({fingerprint:z68.string().regex(/^[a-f0-9]{64}$/),result:LocalManagementResultSchema.nullable()});var localManagementRoutes={ENROLL:"devices/enroll",REVOKE_DEVICE:"devices/revoke",PREVIEW:"previews",FINAL_RENDER:"final-renders"};var LocalDeviceManagementCommandSchema=LocalManagementCommandSchema;var ScopedLocalManagementReceiptSchema=z68.strictObject({tenantId:LocalIdSchema,command:LocalDeviceManagementCommandSchema}).refine(value2=>value2.tenantId.toLowerCase()===value2.command.input.tenantId.toLowerCase(),{message:"Management receipt must use the authorized tenant"});import{z as z69}from"zod";var fingerprint=z69.string().regex(/^[a-f0-9]{64}$/);var scope={tenantId:z69.uuid(),requestId:z69.uuid()};var DeviceEnrollmentIssueSchema=EnrollLocalDeviceSchema.extend({expectedPrincipalId:z69.uuid()});var DeviceEnrollmentLookupSchema=z69.strictObject(scope);var DeviceEnrollmentTicketSchema=z69.strictObject({...scope,protocol:z69.literal("NVS_DEVICE_ENROLLMENT_V1"),enrollmentId:z69.uuid(),deviceId:z69.uuid(),fingerprint,issuedAt:z69.iso.datetime(),expiresAt:z69.iso.datetime()}).refine(({issuedAt,expiresAt})=>{const ttl=Date.parse(expiresAt)-Date.parse(issuedAt);return ttl>0&&ttl<=3e5});var DeviceEnrollmentRedeemSchema=z69.strictObject({tenantId:z69.uuid(),enrollmentId:z69.uuid(),signature:z69.string().regex(/^[A-Za-z0-9_-]{86}$/).meta({writeOnly:true})});var DeviceEnrollmentReceiptSchema=z69.strictObject({fingerprint,result:LocalDeviceViewSchema});var DeviceEnrollmentObservationSchema=z69.discriminatedUnion("state",[z69.strictObject({...scope,state:z69.literal("NOT_FOUND")}),z69.strictObject({...scope,state:z69.literal("ISSUED"),ticket:DeviceEnrollmentTicketSchema}),z69.strictObject({...scope,state:z69.literal("EXPIRED"),fingerprint}),z69.strictObject({...scope,state:z69.literal("ENROLLED"),receipt:DeviceEnrollmentReceiptSchema})]);function deviceEnrollmentSigningInput(ticket){return canonicalLocalJson(DeviceEnrollmentTicketSchema.parse(ticket))}import{z as z70}from"zod";var timestamp=z70.iso.datetime();var reason=z70.string().regex(/^[A-Z][A-Z0-9_]{0,79}$/);var absent=z70.strictObject({state:z70.enum(["NONE","UNKNOWN","NOT_APPLICABLE"])});var occurrence=z70.strictObject({state:z70.literal("OBSERVED"),at:timestamp,reasonCode:reason});var event=z70.union([occurrence,absent]);var count=z70.int().nonnegative();var depth=z70.union([z70.strictObject({state:z70.literal("OBSERVED"),ready:count,pending:count,running:count,waiting:count}),absent.extend({state:z70.enum(["UNKNOWN","NOT_APPLICABLE"])})]);var health=z70.strictObject({at:timestamp.nullable(),reasonCode:reason});var ComponentStatusSchema=z70.strictObject({protocol:z70.literal("NVS_COMPONENT_STATUS_V1"),observedAt:timestamp,liveness:health.extend({state:z70.enum(["ALIVE","STOPPED","STALE","UNKNOWN"])}),readiness:health.extend({state:z70.enum(["READY","BLOCKED","UNKNOWN"])}),lastSuccess:event,lastFailure:event,queueDepth:depth,nextRetry:event});var WorkspaceStatusSchema=ComponentStatusSchema.extend({component:z70.enum(["STUDIO_API","STUDIO_MCP"]),source:z70.literal("AUTHORIZED_WORKSPACE_READ"),tenantId:z70.uuid(),agentGrantId:z70.uuid().optional()});var DeviceStatusInputSchema=z70.strictObject({tenantId:z70.uuid(),deviceId:z70.uuid()});var DeviceStatusSchema=ComponentStatusSchema.extend({component:z70.literal("EXECUTION_NODE"),source:z70.literal("DEVICE_HEARTBEAT_AND_NATIVE_WORK"),tenantId:z70.uuid(),deviceId:z70.uuid(),deviceRevision:z70.int().positive(),runtimeVersion:z70.string().min(1).max(120).nullable(),runtimeVersionObservedAt:timestamp.nullable(),capabilityMismatch:CapabilityVersionMismatchSchema.optional()});import{z as z71}from"zod";var TenantMediaComputeModeSchema=z71.enum(["STAGE_ONE","TENANT_TRUSTED_VALIDATOR"]);var tenantRenderValidationProfile={protocol:"NVS_TENANT_MEDIA_REPORT_V1",inspection:"STUDIO_DECODE_READBACK_V1"};var TenantMediaWorkSchema=LocalWorkScopeSchema.extend({protocol:z71.literal("NVS_TENANT_MEDIA_WORK_V1"),family:z71.enum(["ROUGH_CUT_RENDER","FINAL_RENDER"]),validationMode:z71.literal("TENANT_TRUSTED_VALIDATOR"),operationId:OperationIdSchema,originRequestFingerprint:LocalDigestSchema,basisFingerprint:LocalDigestSchema,policyRevision:LocalRevisionSchema,target:TenantDeviceTargetSchema,renderProfileDigest:LocalDigestSchema,validationProfileDigest:LocalDigestSchema,audioRequired:z71.boolean()});var renderChecks=["CONTAINER_PROFILE","DURATION","VIDEO_DECODE","AUDIO_DECODE","POSTER_DECODE"];var renderCheck=z71.strictObject({key:z71.enum(renderChecks),result:z71.enum(["PASS","FAIL","UNVERIFIED","NOT_APPLICABLE"])});var TenantMediaValidationBodySchema=LocalLeaseBindingSchema.extend({schemaVersion:z71.literal(1),work:TenantMediaWorkSchema,originRequestFingerprint:LocalDigestSchema,requestId:LocalIdSchema,validationRequestId:LocalIdSchema,outputs:z71.array(MediaObjectVersionSchema).length(2),checks:z71.array(renderCheck).length(renderChecks.length),technical:RoughCutTechnicalSchema.nullable()}).superRefine((report,ctx)=>{const{work,outputs,checks}=report;if(work.tenantId!==report.tenantId||work.projectId!==report.projectId||work.productionId!==report.productionId||work.runtimeJobId!==report.runtimeJobId||work.originRequestFingerprint!==report.originRequestFingerprint)ctx.addIssue({code:"custom",path:["work"],message:"Work scope mismatch"});if(!outputs.some(output=>output.role==="VIDEO")||!outputs.some(output=>output.role==="POSTER")||new Set(outputs.map(output=>output.versionId)).size!==2||outputs.some(output=>output.tenantId!==report.tenantId||output.projectId!==report.projectId))ctx.addIssue({code:"custom",path:["outputs"],message:"Exact video and poster versions required"});if(new Set(checks.map(check=>check.key)).size!==renderChecks.length||checks.some(check=>check.result==="NOT_APPLICABLE"!==(check.key==="AUDIO_DECODE"&&!work.audioRequired)))ctx.addIssue({code:"custom",path:["checks"],message:"Exact applicable checks required"});const video=outputs.find(output=>output.role==="VIDEO");if(checks.every(check=>check.result==="PASS"||check.result==="NOT_APPLICABLE")&&!report.technical||report.technical&&(report.technical.checksumSha256!==video?.checksumSha256||report.technical.byteSize!==video?.byteSize||report.technical.hasAudio!==work.audioRequired))ctx.addIssue({code:"custom",path:["technical"],message:"Exact inspected video required"})});var TenantMediaValidationReportSchema=TenantMediaValidationBodySchema.safeExtend({reportFingerprint:LocalDigestSchema,signature:z71.string().regex(/^[A-Za-z0-9_-]{86}$/)});import{z as z81}from"zod";import{z as z72}from"zod";var IMPORTED_VISUAL_PROFILE_ID="IMPORTED_H264_SDR_CFR30_VISUAL_V1";var IMPORTED_VISUAL_MAX_BYTES=128*1024*1024;var Hash=z72.string().regex(/^[0-9a-f]{64}$/);var PositiveInteger=z72.int().positive().max(1e9);var ImportedVisualRationalSchema=z72.strictObject({numerator:PositiveInteger,denominator:PositiveInteger});var geometry=limit=>z72.strictObject({width:z72.int().min(2).max(limit).multipleOf(2),height:z72.int().min(2).max(limit).multipleOf(2)}).refine(({width,height})=>width*9===height*16||width*16===height*9,"Only exact 16:9 or 9:16 geometry is supported");var ImportedVisualToolchainSchema=z72.strictObject({ffmpegVersion:z72.string().startsWith("ffmpeg version ").max(512),ffprobeVersion:z72.string().startsWith("ffprobe version ").max(512)});var ImportedVisualSourceInputSchema=z72.strictObject({contentType:z72.literal("video/mp4"),checksumSha256:Hash,byteSize:z72.int().min(32).max(IMPORTED_VISUAL_MAX_BYTES),executionClass:z72.enum(["LIVE","TEST_ONLY"])});var ImportedVisualSourceRangeSchema=z72.strictObject({clock:z72.literal("SOURCE_ZERO_BASED_CFR30"),startFrame:z72.int().min(0).max(1799),endFrame:z72.int().min(1).max(1800)}).refine(v=>v.endFrame>v.startFrame&&v.endFrame-v.startFrame<=360,"The half-open interval must contain 1 to 360 frames");var ImportedVisualNormalizationRequestSchema=z72.strictObject({schemaVersion:z72.literal(1),profileId:z72.literal(IMPORTED_VISUAL_PROFILE_ID),source:ImportedVisualSourceInputSchema,sourceRange:ImportedVisualSourceRangeSchema,output:geometry(1920),audioPolicy:z72.enum(["REQUIRE_NO_AUDIO","SILENT_DERIVATIVE"]),expectedToolchain:ImportedVisualToolchainSchema});var ImportedVisualSourceMetadataSchema=z72.strictObject({...ImportedVisualSourceInputSchema.shape,geometry:geometry(3840),videoCodec:z72.literal("h264"),pixelFormat:z72.literal("yuv420p"),sampleAspectRatio:z72.literal("1:1"),rotationDegrees:z72.literal(0),startPts:z72.literal(0),timeBase:ImportedVisualRationalSchema,frameRate:ImportedVisualRationalSchema,frameCount:z72.int().min(1).max(3600),durationTicks:z72.int().positive().max(6e10),availableCfr30Frames:z72.int().min(0).max(1800),color:z72.strictObject({range:z72.enum(["tv","unknown"]),space:z72.enum(["bt709","unknown"]),transfer:z72.enum(["bt709","unknown"]),primaries:z72.enum(["bt709","unknown"])}),audio:z72.strictObject({codec:z72.literal("aac"),sampleRateHz:z72.union([z72.literal(44100),z72.literal(48e3)]),channels:z72.union([z72.literal(1),z72.literal(2)]),startPts:z72.int(),timeBase:ImportedVisualRationalSchema,durationTicks:z72.int().positive().max(6e10)}).nullable(),fullDecode:z72.literal(true),cfrTimestampsVerified:z72.literal(true)}).superRefine((v,ctx)=>{if(![v.durationTicks,v.timeBase.numerator,v.timeBase.denominator,v.frameRate.numerator,v.frameRate.denominator,v.frameCount,v.availableCfr30Frames].every(Number.isSafeInteger)||v.timeBase.denominator<=0||v.frameRate.numerator<=0||v.frameRate.denominator<=0)return;const ticks=BigInt(v.durationTicks)*BigInt(v.timeBase.numerator);const base2=BigInt(v.timeBase.denominator);const declaredFrames=ticks*BigInt(v.frameRate.numerator);const expectedFrames=BigInt(v.frameCount)*base2*BigInt(v.frameRate.denominator);if(ticks>60n*base2||declaredFrames!==expectedFrames||BigInt(v.availableCfr30Frames)!==ticks*30n/base2||v.audio&&BigInt(v.audio.durationTicks)*BigInt(v.audio.timeBase.numerator)>60n*BigInt(v.audio.timeBase.denominator))ctx.addIssue({code:"custom",message:"Media clock/count/duration metadata is inconsistent"})});var ImportedVisualInspectionSchema=z72.strictObject({profileId:z72.literal(IMPORTED_VISUAL_PROFILE_ID),source:ImportedVisualSourceMetadataSchema,toolchain:ImportedVisualToolchainSchema,evidenceScope:z72.literal("TECHNICAL_MEDIA_ONLY")});var ImportedVisualNormalizationReceiptSchema=z72.strictObject({schemaVersion:z72.literal(1),request:ImportedVisualNormalizationRequestSchema,original:ImportedVisualSourceMetadataSchema,output:ImportedVisualSourceMetadataSchema,toolchain:ImportedVisualToolchainSchema,frameMap:z72.array(z72.strictObject({outputFrame:z72.int().min(0).max(359),sourceFrame:z72.int().min(0).max(3599),sourcePts:z72.int().min(0).max(6e10)})).min(1).max(360),audioDisposition:z72.enum(["NO_AUDIO_PRESENT","REMOVED_FROM_DERIVATIVE_ONLY"]),evidenceScope:z72.literal("TECHNICAL_MEDIA_ONLY")}).superRefine((v,ctx)=>{const count2=v.request.sourceRange.endFrame-v.request.sourceRange.startFrame;const source3=v.original;if(![source3.frameRate.numerator,source3.frameRate.denominator,source3.timeBase.numerator,source3.timeBase.denominator,v.request.sourceRange.startFrame].every(Number.isSafeInteger)||source3.frameRate.numerator<=0||source3.frameRate.denominator<=0)return;const rounded=i=>(2n*BigInt(i)*30n*BigInt(source3.frameRate.denominator)+BigInt(source3.frameRate.numerator))/(2n*BigInt(source3.frameRate.numerator));const exactFrameMap=v.frameMap.every((m,i)=>{if(!Number.isSafeInteger(m.sourcePts)||!Number.isSafeInteger(m.sourceFrame))return false;const absoluteFrame=BigInt(v.request.sourceRange.startFrame+i);return BigInt(m.sourcePts)*BigInt(source3.timeBase.numerator)*BigInt(source3.frameRate.numerator)===BigInt(m.sourceFrame)*BigInt(source3.timeBase.denominator)*BigInt(source3.frameRate.denominator)&&rounded(m.sourceFrame)<=absoluteFrame&&(m.sourceFrame+1===source3.frameCount||rounded(m.sourceFrame+1)>absoluteFrame)});if(!exactFrameMap||v.request.sourceRange.endFrame>source3.availableCfr30Frames||v.output.geometry.width>source3.geometry.width||v.output.geometry.height>source3.geometry.height||v.output.geometry.width*source3.geometry.height!==v.output.geometry.height*source3.geometry.width)ctx.addIssue({code:"custom",message:"Receipt frame mapping or geometry violates the pinned profile"});if(v.output.frameCount!==count2||v.frameMap.length!==count2||v.frameMap.some((m,i)=>m.outputFrame!==i||m.sourceFrame>=v.original.frameCount)||v.output.frameRate.numerator!==30||v.output.frameRate.denominator!==1||v.output.audio||v.original.checksumSha256!==v.request.source.checksumSha256||v.original.byteSize!==v.request.source.byteSize||v.original.executionClass!==v.request.source.executionClass||v.output.executionClass!==v.original.executionClass||v.output.geometry.width!==v.request.output.width||v.output.geometry.height!==v.request.output.height||v.toolchain.ffmpegVersion!==v.request.expectedToolchain.ffmpegVersion||v.toolchain.ffprobeVersion!==v.request.expectedToolchain.ffprobeVersion||v.audioDisposition!==(v.original.audio?"REMOVED_FROM_DERIVATIVE_ONLY":"NO_AUDIO_PRESENT")||v.original.audio&&v.request.audioPolicy!=="SILENT_DERIVATIVE"){ctx.addIssue({code:"custom",message:"Normalization receipt does not match its exact request/source/output"})}});var MAX_SHOT_REVIEW_REQUIREMENTS=2200;import{z as z76}from"zod";import{z as z73}from"zod";var TemporalEvidenceReferenceSchema=z73.strictObject({evidenceId:z73.uuid(),frameSetArtifactId:z73.uuid(),contactSheetArtifactId:z73.uuid(),manifestRepresentationId:z73.uuid(),sheetRepresentationId:z73.uuid(),planFingerprint:z73.string().regex(/^[0-9a-f]{64}$/),sourceArtifactId:z73.uuid(),sourceRepresentationId:z73.uuid(),sourceChecksumSha256:z73.string().regex(/^[0-9a-f]{64}$/),timestampsMs:z73.array(z73.number().nonnegative().max(6e4)).min(1).max(64),executionClass:z73.enum(["LIVE","TEST_ONLY"])});var TemporalEvidenceIdsSchema=z73.array(z73.uuid()).min(1).max(8).refine(v=>new Set(v).size===v.length,"Evidence references must be unique");import{z as z75}from"zod";import{z as z74}from"zod";var ListeningEvidenceIdsSchema=z74.array(z74.string().min(1).max(100)).max(64);var ListeningEvidenceSchema=z74.strictObject({id:z74.string().trim().min(1).max(100),kind:z74.enum(["AUDIO_LISTENING","VIDEO_WITH_AUDIO_PLAYBACK"]),media:z74.strictObject({artifactId:z74.uuid(),representationId:z74.uuid(),checksumSha256:z74.string().regex(/^[0-9a-f]{64}$/)}),coverage:z74.array(z74.strictObject({startMs:z74.int().nonnegative().max(6e4),endMs:z74.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs)).min(1).max(200),producer:z74.string().trim().min(1).max(200)});var ListeningEvidenceSetSchema=z74.array(ListeningEvidenceSchema).max(64).refine(v=>new Set(v.map(e=>e.id)).size===v.length);var Fingerprint3=z75.string().regex(/^[0-9a-f]{64}$/);var VideoReviewScopeSchema=z75.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:z75.uuid()});var VideoReviewRequirementSchema=z75.strictObject({intentPath:z75.string().min(1).max(220).optional(),continuity:ContinuityExpectationSchema.optional(),interval:z75.strictObject({startMs:z75.int().nonnegative().max(6e4),endMs:z75.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs,"Requirement interval must advance").optional(),key:z75.string().min(1).max(220),family:z75.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","SHOT_INTENT","BOUNDARY_CONTINUITY","SOUND"]),expected:z75.string().min(1).max(2500),enforcement:z75.enum(["LOCKED","REQUIRED","PREFERRED"]),evidenceWindow:z75.enum(["WHOLE_VIDEO","START","END","TEMPORAL"])});var VideoObservationSchema=z75.strictObject({listeningEvidenceIds:ListeningEvidenceIdsSchema.optional(),continuitySamples:ContinuitySamplesSchema.optional(),temporalEvidenceIds:TemporalEvidenceIdsSchema.optional(),key:z75.string().min(1).max(220),status:z75.enum(["SATISFIED","VIOLATED","NOT_OBSERVABLE","NOT_APPLICABLE"]),confidence:z75.enum(["CLEAR","UNCERTAIN"]),observed:z75.string().trim().min(1).max(1800),interval:z75.strictObject({startMs:z75.int().nonnegative(),endMs:z75.int().positive()}).refine(v=>v.endMs>v.startMs,"Observation interval must advance").optional()});var RecordVideoReviewSchema=VideoReviewScopeSchema.extend({listeningEvidence:ListeningEvidenceSetSchema.optional(),candidateId:z75.uuid(),representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint3,expectedReviewVersion:z75.int().nonnegative(),idempotencyKey:z75.string().trim().min(1).max(200),observations:z75.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z75.string().trim().min(1).max(2500)});var VideoReviewRecordSchema=z75.strictObject({listeningEvidence:ListeningEvidenceSetSchema.optional(),id:z75.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,generationId:z75.uuid(),candidateId:z75.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint3,shotId:ShotIdSchema,version:z75.int().positive(),preparationId:z75.uuid(),contractId:z75.uuid(),contractFingerprint:Fingerprint3,executionClass:z75.enum(["LIVE","TEST_ONLY"]),kind:z75.literal("SHOT_REVIEW_1"),lifecycle:z75.literal("COMPLETED"),evaluatorVersion:z75.literal("shot-review-v1"),source:z75.literal("EXPLICIT_MEDIA_INSPECTION"),technical:VideoTechnicalMetadataSchema,requirements:z75.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),observations:z75.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),result:z75.enum(["PASS","WARNING","FAIL"]),blockingKeys:z75.array(z75.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z75.array(z75.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z75.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z75.iso.datetime({offset:true})});var DecideVideoShotSchema=VideoReviewScopeSchema.extend({candidateId:z75.uuid(),reviewId:z75.uuid(),expectedAcceptanceVersion:z75.int().nonnegative(),action:z75.enum(["ACCEPT","REJECT"]),acknowledgeWarnings:z75.boolean().default(false),reason:z75.string().trim().min(1).max(2500),idempotencyKey:z75.string().trim().min(1).max(200)});var ShotAcceptanceScopeSchema=z75.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema});var RevokeShotAcceptanceSchema=ShotAcceptanceScopeSchema.extend({acceptanceId:z75.uuid(),expectedAcceptanceVersion:z75.int().positive(),reason:z75.string().trim().min(1).max(2500),idempotencyKey:z75.string().trim().min(1).max(200)});var GeneratedShotAcceptanceDecisionSchema=z75.strictObject({id:z75.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,acceptanceVersion:z75.int().positive(),generationId:z75.uuid(),candidateId:z75.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,reviewId:z75.uuid(),action:z75.enum(["ACCEPT","REJECT","REVOKE"]),reference:AcceptedShotReferenceSchema.nullable(),previousAcceptanceId:z75.uuid().nullable(),warningKeys:z75.array(z75.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z75.boolean(),reason:z75.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z75.iso.datetime({offset:true})});var ProgrammaticShotAcceptanceDecisionSchema=z75.strictObject({sourceKind:z75.literal("PROGRAMMATIC"),id:z75.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,acceptanceVersion:z75.int().positive(),renderId:z75.uuid(),compositionId:z75.uuid(),compositionVersionId:z75.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,reviewId:z75.uuid(),action:z75.enum(["ACCEPT","REJECT","REVOKE"]),reference:ProgrammaticAcceptedVisualSourceReferenceSchema.nullable(),previousAcceptanceId:z75.uuid().nullable(),warningKeys:z75.array(z75.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z75.boolean(),reason:z75.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z75.iso.datetime({offset:true})});var ShotAcceptanceDecisionSchema=z75.union([GeneratedShotAcceptanceDecisionSchema,ProgrammaticShotAcceptanceDecisionSchema,z75.strictObject({sourceKind:z75.literal("IMPORTED"),id:z75.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,acceptanceVersion:z75.int().positive(),normalizationId:z75.uuid(),sourceId:z75.uuid(),sourceVersionId:z75.uuid(),artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,reviewId:z75.uuid(),action:z75.enum(["ACCEPT","REJECT","REVOKE"]),reference:ImportedAcceptedVisualSourceReferenceSchema.nullable(),previousAcceptanceId:z75.uuid().nullable(),warningKeys:z75.array(z75.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z75.boolean(),reason:z75.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z75.iso.datetime({offset:true})})]);var VideoReviewTargetSchema=VideoReviewScopeSchema.extend({temporalEvidence:z75.array(TemporalEvidenceReferenceSchema).max(8).optional(),projectId:ProjectIdSchema,shotId:ShotIdSchema,preparationId:z75.uuid(),contractId:z75.uuid(),contractFingerprint:Fingerprint3,executionClass:z75.enum(["LIVE","TEST_ONLY"]),freshness:z75.enum(["CURRENT_BASIS","STALE_BASIS"]),runtimeSucceeded:z75.boolean(),productionRunnable:z75.boolean(),candidate:VideoCandidateSchema,requirements:z75.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),latestReview:VideoReviewRecordSchema.nullable(),reviewVersion:z75.int().nonnegative(),acceptanceVersion:z75.int().nonnegative(),activeAcceptanceId:z75.uuid().nullable()});var ShotAcceptanceViewSchema=ShotAcceptanceScopeSchema.extend({acceptanceVersion:z75.int().nonnegative(),status:z75.enum(["NONE","CURRENT","STALE"]),acceptance:ShotAcceptanceDecisionSchema.nullable(),reference:AcceptedVisualSourceReferenceSchema.nullable()});var VideoReviewQuerySchema=VideoReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var VideoReviewPageSchema=z75.strictObject({items:z75.array(VideoReviewRecordSchema),page:QueryPageInfoSchema});var ShotDecisionQuerySchema=ShotAcceptanceScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var ShotDecisionPageSchema=z75.strictObject({items:z75.array(ShotAcceptanceDecisionSchema),page:QueryPageInfoSchema});var VideoReviewReceiptSchema=z75.strictObject({semanticStatus:z75.literal("SUCCESS"),review:VideoReviewRecordSchema,productionRevision:z75.int().positive()});var ShotDecisionReceiptSchema=z75.strictObject({semanticStatus:z75.literal("SUCCESS"),decision:ShotAcceptanceDecisionSchema,productionRevision:z75.int().positive()});var Uuid=z76.uuid();var Hash2=z76.string().regex(/^[0-9a-f]{64}$/);var ImportedVisualOriginalRegisterSchema=z76.strictObject({deviceId:z76.uuid().toLowerCase().optional(),projectSourceArtifactId:z76.uuid().optional(),tenantId:Uuid,projectId:Uuid,productionId:Uuid,shotId:Uuid,expectedProductionRevision:z76.int().nonnegative(),source:z76.strictObject({contentType:z76.literal("video/mp4"),checksumSha256:Hash2,byteSize:z76.int().min(32).max(128*1024*1024),executionClass:z76.enum(["LIVE","TEST_ONLY"])}),declaredProvenance:z76.strictObject({originalName:z76.string().trim().min(1).max(255).optional(),authorship:z76.string().trim().min(1).max(500).optional(),license:z76.string().trim().min(1).max(500).optional()}),idempotencyKey:z76.string().trim().min(1).max(200)});var ImportedVisualFromProjectSourceSchema=ImportedVisualOriginalRegisterSchema.omit({source:true,projectSourceArtifactId:true}).extend({projectSourceArtifactId:Uuid});var ImportedVisualOriginalReviseSchema=ImportedVisualOriginalRegisterSchema.extend({sourceId:Uuid,expectedVersion:z76.int().positive()});var ImportedVisualNormalizeStartSchema=z76.strictObject({deviceExecution:DeviceRenderTargetSchema.optional(),tenantId:Uuid,projectId:Uuid,productionId:Uuid,shotId:Uuid,sourceId:Uuid,sourceVersionId:Uuid,expectedProductionRevision:z76.int().nonnegative(),request:ImportedVisualNormalizationRequestSchema,idempotencyKey:z76.string().trim().min(1).max(200)});var ImportedVisualGetSchema=z76.strictObject({tenantId:Uuid,productionId:Uuid,normalizationId:Uuid});var ImportedVisualReviewSchema=z76.strictObject({tenantId:Uuid,productionId:Uuid,normalizationId:Uuid,representationId:Uuid,checksumSha256:Hash2,expectedReviewVersion:z76.int().nonnegative(),observations:z76.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z76.string().trim().min(1).max(2500),idempotencyKey:z76.string().trim().min(1).max(200)});var ImportedVisualDecisionSchema=z76.strictObject({tenantId:Uuid,productionId:Uuid,normalizationId:Uuid,reviewId:Uuid,expectedAcceptanceVersion:z76.int().nonnegative(),action:z76.enum(["ACCEPT","REJECT"]),acknowledgeWarnings:z76.boolean().default(false),reason:z76.string().trim().min(1).max(2500),idempotencyKey:z76.string().trim().min(1).max(200)});var ImportedVisualOriginalViewSchema=z76.strictObject({sourceId:Uuid,versionId:Uuid,version:z76.int().positive(),tenantId:Uuid,projectId:Uuid,productionId:Uuid,shotId:Uuid,artifactId:Uuid,representationId:Uuid,metadata:ImportedVisualSourceMetadataSchema,declaredProvenance:ImportedVisualOriginalRegisterSchema.shape.declaredProvenance.optional(),executionClass:z76.enum(["LIVE","TEST_ONLY"]),current:z76.boolean(),createdAt:z76.iso.datetime({offset:true})});var ImportedVisualNormalizationViewSchema=z76.strictObject({normalizationId:Uuid,runtimeJobId:Uuid,sourceId:Uuid,sourceVersionId:Uuid,lifecycle:z76.string(),cancellationRequested:z76.boolean(),receipt:ImportedVisualNormalizationReceiptSchema.nullable(),output:z76.strictObject({artifactId:Uuid,representationId:Uuid,posterArtifactId:Uuid,posterRepresentationId:Uuid}).nullable()});import{z as z77}from"zod";var Fingerprint4=z77.string().regex(/^[0-9a-f]{64}$/);var ProgrammaticVideoReviewScopeSchema=z77.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,renderId:z77.uuid()});var ProgrammaticReviewMediaSchema=VideoTechnicalMetadataSchema.extend({artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,availability:z77.enum(["AVAILABLE","INVALID"])});var ProgrammaticVideoReviewRecordSchema=z77.strictObject({sourceKind:z77.literal("PROGRAMMATIC"),id:z77.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,renderId:z77.uuid(),compositionId:z77.uuid(),compositionVersionId:z77.uuid(),compositionVersion:z77.int().positive(),compositionFingerprint:Fingerprint4,renderManifestFingerprint:Fingerprint4,artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint4,version:z77.int().positive(),planVersionId:z77.uuid(),planVersion:z77.int().positive(),shotPlanningRevision:z77.int().positive(),executionClass:z77.enum(["LIVE","TEST_ONLY"]),kind:z77.literal("SHOT_REVIEW_1"),lifecycle:z77.literal("COMPLETED"),evaluatorVersion:z77.literal("shot-review-v1"),source:z77.literal("EXPLICIT_MEDIA_INSPECTION"),technical:VideoTechnicalMetadataSchema,requirements:z77.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),observations:z77.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),result:z77.enum(["PASS","WARNING","FAIL"]),blockingKeys:z77.array(z77.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z77.array(z77.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z77.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z77.iso.datetime({offset:true})});var ProgrammaticVideoReviewTargetSchema=ProgrammaticVideoReviewScopeSchema.extend({sourceKind:z77.literal("PROGRAMMATIC"),temporalEvidence:z77.array(TemporalEvidenceReferenceSchema).max(8).optional(),projectId:ProjectIdSchema,shotId:ShotIdSchema,compositionId:z77.uuid(),compositionVersionId:z77.uuid(),compositionVersion:z77.int().positive(),compositionFingerprint:Fingerprint4,renderManifestFingerprint:Fingerprint4,executionClass:z77.enum(["LIVE","TEST_ONLY"]),freshness:z77.enum(["CURRENT_BASIS","STALE_BASIS"]),runtimeSucceeded:z77.boolean(),productionRunnable:z77.boolean(),media:ProgrammaticReviewMediaSchema,requirements:z77.array(VideoReviewRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),latestReview:ProgrammaticVideoReviewRecordSchema.nullable(),reviewVersion:z77.int().nonnegative(),acceptanceVersion:z77.int().nonnegative(),activeAcceptanceId:z77.uuid().nullable()});var RecordProgrammaticVideoReviewSchema=ProgrammaticVideoReviewScopeSchema.extend({representationId:ArtifactRepresentationIdSchema,checksumSha256:Fingerprint4,expectedReviewVersion:z77.int().nonnegative(),idempotencyKey:z77.string().trim().min(1).max(200),observations:z77.array(VideoObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z77.string().trim().min(1).max(2500)});var DecideProgrammaticShotSchema=ProgrammaticVideoReviewScopeSchema.extend({reviewId:z77.uuid(),expectedAcceptanceVersion:z77.int().nonnegative(),action:z77.enum(["ACCEPT","REJECT"]),acknowledgeWarnings:z77.boolean().default(false),reason:z77.string().trim().min(1).max(2500),idempotencyKey:z77.string().trim().min(1).max(200)});var ProgrammaticVideoReviewQuerySchema=ProgrammaticVideoReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var ProgrammaticVideoReviewPageSchema=z77.strictObject({items:z77.array(ProgrammaticVideoReviewRecordSchema),page:QueryPageInfoSchema});var ProgrammaticVideoReviewReceiptSchema=z77.strictObject({semanticStatus:z77.literal("SUCCESS"),review:ProgrammaticVideoReviewRecordSchema,productionRevision:z77.int().positive()});import{z as z78}from"zod";var DirectOriginalCommandSchema=z78.discriminatedUnion("operation",[z78.strictObject({operation:z78.literal("REGISTER"),input:ImportedVisualOriginalRegisterSchema}),z78.strictObject({operation:z78.literal("REVISE"),input:ImportedVisualOriginalReviseSchema})]);var DirectOriginalKeySchema=LocalWorkScopeSchema.omit({runtimeJobId:true}).extend({intakeId:LocalIdSchema});var DirectOriginalAdmissionSchema=z78.strictObject({state:z78.literal("SUBMITTED"),tenantId:z78.uuid(),projectId:z78.uuid(),productionId:z78.uuid(),intakeId:z78.uuid(),runtimeJobId:z78.uuid(),operationId:OperationIdSchema});var accepted=z78.strictObject({state:z78.literal("ACCEPTED"),original:ImportedVisualOriginalViewSchema});var DirectOriginalStageSchema=z78.discriminatedUnion("state",[accepted,DirectOriginalAdmissionSchema,DirectOriginalKeySchema.extend({state:z78.literal("UPLOAD"),ticket:MediaObjectTicketSchema,uploaded:z78.boolean()})]);var DirectOriginalSubmitSchema=z78.discriminatedUnion("state",[accepted,DirectOriginalAdmissionSchema]);import{z as z80}from"zod";import{z as z79}from"zod";var ArtifactLifecycleSchema=z79.enum(["CREATING","PROCESSING","READY","INVALID","ARCHIVED"]);var ArtifactMetadataSchema=z79.object({id:ArtifactIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema.nullable(),family:z79.string().trim().min(1),origin:z79.string().trim().min(1),lifecycle:ArtifactLifecycleSchema,createdByPrincipalId:PrincipalIdSchema,checksumSha256:z79.string().regex(/^[0-9a-f]{64}$/).nullable(),contentType:z79.string().trim().min(1).nullable(),primaryRepresentationId:ArtifactRepresentationIdSchema.nullable(),mediaMetadata:z79.record(z79.string(),z79.unknown()),createdAt:z79.iso.datetime({offset:true}),readyAt:z79.iso.datetime({offset:true}).nullable()});var ArtifactRepresentationSchema=z79.object({id:ArtifactRepresentationIdSchema,tenantId:TenantIdSchema,artifactId:ArtifactIdSchema,role:z79.string().trim().min(1),storageDriver:z79.string().trim().min(1),storageLocator:z79.record(z79.string(),z79.unknown()),checksumSha256:z79.string().regex(/^[0-9a-f]{64}$/),contentType:z79.string().trim().min(1),byteSize:z79.string().regex(/^\d+$/),width:z79.int().positive().nullable(),height:z79.int().positive().nullable(),durationMs:z79.string().regex(/^\d+$/).nullable(),frameRate:z79.string().nullable(),videoCodec:z79.string().nullable(),audioCodec:z79.string().nullable(),hasAudio:z79.boolean().nullable(),sampleRateHz:z79.int().positive().nullable(),audioChannels:z79.int().positive().nullable(),createdAt:z79.iso.datetime({offset:true})});var ArtifactRelationSchema=z79.object({id:ArtifactRelationIdSchema,tenantId:TenantIdSchema,sourceArtifactId:ArtifactIdSchema,targetArtifactId:ArtifactIdSchema,relationType:z79.string().trim().min(1),createdByPrincipalId:PrincipalIdSchema,createdAt:z79.iso.datetime({offset:true})});var RegisterReadyArtifactInputSchema=z79.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema.nullable(),principalId:PrincipalIdSchema,family:z79.string().trim().min(1),origin:z79.string().trim().min(1),representation:z79.object({role:z79.string().trim().min(1),storageDriver:z79.string().trim().min(1),storageLocator:z79.record(z79.string(),z79.unknown()),checksumSha256:z79.string().regex(/^[0-9a-f]{64}$/),contentType:z79.string().trim().min(1),byteSize:z79.string().regex(/^\d+$/),width:z79.int().positive().nullable(),height:z79.int().positive().nullable(),durationMs:z79.string().regex(/^\d+$/).nullable(),frameRate:z79.string().nullable(),videoCodec:z79.string().nullable(),audioCodec:z79.string().nullable(),hasAudio:z79.boolean().nullable(),sampleRateHz:z79.int().positive().nullable(),audioChannels:z79.int().positive().nullable()}),mediaMetadata:z79.record(z79.string(),z79.unknown()).default({}),provenance:z79.array(z79.object({targetArtifactId:ArtifactIdSchema,relationType:z79.string().trim().min(1)})).default([])});var ReadyArtifactRegistrationSchema=z79.object({artifact:ArtifactMetadataSchema,primaryRepresentation:ArtifactRepresentationSchema,relations:z79.array(ArtifactRelationSchema)});var SourceInputMetadataSchema=z79.strictObject({idempotencyKey:z79.string().trim().min(1).max(200).optional(),tenantId:TenantIdSchema,kind:z79.enum(["PRODUCT_INFORMATION","REFERENCE_IMAGE","REFERENCE_VIDEO"]),contentType:z79.enum(["text/plain","application/json","image/png","image/jpeg","image/webp","video/mp4"]),originalName:z79.string().trim().min(1).max(255).optional()});var UploadSourceInputRequestSchema=SourceInputMetadataSchema.extend({contentBase64:z79.string().min(4).max(11184812).regex(/^[A-Za-z0-9+/]*={0,2}$/)});var DirectProjectSourceCommandSchema=z80.strictObject({projectId:LocalIdSchema,metadata:SourceInputMetadataSchema.extend({tenantId:LocalIdSchema.pipe(TenantIdSchema),idempotencyKey:z80.string().trim().min(1).max(200)}),checksumSha256:LocalDigestSchema,byteSize:z80.int().positive().max(8*1024*1024),requestedDeviceId:LocalIdSchema.optional()}).refine(({metadata})=>metadata.kind==="REFERENCE_VIDEO"?metadata.contentType==="video/mp4":metadata.kind==="REFERENCE_IMAGE"&&["image/png","image/jpeg","image/webp"].includes(metadata.contentType));var DirectProjectSourceKeySchema=LocalProjectScopeSchema.extend({intakeId:LocalIdSchema});var DirectProjectSourceAdmissionSchema=DirectProjectSourceKeySchema.extend({state:z80.literal("SUBMITTED"),productionId:LocalIdSchema,runtimeJobId:LocalIdSchema,operationId:OperationIdSchema});var accepted2=z80.strictObject({state:z80.literal("ACCEPTED"),registration:ReadyArtifactRegistrationSchema});var DirectProjectSourceStageSchema=z80.discriminatedUnion("state",[accepted2,DirectProjectSourceAdmissionSchema,DirectProjectSourceKeySchema.extend({state:z80.literal("UPLOAD"),ticket:MediaObjectTicketSchema,uploaded:z80.boolean()})]);var DirectProjectSourceSubmitSchema=z80.discriminatedUnion("state",[accepted2,DirectProjectSourceAdmissionSchema]);var LocalLibraryDestinationSchema=z81.discriminatedUnion("kind",[z81.strictObject({kind:z81.literal("ORIGINAL"),command:DirectOriginalCommandSchema}),z81.strictObject({kind:z81.literal("PROJECT_SOURCE"),command:DirectProjectSourceCommandSchema})]);function localLibraryInspectable(reference){if(reference.contentType==="video/mp4")return reference.byteSize>=32;return["image/png","image/jpeg","image/webp"].includes(reference.contentType)&&reference.byteSize>0&&reference.byteSize<=8*1024*1024}var sameId=(left,right)=>left.toLowerCase()===right.toLowerCase();function destinationMatches(destination,reference){if(destination.kind==="ORIGINAL"){const{input}=destination.command;return sameId(input.tenantId,reference.tenantId)&&sameId(input.projectId,reference.projectId)&&(!input.deviceId||sameId(input.deviceId,reference.deviceId))&&input.source.contentType===reference.contentType&&input.source.byteSize===reference.byteSize&&input.source.checksumSha256===reference.checksumSha256}const{command:command2}=destination;return sameId(command2.metadata.tenantId,reference.tenantId)&&sameId(command2.projectId,reference.projectId)&&(!command2.requestedDeviceId||sameId(command2.requestedDeviceId,reference.deviceId))&&command2.metadata.contentType===reference.contentType&&command2.byteSize===reference.byteSize&&command2.checksumSha256===reference.checksumSha256}var command=LocalWorkScopeSchema.omit({runtimeJobId:true}).extend({requestId:LocalIdSchema,reference:LocalLibraryReferenceSchema,accessRevision:z81.int().positive()});var LocalLibraryCommandSchema=z81.discriminatedUnion("action",[command.extend({action:z81.literal("INSPECT")}),command.extend({action:z81.literal("PUBLISH"),destination:LocalLibraryDestinationSchema})]).superRefine((value2,ctx)=>{if(value2.reference.tenantId!==value2.tenantId||value2.reference.projectId!==value2.projectId)ctx.addIssue({code:"custom",message:"Exact local file project required"});if(!localLibraryInspectable(value2.reference))ctx.addIssue({code:"custom",message:"A qualified media file version is required"});if(value2.action!=="PUBLISH")return;const d=value2.destination;if(d.kind==="ORIGINAL"){const input=d.command.input;if(!sameId(input.tenantId,value2.tenantId)||!sameId(input.projectId,value2.projectId)||!sameId(input.productionId,value2.productionId)||input.deviceId&&!sameId(input.deviceId,value2.reference.deviceId)||input.source.byteSize!==value2.reference.byteSize||input.source.checksumSha256!==value2.reference.checksumSha256||input.source.contentType!==value2.reference.contentType)ctx.addIssue({code:"custom",message:"Original must bind exact local file and native Production"})}else if(!sameId(d.command.metadata.tenantId,value2.tenantId)||!sameId(d.command.projectId,value2.projectId)||d.command.requestedDeviceId&&!sameId(d.command.requestedDeviceId,value2.reference.deviceId)||d.command.byteSize!==value2.reference.byteSize||d.command.checksumSha256!==value2.reference.checksumSha256||d.command.metadata.contentType!==value2.reference.contentType)ctx.addIssue({code:"custom",message:"Project SOURCE must bind exact local file"})});var LocalLibraryCommandQuerySchema=LocalWorkScopeSchema.omit({runtimeJobId:true}).extend({requestId:LocalIdSchema});var LocalLibraryAdmissionSchema=LocalWorkScopeSchema.extend({state:z81.literal("SUBMITTED"),requestId:LocalIdSchema,operationId:OperationIdSchema,reference:LocalLibraryReferenceSchema,accessRevision:z81.int().positive()});var LocalLibraryInspectionSchema=z81.discriminatedUnion("kind",[z81.strictObject({kind:z81.literal("VIDEO"),metadata:ImportedVisualSourceMetadataSchema}),z81.strictObject({kind:z81.literal("IMAGE"),checksumSha256:LocalDigestSchema,byteSize:z81.int().positive().max(8*1024*1024),width:z81.int().positive().max(4096),height:z81.int().positive().max(4096)})]);var LocalLibraryInspectRecipeSchema=z81.strictObject({processor:z81.literal("LOCAL_MEDIA_INSPECT"),reference:LocalLibraryReferenceSchema,accessRevision:z81.int().positive(),libraryProfileDigest:LocalDigestSchema}).refine(({reference})=>localLibraryInspectable(reference),"Qualified local inspection required");var LocalLibraryPublishRecipeSchema=z81.strictObject({processor:z81.literal("LOCAL_MEDIA_PUBLISH"),reference:LocalLibraryReferenceSchema,accessRevision:z81.int().positive(),libraryProfileDigest:LocalDigestSchema,destination:LocalLibraryDestinationSchema,object:MediaObjectVersionSchema.extend({role:z81.literal("SOURCE")})}).refine(({reference,object,destination})=>localLibraryInspectable(reference)&&destinationMatches(destination,reference)&&object.tenantId===reference.tenantId&&object.projectId===reference.projectId&&object.checksumSha256===reference.checksumSha256&&object.byteSize===reference.byteSize,"Publication must use the exact local file version and native destination");var LocalLibraryInspectEvidenceSchema=z81.strictObject({processor:z81.literal("LOCAL_MEDIA_INSPECT"),inspection:LocalLibraryInspectionSchema});var LocalLibraryPublishEvidenceSchema=z81.strictObject({processor:z81.literal("LOCAL_MEDIA_PUBLISH"),inspection:LocalLibraryInspectionSchema});import{z as z100}from"zod";import{z as z82}from"zod";var sha10=z82.string().regex(/^[0-9a-f]{64}$/);var TemporalEvidenceSourceSchema=z82.strictObject({tenantId:z82.uuid(),projectId:z82.uuid(),productionId:z82.uuid(),artifactId:z82.uuid(),representationId:z82.uuid(),checksumSha256:sha10,byteSize:z82.int().positive().max(128*1024*1024),width:z82.int().min(16).max(4096),height:z82.int().min(16).max(4096),durationMs:z82.int().positive().max(6e4),frameRate:z82.number().min(1).max(60),frameCount:z82.int().positive().max(3600),videoCodec:z82.literal("h264"),executionClass:z82.enum(["LIVE","TEST_ONLY"])}).refine(v=>Math.abs(v.frameCount/v.frameRate*1e3-v.durationMs)<=150,"Exact frame count, duration and rate must agree");var TemporalRiskWindowSchema=z82.strictObject({startMs:z82.int().nonnegative().max(6e4),endMs:z82.int().positive().max(6e4),reason:z82.enum(["TEMPORAL_BEAT","PRIOR_FINDING","SUSPICIOUS_DRIFT","SCENE_CHANGE"])}).refine(v=>v.endMs>v.startMs,"Risk window must advance");var TemporalSamplingProfileSchema=z82.strictObject({id:z82.literal("ADAPTIVE_TEMPORAL_V1"),motion:z82.enum(["NORMAL","HIGH"]),lockedIdentity:z82.boolean(),windows:z82.array(TemporalRiskWindowSchema).max(32)});var TemporalSampleSchema=z82.strictObject({ordinal:z82.int().nonnegative().max(63),frameIndex:z82.int().nonnegative().max(3599),timestampMs:z82.number().nonnegative().max(6e4),reasons:z82.array(z82.enum(["START","END","INTERIOR","HIGH_MOTION","LOCKED_IDENTITY","TEMPORAL_BEAT","PRIOR_FINDING","SUSPICIOUS_DRIFT","SCENE_CHANGE"])).min(1).max(9)});var TemporalSamplingPlanSchema=z82.strictObject({schemaVersion:z82.literal(1),source:TemporalEvidenceSourceSchema,profile:TemporalSamplingProfileSchema,samples:z82.array(TemporalSampleSchema).min(1).max(64),frameWidth:z82.int().min(16).max(320),frameHeight:z82.int().min(16).max(320),columns:z82.int().min(1).max(4),rows:z82.int().min(1).max(16),gutterPx:z82.literal(8)}).superRefine((p,ctx)=>{const s=p.samples;if(s[0]?.frameIndex!==0||s.at(-1)?.frameIndex!==p.source.frameCount-1||p.rows!==Math.ceil(s.length/p.columns)||p.columns!==Math.min(4,s.length)||s.some((v,i)=>v.ordinal!==i||v.frameIndex>=p.source.frameCount||Math.abs(v.timestampMs-v.frameIndex*1e3/p.source.frameRate)>.001||i>0&&v.frameIndex<=s[i-1].frameIndex||new Set(v.reasons).size!==v.reasons.length)||p.profile.windows.some(w=>w.endMs>p.source.durationMs))ctx.addIssue({code:"custom",message:"Temporal samples must preserve exact bounded source order, time and layout"})});var ExtractedTemporalFrameSchema=z82.strictObject({sample:TemporalSampleSchema,checksumSha256:sha10,byteSize:z82.int().positive().max(2*1024*1024),width:z82.int().positive().max(320),height:z82.int().positive().max(320),contentType:z82.literal("image/png")});var TemporalEvidenceManifestSchema=z82.strictObject({schemaVersion:z82.literal(1),plan:TemporalSamplingPlanSchema,engineVersion:z82.string().min(1).max(200),frames:z82.array(ExtractedTemporalFrameSchema).min(1).max(64),sheet:z82.strictObject({checksumSha256:sha10,byteSize:z82.int().positive().max(16*1024*1024),width:z82.int().positive().max(1320),height:z82.int().positive().max(5256),contentType:z82.literal("image/png")})}).superRefine((m,ctx)=>{const p=m.plan;if(m.frames.length!==p.samples.length||m.frames.some((f,i)=>JSON.stringify(f.sample)!==JSON.stringify(p.samples[i])||f.width!==p.frameWidth||f.height!==p.frameHeight)||m.sheet.width!==p.columns*p.frameWidth+(p.columns+1)*p.gutterPx||m.sheet.height!==p.rows*p.frameHeight+(p.rows+1)*p.gutterPx)ctx.addIssue({code:"custom",message:"Evidence frames and sheet must match the exact sampling plan"})});function processorToolchain(raw,processor){const parsed=LocalToolchainSchema.safeParse(raw);if(!parsed.success)return null;const value2=parsed.data;if(processor!=="SPEECH_SYNTHESIZE_CPU"){if(value2.profile.kind!=="STUDIO_MEDIA_V2")return null;return selectLocalToolchain(value2,value2.profile.contractDigest)}const selected=value2.profile.kind==="AUDIO_MEDIA_V1"?value2:value2.supported?.find(s=>s.profile.kind==="AUDIO_MEDIA_V1");if(!selected)return null;const{supported,...base2}=value2;void supported;return LocalToolchainSchema.parse({...base2,profile:selected.profile,rendererVersion:selected.rendererVersion,rendererDigest:selected.rendererDigest})}import{z as z87}from"zod";import{z as z86}from"zod";import{z as z84}from"zod";import{z as z83}from"zod";var sha11=z83.string().regex(/^[0-9a-f]{64}$/);var name=z83.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,63}$/);var CompositionPathSchema=z83.string().max(240).regex(/^[A-Za-z0-9_-][A-Za-z0-9_.-]*(?:\/[A-Za-z0-9_.-]+)*$/).refine(v=>!v.split("/").some(p=>p==="."||p===".."));var CompositionScopeSchema=z83.strictObject({tenantId:z83.uuid(),productionId:z83.uuid()});var CompositionBasisPinSchema=z83.strictObject({briefVersionId:z83.uuid(),storyVersionId:z83.uuid(),planVersionId:z83.uuid(),shotId:z83.uuid().nullable()});var CompositionBindingSchema=z83.strictObject({name,purpose:z83.enum(["SOURCE","DEPENDENCY_MANIFEST","DEPENDENCY_LOCK","DATA","FONT","IMAGE","VIDEO"]),artifactId:z83.uuid(),representationId:z83.uuid(),checksumSha256:sha11,declaredOrigin:z83.enum(["CODE","AI","HUMAN","IMPORTED","UNKNOWN"])});var parameter=z83.discriminatedUnion("type",[z83.strictObject({name,type:z83.literal("STRING"),value:z83.string().max(4e3),maxLength:z83.int().min(0).max(4e3)}).refine(v=>v.value.length<=v.maxLength),z83.strictObject({name,type:z83.literal("NUMBER"),value:z83.number().finite(),minimum:z83.number().finite(),maximum:z83.number().finite()}).refine(v=>v.minimum<=v.value&&v.value<=v.maximum),z83.strictObject({name,type:z83.literal("BOOLEAN"),value:z83.boolean()})]);var CompositionContentSchema=z83.strictObject({schemaVersion:z83.literal(1),provider:z83.literal("HYPERFRAME"),dialect:z83.literal("HYPERFRAME_HTML_GSAP_V1"),role:z83.enum(["PRIMARY_VISUAL","VISUAL_LAYER"]),executionClass:z83.enum(["LIVE","TEST_ONLY"]),intent:z83.string().trim().min(1).max(2e3),viewport:z83.strictObject({width:z83.int().min(1).max(8192),height:z83.int().min(1).max(8192)}),clock:z83.strictObject({numerator:z83.int().positive(),denominator:z83.int().positive(),frameCount:z83.int().positive().max(2147483647)}),entrypoint:CompositionPathSchema,parameterSchemaVersion:z83.literal(1),parameters:z83.array(parameter).max(64),bindings:z83.array(CompositionBindingSchema).min(3).max(64),dependencies:z83.array(z83.strictObject({name:z83.string().regex(/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/),version:z83.string().regex(/^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/),integrity:z83.string().regex(/^sha(?:256|384|512)-[A-Za-z0-9+/]+={0,2}$/)})).min(1).max(64),randomSeed:z83.int().nonnegative().max(4294967295).nullable()}).superRefine((c,ctx)=>{for(const list of[c.parameters,c.bindings,c.dependencies])if(new Set(list.map(x=>x.name)).size!==list.length)ctx.addIssue({code:"custom",message:"Names must be unique within each input group"});for(const purpose of["SOURCE","DEPENDENCY_MANIFEST","DEPENDENCY_LOCK"])if(c.bindings.filter(x=>x.purpose===purpose).length!==1)ctx.addIssue({code:"custom",path:["bindings"],message:"Exactly one "+purpose+" binding is required"});if(c.bindings.find(x=>x.purpose==="SOURCE")?.declaredOrigin!=="CODE")ctx.addIssue({code:"custom",path:["bindings"],message:"Programmatic source must retain CODE provenance"});for(const p of["@hyperframes/engine","@hyperframes/producer","gsap"])if(!c.dependencies.some(x=>x.name===p))ctx.addIssue({code:"custom",path:["dependencies"],message:"Missing authoring dependency: "+p})});var CompositionSourceBundleSchema=z83.strictObject({schemaVersion:z83.literal(1),entrypoint:CompositionPathSchema,files:z83.array(z83.strictObject({path:CompositionPathSchema,contentType:z83.enum(["text/html","text/css","text/javascript","image/svg+xml","application/json"]),content:z83.string().max(1048576)})).min(1).max(128)}).superRefine((b,ctx)=>{if(new Set(b.files.map(x=>x.path)).size!==b.files.length)ctx.addIssue({code:"custom",message:"Source paths must be unique"});if(!b.files.some(x=>x.path===b.entrypoint&&x.contentType==="text/html"))ctx.addIssue({code:"custom",message:"Entrypoint must resolve to a declared HTML file"})});var SubmitCompositionSchema=CompositionScopeSchema.extend({compositionId:z83.uuid().nullable(),expectedVersion:z83.int().nonnegative(),previousVersionId:z83.uuid().nullable(),expectedProductionRevision:z83.int().positive(),basis:CompositionBasisPinSchema,content:CompositionContentSchema,idempotencyKey:z83.string().trim().min(1).max(200)}).superRefine((i,ctx)=>{if(i.expectedVersion===0!==(i.compositionId===null&&i.previousVersionId===null)||i.expectedVersion>0&&(!i.compositionId||!i.previousVersionId))ctx.addIssue({code:"custom",message:"Create and exact-version revision identities must not be mixed"});if(i.content.role==="PRIMARY_VISUAL"&&!i.basis.shotId)ctx.addIssue({code:"custom",message:"Primary visual must bind a planned Shot"})});var CompositionGetSchema=CompositionScopeSchema.extend({compositionId:z83.uuid(),versionId:z83.uuid().optional()});var CompositionHistorySchema=CompositionScopeSchema.extend({compositionId:z83.uuid(),limit:z83.int().min(1).max(100).default(20),beforeVersion:z83.int().positive().optional()});var CompositionInputFactSchema=CompositionBindingSchema.extend({contentType:z83.string().min(1),byteSize:z83.int().positive().max(67108864),registeredOrigin:z83.string().min(1),executionClass:z83.enum(["LIVE","TEST_ONLY"]).nullable()});var CompositionVersionSchema=CompositionScopeSchema.extend({id:z83.uuid(),compositionId:z83.uuid(),projectId:z83.uuid(),version:z83.int().positive(),previousVersionId:z83.uuid().nullable(),basis:CompositionBasisPinSchema,content:CompositionContentSchema,inputs:z83.array(CompositionInputFactSchema).min(3).max(64),fingerprint:sha11,createdByPrincipalId:z83.uuid(),createdAt:z83.iso.datetime({offset:true})}).refine(v=>v.version===1===(v.previousVersionId===null));var CompositionReceiptSchema=z83.strictObject({semanticStatus:z83.literal("SUCCESS"),version:CompositionVersionSchema,productionRevision:z83.int().positive()});var CompositionViewSchema=z83.strictObject({version:CompositionVersionSchema,isCurrent:z83.boolean(),basisStatus:z83.enum(["CURRENT","STALE"]),inputStatus:z83.enum(["AVAILABLE","UNAVAILABLE"]),byteReadback:z83.literal("NOT_CHECKED")});var CompositionPageSchema=z83.strictObject({items:z83.array(CompositionViewSchema).max(100),hasMore:z83.boolean(),nextBeforeVersion:z83.int().positive().nullable()});var CompositionDependencyManifestSchema=z83.object({dependencies:z83.record(z83.string(),z83.string())});var CompositionDependencyLockSchema=z83.object({lockfileVersion:z83.literal(3),packages:z83.record(z83.string(),z83.object({version:z83.string().optional(),integrity:z83.string().optional(),dependencies:z83.record(z83.string(),z83.string()).optional()}))});var HyperframeLegacyRenderProfileSchema=z84.strictObject({id:z84.literal("HYPERFRAME_1080P30_FULL_PAINT_V1"),adapter:z84.literal("native-hyperframe-v1"),engine:z84.literal("0.8.134"),producer:z84.literal("0.8.134"),gsap:z84.literal("3.15.0"),node:z84.string().min(1).max(80),browser:z84.string().min(1).max(160),browserSha256:z84.string().regex(/^[0-9a-f]{64}$/),ffmpeg:z84.string().min(1).max(240),maxFrames:z84.literal(360),timeoutMs:z84.literal(6e5),maxRssBytes:z84.literal(3221225472),maxScratchBytes:z84.literal(3221225472),maxOutputBytes:z84.literal(134217728),maxCpuMs:z84.literal(6e5),capture:z84.literal("PNG_SOFTWARE_SCREENSHOT_FULL_PAINT"),encode:z84.literal("H264_YUV420P_CRF18_THREADS2_NO_AUDIO")});var HyperframeCachedRenderProfileSchema=HyperframeLegacyRenderProfileSchema.extend({id:z84.literal("HYPERFRAME_1080P30_FRAME_CACHE_V2"),adapter:z84.literal("native-hyperframe-cache-v2"),encode:z84.literal("H264_YUV420P_CRF18_VERYFAST_THREADS2_NO_AUDIO")});var HyperframeRenderProfileSchema=z84.discriminatedUnion("id",[HyperframeLegacyRenderProfileSchema,HyperframeCachedRenderProfileSchema]);var CompositionRenderStartSchema=CompositionGetSchema.extend({versionId:z84.uuid(),fingerprint:z84.string().regex(/^[0-9a-f]{64}$/),expectedProductionRevision:z84.int().positive(),profileId:z84.enum(["HYPERFRAME_1080P30_FULL_PAINT_V1","HYPERFRAME_1080P30_FRAME_CACHE_V2","HYPERFRAME_RGBA_PNG30_FULL_PAINT_V1"]),idempotencyKey:z84.string().trim().min(1).max(200),deviceId:z84.uuid().toLowerCase().optional()});var CompositionRenderGetSchema=CompositionScopeSchema.extend({renderId:z84.uuid()});var CompositionRenderManifestSchema=z84.strictObject({schemaVersion:z84.literal(1),version:CompositionVersionSchema,profile:HyperframeRenderProfileSchema,firstFrame:z84.literal(0),frameCount:z84.int().min(1).max(360)}).superRefine((m,ctx)=>{if(m.frameCount!==m.version.content.clock.frameCount||m.version.inputs.reduce((n,i)=>n+i.byteSize,0)>134217728)ctx.addIssue({code:"custom",message:"Exact frame count and aggregate input budget required"})});var CompositionRenderReceiptSchema=z84.strictObject({semanticStatus:z84.literal("ACCEPTED"),renderId:z84.uuid(),runtimeJobId:z84.uuid(),compositionVersionId:z84.uuid(),manifestFingerprint:z84.string().regex(/^[0-9a-f]{64}$/),productionRevision:z84.int().positive()});var CompositionRenderTechnicalSchema=z84.strictObject({width:z84.literal(1920),height:z84.literal(1080),frameRate:z84.literal(30),frameCount:z84.int().min(1).max(360),durationMs:z84.number().positive(),contentType:z84.literal("video/mp4"),videoCodec:z84.literal("h264"),pixelFormat:z84.literal("yuv420p"),hasAudio:z84.literal(false),fullDecode:z84.literal(true),checksumSha256:z84.string().regex(/^[0-9a-f]{64}$/),byteSize:z84.int().min(1).max(134217728),decodedFramesSha256:z84.string().regex(/^[0-9a-f]{64}$/)});var CompositionRenderResourcesSchema=z84.strictObject({sampleIntervalMs:z84.literal(100),sampledTreePeakRssBytes:z84.int().nonnegative(),sampledTreeCpuMs:z84.number().nonnegative(),observedPids:z84.int().nonnegative(),scratchPeakBytes:z84.int().nonnegative(),wallMs:z84.number().nonnegative(),processGroupCleaned:z84.literal(true)});import{z as z85}from"zod";var HyperframeAlphaRenderProfileSchema=HyperframeLegacyRenderProfileSchema.extend({id:z85.literal("HYPERFRAME_RGBA_PNG30_FULL_PAINT_V1"),adapter:z85.literal("native-hyperframe-alpha-v1"),encode:z85.literal("RGBA_PNG_SEQUENCE_30_V1"),maxOutputBytes:z85.literal(67108864),maxDecodedBytes:z85.literal(536870912)});var CompositionFrameRenderManifestSchema=z85.strictObject({...CompositionRenderManifestSchema.shape,schemaVersion:z85.literal(2),profile:HyperframeAlphaRenderProfileSchema}).superRefine((m,context)=>{const c=m.version.content;if(m.frameCount!==c.clock.frameCount||m.version.inputs.reduce((n,i)=>n+i.byteSize,0)>134217728||c.role!=="VISUAL_LAYER"||c.viewport.width>1920||c.viewport.height>1920||c.viewport.width*c.viewport.height>1920*1080||c.viewport.width*c.viewport.height*m.frameCount*4>m.profile.maxDecodedBytes||c.clock.numerator!==30||c.clock.denominator!==1)context.addIssue({code:"custom",message:"Qualified CODE alpha geometry/role/clock/decoded budget mismatch"})});var CompositionFrameTechnicalSchema=z85.strictObject({profileId:z85.literal("RGBA_PNG_SEQUENCE_30_V1"),width:z85.int().min(1).max(1920),height:z85.int().min(1).max(1920),frameRate:z85.literal(30),frameCount:z85.int().min(1).max(360),alpha:z85.literal("STRAIGHT_RGBA"),fullDecode:z85.literal(true),frames:z85.array(z85.strictObject({ordinal:z85.int().min(0).max(359),checksumSha256:z85.string().regex(/^[0-9a-f]{64}$/),byteSize:z85.int().min(1).max(16777216)})).min(1).max(360)}).superRefine((value2,context)=>{if(value2.frames.length!==value2.frameCount||value2.frames.some((f,i)=>f.ordinal!==i)||value2.width*value2.height>1920*1080||value2.width*value2.height*value2.frameCount*4>536870912||value2.frames.reduce((n,f)=>n+f.byteSize,0)>67108864)context.addIssue({code:"custom",message:"CODE frame order/geometry/byte budget mismatch"})});var CompositionFrameRenderOutputSchema=z85.strictObject({sequence:VisualFrameSequenceSchema,technical:CompositionFrameTechnicalSchema,resources:CompositionRenderResourcesSchema}).superRefine((output,context)=>{if(output.sequence.width!==output.technical.width||output.sequence.height!==output.technical.height||output.sequence.frameCount!==output.technical.frameCount||output.sequence.frames.some((frame2,i)=>frame2.ordinal!==output.technical.frames[i]?.ordinal||frame2.checksumSha256!==output.technical.frames[i]?.checksumSha256||frame2.byteSize!==output.technical.frames[i]?.byteSize))context.addIssue({code:"custom",message:"CODE frame output must identify the exact native sequence"})});var CompositionRenderManifestReaderSchema=z86.discriminatedUnion("schemaVersion",[CompositionRenderManifestSchema,CompositionFrameRenderManifestSchema]);var CompositionRenderViewSchema=z86.strictObject({sourceIdentity:z86.strictObject({tenantId:z86.uuid(),projectId:z86.uuid(),productionId:z86.uuid(),compositionId:z86.uuid(),versionId:z86.uuid(),fingerprint:z86.string().regex(/^[0-9a-f]{64}$/),shotId:z86.uuid().nullable(),role:z86.enum(["PRIMARY_VISUAL","VISUAL_LAYER"])}).optional(),frameOutput:CompositionFrameRenderOutputSchema.optional(),receipt:CompositionRenderReceiptSchema,lifecycle:z86.string().min(1).max(80),cancellationRequested:z86.boolean(),failureClassification:z86.string().min(1).max(80).nullable(),output:z86.strictObject({artifactId:z86.uuid(),representationId:z86.uuid(),technical:CompositionRenderTechnicalSchema,resources:CompositionRenderResourcesSchema}).nullable()}).superRefine((view,context)=>{if(view.sourceIdentity&&view.sourceIdentity.versionId!==view.receipt.compositionVersionId)context.addIssue({code:"custom",message:"Render source identity must bind the admitted exact version"});if(view.frameOutput&&view.output!==null)context.addIssue({code:"custom",message:"CODE frame output must match its render Production and exclude an MP4 output"})});var CompositionRenderCancellationSchema=z86.strictObject({cancellationRequested:z86.boolean()});var identity2=z87.strictObject({artifactId:LocalIdSchema,representationId:LocalIdSchema});var ProcessorCompositionAllocationSchema=z87.strictObject({sequence:identity2,frames:z87.array(identity2).min(1).max(360)}).refine(({sequence,frames})=>{const entries=[sequence,...frames];return new Set(entries.map(entry=>entry.artifactId)).size===entries.length&&new Set(entries.map(entry=>entry.representationId)).size===entries.length});var processorCompositionFields={manifest:CompositionRenderManifestReaderSchema,allocation:ProcessorCompositionAllocationSchema.nullable()};var base={processor:z87.literal("COMPOSITION_RENDER"),resources:CompositionRenderResourcesSchema};var ProcessorCompositionVideoEvidenceSchema=z87.strictObject({...base,format:z87.literal("MP4"),technical:CompositionRenderTechnicalSchema});var ProcessorCompositionSequenceEvidenceSchema=z87.strictObject({...base,format:z87.literal("RGBA_SEQUENCE"),technical:CompositionFrameTechnicalSchema,sequence:VisualFrameSequenceSchema});var ProcessorCompositionEvidenceSchema=z87.discriminatedUnion("format",[ProcessorCompositionVideoEvidenceSchema,ProcessorCompositionSequenceEvidenceSchema]);import{z as z99}from"zod";import{z as z88}from"zod";var VisualSequenceScopeSchema=z88.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema});var RegisterVisualSequenceSchema=VisualSequenceScopeSchema.extend({deviceId:z88.uuid().toLowerCase().optional(),productionId:ProductionIdSchema.nullable(),idempotencyKey:z88.string().trim().min(1).max(200),width:z88.int().min(1).max(1920),height:z88.int().min(1).max(1920),frameArtifactIds:z88.array(ArtifactIdSchema).min(1).max(360)}).refine(v=>v.width*v.height<=1920*1080&&new Set(v.frameArtifactIds).size===v.frameArtifactIds.length,"Sequence requires bounded geometry and unique ordered frame Artifacts");var VisualSequenceGetSchema=VisualSequenceScopeSchema.extend({artifactId:ArtifactIdSchema});var LegacyVisualSequenceRegistrationSchema=z88.strictObject(RegisterVisualSequenceSchema.shape).omit({deviceId:true}).refine(input=>RegisterVisualSequenceSchema.safeParse(input).success);var VisualSequenceRegistrationAdmissionSchema=z88.strictObject({semanticStatus:z88.literal("ACCEPTED"),requestId:z88.uuid(),runtimeJobId:z88.uuid(),runtimeProductionId:ProductionIdSchema,operationId:OperationIdSchema,artifactId:ArtifactIdSchema,representationId:z88.uuid()});var VisualSequenceViewSchema=z88.strictObject({sequence:VisualFrameSequenceSchema,freshness:z88.enum(["CURRENT_BASIS","STALE_BASIS"]),staleReasons:z88.array(z88.enum(["SEQUENCE_UNAVAILABLE","FRAME_UNAVAILABLE"])).max(2),createdAt:z88.iso.datetime({offset:true})});var VisualSequenceQuerySchema=VisualSequenceScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var VisualSequencePageSchema=z88.strictObject({items:z88.array(VisualSequenceViewSchema).max(100),page:QueryPageInfoSchema});var{checksumSha256:_checksum,...manifestShape}=VisualFrameSequenceSchema.shape;var VisualSequenceManifestSchema=z88.strictObject(manifestShape).superRefine((value2,context)=>{if(!VisualFrameSequenceSchema.safeParse({...value2,checksumSha256:"0".repeat(64)}).success)context.addIssue({code:"custom",message:"Invalid canonical frame sequence manifest"})});import{z as z97}from"zod";import{z as z96}from"zod";import{z as z95}from"zod";import{z as z94}from"zod";import{z as z89}from"zod";var sha12=z89.string().regex(/^[a-f0-9]{64}$/);var VoiceListeningIntervalSchema=ListeningEvidenceSchema.shape.coverage.element;var VoiceExpectationSchema=z89.strictObject({voiceProfile:VoiceProfileRefSchema,referenceId:z89.uuid()});var VoiceRuleTargetsSchema=z89.discriminatedUnion("kind",[z89.strictObject({kind:z89.literal("VOICEOVER")}),z89.strictObject({kind:z89.literal("SOUND_CUES"),cueIds:z89.array(z89.string().regex(/^[a-z][a-z0-9_-]{0,63}$/)).min(1).max(64).refine(ids=>new Set(ids).size===ids.length)})]);var VoiceConsistencyReasonSchema=z89.enum(["NO_SOURCE","VOICE_UNAVAILABLE","REFERENCE_CHANGED","AUDIO_UNAVAILABLE","IDENTITY_MISMATCH","NO_COMPARISON","COMPARISON_NOT_MATCHED","COMPARISON_STALE","TEST_ONLY"]);var VoiceRequirementGateSchema=z89.strictObject({qualified:z89.boolean(),evidenceFingerprint:sha12,listeningIntervals:z89.array(VoiceListeningIntervalSchema).min(1).max(264),sourceAudioVersionIds:z89.array(z89.uuid()).max(65),reasons:z89.array(VoiceConsistencyReasonSchema).max(9)}).refine(v=>v.qualified===(v.reasons.length===0)&&(!v.qualified||v.sourceAudioVersionIds.length>0));var VoiceSourceEvidenceSchema=z89.strictObject({audioVersionId:z89.uuid(),voiceProfile:VoiceProfileRefSchema.nullable(),referenceId:z89.uuid().nullable(),comparisonId:z89.uuid().nullable(),comparisonVersion:z89.int().nonnegative(),comparisonFingerprint:sha12.nullable(),identityResult:z89.enum(["MATCH","DIFFERENT","UNDETERMINED"]).nullable(),current:z89.boolean(),executionClass:z89.enum(["LIVE","TEST_ONLY"]).nullable(),reasons:z89.array(VoiceConsistencyReasonSchema).max(9)});var VoiceExpectationEvidenceSchema=VoiceExpectationSchema.extend({current:z89.boolean(),executionClass:z89.enum(["LIVE","TEST_ONLY"]).nullable(),reasons:z89.array(VoiceConsistencyReasonSchema).max(9)});var ProductionVoiceEvidenceSchema=z89.strictObject({expectations:z89.array(VoiceExpectationEvidenceSchema).max(16),sources:z89.array(VoiceSourceEvidenceSchema).max(65)});import{z as z90}from"zod";var sha13=z90.string().regex(/^[0-9a-f]{64}$/);var CompositionFindingLocalitySchema=z90.strictObject({schemaVersion:z90.literal(1),sourceKind:z90.literal("CODE"),role:z90.enum(["PRIMARY_VISUAL","VISUAL_LAYER"]),compositionId:z90.uuid(),compositionVersionId:z90.uuid(),compositionVersion:z90.int().positive(),compositionFingerprint:sha13,renderId:z90.uuid(),renderManifestFingerprint:sha13,artifactId:z90.uuid(),representationId:z90.uuid(),checksumSha256:sha13,clipOrdinal:z90.int().min(1).max(200).nullable(),visualLayerId:z90.uuid().nullable(),sourceInFrame:z90.int().min(0).max(359),sourceOutFrame:z90.int().min(1).max(360),mapping:z90.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 z91}from"zod";var CanonicalFactSchema=z91.strictObject({key:z91.string().regex(/^[A-Z][A-Z0-9_]{1,59}$/),value:z91.string().trim().min(1).max(300),sourceArtifactId:ArtifactIdSchema,evidence:z91.discriminatedUnion("kind",[z91.strictObject({kind:z91.literal("JSON_POINTER"),pointer:z91.string().startsWith("/").max(200)}),z91.strictObject({kind:z91.literal("EXACT_TEXT_LINE")})])});var BriefContentSchema=z91.strictObject({objective:z91.string().trim().min(1).max(1e3),productPresentationGoal:z91.string().trim().min(1).max(1e3),audience:z91.string().trim().min(1).max(300).optional(),styleTone:z91.string().trim().min(1).max(300).optional(),callToAction:z91.string().trim().min(1).max(300).optional(),targetDurationSeconds:z91.int().min(30).max(60),aspectRatio:z91.enum(["16:9","9:16"]),outputProfile:DeliveryOutputProfileSchema,canonicalFacts:z91.array(CanonicalFactSchema).max(32).default([])});var AcceptBriefRequestSchema=z91.strictObject({tenantId:TenantIdSchema,expectedProductionRevision:z91.int().positive(),revisionReason:z91.string().trim().min(1).max(1e3).optional(),sourceArtifactIds:z91.array(ArtifactIdSchema).max(20).default([]),content:BriefContentSchema});var BriefSourceReferenceSchema=z91.strictObject({artifactId:ArtifactIdSchema,checksumSha256:z91.string().regex(/^[0-9a-f]{64}$/)});var BriefVersionSchema=z91.strictObject({id:BriefVersionIdSchema,briefId:BriefIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z91.int().positive(),content:BriefContentSchema,sources:z91.array(BriefSourceReferenceSchema).min(1).max(20),createdByPrincipalId:PrincipalIdSchema,createdAt:z91.iso.datetime({offset:true})});var AcceptBriefResultSchema=z91.discriminatedUnion("semanticStatus",[z91.strictObject({semanticStatus:z91.literal("SUCCESS"),briefVersion:BriefVersionSchema,productionRevision:z91.int().positive(),activeBriefVersion:z91.int().positive()}),z91.strictObject({semanticStatus:z91.literal("NEEDS_INPUT"),missingFacts:z91.array(z91.enum(["PRODUCT_INFORMATION_SOURCE","PRODUCT_NAME"])).min(1)})]);import{z as z92}from"zod";var StoryFactKeySchema=z92.string().regex(/^[A-Z][A-Z0-9_]{1,59}$/);var StoryFactClaimSchema=z92.strictObject({key:StoryFactKeySchema,value:z92.string().trim().min(1).max(300)});var StoryBeatSchema=z92.strictObject({summary:z92.string().trim().min(1).max(600),sceneRequirements:z92.array(z92.string().trim().min(1).max(300)).max(8).default([])});var StoryContentSchema=z92.strictObject({narrativeIntent:z92.string().trim().min(1).max(2e3),beats:z92.array(StoryBeatSchema).min(1).max(24),factualClaims:z92.array(StoryFactClaimSchema).max(32).default([])});var AcceptStoryRequestSchema=z92.strictObject({tenantId:TenantIdSchema,expectedProductionRevision:z92.int().positive(),expectedBriefVersion:z92.int().positive(),revisionReason:z92.string().trim().min(1).max(1e3).optional(),idempotencyKey:z92.string().trim().min(1).max(200),content:StoryContentSchema});var StoryVersionSchema=z92.strictObject({id:StoryVersionIdSchema,storyId:StoryIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z92.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z92.int().positive(),content:StoryContentSchema,createdByPrincipalId:PrincipalIdSchema,createdAt:z92.iso.datetime({offset:true})});var AcceptStoryResultSchema=z92.discriminatedUnion("semanticStatus",[z92.strictObject({semanticStatus:z92.literal("SUCCESS"),storyVersion:StoryVersionSchema,productionRevision:z92.int().positive(),activeStoryVersion:z92.int().positive()}),z92.strictObject({semanticStatus:z92.literal("NEEDS_INPUT"),missingPrerequisites:z92.array(z92.literal("ACTIVE_BRIEF")).min(1)})]);import{z as z93}from"zod";var ConsistencyFamilySchema=z93.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","BOUNDARY_CONTINUITY","STYLE","VOICE_IDENTITY"]);var ConsistencyEnforcementSchema=z93.enum(["LOCKED","REQUIRED","PREFERRED","FREE"]);var ConsistencyMasterReferenceSchema=z93.strictObject({artifactId:ArtifactIdSchema,representationId:ArtifactRepresentationIdSchema,checksumSha256:z93.string().regex(/^[0-9a-f]{64}$/),artifactChecksumSha256:z93.string().regex(/^[0-9a-f]{64}$/),contentType:z93.enum(["image/png","image/jpeg","image/webp","audio/wav"])});var Fact=z93.strictObject({dimension:z93.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/),value:z93.string().trim().min(1).max(1e3)});var ConsistencySubjectSchema=z93.strictObject({id:z93.uuid(),kind:z93.enum(["CHARACTER","VOICE"]),displayName:z93.string().trim().min(1).max(200),facts:z93.array(Fact).min(1).max(32),master:ConsistencyMasterReferenceSchema,voiceExpectation:VoiceExpectationSchema.optional()}).superRefine((s,c)=>{if(new Set(s.facts.map(f=>f.dimension)).size!==s.facts.length)c.addIssue({code:"custom",message:"Canonical subject dimensions must be unique"});if(s.kind==="VOICE"!==(s.master.contentType==="audio/wav"))c.addIssue({code:"custom",message:"Character requires an image master; Voice requires audio"});if(s.voiceExpectation&&s.kind!=="VOICE")c.addIssue({code:"custom",message:"Only Voice subjects carry a voice expectation"})});var ConsistencyRuleScopeSchema=z93.discriminatedUnion("kind",[z93.strictObject({kind:z93.literal("PROJECT")}),z93.strictObject({kind:z93.literal("PRODUCTION")}),z93.strictObject({kind:z93.literal("SCENE"),id:z93.uuid()}),z93.strictObject({kind:z93.literal("SHOT"),id:z93.uuid()}),z93.strictObject({kind:z93.literal("CONTINUITY_EDGE"),id:z93.uuid()})]);var ConsistencyRuleSchema=z93.strictObject({voiceTargets:VoiceRuleTargetsSchema.optional(),reviewScales:z93.array(ConsistencyReviewScaleSchema).min(1).max(3).refine(s=>new Set(s).size===s.length,"Review scales must be unique").optional(),continuity:ContinuityExpectationSchema.optional(),id:z93.uuid(),family:ConsistencyFamilySchema,subjectId:z93.uuid().nullable(),dimension:z93.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/),scope:ConsistencyRuleScopeSchema,enforcement:ConsistencyEnforcementSchema,expected:z93.string().trim().min(1).max(1e3).nullable(),referenceMode:z93.enum(["NONE","SUBJECT_MASTER","EXACT"]),reference:ConsistencyMasterReferenceSchema.optional(),override:z93.strictObject({priorRuleId:z93.uuid(),reason:z93.string().trim().min(1).max(1e3)}).optional(),transition:z93.strictObject({edgeId:z93.uuid(),from:z93.string().trim().min(1).max(1e3),to:z93.string().trim().min(1).max(1e3),reason:z93.string().trim().min(1).max(1e3)}).optional()}).superRefine((r,c)=>{const invalid=message=>c.addIssue({code:"custom",message});if(r.continuity&&(r.enforcement==="FREE"||r.family==="VOICE_IDENTITY"))invalid("FREE/Voice rules cannot create visual state/time obligations");if(r.family==="VOICE_IDENTITY"&&r.enforcement!=="FREE"&&(!r.voiceTargets||r.referenceMode!=="SUBJECT_MASTER"||r.reviewScales?.length!==1||r.reviewScales[0]!=="PRODUCTION"))invalid("Active Voice identity requires explicit audio targets, subject reference and full-production review");if(r.voiceTargets&&(r.family!=="VOICE_IDENTITY"||r.enforcement==="FREE"))invalid("Only active Voice rules select audio targets");if(r.enforcement==="FREE"!==(r.expected===null))invalid("FREE has no expected obligation; other enforcement requires an expectation");if(r.enforcement==="FREE"&&r.referenceMode!=="NONE")invalid("FREE cannot require reference conditioning");if(r.referenceMode==="EXACT"!==(r.reference!==void 0))invalid("Only EXACT reference mode carries an exact reference");if(r.referenceMode==="SUBJECT_MASTER"&&!r.subjectId)invalid("SUBJECT_MASTER requires an exact canonical subject");if(["CHARACTER_IDENTITY","WARDROBE","VOICE_IDENTITY"].includes(r.family)&&!r.subjectId)invalid("Character, Wardrobe and Voice obligations require an exact subject");if(r.family==="CHARACTER_IDENTITY"&&["LOCKED","REQUIRED"].includes(r.enforcement)&&r.referenceMode==="NONE")invalid("Mandatory Character identity requires concrete identity evidence");if(r.transition&&(r.family!=="WARDROBE"||r.transition.to!==r.expected||!r.override))invalid("A planned Wardrobe transition must name the changed inherited rule and new expectation")});var ConsistencyProfileContentSchema=z93.strictObject({subjects:z93.array(ConsistencySubjectSchema).max(32),rules:z93.array(ConsistencyRuleSchema).max(256)}).superRefine((p,c)=>{const invalid=message=>c.addIssue({code:"custom",message});if(new Set(p.subjects.map(s=>s.id)).size!==p.subjects.length||new Set(p.rules.map(r=>r.id)).size!==p.rules.length)invalid("Consistency subjects and rules require distinct stable IDs");if(p.rules.filter(r=>r.family==="VOICE_IDENTITY"&&r.enforcement!=="FREE").length>16)invalid("Voice obligations exceed their bounded rule budget");for(const r of p.rules){const s=p.subjects.find(s2=>s2.id===r.subjectId);if(r.subjectId&&!s)invalid("Rule names an unknown canonical subject");if(r.family==="VOICE_IDENTITY"&&r.enforcement!=="FREE"&&!s?.voiceExpectation)invalid("Active Voice identity requires an exact approved voice expectation");if(s&&r.family==="VOICE_IDENTITY"!==(s.kind==="VOICE")&&["CHARACTER_IDENTITY","WARDROBE","VOICE_IDENTITY"].includes(r.family))invalid("Rule family and canonical subject kind disagree");if(r.override&&!p.rules.some(prior=>prior.id===r.override.priorRuleId))invalid("An override must name an existing inherited rule");if(r.reference&&r.family==="VOICE_IDENTITY"!==(r.reference.contentType==="audio/wav"))invalid("Visual obligations cannot use audio and Voice obligations cannot use images")}});var ConsistencyProfileScopeSchema=z93.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema});var ConsistencyProfileVersionQuerySchema=ConsistencyProfileScopeSchema.extend({profileId:z93.uuid()});var ConfigureConsistencyProfileSchema=ConsistencyProfileScopeSchema.extend({expectedProductionRevision:z93.int().positive(),expectedProfileVersion:z93.int().nonnegative(),content:ConsistencyProfileContentSchema,reason:z93.string().trim().min(1).max(2e3),idempotencyKey:z93.string().trim().min(1).max(200)});var ConsistencyProfileVersionSchema=ConsistencyProfileScopeSchema.extend({id:z93.uuid(),projectId:ProjectIdSchema,version:z93.int().positive(),previousVersionId:z93.uuid().nullable(),content:ConsistencyProfileContentSchema,fingerprint:z93.string().regex(/^[0-9a-f]{64}$/),reason:z93.string().trim().min(1).max(2e3),createdByPrincipalId:PrincipalIdSchema,createdAt:z93.iso.datetime({offset:true})});var ConsistencyProfileViewSchema=ConsistencyProfileScopeSchema.extend({productionRevision:z93.int().positive(),current:ConsistencyProfileVersionSchema.nullable()});var ConsistencyProfileReceiptSchema=z93.strictObject({semanticStatus:z93.literal("SUCCESS"),profile:ConsistencyProfileVersionSchema,productionRevision:z93.int().positive()});var sha14=z94.string().regex(/^[0-9a-f]{64}$/);var RoughCutReviewScopeSchema=TimelineScopeSchema.extend({renderId:z94.uuid()});var ReviewIntervalSchema=z94.strictObject({startMs:z94.int().nonnegative().max(6e4),endMs:z94.int().positive().max(6e4)}).refine(v=>v.endMs>v.startMs,"Review interval must advance");var RoughCutRequirementSchema=z94.strictObject({voiceIdentity:VoiceRequirementGateSchema.optional(),continuity:ContinuityExpectationSchema.optional(),consistencyScale:ConsistencyReviewScaleSchema.optional(),consistencyFamily:z94.enum(["PRODUCT_IDENTITY","CHARACTER_IDENTITY","WARDROBE","LOCATION","STYLE","BOUNDARY_CONTINUITY","VOICE_IDENTITY"]).optional(),consistencySubject:ConsistencySubjectSchema.optional(),consistencyReference:ConsistencyMasterReferenceSchema.optional(),key:z94.string().min(1).max(220),dimension:z94.enum(["PRODUCT_PRESENTATION","CANONICAL_FACT","NARRATIVE","PACING","REPETITION","STYLE","TECHNICAL","TRANSITION"]),expected:z94.string().min(1).max(4e3),enforcement:z94.enum(["LOCKED","REQUIRED","PREFERRED"]),scope:z94.enum(["PRODUCTION","TRANSITION"]),interval:ReviewIntervalSchema,shotIds:z94.array(z94.uuid()).min(1).max(200)});var RoughCutObservationSchema=z94.strictObject({listeningEvidenceIds:ListeningEvidenceIdsSchema.optional(),continuitySamples:ContinuitySamplesSchema.optional(),temporalEvidenceIds:TemporalEvidenceIdsSchema.optional(),key:z94.string().min(1).max(220),status:z94.enum(["SATISFIED","VIOLATED","NOT_OBSERVABLE","NOT_APPLICABLE"]),confidence:z94.enum(["CLEAR","UNCERTAIN"]),observed:z94.string().trim().min(1).max(1800),interval:ReviewIntervalSchema,location:z94.strictObject({interval:ReviewIntervalSchema,shotIds:z94.array(z94.uuid()).min(1).max(200)}).optional()});var RoughCutInspectionSchema=z94.strictObject({actor:z94.enum(["HUMAN","EXTERNAL_AGENT"]),method:z94.literal("FULL_TEMPORAL_INSPECTION"),coverage:z94.array(ReviewIntervalSchema).min(1).max(200)});var RoughCutReviewBasisSchema=z94.strictObject({voiceEvidence:ProductionVoiceEvidenceSchema.optional(),consistencyRequirements:z94.array(RoughCutRequirementSchema).max(256).optional(),artifactId:z94.uuid(),representationId:z94.uuid(),checksumSha256:sha14,manifestFingerprint:sha14,manifest:RoughCutManifestReaderSchema,brief:BriefVersionSchema,story:StoryVersionSchema});var RecordRoughCutReviewSchema=RoughCutReviewScopeSchema.extend({listeningEvidence:ListeningEvidenceSetSchema.optional(),artifactId:z94.uuid(),representationId:z94.uuid(),checksumSha256:sha14,basisFingerprint:sha14,expectedProductionRevision:z94.int().positive(),expectedReviewVersion:z94.int().nonnegative(),idempotencyKey:z94.string().trim().min(1).max(200),inspection:RoughCutInspectionSchema,observations:z94.array(RoughCutObservationSchema).min(1).max(300),summary:z94.string().trim().min(1).max(2500)});var RoughCutReviewRecordSchema=RoughCutReviewScopeSchema.extend({listeningEvidence:ListeningEvidenceSetSchema.optional(),id:z94.uuid(),projectId:ProjectIdSchema,version:z94.int().positive(),kind:z94.literal("PRODUCTION_REVIEW_2"),lifecycle:z94.literal("COMPLETED"),evaluatorVersion:z94.literal("production-review-v1"),basis:RoughCutReviewBasisSchema,basisFingerprint:sha14,executionClass:z94.enum(["LIVE","TEST_ONLY"]),technical:RoughCutTechnicalSchema,durationMs:z94.int().min(3e4).max(6e4),requirements:z94.array(RoughCutRequirementSchema).min(1).max(300),inspection:RoughCutInspectionSchema,observations:z94.array(RoughCutObservationSchema).min(1).max(300),result:z94.enum(["PASS","WARNING","FAIL"]),blockingKeys:z94.array(z94.string()).max(300),warningKeys:z94.array(z94.string()).max(300),summary:z94.string().min(1).max(2500),createdByPrincipalId:PrincipalIdSchema,createdAt:z94.iso.datetime({offset:true})});var RoughCutReviewTargetSchema=RoughCutReviewScopeSchema.extend({temporalEvidence:z94.array(TemporalEvidenceReferenceSchema).max(8).optional(),projectId:ProjectIdSchema,productionRevision:z94.int().positive(),productionRunnable:z94.boolean(),executionClass:z94.enum(["LIVE","TEST_ONLY"]),freshness:z94.enum(["CURRENT_BASIS","STALE_BASIS"]),staleReasons:z94.array(z94.string()).max(18),inspectable:z94.boolean(),durationMs:z94.int().min(3e4).max(6e4),basis:RoughCutReviewBasisSchema,basisFingerprint:sha14,technical:RoughCutTechnicalSchema,requirements:z94.array(RoughCutRequirementSchema).min(1).max(300),latestReview:RoughCutReviewRecordSchema.nullable(),reviewVersion:z94.int().nonnegative(),finalReadyVersion:z94.int().nonnegative()});var RoughCutFindingSchema=RoughCutReviewScopeSchema.extend({compositionLocality:z94.array(CompositionFindingLocalitySchema).min(1).max(208).optional(),id:z94.uuid(),projectId:ProjectIdSchema,reviewId:z94.uuid(),reviewVersion:z94.int().positive(),basisFingerprint:sha14,artifactId:z94.uuid(),timelineVersionId:z94.uuid(),requirement:RoughCutRequirementSchema,observation:RoughCutObservationSchema,blocking:z94.boolean(),severity:z94.enum(["BLOCKING","WARNING"]),remediation:z94.enum(["REVISE_PRODUCTION","REVISE_TRANSITION","CORRECT_CANONICAL_CONTRADICTION"]),affectedScope:z94.strictObject({kind:z94.enum(["PRODUCTION","SHOT","TRANSITION","TIMELINE_REGION"]),interval:ReviewIntervalSchema,shotIds:z94.array(z94.uuid()).min(1).max(200)}),initialLifecycle:z94.literal("OPEN"),createdAt:z94.iso.datetime({offset:true})});var RoughCutFindingViewSchema=RoughCutFindingSchema.extend({lifecycle:z94.enum(["OPEN","REMEDIATION_PLANNED","RESOLVED","WAIVED","SUPERSEDED"]),proofReviewId:z94.uuid().nullable(),proofDecisionId:z94.uuid().nullable()});var RoughCutReviewQuerySchema=RoughCutReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var RoughCutReviewPageSchema=z94.strictObject({items:z94.array(RoughCutReviewRecordSchema),page:QueryPageInfoSchema});var RoughCutFindingQuerySchema=TimelineScopeSchema.extend({renderId:z94.uuid().optional(),limit:QueryLimitSchema,next:ContinuationSchema.optional()});var RoughCutFindingGetSchema=TimelineScopeSchema.extend({findingId:z94.uuid()});var RoughCutFindingPageSchema=z94.strictObject({items:z94.array(RoughCutFindingViewSchema),page:QueryPageInfoSchema});var RoughCutReviewReceiptSchema=z94.strictObject({semanticStatus:z94.literal("SUCCESS"),review:RoughCutReviewRecordSchema,findingIds:z94.array(z94.uuid()).max(300),productionRevision:z94.int().positive()});var ReviewEvidenceKeySchema=z95.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);var ReviewEvidenceMediaSchema=z95.strictObject({artifactId:z95.uuid(),representationId:z95.uuid(),checksumSha256:z95.string().regex(/^[0-9a-f]{64}$/)});var common={id:ReviewEvidenceKeySchema,label:z95.string().trim().min(1).max(200),producer:z95.enum(["EXTERNAL_AGENT_HOST","HUMAN","VLM"]),media:ReviewEvidenceMediaSchema};var ReviewIntelligenceEvidenceSchema=z95.discriminatedUnion("kind",[z95.strictObject({...common,kind:z95.literal("METADATA")}),z95.strictObject({...common,kind:z95.literal("IMAGE_PIXELS")}),z95.strictObject({...common,kind:z95.literal("REGISTERED_TEMPORAL_FRAMES"),reference:TemporalEvidenceReferenceSchema}),z95.strictObject({...common,kind:z95.literal("VIDEO_PLAYBACK"),coverage:z95.array(ReviewIntervalSchema).min(1).max(200)}),z95.strictObject({...common,kind:z95.literal("AUDIO_LISTENING"),coverage:z95.array(ReviewIntervalSchema).min(1).max(200)}),z95.strictObject({...common,kind:z95.literal("VIDEO_WITH_AUDIO_PLAYBACK"),coverage:z95.array(ReviewIntervalSchema).min(1).max(200)}),z95.strictObject({...common,kind:z95.literal("VIDEO_FRAMES"),timestampsMs:z95.array(z95.number().nonnegative().max(6e4)).min(1).max(64)})]);var ObservationScopeSchema=z96.strictObject({tenantId:z96.uuid(),productionId:z96.uuid()});var audioSourceRequest=z96.strictObject({kind:z96.literal("AUDIO"),media:ReviewEvidenceMediaSchema,versionId:z96.uuid(),purpose:z96.enum(["VOICEOVER","MUSIC"])});var ObservationSourceRequestSchema=z96.discriminatedUnion("kind",[audioSourceRequest,z96.strictObject({kind:z96.literal("VIDEO"),media:ReviewEvidenceMediaSchema})]);var ObservationStartSchema=ObservationScopeSchema.extend({expectedProductionRevision:z96.int().positive(),idempotencyKey:z96.string().min(1).max(200),source:ObservationSourceRequestSchema,mode:ObservationModeSchema,selection:ProviderSelectionSchema,expectedModelProfileVersion:z96.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:z96.uuid()});var ObservationBindingSchema=z96.strictObject({tenantId:z96.uuid(),connectionId:z96.uuid(),connectionVersion:z96.int().positive(),credentialRef:z96.string(),credentialVersion:z96.int().positive(),profile:ObservationProfileSchema,matrix:ModelCapabilityMatrixSchema.optional(),executionClass:z96.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:z96.uuid(),projectId:z96.uuid(),productionId:z96.uuid(),byteSize:z96.int().positive().max(12582912),durationMs:z96.number().positive().max(6e4),frameRate:z96.number().positive().max(60).optional(),executionClass:z96.enum(["LIVE","TEST_ONLY"])});var json=z96.record(z96.string(),z96.unknown());var ObservationResultSchema=z96.strictObject({schemaVersion:z96.int().positive(),advisory:z96.literal(true),producer:z96.enum(["VLM","ASR"]).optional(),source:ObservationSourceSchema,input:json,provider:json,observedAt:z96.iso.datetime(),report:json,transcript:TranscriptSchema.optional(),evidence:ReviewIntelligenceEvidenceSchema.optional(),limitations:z96.array(z96.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=z96.strictObject({semanticStatus:z96.literal("ACCEPTED"),observationId:z96.uuid(),runtimeJobId:z96.uuid(),productionRevision:z96.int().positive(),executionClass:z96.enum(["LIVE","TEST_ONLY"])});var ObservationViewSchema=ObservationScopeSchema.extend({observationId:z96.uuid(),runtimeJobId:z96.uuid(),request:ObservationStartSchema,profile:ObservationProfileSchema,matrix:ModelCapabilityMatrixSchema.optional(),parameters:ObservationParametersSchema,executionClass:z96.enum(["LIVE","TEST_ONLY"]),runtimeStatus:z96.enum(["PENDING","READY","RUNNING","WAITING","SUCCEEDED","FAILED","CANCELLED","SUPERSEDED"]),providerStatus:z96.enum(["NOT_SUBMITTED","SUBMITTING","UNKNOWN","SUCCEEDED","REJECTED"]),cancellationRequested:z96.boolean(),failure:z96.strictObject({classification:z96.string().min(1).max(100),summary:z96.string().min(1).max(1e3)}).nullable(),result:ObservationResultSchema.nullable(),createdAt:z96.iso.datetime()});var ObservationOptionsSchema=ObservationScopeSchema.extend({options:z96.array(z96.strictObject({selection:ProviderSelectionSchema,profile:ObservationProfileSchema,matrix:ModelCapabilityMatrixSchema.optional(),connectionLabel:z96.string(),connectionVersion:z96.int().positive()})).max(100),possiblyTruncated:z96.boolean()});var LocalObservationStartSchema=ObservationScopeSchema.extend({expectedProductionRevision:ObservationStartSchema.shape.expectedProductionRevision,idempotencyKey:ObservationStartSchema.shape.idempotencyKey,source:audioSourceRequest,mode:z96.literal("TRANSCRIPTION"),deviceExecution:z96.strictObject({deviceId:z96.uuid().optional()})});var localObservationExecution=z96.strictObject({target:z96.literal("TENANT_DEVICE"),deviceId:z96.uuid(),identity:LocalWhisperIdentitySchema});var LocalObservationBindingSchema=localObservationExecution.extend({tenantId:z96.uuid(),executionClass:z96.literal("LIVE"),source:ObservationSourceSchema});var LocalObservationAdmissionSchema=ObservationAdmissionSchema.extend({executionClass:z96.literal("LIVE"),deviceExecution:localObservationExecution});var LocalObservationResultSchema=z96.strictObject({schemaVersion:z96.literal(1),advisory:z96.literal(true),producer:z96.literal("ASR"),source:ObservationSourceSchema,deviceExecution:localObservationExecution,observedAt:z96.iso.datetime(),transcript:TranscriptSchema.options[0],inputPcmSha256:z96.string().regex(/^[0-9a-f]{64}$/),inputPcmByteSize:z96.int().min(44).max(1920044)}).refine(v=>new TextEncoder().encode(JSON.stringify(v)).length<=131072,{message:"Observation report too large"});var LocalObservationViewSchema=ObservationViewSchema.omit({profile:true,matrix:true,parameters:true,providerStatus:true}).extend({request:LocalObservationStartSchema,executionClass:z96.literal("LIVE"),deviceExecution:localObservationExecution,result:LocalObservationResultSchema.nullable()});var qwenAsrModelId="qwen3-asr-flash-2026-02-10";var QwenAsrDeviceQuoteInputSchema=ObservationScopeSchema.extend({expectedProductionRevision:ObservationStartSchema.shape.expectedProductionRevision,idempotencyKey:ObservationStartSchema.shape.idempotencyKey,source:audioSourceRequest,mode:z96.literal("TRANSCRIPTION"),selection:ProviderSelectionSchema.extend({modelProfileId:z96.literal(qwenAsrModelId)}),expectedModelProfileVersion:z96.literal(1),parameters:ObservationParametersSchema.default({}),deviceId:z96.uuid()});var QwenAsrCostQuoteSchema=z96.strictObject({protocol:z96.literal("NVS_QWEN_ASR_COST_QUOTE_V1"),currency:z96.literal("USD"),ruleId:z96.string().min(1).max(100),sourceUrl:z96.url().max(2048),selection:QwenAsrDeviceQuoteInputSchema.shape.selection,connectionVersion:z96.int().positive(),modelProfileVersion:z96.literal(1),deviceId:z96.uuid(),intentFingerprint:z96.string().regex(/^[0-9a-f]{64}$/),inputDurationMs:z96.number().positive().max(6e4),reservedSeconds:z96.int().min(1).max(60),upperBoundMicrosPerSecond:z96.int().positive().max(1e6),upperBoundMicros:z96.int().positive().max(6e7),validUntil:z96.iso.datetime()});var QwenAsrDeviceStartSchema=QwenAsrDeviceQuoteInputSchema.extend({approvedQuote:QwenAsrCostQuoteSchema});var qwenAsrDeviceExecution=z96.strictObject({target:z96.literal("TENANT_EXTERNAL_PROVIDER"),deviceId:z96.uuid()});var QwenAsrDeviceAdmissionSchema=ObservationAdmissionSchema.extend({executionClass:z96.literal("LIVE"),deviceExecution:qwenAsrDeviceExecution});var qwenAsrTokenCount=z96.int().min(0).max(1e7).optional();var QwenAsrDeviceResultSchema=ObservationResultSchema.safeExtend({producer:z96.literal("ASR"),transcript:TranscriptSchema.options[0],input:z96.strictObject({kind:z96.literal("ORIGINAL_PCM_WAV_TRANSCRIPTION"),checksumSha256:ObservationSourceSchema.shape.checksumSha256,byteSize:ObservationSourceSchema.shape.byteSize,timeScaleFactor:z96.literal(1)}),provider:z96.strictObject({protocol:z96.literal("QWEN_ASR_V1"),requestedModel:z96.literal(qwenAsrModelId),model:z96.literal(qwenAsrModelId),requestId:z96.string().regex(/^[A-Za-z0-9_.:-]{1,500}$/),usage:z96.strictObject({seconds:z96.int().min(0).max(60).optional(),prompt_tokens:qwenAsrTokenCount,completion_tokens:qwenAsrTokenCount,total_tokens:qwenAsrTokenCount})}),report:z96.strictObject({task:z96.literal("SPEECH_RECOGNITION")})});var QwenAsrDeviceViewSchema=ObservationViewSchema.extend({request:QwenAsrDeviceQuoteInputSchema,executionClass:z96.literal("LIVE"),deviceExecution:qwenAsrDeviceExecution,result:QwenAsrDeviceResultSchema.nullable()});var ProductionGuidanceSchema=z96.strictObject({version:z96.enum(["NVS_PRODUCTION_GUIDANCE_V1","NVS_PRODUCTION_GUIDANCE_V2"]),instructions:z96.string().min(1).max(16e3)});var ProductionGuidanceContextSchema=ObservationScopeSchema.extend({projectId:z96.uuid(),revision:z96.int().positive(),guidance:ProductionGuidanceSchema});var TranscribeAudioRecipeSchema=z97.strictObject({processor:z97.literal("TRANSCRIBE_AUDIO"),source:ObservationSourceSchema.extend({contentType:z97.literal("audio/wav")}),identity:LocalWhisperIdentitySchema});var TranscribeAudioEvidenceSchema=z97.strictObject({processor:z97.literal("TRANSCRIBE_AUDIO"),identity:LocalWhisperIdentitySchema,transcript:TranscriptSchema.refine(transcript=>transcript.timing==="UNAVAILABLE"),inputPcmSha256:LocalDigestSchema,inputPcmByteSize:z97.int().min(44).max(1920044)});var QwenAsrRecipeSchema=z97.strictObject({processor:z97.literal("TRANSCRIBE_EXTERNAL_QWEN"),observationId:LocalIdSchema,quoteFingerprint:LocalDigestSchema,credential:QwenDeviceCredentialIdentitySchema,source:TranscribeAudioRecipeSchema.shape.source,parameters:z97.strictObject({context:z97.string().max(2e3).refine(value2=>!value2.includes("\0")).optional(),language:z97.string().regex(/^[a-zA-Z][a-zA-Z0-9-]{1,19}$/).optional(),enable_itn:z97.boolean().optional()})});var asrTokens=z97.int().min(0).max(1e7).optional();var QwenAsrEvidenceSchema=z97.strictObject({processor:z97.literal("TRANSCRIBE_EXTERNAL_QWEN"),providerRequestId:z97.string().regex(/^[A-Za-z0-9_.:-]{1,500}$/),model:z97.literal("qwen3-asr-flash-2026-02-10"),usage:z97.strictObject({seconds:z97.int().min(0).max(60).optional(),prompt_tokens:asrTokens,completion_tokens:asrTokens,total_tokens:asrTokens}),transcript:TranscriptSchema.options[0]});import{z as z98}from"zod";var CpuSpeechRecipeSchema=CpuSpeechInputSchema.extend({processor:z98.literal("SPEECH_SYNTHESIZE_CPU"),identity:CpuSpeechIdentitySchema,voiceProfile:VoiceProfileUseSchema}).refine(v=>v.voiceProfile.language===v.language);var CpuSpeechEvidenceSchema=SpeechSynthesisEvidenceSchema.extend({processor:z98.literal("SPEECH_SYNTHESIZE_CPU"),sourceMedia:z98.strictObject({sampleRateHz:z98.literal(24e3),audioChannels:z98.literal(1),sampleCount:z98.int().min(2400).max(144e4)})});var sourceReference=z99.strictObject({artifactId:LocalIdSchema,representationId:LocalIdSchema,byteSize:MediaObjectVersionSchema.shape.byteSize,checksumSha256:LocalDigestSchema,contentType:z99.string().min(1).max(100)});var source2=sourceReference.extend({contentType:z99.literal("video/mp4")});var ReferencePreviewRecipeSchema=z99.strictObject({processor:z99.literal("REFERENCE_PREVIEW"),briefVersionId:LocalIdSchema,source:sourceReference.extend({contentType:z99.enum(["image/png","image/jpeg","image/webp"]),byteSize:z99.int().positive().max(8*1024*1024)})});var normalize=z99.strictObject({processor:z99.literal("IMPORTED_VISUAL_NORMALIZE"),source:source2,request:ImportedVisualNormalizationRequestSchema}).refine(({request,source:source3})=>request.source.byteSize===source3.byteSize&&request.source.checksumSha256===source3.checksumSha256,"Original representation must match the normalization request");var audio=z99.strictObject({processor:z99.literal("SOURCE_SYNC_AUDIO"),source:source2,input:ImportedVisualSourceInputSchema,extraction:ImportedSynchronousAudioExtractionSchema}).refine(value2=>value2.source.checksumSha256===value2.input.checksumSha256&&value2.source.checksumSha256===value2.extraction.originalChecksumSha256&&value2.source.representationId===value2.extraction.originalRepresentationId&&value2.source.artifactId===value2.extraction.originalArtifactId&&value2.source.byteSize===value2.input.byteSize);var temporal=z99.strictObject({processor:z99.literal("TEMPORAL_SAMPLE"),source:source2,plan:TemporalSamplingPlanSchema}).refine(value2=>value2.source.checksumSha256===value2.plan.source.checksumSha256&&value2.source.representationId===value2.plan.source.representationId&&value2.source.artifactId===value2.plan.source.artifactId&&value2.source.byteSize===value2.plan.source.byteSize);var delivery=z99.strictObject({processor:z99.literal("DELIVERY_VALIDATE"),recipe:LocalMediaRecipeSchema.refine(value2=>value2.family==="FINAL_RENDER"),target:DeliveryTargetSchema.pick({representationId:true,checksumSha256:true,byteSize:true,artifactId:true}).extend({contentType:z99.literal("video/mp4")}),policy:z99.strictObject({requiredAudio:z99.boolean(),requiredCaptions:z99.boolean(),requiredGraphics:z99.boolean()}),engineVersion:z99.string().min(1).max(200),sources:z99.array(sourceReference).min(1).max(512),manifestBasisFingerprint:LocalDigestSchema}).refine(({sources,target:target2})=>new Set([target2.representationId,...sources.map(v=>v.representationId)]).size===sources.length+1);var composition=z99.strictObject({processor:z99.literal("COMPOSITION_RENDER"),...processorCompositionFields,sources:z99.array(sourceReference).min(1).max(64)}).refine(({manifest,allocation,sources})=>{const inputs=manifest.version.inputs;return(manifest.schemaVersion===1?allocation===null:allocation?.frames.length===manifest.frameCount)&&new Set(inputs.map(input=>input.representationId)).size===sources.length&&new Set(sources.map(source3=>source3.representationId)).size===sources.length&&inputs.every(input=>sources.some(source3=>source3.representationId===input.representationId&&source3.artifactId===input.artifactId&&source3.checksumSha256===input.checksumSha256&&source3.byteSize===input.byteSize&&source3.contentType===input.contentType))});var directOriginal=z99.strictObject({processor:z99.literal("IMPORT_ORIGINAL"),command:DirectOriginalCommandSchema,object:MediaObjectVersionSchema.extend({role:z99.literal("SOURCE")})}).refine(({command:{input},object})=>input.tenantId===object.tenantId&&input.projectId===object.projectId&&input.source.checksumSha256===object.checksumSha256&&input.source.byteSize===object.byteSize);var projectSource=z99.strictObject({processor:z99.literal("IMPORT_PROJECT_SOURCE"),metadata:SourceInputMetadataSchema.extend({idempotencyKey:z99.string().trim().min(1).max(200)}),projectId:LocalIdSchema,object:MediaObjectVersionSchema.extend({role:z99.literal("SOURCE")})}).refine(({metadata,projectId,object})=>metadata.tenantId===object.tenantId&&projectId===object.projectId&&object.byteSize<=8*1024*1024&&(metadata.kind==="REFERENCE_VIDEO"?metadata.contentType==="video/mp4":metadata.kind==="REFERENCE_IMAGE"&&["image/png","image/jpeg","image/webp"].includes(metadata.contentType)));var visualSequence=z99.strictObject({processor:z99.literal("REGISTER_VISUAL_SEQUENCE"),input:RegisterVisualSequenceSchema,manifest:VisualSequenceManifestSchema,sources:z99.array(sourceReference).min(1).max(360)}).refine(({input,manifest,sources})=>input.tenantId===manifest.tenantId&&input.projectId===manifest.projectId&&input.productionId===manifest.productionId&&new Set(sources.map(source3=>source3.representationId)).size===sources.length&&manifest.frames.every(frame2=>sources.some(source3=>source3.artifactId===frame2.artifactId&&source3.representationId===frame2.representationId&&source3.byteSize===frame2.byteSize&&source3.checksumSha256===frame2.checksumSha256&&source3.contentType==="image/png")));var TenantProcessorRecipeSchema=z99.discriminatedUnion("processor",[normalize,audio,temporal,delivery,composition,directOriginal,projectSource,ReferencePreviewRecipeSchema,LocalLibraryInspectRecipeSchema,LocalLibraryPublishRecipeSchema,visualSequence,SpeechSynthesisRecipeSchema,CpuSpeechRecipeSchema,QwenSpeechRecipeSchema,TranscribeAudioRecipeSchema,QwenAsrRecipeSchema,QwenKeyframeRecipeSchema,QwenVideoRecipeSchema]);var TenantProcessorWorkSchema=TenantMediaWorkSchema.omit({audioRequired:true,renderProfileDigest:true}).extend({protocol:z100.literal("NVS_TENANT_PROCESSOR_V1"),family:z100.enum(["ARTIFACT_INGEST","PLANNING_MATERIALIZE","TEMPORAL_SAMPLE","DELIVERY_VALIDATE","COMPOSITION_RENDER","AUDIO_GENERATE","OBSERVE","KEYFRAME_GENERATE","VIDEO_GENERATE"]),processor:TenantProcessorKindSchema,recipeFingerprint:LocalDigestSchema,toolchainFingerprint:LocalDigestSchema,externalGeneration:ExternalGenerationReservationMarkerSchema.optional()}).refine(value2=>processorFamilies[value2.processor]===value2.family&&(value2.processor==="KEYFRAME_GENERATE"||value2.processor==="VIDEO_GENERATE")===!!value2.externalGeneration);var TenantComputeWorkSchema=z100.discriminatedUnion("protocol",[TenantMediaWorkSchema,TenantProcessorWorkSchema]);var importedNormalizationValidationProfile={processor:"IMPORTED_VISUAL_NORMALIZE",protocol:"NVS_TENANT_PROCESSOR_REPORT_V1",inspection:"IMPORTED_MP4_AND_POSTER_READBACK_V1"};var ClaimTenantProcessorSchema=LocalProjectScopeSchema.extend({requestId:LocalIdSchema});var TenantProcessorAssignmentSchema=z100.strictObject({work:TenantProcessorWorkSchema,recipe:TenantProcessorRecipeSchema,lease:LocalExecutionLeaseSchema,toolchain:LocalToolchainSchema}).superRefine(({work,recipe,lease,toolchain},ctx)=>{const selected=work.processor==="SPEECH_SYNTHESIZE_CPU"?processorToolchain(toolchain,work.processor):toolchain;if(!selected||toolchain.profile.kind==="AUDIO_MEDIA_V1"&&work.processor!=="SPEECH_SYNTHESIZE_CPU"||canonicalLocalJson(selected)!==canonicalLocalJson(toolchain))ctx.addIssue({code:"custom",message:"Exact processor media profile required"});const target2=lease.target;if((recipe.processor==="LOCAL_MEDIA_INSPECT"||recipe.processor==="LOCAL_MEDIA_PUBLISH")&&(recipe.reference.tenantId!==work.tenantId||recipe.reference.projectId!==work.projectId||recipe.reference.deviceId!==work.target.deviceId||recipe.processor==="LOCAL_MEDIA_PUBLISH"&&recipe.destination.kind==="ORIGINAL"&&recipe.destination.command.input.productionId.toLowerCase()!==work.productionId))ctx.addIssue({code:"custom",message:"Local file reference must match native target and scope"});if(recipe.processor!==work.processor||lease.tenantId!==work.tenantId||lease.projectId!==work.projectId||lease.productionId!==work.productionId||lease.runtimeJobId!==work.runtimeJobId||lease.toolchainFingerprint!==work.toolchainFingerprint||target2.kind!=="DEVICE"||!sameDeviceAuthority(target2,work.target))ctx.addIssue({code:"custom",message:"Assignment must match the frozen device work"})});var TenantProcessorClaimReceiptSchema=z100.strictObject({found:z100.boolean(),assignment:TenantProcessorAssignmentSchema.nullable()});var StageTenantProcessorOutputSchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema,role:z100.enum(["VIDEO","POSTER","AUDIO","FRAME","SHEET","MANIFEST"]),ordinal:z100.int().nonnegative().max(359).default(0),checksumSha256:LocalDigestSchema,byteSize:MediaObjectVersionSchema.shape.byteSize});var PrepareTenantProcessorReportSchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema,outputVersionIds:z100.array(LocalIdSchema).max(362).refine(ids=>ids.length===new Set(ids).size)});var TenantProcessorReportRequestSchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema,validationRequestId:LocalIdSchema,work:TenantProcessorWorkSchema,outputs:z100.array(MediaObjectVersionSchema).max(362)});var poster=z100.strictObject({checksumSha256:LocalDigestSchema,byteSize:z100.int().min(1).max(2*1024*1024),width:z100.int().min(1).max(320),height:z100.int().min(1).max(320)});var TenantProcessorEvidenceSchema=z100.discriminatedUnion("processor",[LocalLibraryInspectEvidenceSchema,LocalLibraryPublishEvidenceSchema,z100.strictObject({processor:z100.literal("IMPORTED_VISUAL_NORMALIZE"),receipt:ImportedVisualNormalizationReceiptSchema,posterEvidence:poster}),z100.strictObject({processor:z100.literal("SOURCE_SYNC_AUDIO"),provenance:ImportedSynchronousAudioSourceSchema}),z100.strictObject({processor:z100.literal("TEMPORAL_SAMPLE"),manifest:TemporalEvidenceManifestSchema}),z100.strictObject({processor:z100.literal("DELIVERY_VALIDATE"),checks:DeliveryPhysicalChecksSchema,technical:FinalRenderTechnicalSchema.nullable()}),ProcessorCompositionEvidenceSchema,SpeechSynthesisEvidenceSchema,CpuSpeechEvidenceSchema,QwenSpeechEvidenceSchema,TranscribeAudioEvidenceSchema,QwenAsrEvidenceSchema,QwenKeyframeEvidenceSchema,QwenVideoEvidenceSchema,z100.strictObject({processor:z100.literal("REFERENCE_PREVIEW"),image:z100.strictObject({checksumSha256:LocalDigestSchema,byteSize:z100.int().positive().max(referenceThumbnailProfile.maxBytes),width:z100.int().positive().max(referenceThumbnailProfile.maxDimension),height:z100.int().positive().max(referenceThumbnailProfile.maxDimension)})}),z100.strictObject({processor:z100.literal("IMPORT_ORIGINAL"),metadata:ImportedVisualSourceMetadataSchema}),z100.strictObject({processor:z100.literal("IMPORT_PROJECT_SOURCE"),validated:z100.strictObject({checksumSha256:LocalDigestSchema,byteSize:z100.int().positive().max(8*1024*1024),width:z100.int().positive().max(4096),height:z100.int().positive().max(4096),video:ImportedVisualSourceMetadataSchema.optional()})}),z100.strictObject({processor:z100.literal("REGISTER_VISUAL_SEQUENCE"),evidence:z100.strictObject({checksumSha256:VisualFrameSequenceSchema.shape.checksumSha256,width:VisualFrameSequenceSchema.shape.width,height:VisualFrameSequenceSchema.shape.height,frames:VisualFrameSequenceSchema.shape.frames,byteSize:z100.int().positive().max(2*1024*1024)})})]);var TenantProcessorReportBodySchema=TenantProcessorReportRequestSchema.extend({schemaVersion:z100.literal(1),evidence:TenantProcessorEvidenceSchema}).superRefine(({work,outputs,evidence,...binding},ctx)=>{if(work.tenantId!==binding.tenantId||work.projectId!==binding.projectId||work.productionId!==binding.productionId||work.runtimeJobId!==binding.runtimeJobId||work.toolchainFingerprint!==binding.toolchainFingerprint||evidence.processor!==work.processor||new Set(outputs.map(value2=>value2.versionId)).size!==outputs.length||outputs.some(object=>object.tenantId!==work.tenantId||object.projectId!==work.projectId)||!matchesEvidence(outputs,evidence))ctx.addIssue({code:"custom",message:"Report must bind the exact processor and committed media versions"})});function matchesEvidence(outputs,evidence){const matches=(index,role,expected)=>{const output=outputs[index];return output?.role===role&&output.checksumSha256===expected.checksumSha256&&output.byteSize===expected.byteSize};switch(evidence.processor){case"REFERENCE_PREVIEW":return outputs.length===1&&matches(0,"POSTER",evidence.image);case"IMPORTED_VISUAL_NORMALIZE":return outputs.length===2&&matches(0,"VIDEO",evidence.receipt.output)&&matches(1,"POSTER",evidence.posterEvidence);case"SOURCE_SYNC_AUDIO":return outputs.length===1&&matches(0,"AUDIO",{checksumSha256:evidence.provenance.wavChecksumSha256,byteSize:evidence.provenance.wavByteSize});case"SPEECH_SYNTHESIZE":case"SPEECH_SYNTHESIZE_CPU":case"SPEECH_EXTERNAL_QWEN":return outputs.length===2&&matches(0,"AUDIO",evidence.source)&&matches(1,"AUDIO",evidence.normalized);case"TEMPORAL_SAMPLE":{const frames=evidence.manifest.frames;return outputs.length===frames.length+2&&frames.every((value2,index)=>matches(index,"FRAME",value2))&&matches(frames.length,"SHEET",evidence.manifest.sheet)&&outputs.at(-1)?.role==="MANIFEST"}case"DELIVERY_VALIDATE":case"TRANSCRIBE_AUDIO":case"TRANSCRIBE_EXTERNAL_QWEN":case"LOCAL_MEDIA_INSPECT":case"LOCAL_MEDIA_PUBLISH":case"IMPORT_ORIGINAL":case"IMPORT_PROJECT_SOURCE":return outputs.length===0;case"REGISTER_VISUAL_SEQUENCE":return outputs.length===1&&matches(0,"MANIFEST",evidence.evidence);case"KEYFRAME_GENERATE":return outputs.length===1&&matches(0,"FRAME",evidence.image);case"VIDEO_GENERATE":return outputs.length===2&&matches(0,"VIDEO",evidence.video)&&matches(1,"POSTER",evidence.poster);case"COMPOSITION_RENDER":if(evidence.format==="MP4")return outputs.length===1&&matches(0,"VIDEO",evidence.technical);return outputs.length===evidence.technical.frames.length+1&&evidence.technical.frames.every((value2,index)=>matches(index,"FRAME",value2))&&outputs.at(-1)?.role==="MANIFEST"&&outputs.at(-1)?.checksumSha256===evidence.sequence.checksumSha256}}var TenantProcessorReportSchema=TenantProcessorReportBodySchema.safeExtend({reportFingerprint:LocalDigestSchema,signature:z100.string().regex(/^[A-Za-z0-9_-]{86}$/)});var TenantProcessorReceiptQuerySchema=LocalLeaseBindingSchema.extend({requestId:LocalIdSchema});var TenantProcessorStateSchema=z100.strictObject({binding:LocalLeaseBindingSchema,state:z100.enum(["FENCED","PENDING"])});var TenantProcessorFailureSchema=LocalLeaseBindingSchema.extend({code:z100.literal("INVALID_SOURCE")});var TenantProcessorProviderOutcomeSchema=LocalLeaseBindingSchema.extend({outcome:z100.enum(["UNKNOWN","REJECTED","WAITING","INVALID_RESULT"]),providerExecutionId:QwenVideoTaskIdSchema.optional()}).refine(value2=>!["WAITING","INVALID_RESULT"].includes(value2.outcome)||!!value2.providerExecutionId);var TenantProcessorProviderTaskSchema=LocalLeaseBindingSchema.extend({providerExecutionId:QwenVideoTaskIdSchema.optional()});var TenantProcessorInvalidSpeechSchema=LocalLeaseBindingSchema.extend(QwenSpeechEvidenceSchema.pick({providerRequestId:true,audioId:true}).shape);var TenantProcessorReceiptSchema=TenantProcessorReceiptQuerySchema.extend({operationId:TenantProcessorWorkSchema.shape.operationId,reportFingerprint:LocalDigestSchema,result:z100.union([z100.strictObject({sourceArtifactId:LocalIdSchema,representationId:LocalIdSchema,reusedExisting:z100.boolean()}),z100.strictObject({localMediaInspectionId:LocalIdSchema}),z100.strictObject({normalizationId:LocalIdSchema,artifactId:LocalIdSchema,representationId:LocalIdSchema,posterArtifactId:LocalIdSchema,posterRepresentationId:LocalIdSchema}),SourceSyncAudioReceiptSchema,z100.strictObject({generationId:LocalIdSchema,audio:AudioReceiptSchema}),z100.strictObject({observationId:LocalIdSchema}),z100.strictObject({generationId:LocalIdSchema,candidateId:LocalIdSchema,artifactId:LocalIdSchema,representationId:LocalIdSchema}),z100.strictObject({evidenceId:LocalIdSchema,frameSetArtifactId:LocalIdSchema,contactSheetArtifactId:LocalIdSchema}),z100.strictObject({deliveryValidationId:LocalIdSchema,reviewId:LocalIdSchema}),z100.strictObject({renderId:LocalIdSchema,artifactId:LocalIdSchema,representationId:LocalIdSchema}),ImportedVisualOriginalViewSchema,ReadyArtifactRegistrationSchema,z100.strictObject({requestId:LocalIdSchema,artifactId:LocalIdSchema,representationId:LocalIdSchema})])});import{z as z101}from"zod";var Fingerprint5=z101.string().regex(/^[0-9a-f]{64}$/);var KeyframeReviewScopeSchema=z101.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,generationId:z101.uuid()});var VisualRequirementSchema=z101.strictObject({intentPath:z101.string().min(1).max(220).optional(),key:z101.string().min(1).max(200),expected:z101.string().min(1).max(2500),enforcement:z101.enum(["LOCKED","REQUIRED","PREFERRED"])});var Region=z101.strictObject({x:z101.number().min(0).max(1),y:z101.number().min(0).max(1),width:z101.number().positive().max(1),height:z101.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=z101.strictObject({key:z101.string().min(1).max(200),status:z101.enum(["SATISFIED","VIOLATED","NOT_OBSERVABLE","NOT_APPLICABLE"]),confidence:z101.enum(["CLEAR","UNCERTAIN"]),observed:z101.string().trim().min(1).max(1500),region:Region.optional()});var RecordKeyframeReviewSchema=KeyframeReviewScopeSchema.extend({candidateId:z101.uuid(),representationId:z101.uuid(),checksumSha256:Fingerprint5,expectedReviewVersion:z101.int().nonnegative(),idempotencyKey:z101.string().trim().min(1).max(200),observations:z101.array(KeyframeObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z101.string().trim().min(1).max(2e3)});var KeyframeReviewRecordSchema=z101.strictObject({id:z101.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,generationId:z101.uuid(),candidateId:z101.uuid(),artifactId:z101.uuid(),representationId:z101.uuid(),checksumSha256:Fingerprint5,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,version:z101.int().positive(),preparationId:z101.uuid(),contractId:z101.uuid(),contractFingerprint:Fingerprint5,executionClass:z101.enum(["LIVE","TEST_ONLY"]),kind:z101.literal("KEYFRAME_REFERENCE"),lifecycle:z101.literal("COMPLETED"),evaluatorVersion:z101.literal("keyframe-reference-v1"),source:z101.literal("EXPLICIT_VISUAL_INSPECTION"),requirements:z101.array(VisualRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),observations:z101.array(KeyframeObservationSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),result:z101.enum(["PASS","WARNING","FAIL"]),blockingKeys:z101.array(z101.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z101.array(z101.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),summary:z101.string().min(1).max(2e3),createdByPrincipalId:PrincipalIdSchema,createdAt:z101.iso.datetime({offset:true})});var DecideKeyframeSchema=KeyframeReviewScopeSchema.extend({candidateId:z101.uuid(),reviewId:z101.uuid(),expectedSelectionVersion:z101.int().nonnegative(),action:z101.enum(["ACCEPT","REJECT"]),acknowledgeWarnings:z101.boolean().default(false),reason:z101.string().trim().min(1).max(2e3),idempotencyKey:z101.string().trim().min(1).max(200)});var KeyframeReferenceScopeSchema=z101.strictObject({tenantId:TenantIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema});var RevokeKeyframeSchema=KeyframeReferenceScopeSchema.extend({acceptanceId:z101.uuid(),expectedSelectionVersion:z101.int().positive(),reason:z101.string().trim().min(1).max(2e3),idempotencyKey:z101.string().trim().min(1).max(200)});var KeyframeDecisionRecordSchema=z101.strictObject({id:z101.uuid(),tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,selectionVersion:z101.int().positive(),generationId:z101.uuid(),candidateId:z101.uuid(),reviewId:z101.uuid(),action:z101.enum(["ACCEPT","REJECT","REVOKE"]),reference:AcceptedKeyframeReferenceSchema.nullable(),previousAcceptanceId:z101.uuid().nullable(),warningKeys:z101.array(z101.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),acknowledgeWarnings:z101.boolean(),reason:z101.string().min(1).max(2e3),createdByPrincipalId:PrincipalIdSchema,createdAt:z101.iso.datetime({offset:true})});var KeyframeReviewTargetSchema=KeyframeReviewScopeSchema.extend({projectId:ProjectIdSchema,shotId:ShotIdSchema,framePurpose:KeyframePurposeSchema,preparationId:z101.uuid(),contractId:z101.uuid(),contractFingerprint:Fingerprint5,executionClass:z101.enum(["LIVE","TEST_ONLY"]),freshness:z101.enum(["CURRENT_BASIS","STALE_BASIS"]),runtimeSucceeded:z101.boolean(),productionRunnable:z101.boolean(),candidate:KeyframeCandidateSchema,requirements:z101.array(VisualRequirementSchema).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS),latestReview:KeyframeReviewRecordSchema.nullable(),reviewVersion:z101.int().nonnegative(),selectionVersion:z101.int().nonnegative(),activeAcceptanceId:z101.uuid().nullable()});var KeyframeReferenceViewSchema=KeyframeReferenceScopeSchema.extend({selectionVersion:z101.int().nonnegative(),status:z101.enum(["NONE","CURRENT","STALE"]),acceptance:KeyframeDecisionRecordSchema.nullable(),reference:AcceptedKeyframeReferenceSchema.nullable()});var KeyframeReviewQuerySchema=KeyframeReviewScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var KeyframeReviewPageSchema=z101.strictObject({items:z101.array(KeyframeReviewRecordSchema),page:QueryPageInfoSchema});var KeyframeReviewReceiptSchema=z101.strictObject({semanticStatus:z101.literal("SUCCESS"),review:KeyframeReviewRecordSchema,productionRevision:z101.int().positive()});var KeyframeDecisionReceiptSchema=z101.strictObject({semanticStatus:z101.literal("SUCCESS"),decision:KeyframeDecisionRecordSchema,productionRevision:z101.int().positive()});var KeyframeDecisionQuerySchema=KeyframeReferenceScopeSchema.extend({limit:QueryLimitSchema,next:ContinuationSchema.optional()});var KeyframeDecisionPageSchema=z101.strictObject({items:z101.array(KeyframeDecisionRecordSchema),page:QueryPageInfoSchema});var KeyframeReviewSummarySchema=z101.strictObject({reviewedCandidates:z101.int().nonnegative(),unreviewedCandidates:z101.int().nonnegative(),decisionCount:z101.int().nonnegative()});import{z as z106}from"zod";import{z as z105}from"zod";import{z as z103}from"zod";import{z as z102}from"zod";var Intent=z102.string().trim().min(1).max(300);var CameraIntentSchema=z102.strictObject({scale:z102.enum(["EXTREME_CLOSE_UP","CLOSE_UP","MEDIUM","WIDE","EXTREME_WIDE"]),framing:z102.enum(["CENTERED","OFF_CENTER","SYMMETRICAL","OVER_SHOULDER"]),angle:z102.enum(["EYE_LEVEL","HIGH","LOW","TOP_DOWN"]),movement:z102.enum(["STATIC","PAN","TILT","DOLLY","TRACK","ORBIT","CRANE","ZOOM"]),stability:z102.enum(["LOCKED","STABILIZED","HANDHELD"]),direction:z102.enum(["LEFT","RIGHT","UP","DOWN","FORWARD","BACKWARD","CLOCKWISE","COUNTERCLOCKWISE"]).optional(),lensIntent:z102.string().trim().min(1).max(120).optional()});var ShotTemporalBeatSchema=z102.strictObject({startSeconds:z102.number().min(0).max(30),endSeconds:z102.number().positive().max(30),action:Intent});var ShotDirectionSchema=z102.strictObject({camera:CameraIntentSchema,temporalBeats:z102.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}var PlanningClientKeySchema=z103.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/);var BoundaryRequirementSchema=z103.strictObject({attribute:z103.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,59}$/),value:z103.string().trim().min(1).max(300)});var ShotIntentSchema=z103.strictObject({narrativePurpose:z103.string().trim().min(1).max(600),subjectAction:z103.string().trim().min(1).max(600),targetDurationSeconds:z103.number().min(.5).max(30),subjectRequirements:z103.array(z103.string().trim().min(1).max(300)).max(16).default([]),cameraComposition:z103.string().trim().min(1).max(500).optional(),factualClaims:z103.array(StoryFactClaimSchema).max(16).default([]),requiresGeneratedKeyframe:z103.boolean().default(false),sourceMediaAllowed:z103.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=z103.strictObject({clientKey:PlanningClientKeySchema,shotId:ShotIdSchema.optional(),intent:ShotIntentSchema,entryBoundary:z103.array(BoundaryRequirementSchema).max(24).default([]),exitBoundary:z103.array(BoundaryRequirementSchema).max(24).default([])});var ScenePlanInputSchema=z103.strictObject({clientKey:PlanningClientKeySchema,sceneId:SceneIdSchema.optional(),purpose:z103.string().trim().min(1).max(800),locationContext:z103.string().trim().min(1).max(300).optional(),timeContext:z103.string().trim().min(1).max(300).optional(),entryBoundary:z103.array(BoundaryRequirementSchema).max(24).default([]),exitBoundary:z103.array(BoundaryRequirementSchema).max(24).default([]),shots:z103.array(ShotPlanInputSchema).min(1).max(24)});var ContinuityRequirementSchema=z103.strictObject({mode:z103.enum(["PERSIST","TRANSITION","REESTABLISH","REVIEW"]),attribute:z103.string().regex(/^[A-Za-z][A-Za-z0-9_.-]{0,59}$/),description:z103.string().trim().min(1).max(500)});var ContinuityEdgeInputSchema=z103.strictObject({fromShotKey:PlanningClientKeySchema,toShotKey:PlanningClientKeySchema,requirements:z103.array(ContinuityRequirementSchema).min(1).max(24)});var AcceptSceneShotPlanRequestSchema=z103.strictObject({tenantId:TenantIdSchema,expectedProductionRevision:z103.int().positive(),expectedStoryVersion:z103.int().positive(),revisionReason:z103.string().trim().min(1).max(1e3).optional(),idempotencyKey:z103.string().trim().min(1).max(200),scenes:z103.array(ScenePlanInputSchema).min(1).max(12),continuityEdges:z103.array(ContinuityEdgeInputSchema).max(64).default([])});var ShotPlanEntrySchema=z103.strictObject({shotId:ShotIdSchema,clientKey:PlanningClientKeySchema,ordinal:z103.int().positive(),planningRevision:z103.int().positive(),intent:ShotIntentSchema,entryBoundary:z103.array(BoundaryRequirementSchema).max(24),exitBoundary:z103.array(BoundaryRequirementSchema).max(24)});var ScenePlanEntrySchema=z103.strictObject({sceneId:SceneIdSchema,clientKey:PlanningClientKeySchema,ordinal:z103.int().positive(),purpose:z103.string().trim().min(1).max(800),locationContext:z103.string().trim().min(1).max(300).optional(),timeContext:z103.string().trim().min(1).max(300).optional(),entryBoundary:z103.array(BoundaryRequirementSchema).max(24),exitBoundary:z103.array(BoundaryRequirementSchema).max(24),shots:z103.array(ShotPlanEntrySchema).min(1).max(24)});var ContinuityEdgeSchema=z103.strictObject({id:ContinuityEdgeIdSchema,fromShotId:ShotIdSchema,toShotId:ShotIdSchema,requirements:z103.array(ContinuityRequirementSchema).min(1).max(24)});var SceneShotPlanVersionSchema=z103.strictObject({id:SceneShotPlanVersionIdSchema,planId:SceneShotPlanIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema,version:z103.int().positive(),storyVersionId:StoryVersionIdSchema,storyVersion:z103.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z103.int().positive(),scenes:z103.array(ScenePlanEntrySchema).min(1).max(12),continuityEdges:z103.array(ContinuityEdgeSchema).max(64),createdByPrincipalId:PrincipalIdSchema,createdAt:z103.iso.datetime({offset:true})});var AcceptSceneShotPlanResultSchema=z103.discriminatedUnion("semanticStatus",[z103.strictObject({semanticStatus:z103.literal("SUCCESS"),planVersion:SceneShotPlanVersionSchema,productionRevision:z103.int().positive(),activeSceneShotPlanVersion:z103.int().positive()}),z103.strictObject({semanticStatus:z103.literal("NEEDS_INPUT"),missingPrerequisites:z103.array(z103.literal("ACTIVE_STORY")).min(1)})]);import{z as z104}from"zod";var WriterScopeSchema=z104.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema,productionId:ProductionIdSchema});var WriterBasisSchema=WriterScopeSchema.extend({productionRevision:z104.int().positive(),briefVersionId:BriefVersionIdSchema,briefVersion:z104.int().positive()});var IntentSchema=z104.string().trim().min(1).max(600);var WriterAlternativeSchema=z104.strictObject({alternativeId:z104.string().regex(/^[a-z][a-z0-9_-]{0,39}$/),title:z104.string().trim().min(1).max(120),story:StoryContentSchema,rationale:z104.strictObject({coreMessage:IntentSchema,hook:IntentSchema,audienceFit:IntentSchema,pacingIntent:IntentSchema,endingIntent:IntentSchema,tradeoffs:z104.array(IntentSchema).max(6)}),beatDurationsSeconds:z104.array(z104.int().positive().max(60)).min(1).max(24)});var WriterProposalSchema=z104.strictObject({origin:z104.strictObject({kind:z104.literal("EXTERNAL_AGENT_HOST"),label:z104.string().trim().min(1).max(100)}),unknowns:z104.array(z104.string().trim().min(1).max(300)).max(8),alternatives:z104.array(WriterAlternativeSchema).min(1).max(3)});var ValidateWriterProposalSchema=z104.strictObject({basis:WriterBasisSchema,revisionReason:AcceptStoryRequestSchema.shape.revisionReason,proposal:WriterProposalSchema});var MissingBriefSchema=z104.strictObject({semanticStatus:z104.literal("NEEDS_INPUT"),missingPrerequisites:z104.array(z104.literal("ACTIVE_BRIEF")).min(1).max(1)});var WriterBriefResultSchema=z104.discriminatedUnion("semanticStatus",[z104.strictObject({semanticStatus:z104.literal("SUCCESS"),basis:WriterBasisSchema,briefVersion:BriefVersionSchema}),MissingBriefSchema]);var WriterAcceptanceDraftSchema=z104.strictObject({alternativeId:WriterAlternativeSchema.shape.alternativeId,projectId:ProjectIdSchema,productionId:ProductionIdSchema,request:AcceptStoryRequestSchema.omit({idempotencyKey:true})});var WriterValidationResultSchema=z104.discriminatedUnion("semanticStatus",[z104.strictObject({semanticStatus:z104.literal("SUCCESS"),advisory:z104.literal(true),basis:WriterBasisSchema,proposal:WriterProposalSchema,acceptanceDrafts:z104.array(WriterAcceptanceDraftSchema).min(1).max(3),limitations:z104.array(z104.enum(["PROSE_IS_CREATIVE_INTENT_NOT_FACT_VERIFIED","PACING_IS_ADVISORY_NOT_TIMELINE_TRUTH","ACCEPTANCE_RECHECKS_CURRENT_BASIS"])).length(3)}),MissingBriefSchema]);var DirectorScopeSchema=WriterScopeSchema;var DirectorBasisSchema=WriterBasisSchema.extend({storyVersionId:StoryVersionIdSchema,storyVersion:z105.int().positive(),sceneShotPlanVersionId:SceneShotPlanVersionIdSchema.nullable(),sceneShotPlanVersion:z105.int().positive().nullable()}).refine(value2=>value2.sceneShotPlanVersionId===null===(value2.sceneShotPlanVersion===null),"Current plan ID and version must both be present or null");var Intent2=z105.string().trim().min(1).max(600);var Plan=AcceptSceneShotPlanRequestSchema.pick({scenes:true,continuityEdges:true});var DirectorAlternativeSchema=z105.strictObject({alternativeId:z105.string().regex(/^[a-z][a-z0-9_-]{0,39}$/),title:z105.string().trim().min(1).max(120),plan:Plan,rationale:z105.strictObject({storyInterpretation:Intent2,visualApproach:Intent2,pacingIntent:Intent2,tradeoffs:z105.array(Intent2).max(6)}),shotStoryBeats:z105.array(z105.strictObject({shotKey:PlanningClientKeySchema,beatOrdinals:z105.array(z105.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=z105.strictObject({origin:z105.strictObject({kind:z105.literal("EXTERNAL_AGENT_HOST"),label:z105.string().trim().min(1).max(100)}),unknowns:z105.array(z105.string().trim().min(1).max(300)).max(8),alternatives:z105.array(DirectorAlternativeSchema).min(1).max(3)});var ValidateDirectorProposalSchema=z105.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=z105.strictObject({semanticStatus:z105.literal("NEEDS_INPUT"),missingPrerequisites:z105.array(z105.enum(["ACTIVE_BRIEF","ACTIVE_STORY"])).min(1).max(2)});var DirectorContextResultSchema=z105.discriminatedUnion("semanticStatus",[z105.strictObject({semanticStatus:z105.literal("SUCCESS"),basis:DirectorBasisSchema,briefVersion:BriefVersionSchema,storyVersion:StoryVersionSchema,sceneShotPlanVersion:SceneShotPlanVersionSchema.nullable(),stalePrerequisites:z105.array(z105.enum(["CURRENT_STORY","CURRENT_SCENE_SHOT_PLAN"])).min(1).max(2).optional()}),Missing]);var DirectorAcceptanceDraftSchema=z105.strictObject({alternativeId:DirectorAlternativeSchema.shape.alternativeId,projectId:DirectorScopeSchema.shape.projectId,productionId:DirectorScopeSchema.shape.productionId,request:AcceptSceneShotPlanRequestSchema.omit({idempotencyKey:true})});var DirectorValidationResultSchema=z105.discriminatedUnion("semanticStatus",[z105.strictObject({semanticStatus:z105.literal("SUCCESS"),advisory:z105.literal(true),basis:DirectorBasisSchema,proposal:DirectorProposalSchema,acceptanceDrafts:z105.array(DirectorAcceptanceDraftSchema).min(1).max(3),limitations:z105.array(z105.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]);var sha15=z106.string().regex(/^[0-9a-f]{64}$/);var evidenceIds=z106.array(ReviewEvidenceKeySchema).max(16);var ReviewIntelligenceTargetSchema=z106.discriminatedUnion("kind",[z106.strictObject({kind:z106.literal("IMAGE"),generationId:z106.uuid()}),z106.strictObject({kind:z106.literal("VIDEO"),generationId:z106.uuid()}),z106.strictObject({kind:z106.literal("ROUGH_CUT"),renderId:z106.uuid()}),z106.strictObject({kind:z106.literal("PROGRAMMATIC"),renderId:z106.uuid()})]);var ReviewIntelligenceContextInputSchema=z106.strictObject({scope:DirectorScopeSchema,target:ReviewIntelligenceTargetSchema});var ReviewIntelligenceBasisSchema=ReviewIntelligenceContextInputSchema.extend({contextFingerprint:sha15});var ReviewIntelligenceOwnerTargetSchema=z106.discriminatedUnion("kind",[z106.strictObject({kind:z106.literal("IMAGE"),target:KeyframeReviewTargetSchema}),z106.strictObject({kind:z106.literal("VIDEO"),target:VideoReviewTargetSchema}),z106.strictObject({kind:z106.literal("ROUGH_CUT"),target:RoughCutReviewTargetSchema}),z106.strictObject({kind:z106.literal("PROGRAMMATIC"),target:ProgrammaticVideoReviewTargetSchema})]);var review=z106.discriminatedUnion("kind",[z106.strictObject({kind:z106.literal("IMAGE"),observations:z106.array(KeyframeObservationSchema.extend({evidenceIds})).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),z106.strictObject({kind:z106.literal("VIDEO"),observations:z106.array(VideoObservationSchema.extend({evidenceIds})).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),z106.strictObject({kind:z106.literal("PROGRAMMATIC"),observations:z106.array(VideoObservationSchema.extend({evidenceIds})).min(1).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),z106.strictObject({kind:z106.literal("ROUGH_CUT"),observations:z106.array(RoughCutObservationSchema.extend({evidenceIds})).min(1).max(300),inspection:RoughCutInspectionSchema})]);var ValidateReviewIntelligenceSchema=z106.strictObject({basis:ReviewIntelligenceBasisSchema,proposal:z106.strictObject({origin:z106.strictObject({kind:z106.literal("EXTERNAL_AGENT_HOST"),label:z106.string().trim().min(1).max(100)}),summary:z106.string().trim().min(1).max(2e3),evidence:z106.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=z106.strictObject({semanticStatus:z106.literal("SUCCESS"),advisory:z106.literal(true),basis:ReviewIntelligenceBasisSchema,productionGuidance:ProductionGuidanceSchema.optional(),ownerContext:DirectorContextResultSchema,reviewTarget:ReviewIntelligenceOwnerTargetSchema,limitations:z106.array(z106.enum(["NO_IMPLICIT_MEDIA_OR_MODEL_CALL","READS_ARE_NOT_ATOMIC_OR_RESERVED"])).length(2)});var ReviewIntelligenceRecordDraftSchema=z106.discriminatedUnion("kind",[z106.strictObject({kind:z106.literal("PROGRAMMATIC"),input:RecordProgrammaticVideoReviewSchema.omit({idempotencyKey:true})}),z106.strictObject({kind:z106.literal("IMAGE"),input:RecordKeyframeReviewSchema.omit({idempotencyKey:true})}),z106.strictObject({kind:z106.literal("VIDEO"),input:RecordVideoReviewSchema.omit({idempotencyKey:true})}),z106.strictObject({kind:z106.literal("ROUGH_CUT"),input:RecordRoughCutReviewSchema.omit({idempotencyKey:true})})]);var ReviewIntelligenceIssueSchema=z106.strictObject({requirement:z106.union([VisualRequirementSchema,VideoReviewRequirementSchema,RoughCutRequirementSchema]),observation:z106.union([KeyframeObservationSchema,VideoObservationSchema,RoughCutObservationSchema]),evidenceIds,blocking:z106.boolean(),severity:z106.enum(["BLOCKING","WARNING"]),affectedScope:z106.strictObject({kind:z106.enum(["PRODUCTION","SHOT","TRANSITION","TIMELINE_REGION"]),interval:ReviewIntervalSchema,shotIds:z106.array(z106.uuid()).min(1).max(200)}).optional()});var ReviewIntelligenceValidationResultSchema=z106.strictObject({semanticStatus:z106.literal("SUCCESS"),advisory:z106.literal(true),basis:ReviewIntelligenceBasisSchema,proposal:ValidateReviewIntelligenceSchema.shape.proposal,canonicalRulePreview:z106.strictObject({source:z106.literal("EXISTING_CANONICAL_DOMAIN_RULES"),authoritative:z106.literal(false),evaluatorVersion:z106.enum(["keyframe-reference-v1","shot-review-v1","production-review-v1"]),result:z106.enum(["PASS","WARNING","FAIL"]),blockingKeys:z106.array(z106.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS),warningKeys:z106.array(z106.string()).max(MAX_SHOT_REVIEW_REQUIREMENTS)}),issueProposals:z106.array(ReviewIntelligenceIssueSchema).max(MAX_SHOT_REVIEW_REQUIREMENTS),recordDraft:ReviewIntelligenceRecordDraftSchema,limitations:z106.array(z106.enum(["EVIDENCE_DECLARATIONS_ARE_NOT_ATTESTED_PIXEL_READS","RULE_PREVIEW_IS_NOT_A_CANONICAL_REVIEW","RECORD_RECHECKS_CURRENTNESS_CAS_AND_EXECUTION_CLASS","ACCEPTANCE_REMAINS_A_SEPARATE_OWNER_DECISION"])).length(4)});import{z as z107}from"zod";var WorkspaceScopeSchema=z107.strictObject({tenantId:TenantIdSchema});var WorkspaceViewSchema=HumanTenantSchema;var skillUrl=z107.url().max(4096).refine(value2=>{try{const u=new URL(value2);return value2===value2.trim()&&![...value2].some(c=>c.charCodeAt(0)<=32||c.charCodeAt(0)===127)&&!u.username&&!u.password&&!/[?#]/.test(value2)&&(u.protocol==="https:"||u.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(u.hostname))}catch{return false}});var PublicDownloadDescriptorSchema=z107.discriminatedUnion("status",[z107.strictObject({status:z107.literal("AVAILABLE"),url:skillUrl}),z107.strictObject({status:z107.enum(["UNCONFIGURED","UNAVAILABLE"]),url:z107.null()})]);var WorkspaceCallerSchema=z107.strictObject({humanLinks:HumanLinksSchema.optional(),tenantId:z107.uuid(),principalId:z107.uuid(),serverOrigin:z107.url().refine(value2=>{const u=new URL(value2);return u.origin===value2&&!u.username&&!u.password&&!u.search&&!u.hash&&u.pathname==="/"&&(u.protocol==="https:"||u.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(u.hostname))}),skill:PublicDownloadDescriptorSchema,hostReleases:PublicDownloadDescriptorSchema});var WorkspacePageSchema=z107.strictObject({items:z107.array(WorkspaceViewSchema).max(100),possiblyTruncated:z107.boolean()});import{createHash as createHash3}from"node:crypto";import{z as z108}from"zod";import{createHash}from"node:crypto";function assertFederationExchangeReply(key3,i,r){let valid=true,write=false;if(key3==="federation.subscription.contract"){valid=r.subscription.revision===i.expectedRevision&&(!i.expectedSource||i.expectedSource===r.source)&&(r.status!=="READY"||(!i.expectedCatalogDigest||i.expectedCatalogDigest===r.catalogDigest)&&r.catalogDigest==="sha256:"+createHash("sha256").update(canonicalFederationCatalogJson(r.catalog)).digest("hex"))}if(key3==="federation.result.reference"){const ref=r.reference;valid=i.resourceType===ref.resourceType&&i.resourceId===ref.resourceId}if(key3==="federation.result.read")valid=canonicalFederationJson(i.reference)===canonicalFederationJson(r.reference)&&r.reference.digest==="sha256:"+createHash("sha256").update(canonicalFederationJson(r.value)).digest("hex");if(key3==="federation.receipt-route.configure"){write=true;valid=["grantRef","grantVersion","state","receiptProfile"].every(k=>i[k]===r[k])&&r.revision===Number(i.expectedRevision)+1&&Date.parse(String(i.notBefore))===Date.parse(String(r.notBefore))&&Date.parse(String(i.expiresAt))===Date.parse(String(r.expiresAt))}if(key3==="federation.receipt.query")valid=r.items.every(v=>(!i.routeId||v.routeId===i.routeId)&&(!i.inboxId||v.inboxId===i.inboxId)&&(!i.originDeliveryId||v.originDelivery?.deliveryId===i.originDeliveryId));if(key3==="federation.receipt.command")valid=i.requestId===r.requestId&&(!r.result||!("requestId"in r.result)||r.result.requestId===i.requestId);if(key3==="federation.receipt.recover"){write=true;valid=i.requestId===r.requestId&&r.generation===Number(i.expectedGeneration)+1&&r.attempts===i.expectedAttempts}if(key3==="federation.subscription.handoff")valid=i.expectedRevision===void 0||i.expectedRevision===r.subscription.revision;if(!valid)throw new NativeStudioSdkError("RESPONSE_SCOPE_MISMATCH","INTERNAL_OPERATIONAL_FAILURE",write?"UNKNOWN":"NO_WRITE")}import{createHash as createHash2}from"node:crypto";function validAcceptance(i,r){const b=r.binding;return b.bindingId===i.bindingId&&b.revision===i.expectedRevision&&(!i.expectedSource||i.expectedSource===r.source)&&(!i.expectedDigest||i.expectedDigest===r.digest)&&(r.document===null||r.digest==="sha256:"+createHash2("sha256").update(canonicalFederationReadJson(r.document)).digest("hex"))}function assertReceiptInboundReply(key3,i,r){if(!key3.startsWith("federation.receipt-inbound."))return;let valid=true;const write=key3.endsWith(".configure");if(key3.endsWith(".contract"))valid=validAcceptance(i,r);if(key3.endsWith(".handoff")){const inspection=r.inspection,delivery2=inspection.delivery;valid=delivery2.digest===i.expectedDeliveryDigest&&validAcceptance({...i,expectedDigest:i.expectedAcceptanceDigest},r.acceptance)}if(write)valid=["contractVersion","remoteService","source","remoteTenant","peerType","consumerRef","peerConsumerRef","peerTargetScope","grantRef","grantVersion","state"].every(k=>i[k]===r[k])&&r.revision===Number(i.expectedRevision)+1&&Date.parse(String(i.notBefore))===Date.parse(String(r.notBefore))&&Date.parse(String(i.expiresAt))===Date.parse(String(r.expiresAt));if(key3.endsWith(".command"))valid=i.requestId===r.requestId;if(key3.endsWith(".catalog"))valid=r.bindings.every(b=>b.tenantId===i.tenantId&&b.productionId===i.productionId&&b.effective==="ACTIVE");if(key3.endsWith(".query"))valid=r.items.every(v=>(!i.bindingId||v.bindingId===i.bindingId)&&(!i.originalDeliveryId||v.originalDeliveryId===i.originalDeliveryId));if(!valid)throw new NativeStudioSdkError("RESPONSE_SCOPE_MISMATCH","INTERNAL_OPERATIONAL_FAILURE",write?"UNKNOWN":"NO_WRITE")}function assertDeliveryInspectionReply(key3,i,raw){if(key3!=="federation.delivery.inspect")return;const d=raw.delivery,b=raw.receiptBinding;if(i.expectedSource&&i.expectedSource!==raw.source||i.expectedDigest&&i.expectedDigest!==d.digest||(i.receiptBindingId?b?.bindingId!==i.receiptBindingId:b!==null))throw new NativeStudioSdkError("RESPONSE_SCOPE_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}function assertFederationReply(key3,input,raw){if(!key3.startsWith("federation.")||!raw||typeof raw!=="object")return;const result=raw;assertDeliveryInspectionReply(key3,input,result);assertReceiptInboundReply(key3,input,result);assertFederationExchangeReply(key3,input,result);let valid=true;if(key3==="federation.inbound.configure"){valid=["contractVersion","source","remoteService","remoteTenant","consumerRef","grantRef","grantVersion","state"].every(k=>input[k]===result[k])&&result.revision===Number(input.expectedRevision)+1&&Date.parse(String(input.notBefore))===Date.parse(String(result.notBefore))&&Date.parse(String(input.expiresAt))===Date.parse(String(result.expiresAt))&&(!input.connectionRef||input.connectionRef===result.connectionRef)&&canonicalFederationJson(input.sourceSelection??null)===canonicalFederationJson(result.sourceSelection??null)}if(key3==="federation.inbound.replay")valid=input.requestId===result.requestId;if(key3==="federation.inbound.catalog")valid=result.bindings.every(b=>["tenantId","productionId"].every(k=>input[k]===b[k]));if(key3==="federation.inbound.signals"&&typeof input.after==="string"){const[first]=result.items;valid=first===void 0||first.inboxId>input.after}if(key3==="federation.inbound.signal-changes")valid=inboundSignalChangesMatch(input,result);if(key3==="federation.inbound.receipt")valid=input.kind==="COMMAND"?input.requestId===result.requestId&&(!result.result||!("requestId"in result.result)||input.requestId===result.result.requestId):["source","eventId","consumerRef"].every(k=>input[k]===result[k]&&(!result.result||input[k]===result.result[k]));if(key3==="federation.recover"){valid=input.requestId===result.requestId&&result.revision===Number(input.expectedRevision)+1&&(input.deliveryId??null)===result.deliveryId&&(input.kind!=="RETRY_HOLD"||input.expectedAttempts===result.attempts)}if(key3==="federation.receipt")valid=input.requestId===result.requestId;if(key3==="federation.query"){valid=result.items.every(r=>["routeId","eventId","deliveryId"].every(k=>input[k]===void 0||r[k]===input[k]))}if(key3==="federation.route.configure"||key3==="federation.subscription.set"){const route=key3==="federation.route.configure";const view=route?result:result.subscription;const refs=route?["remoteService","remoteTenant","grantRef"]:["subscriberKind","subscriberRef"];const arrays=route?["grantEventTypes","selectedEventTypes"]:["eventTypes"];valid=refs.every(k=>input[k]===view[k])&&arrays.every(k=>JSON.stringify([...input[k]].sort())===JSON.stringify([...view[k]].sort()))&&view.revision===Number(input.expectedRevision)+1&&view.state===input.state&&Date.parse(String(input.expiresAt))===Date.parse(String(view.expiresAt));if(route)valid=valid&&input.publicationMode===view.publicationMode&&Date.parse(String(input.notBefore))===Date.parse(String(view.notBefore))}if(!valid)throw new NativeStudioSdkError("RESPONSE_SCOPE_MISMATCH","INTERNAL_OPERATIONAL_FAILURE",key3==="federation.route.configure"||key3==="federation.subscription.set"||key3==="federation.inbound.configure"||key3==="federation.inbound.replay"||key3==="federation.recover"?"UNKNOWN":"NO_WRITE")}var success=z108.strictObject({semanticStatus:z108.literal("SUCCESS")});var same=(a,b)=>canonicalLocalJson(a??null)===canonicalLocalJson(b??null);var commandFingerprint=command2=>createHash3("sha256").update(canonicalLocalJson(command2)).digest("hex");function resultMatches(command2,raw){const schema=command2.kind==="ENROLL"?LocalDeviceViewSchema:command2.kind==="PREVIEW"?LocalPreviewAdmissionSchema:command2.kind==="FINAL_RENDER"?LocalFinalRenderAdmissionSchema:success;const parsed=schema.safeParse(raw);if(!parsed.success)return false;const result=parsed.data,original=command2.input;for(const key3 of["tenantId","projectId","deviceId","productionId","timelineVersionId"])if(key3 in original&&key3 in result&&String(result[key3]).toLowerCase()!==String(original[key3]).toLowerCase())return false;if(command2.kind==="ENROLL")return result.revokedAt===null&&(!command2.input.expectedPrincipalId||String(result.enrolledByPrincipalId).toLowerCase()===command2.input.expectedPrincipalId.toLowerCase())&&["publicKey","label","platform","runtimeVersion"].every(key3=>same(original[key3],result[key3]));if(command2.kind==="PREVIEW"||command2.kind==="FINAL_RENDER")return same(original.timelineFingerprint,result.timelineFingerprint)&&same(command2.input.placement,result.placement.policy);return true}function checkedManagementReceipt(rawCommand,rawReceipt){const command2=LocalDeviceManagementCommandSchema.parse(rawCommand);const receipt=LocalManagementReceiptSchema.parse(rawReceipt);if(receipt.fingerprint!==commandFingerprint(command2)||receipt.result!==null&&!resultMatches(command2,receipt.result))throw new NativeStudioSdkError("LOCAL_RECEIPT_INVALID","BLOCKED","NO_WRITE");return receipt}function checkedEnrollmentObservation(original,observation,write){const command2="kind"in original?original:void 0;const request="kind"in original?original.input:original;const bound=value2=>value2.tenantId.toLowerCase()===request.tenantId.toLowerCase()&&value2.requestId.toLowerCase()===request.requestId.toLowerCase();const invalid=()=>{throw new NativeStudioSdkError("DEVICE_ENROLLMENT_RESPONSE_INVALID","BLOCKED",write?"UNKNOWN":"NO_WRITE")};if(!bound(observation))invalid();const fingerprint2=command2&&commandFingerprint(command2);if(observation.state==="ISSUED"&&(!bound(observation.ticket)||fingerprint2&&observation.ticket.fingerprint!==fingerprint2))invalid();if(observation.state==="EXPIRED"&&fingerprint2&&observation.fingerprint!==fingerprint2)invalid();if(observation.state==="ENROLLED"){const{receipt}=observation;if(receipt.result.tenantId.toLowerCase()!==request.tenantId.toLowerCase()||command2&&(receipt.fingerprint!==fingerprint2||!resultMatches(command2,receipt.result)))invalid()}return observation}function assertManagementReceipt(key3,input,result){assertFederationReply(key3,input,result);if(key3==="device.management-receipt")checkedManagementReceipt(input.command,result);else if(key3==="device.enrollment.issue"||key3==="device.enrollment.lookup"){const write=key3==="device.enrollment.issue";const original=write?{kind:"ENROLL",input:DeviceEnrollmentIssueSchema.parse(input)}:DeviceEnrollmentLookupSchema.parse(input);checkedEnrollmentObservation(original,DeviceEnrollmentObservationSchema.parse(result),write)}else if(key3==="device.enroll"){const command2=LocalDeviceManagementCommandSchema.parse({kind:"ENROLL",input});if(!resultMatches(command2,result))throw new NativeStudioSdkError("RESPONSE_SCOPE_MISMATCH","INTERNAL_OPERATIONAL_FAILURE","UNKNOWN")}}export{LocalIdSchema,LocalDigestSchema,LocalRevisionSchema,LocalTimeSchema,LocalPackageVersionSchema,LocalProjectScopeSchema,LocalWorkScopeSchema,LocalDevicePlatformSchema,EnrollLocalDeviceSchema,LocalDeviceViewSchema,LocalDeviceChallengeSchema,RevokeLocalDeviceSchema,DeviceSetupRecoverySchema,ClipTransitionSchema,TimelineGraphicInputSchema,TimelineGraphicSchema,CaptionTranscriptPlanSchema,AuthorTranscriptCaptionsSchema,CaptionContentSchema,CaptionScopeSchema,AuthorCaptionsSchema,CaptionGetSchema,CaptionQuerySchema,CaptionViewSchema,CaptionReceiptSchema,CaptionBasisSchema,CaptionPageSchema,CaptionExportSchema,CaptionSnapshotSchema,CaptionTranscriptDraftSchema,LegacyCaptionRenderStyleSchema,RegularCaptionRenderStyleSchema,VoiceProfileRefSchema,VoiceLocaleSchema,VoiceProfileUseSchema,AudioReadScopeSchema,AudioImportRequestSchema,AudioGetSchema,AudioQuerySchema,AudioViewSchema,AudioReceiptSchema,AudioBasisSchema,AudioPageSchema,AudioSnapshotSchema,TimelineAudioInputSchema,ModelProfileIdSchema,ProviderSelectionSchema,ConfigureProviderInputSchema,ProviderConnectionViewSchema,ProviderConnectionCommandSchema,ProviderCredentialRevokeSchema,SetKeyframeDefaultSchema,GenerationCostQuoteSchema,PreparationIdSchema,GenerationContractIdSchema,ContentFingerprintSchema,PreparationTargetSchema,PreparationBasisSchema,ReferenceRoleSchema,ReferenceBindingInputSchema,ExactEvidenceReferenceSchema,PreparationBlockerSchema,ConstraintSetSchema,ReferenceSetSchema,VideoProviderProfileSchema,VideoOptionsInputSchema,VideoStartInputSchema,VideoDeviceStartInputSchema,VideoGetInputSchema,VideoQueryInputSchema,VideoAdmissionSchema,VideoGenerationViewSchema,VideoQueryPageSchema,VideoSummarySchema,RoughCutProfileIdSchema,AcceptedVisualSourceReferenceSchema,SourceSyncAudioStartSchema,SourceSyncAudioGetSchema,SourceSyncAudioVersionSchema,SourceSyncAudioReceiptSchema,SourceSyncAudioViewSchema,SpeechParametersSchema,kokoroCpuProfile,CpuSpeechInputSchema,CpuSpeechCapabilitySchema,CpuSpeechInstallationSchema,NativeSpeechExecutionSchema,SpeechScopeSchema,SpeechStartSchema,SpeechGetSchema,SpeechAdmissionSchema,SpeechGenerationViewSchema,LocalSpeechStartSchema,LocalSpeechAdmissionSchema,LocalSpeechGenerationViewSchema,SpeechOptionsSchema,KeyframeProviderProfileSchema,KeyframeStartInputSchema,KeyframeDeviceStartInputSchema,KeyframeGetInputSchema,KeyframeQueryInputSchema,KeyframeAdmissionSchema,KeyframeGenerationViewSchema,KeyframeQueryPageSchema,KeyframeMediaSchema,KeyframeSummarySchema,ProviderTenantInputSchema,ProviderDefaultViewSchema,ProviderConnectionPageSchema,ProviderModelsViewSchema,SpeechCostQuoteSchema,SpeechDeviceStartSchema,ProviderModelViewSchema,ConfigureProviderModelSchema,DisableProviderModelSchema,ProviderModelPageSchema,ProviderModelGetSchema,SoundPlanScopeSchema,SoundPlanValidateSchema,SoundPlanAcceptSchema,SoundPlanGetSchema,SoundPlanValidationSchema,SoundPlanViewSchema,SoundPlanReceiptSchema,SoundPlanContextSchema,TimelineVisualLayerInputSchema,processorFamilies,TenantProcessorKindSchema,referenceThumbnailProfile,DeviceRenderTargetSchema,DeviceRenderReceiptSchema,ProjectDeviceListInputSchema,ProjectDeviceListSchema,TimelineManifestReaderSchema,TimelineScopeSchema,BuildTimelineShapeSchema,BuildTimelineSchema,TimelineViewSchema,TimelineGetSchema,TimelineQuerySchema,TimelinePageSchema,TimelineBuildReceiptSchema,TimelineBasisSchema,TimelineSnapshotSchema,RoughCutStartSchema,RoughCutGetSchema,RoughCutQuerySchema,RoughCutAdmissionSchema,RoughCutViewSchema,RoughCutPageSchema,RoughCutSnapshotSchema,DeliveryPolicySchema,DeliveryPolicyInputSchema,DeliveryTargetSchema,DeliveryCheckKeySchema,DeliveryValidationReviewSchema,DeliveryApprovalSchema,DeliveryManifestLinkSchema,FinalDeliveryReceiptSchema,DecideFinalReadySchema,RevokeFinalReadySchema,FinalReadyViewSchema,FinalReadyQuerySchema,FinalReadyPageSchema,FinalReadyReceiptSchema,RoughCutReviewSnapshotSchema,FinalRenderStartSchema,FinalRenderGetSchema,FinalRenderQuerySchema,FinalRenderManifestReaderSchema,FinalRenderTechnicalSchema,FinalRenderAdmissionSchema,FinalRenderViewSchema,FinalRenderPageSchema,FinalRenderEligibilitySchema,FinalRenderSnapshotSchema,LocalLeaseBindingSchema,MediaCategorySchema,mediaCategoryOf,localLibraryProfile,LocalLibraryContentTypeSchema,LocalLibraryReferenceSchema,LocalLibraryItemSchema,LocalLibraryQuerySchema,LocalLibraryPageSchema,LocalLibraryProjectionSchema,LocalLibraryProjectionPageSchema,LocalLibraryProjectionQuerySchema,LocalLibraryImportSchema,LocalLibraryImportReceiptQuerySchema,LocalLibraryReadReplySchema,LocalLibraryGetSchema,LocalLibraryCallSchema,LocalLibraryCapabilitySchema,LocalLibraryUsageSchema,ListeningEvidenceSchema,CompositionFindingLocalitySchema,BriefContentSchema,AcceptBriefRequestSchema,AcceptBriefResultSchema,StoryContentSchema,AcceptStoryRequestSchema,StoryVersionSchema,AcceptStoryResultSchema,ConsistencyProfileContentSchema,ConsistencyProfileScopeSchema,ConsistencyProfileVersionQuerySchema,ConfigureConsistencyProfileSchema,ConsistencyProfileVersionSchema,ConsistencyProfileViewSchema,ConsistencyProfileReceiptSchema,RoughCutReviewScopeSchema,RoughCutRequirementSchema,RecordRoughCutReviewSchema,RoughCutReviewRecordSchema,RoughCutReviewTargetSchema,RoughCutFindingViewSchema,RoughCutReviewQuerySchema,RoughCutReviewPageSchema,RoughCutFindingQuerySchema,RoughCutFindingPageSchema,RoughCutReviewReceiptSchema,ReviewEvidenceKeySchema,ReviewEvidenceMediaSchema,whisperCppRecognitionProfile,LocalWhisperToolSelectionSchema,canonicalLocalJson,ObservationScopeSchema,ObservationStartSchema,ObservationGetSchema,ObservationAdmissionSchema,ObservationViewSchema,ObservationOptionsSchema,LocalObservationStartSchema,LocalObservationAdmissionSchema,LocalObservationViewSchema,QwenAsrDeviceQuoteInputSchema,QwenAsrCostQuoteSchema,QwenAsrDeviceStartSchema,QwenAsrDeviceAdmissionSchema,QwenAsrDeviceViewSchema,ProductionGuidanceContextSchema,VideoReviewScopeSchema,VideoReviewRequirementSchema,VideoObservationSchema,RecordVideoReviewSchema,VideoReviewRecordSchema,DecideVideoShotSchema,ShotAcceptanceScopeSchema,RevokeShotAcceptanceSchema,GeneratedShotAcceptanceDecisionSchema,ProgrammaticShotAcceptanceDecisionSchema,VideoReviewTargetSchema,ShotAcceptanceViewSchema,VideoReviewQuerySchema,VideoReviewPageSchema,ShotDecisionQuerySchema,ShotDecisionPageSchema,VideoReviewReceiptSchema,ShotDecisionReceiptSchema,ProgrammaticVideoReviewScopeSchema,ProgrammaticVideoReviewTargetSchema,RecordProgrammaticVideoReviewSchema,DecideProgrammaticShotSchema,ProgrammaticVideoReviewQuerySchema,ProgrammaticVideoReviewPageSchema,ProgrammaticVideoReviewReceiptSchema,BoundaryRequirementSchema,ShotIntentSchema,AcceptSceneShotPlanRequestSchema,ShotPlanEntrySchema,SceneShotPlanVersionSchema,AcceptSceneShotPlanResultSchema,WriterScopeSchema,ValidateWriterProposalSchema,WriterBriefResultSchema,WriterValidationResultSchema,DirectorScopeSchema,DirectorBasisSchema,ValidateDirectorProposalSchema,DirectorContextResultSchema,DirectorValidationResultSchema,KeyframeReviewScopeSchema,VisualRequirementSchema,KeyframeObservationSchema,RecordKeyframeReviewSchema,DecideKeyframeSchema,KeyframeReferenceScopeSchema,RevokeKeyframeSchema,KeyframeReviewTargetSchema,KeyframeReferenceViewSchema,KeyframeReviewQuerySchema,KeyframeReviewPageSchema,KeyframeReviewReceiptSchema,KeyframeDecisionReceiptSchema,KeyframeDecisionQuerySchema,KeyframeDecisionPageSchema,KeyframeReviewSummarySchema,ReviewIntelligenceContextInputSchema,ReviewIntelligenceBasisSchema,ValidateReviewIntelligenceSchema,ReviewIntelligenceContextResultSchema,ReviewIntelligenceValidationResultSchema,mediaObjectTransferPath,MediaBrowserContentTypeSchema,MediaObjectVersionSchema,MediaObjectTicketSchema,MediaBrowserReadTicketSchema,StartLocalPreviewSchema,LocalDeviceSessionSchema,LocalDeviceTransportConfigurationSchema,LocalPreviewAdmissionSchema,StartLocalFinalRenderSchema,LocalFinalRenderAdmissionSchema,LocalManagementCommandSchema,LocalManagementResultSchema,LocalManagementReceiptSchema,localManagementRoutes,LocalDeviceManagementCommandSchema,ScopedLocalManagementReceiptSchema,WorkspaceScopeSchema,WorkspaceViewSchema,WorkspaceCallerSchema,WorkspacePageSchema,DeviceEnrollmentIssueSchema,DeviceEnrollmentLookupSchema,DeviceEnrollmentTicketSchema,DeviceEnrollmentReceiptSchema,DeviceEnrollmentObservationSchema,deviceEnrollmentSigningInput,ComponentStatusSchema,WorkspaceStatusSchema,DeviceStatusInputSchema,DeviceStatusSchema,tenantRenderValidationProfile,TenantMediaWorkSchema,ImportedVisualOriginalRegisterSchema,ImportedVisualFromProjectSourceSchema,ImportedVisualOriginalReviseSchema,ImportedVisualNormalizeStartSchema,ImportedVisualGetSchema,ImportedVisualReviewSchema,ImportedVisualDecisionSchema,ImportedVisualOriginalViewSchema,ImportedVisualNormalizationViewSchema,DirectOriginalCommandSchema,DirectOriginalStageSchema,DirectOriginalSubmitSchema,ReadyArtifactRegistrationSchema,SourceInputMetadataSchema,UploadSourceInputRequestSchema,DirectProjectSourceCommandSchema,DirectProjectSourceStageSchema,DirectProjectSourceSubmitSchema,LocalLibraryCommandSchema,LocalLibraryCommandQuerySchema,LocalLibraryAdmissionSchema,LocalLibraryInspectionSchema,TemporalEvidenceSourceSchema,TemporalSamplingProfileSchema,TemporalEvidenceManifestSchema,CompositionPathSchema,CompositionScopeSchema,CompositionBasisPinSchema,CompositionBindingSchema,CompositionContentSchema,SubmitCompositionSchema,CompositionGetSchema,CompositionHistorySchema,CompositionInputFactSchema,CompositionReceiptSchema,CompositionViewSchema,CompositionPageSchema,CompositionDependencyManifestSchema,CompositionDependencyLockSchema,CompositionRenderStartSchema,CompositionRenderGetSchema,CompositionRenderReceiptSchema,CompositionRenderViewSchema,CompositionRenderCancellationSchema,RegisterVisualSequenceSchema,VisualSequenceGetSchema,LegacyVisualSequenceRegistrationSchema,VisualSequenceRegistrationAdmissionSchema,VisualSequenceViewSchema,VisualSequenceQuerySchema,VisualSequencePageSchema,importedNormalizationValidationProfile,TenantProcessorReceiptSchema,checkedManagementReceipt,checkedEnrollmentObservation,assertManagementReceipt};