
    5iYS                       d Z ddlmZ ddlmZmZ ddlmZ ddlmZm	Z	 ddl
mZmZ  G d dee      Z G d	 d
ee      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d d e      Z G d! d"e      Z G d# d$e      Z G d% d&e      Z G d' d(e      Z G d) d*e      Z G d+ d,e      Z  G d- d.e      Z!y/)0zr
Pydantic data models for the AI Video Production Pipeline.
All data flows between agents use these typed models.
    )annotations)datetimetimezone)Enum)AnyOptional)	BaseModelFieldc                      e Zd ZdZdZdZdZy)TargetPlatformtiktokinstagram_reelsyoutube_shortsyoutubeN)__name__
__module____qualname__TIKTOKINSTAGRAM_REELSYOUTUBE_SHORTSYOUTUBE     //root/.openclaw/workspace/visionaryfx/models.pyr   r      s    F'O%NGr   r   c                      e Zd ZdZdZdZy)PipelineModeplanplan_imagesgenerateN)r   r   r   PLANPLAN_AND_IMAGESGENERATEr   r   r   r   r      s    D#OHr   r   c                     e Zd ZU dZ ed      Zded<    ed      Zded<    eed	      Z	d
ed<    eed	      Z
d
ed<    eed	      Zd
ed<    ed      Zded<    ed      Zded<    ed      Zded<    ed      Zded<    ed      Zded<    ed      Zded<    edd      Zded <    edd!      Zded"<    edd#      Zded$<    edd%      Zded&<    edd'      Zded(<   y))*CharacterTemplateuD   Immutable character DNA – repeated verbatim in every image prompt.z+Short identifier for the character templatedescriptionstrnamez^Full physical description of the character. This is injected verbatim into every image prompt.physical_descriptionz-Visual style keywords applied to every promptdefault_factoryr&   	list[str]style_keywordsz0Keywords to explicitly exclude from every promptnegative_keywordszgAbsolute prohibitions - things that MUST NEVER appear in any image. More strict than negative_keywords.hard_prohibitionszMedium or medium-wide shot, eye-level or chest-level camera, no extreme angles, no dramatic lens changes, same framing logic across scenesdefaultcamera_settingsz_Real-world lighting matching the environment, natural shadows, photorealistic cinematic realismlighting_settingszThe character's POSE, BODY POSITION, and GESTURE MUST change per scene to match the script. DO NOT keep a neutral standing pose unless the script explicitly implies it. DO NOT repeat identical poses in consecutive scenes.	pose_rulezInfer the environment directly from the script. Place the character naturally inside that environment. Environment must be realistic and context-appropriate. Vary environments across scenes for visual dynamism.environment_ruleaE  Analyze the script to determine contextually appropriate clothing. ONE clothing style is defined at the start and maintained consistently across ALL scenes unless the script explicitly implies a change. Clothing must be REALISTIC and contextually believable. Always describe clothing in FULL DETAIL (color, fabric type, fit).clothing_ruleuc  When the script mentions a BODY PART, ORGAN, HEALTH CONDITION, PAIN, or PHYSICAL SYMPTOM, that specific body area MUST be visually highlighted. Use distinct COLOR CODING:
- PAIN/INFLAMMATION → Pulsing deep red or orange glow
- FATIGUE/WEAKNESS → Faded blue-grey desaturation
- BLOCKAGE/TENSION → Dense dark purple or black pressure cloud
- DAMAGE/INJURY → Fractured visualization with amber-red highlight
- HEALING/RECOVERY → Soft golden or green luminescent glow
- NERVE SIGNAL/ACTIVITY → Electric blue or cyan pulse lines
The highlight must look MEDICAL and SCIENTIFIC, not stylized or cartoonish.anatomical_highlight_rules zhPhilosophy for showing consequences instead of symptoms. Maps script concepts to representative actions.r1   r&   consequence_philosophyz?Rules for death scenes: camera angle, posture, visual elements.death_scene_rulesz:Rules for depicting children: always abstract silhouettes.child_rulesz?Rules for infected/zombie characters: color + posture, no gore.zombie_rulesz>Rules for shot variety and intercalation throughout the video.shot_intercalation_rulesN)r   r   r   __doc__r
   r(   __annotations__r)   listr-   r.   r/   r2   r3   r4   r5   r6   r7   r:   r;   r<   r=   r>   r   r   r   r$   r$   $   s   N"OPD#P %=!#  !&C!NI  $)F$y  $).$y 
 !XOS  #+s  aIs 
 "Tc 
 MM3  ',V
' 
 #(:#C 
 #Us  PK  UL#  %*T%c r   r$   c                     e Zd ZU  edd      Zded<    edd      Zded<    ed	d
      Zded<    eddd      Zded<    eddd      Z	ded<    eddd      Z
ded<    eddd      Zded<    edd      Zded<    edd      Zded<    edd      Zded<    ed d!      Zded"<    edd#d$d%&      Zded'<    ed(d)      Zded*<    ed+d,      Zd-ed.<   y+)/VoiceSettings
chatterboxz*TTS provider: 'chatterbox' or 'elevenlabs'r9   r'   tts_providerJBFqnCBsd6RMkjVDRZzbzElevenLabs voice IDvoice_ideleven_multilingual_v2zElevenLabs model IDmodel_idg      ?g        g      ?)r1   gelefloat	stabilityg      ?similarity_booststyleg       @speedptz5Language code for ChatterBox (e.g., 'pt', 'en', 'es')chatterbox_languager8   z4Path to reference audio for voice cloning (optional)chatterbox_voice_refopenaizTTS model: openai or elevenlabspollinations_modelnovazPollinations voice namepollinations_voiceg      ?g      @zSpeech speedr1   rJ   rK   r&   pollinations_speedmp3z,Audio format: mp3, opus, aac, flac, wav, pcmpollinations_formatNz"Optional API key for higher limitsOptional[str]pollinations_api_key)r   r   r   r
   rE   r@   rG   rI   rM   rN   rO   rP   rR   rS   rU   rW   rY   r[   r]   r   r   r   rC   rC   x   s   l@lmL#m "8F[\Hc\":H]^Hc^SSS9Iu9#DSSAeA5E555E55  %T?vww %b>t u#u $HBcdd#F@YZZ %cdsP^ __$U@noo*/Jn*o-or   rC   c                  ~    e Zd ZU  ed      Zded<    ed      Zded<    ed      Zded	<    ed
      Zded<   y)ExportSettings	1080x1920r0   r'   
resolution   intfpsmp4video_formatz9:16aspect_ratioN)	r   r   r   r
   ra   r@   rd   rf   rg   r   r   r   r_   r_      s>    K0J0R C e,L#,f-L#-r   r_   c                      e Zd ZU dZ ed      Zded<    ed      Zded<    ed	      Zded
<    ed      Z	ded<    ed      Z
ded<    edd      Zded<    edddd      Zded<    edd      Zded<   y)SceneAnalysisz7Output of the Script Analyzer agent for a single scene.z%Sequential scene number starting at 1r%   rc   scene_numberz(Physical setting / location of the scener'   environmentz8Character pose, body position and gesture for this scenepose_actionz"Emotional tone / mood of the scenemoodz0Exact narration text to be spoken for this scenenarration_textr8   z/Optional delivery notes (pace, emotion, pauses)r9   narration_notes      
   zImportance score for coverage (1-10). Higher = more likely to get multi-angle coverage. 10=climax/action, 7-9=emotional intensity, 4-6=normal, 1-3=transition/expositionrX   coverage_priorityFzAI-determined: does this scene benefit from multi-angle coverage? True for action, emotion, climax. False for exposition, transition, static scenes.boolneeds_coverageN)r   r   r   r?   r
   rj   r@   rk   rl   rm   rn   ro   rs   ru   r   r   r   ri   ri      s    A*QRL#R)STKTNK  "FGD#GFNC  !EOS  #[	s  !]ND r   ri   c                      e Zd ZU dZ ed      Zded<    ed      Zded<    ed	      Zd
ed<    edd      Z	ded<   y)SceneBreakdownz-Complete output of the Script Analyzer agent.zShort title for the videor%   r'   titlezTotal number of scenesrc   total_sceneszOrdered list of sceneszlist[SceneAnalysis]scenesr8   zBrief summary of the storyr9   summaryN)
r   r   r   r?   r
   rx   r@   ry   rz   r{   r   r   r   rw   rw      sH    7#>?E3?*BCL#C"'4L"MFM1MNGSNr   rw   c                     e Zd ZU dZ ed      Zded<    ed      Zded<    ed      Zd	ed
<    ed      Z	d	ed<    ed      Z
d	ed<    ed      Zd	ed<    ed      Zd	ed<    ed      Zd	ed<    ed      Zd	ed<    ed      Zd	ed<    edd      Zd	ed<    edd      Zd	ed<    edd      Zd	ed <    ed!d"      Zd#ed$<    ed%d&      Zded'<    edd(      Zd	ed)<   y!)*Framez5A single visual frame expanded from a narrative beat.z,Global sequential frame number starting at 1r%   rc   frame_numberz0Which narrative beat/scene this frame belongs toparent_scenezCamera shot type: wide shot, medium shot, medium close-up, close-up, extreme close-up, low angle, high angle, dutch angle, POV, over-the-shoulder, tracking shot, establishing shotr'   camera_shotzfCamera movement: static, slow pan left/right, dolly forward/back, slight drift, tilt up/down, crane upcamera_movementznComposition: centered, rule of thirds left/right, foreground emphasis, background depth, symmetrical, diagonalcompositionz)Specific environment focus for this frameenvironment_detailz1Specific character pose and action for this framerl   z%Emotional tone of this specific framerm   z6What the viewer's eye should be drawn to in this framevisual_focusz6The narration text spoken during this frame's durationrn   r8   z)Delivery notes for this frame's narrationr9   ro   zExact word or short phrase (1-5 words) from the script that this frame represents. This is the editing anchor - the moment in the audio where this image should cut in.	sync_wordzIf the frame involves a body part, organ, or health condition, describe the anatomical highlight with color coding (e.g., 'lower back - red/orange glow for pain'). Leave empty if no anatomical highlight is needed.anatomical_highlightNzID grouping frames that show the same scene from different angles. Frames with the same coverage_group_id represent the same moment with different camera angles.r\   coverage_group_idr   zMIndex within coverage group: 0=master/wide, 1=medium, 2=close-up, 3+=variantscoverage_angle_indexzeType of coverage angle: 'master', 'medium', 'close-up', 'reverse', 'insert', or empty if not coveragecoverage_angle_type)r   r   r   r?   r
   r~   r@   r   r   r   r   r   rl   rm   r   rn   ro   r   r   r   r   r   r   r   r   r}   r}      sy   ?*XYL#Y*\]L#]CK 
 !COS  GK  $?  GK  "IJD#JLL#   LNC  !?OS  _Is 
 !&<!#  (-i(} 
 !&c!#   %{  r   r}   c                  :    e Zd ZU dZded<   ded<   ded<   ded<   y	)
ExpandedFrameBreakdownu?   Output of the FrameExpander agent – all frames for the video.r'   rx   r{   rc   total_frameszlist[Frame]framesNr   r   r   r?   r@   r   r   r   r   r     s    IJLr   r   c                  D   e Zd ZU dZded<    ed      Zded<    ed      Zded	<    ed
d      Zded<    ed
d      Z	ded<    ed
d      Z
ded<    ed
d      Zded<    ed
d      Zded<    ed
d      Zded<    ed
d      Zded<    ed
d      Zded<   y)ScenePromptsz7Output of the Prompt Engineer agent for a single frame.rc   rj   zwFull standalone image generation prompt with complete character description, environment, pose, camera, lighting, styler%   r'   image_promptzyImage-to-video motion prompt describing character action joint-by-joint with kinetic chain, timing, and muscle visibilityvideo_promptr8   zjExact word or short phrase (1-5 words) from the script - the editing anchor where this image should cut inr9   r   z_Body part + real anatomical structure (e.g., 'quadriceps expanding with visible muscle fibers')r   z=Full clothing description for this scene (color, fabric, fit)clothing_descriptionz"Environment/setting for this scenerk   z<Emotional tone of this scene (e.g., confusion, relief, fear)emotional_tonezVNamed camera movement from library (e.g., 'SLOW PUSH IN', 'ORBIT', 'PULL BACK REVEAL')camera_movezDetailed character action joint-by-joint with kinetic chain, muscle visibility, timing in seconds, and transition to next scenecharacter_actionzaPhysical SFX for the scene (e.g., 'deep snow crunch per step, wood whistle'). NO music. NO voice.sound_effectsN)r   r   r   r?   r@   r
   r   r   r   r   r   rk   r   r   r   r   r   r   r   r   r     s   ALL#  KL#  <Is 
 !&u!#  !&S!#  8K   RNC 
 lK  "Mc 
 M3 r   r   c                  .    e Zd ZU dZ ed      Zded<   y)BatchScenePromptsuP   Output of a batched PromptEngineer call — prompts for multiple frames at once.z+List of prompts, one per frame in the batchr%   list[ScenePrompts]rz   N)r   r   r   r?   r
   rz   r@   r   r   r   r   r   F  s    Z!&A"F r   r   c                      e Zd ZU dZded<   y)AllScenePromptsz.Complete collection of prompts for all frames.r   rz   Nr   r   r   r   r   r   N  s    8r   r   c                  V    e Zd ZU dZded<    ed      Zded<    edd	
      Zded<   y)SceneTTSz8Output of the TTS Scriptwriter agent for a single scene.rc   rj   z5Exact text to send to ElevenLabs for voice generationr%   r'   tts_textr8   z,Voice acting direction (tone, pace, emotion)r9   voice_directionN)r   r   r   r?   r@   r
   r   r   r   r   r   r   r   T  s8    BKHc  !BOS r   r   c                      e Zd ZU dZded<   y)AllSceneTTSz.Complete output of the TTS Scriptwriter agent.zlist[SceneTTS]rz   Nr   r   r   r   r   r   a  s    8r   r   c                      e Zd ZU dZded<    ed      Zded<    ed      Zded	<    ed
      Zded<    ed      Z	ded<    edd      Z
ded<   y)SceneTimelinez"Timeline entry for a single scene.rc   rj   zStart time in MM:SS formatr%   r'   
time_startzEnd time in MM:SS formattime_endzDuration in secondsrL   duration_secondszExact cut point in MM:SS format	cut_pointzcrossfade 0.3szTransition type to next scener9   
transitionN)r   r   r   r?   r@   r
   r   r   r   r   r   r   r   r   r   r   k  sc    ,(DEJE&@AHcA#0EFeF'HIIsI 3J r   r   c                  B    e Zd ZU dZded<    ed      Zded<   ded	<   y
)Timelinez Complete timeline for the video.rL   total_duration_secondszTotal duration in MM:SSr%   r'   total_duration_formattedzlist[SceneTimeline]rz   N)r   r   r   r?   r@   r
   r   r   r   r   r   r   y  s"    *!!$)6O$PcPr   r   c                     e Zd ZU dZded<   ded<   ded<   ded<   ded	<   ded
<   ded<   ded<   ded<    ed      Zded<    ed      Zded<    ed      Zded<    ed      Z	ded<   ded<   ded<   ded<   ded<   ded<    edd      Z
ded<    edd      Zded <    edd!      Zded"<    edd#      Zded$<    ed%d&      Zd'ed(<    ed)d*      Zded+<    edd,      Zded-<   y%).ProductionScenez8A single frame with ALL production information combined.rc   rj   r'   r   r   rL   r   r   r   rk   rl   rm   zmedium shotr0   r   staticr   centeredr   r8   r   r   r   r   r   ro   z)Editing anchor word/phrase from narrationr9   r   zBody part + color if applicabler   zFull clothing descriptionr   zEmotional tone of this scener   NzAID grouping frames that show the same scene from different anglesr\   r   r   z;Index within coverage group: 0=master, 1=medium, 2=close-upr   z<Type of coverage angle: 'master', 'medium', 'close-up', etc.r   )r   r   r   r?   r@   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r     s'   BOMNO
I]3K3 2OS2Z0K0b)L#)M23^_Is_ %b>_ `#` %b>Y Z#Z8VWNCW (-W(}  !&Q!#   %R  r   r   c                      e Zd ZU dZded<   ded<   ded<   ded<   ded	<   ded
<   ded<   ded<   ded<   ded<    eed      Zded<   y)ProductionPlanuB   The complete production plan – the final output of the pipeline.r'   rx   r{   r   rL   r   rc   ry   target_platformcharacter_template_namerC   voice_settingsr_   export_settingszlist[ProductionScene]rz   z5Step-by-step instructions to assemble the final videor*   r,   assembly_instructionsN)r   r   r   r?   r@   r
   rA   r   r   r   r   r   r     sW    LJL!!!!  !!##!!',K(9 r   r   c                  >   e Zd ZU dZ ed      Zded<    edd      Zd	ed
<    edd      Zded<    edd      Z	d	ed<    edd      Z
d	ed<    edd      Zded<    edd      Zded<    edd      Zded<    edd      Zd	ed<    ed d      Zded<   y) PipelineEventzAEvent emitted during pipeline execution for real-time UI updates.zeType of event: agent_start, agent_complete, agent_progress, image_generated, pipeline_complete, errorr%   r'   
event_typeNzAgent number 1-5r9   zOptional[int]agent_numberzHuman-readable agent namer\   
agent_namezCurrent progress countprogress_currentzTotal items to processprogress_totalr8   zHuman-readable status messagemessagezArbitrary event datazOptional[dict[str, Any]]datazBase64-encoded generated imageimage_base64zScene number for imageimage_scene_numberc                 d    t        j                  t        j                        j	                         S )N)r   nowr   utc	isoformatr   r   r   <lambda>zPipelineEvent.<lambda>  s    X\\ : D D F r   zISO 8601 timestampr*   	timestamp)r   r   r   r?   r
   r   r@   r   r   r   r   r   r   r   r   r   r   r   r   r   r     s    K4J  #(BT"UL-U %d@[ \J\&+DF^&_m_$)$D\$]NM]1PQGSQ%*4E[%\D
"\"'Bb"cL-c(-dH`(aaF(Is r   r   c                     e Zd ZU dZej
                  Zded<    ed      Z	ded<   e
j                  Zded	<   d
Zded<    ee      Zded<    ee      Zded<    ed      Zded<    edd      Zded<    edd      Zded<    edd      Zded<    edd       Zd!ed"<    ed#d$      Zd%ed&<    ed'd(d)d*+      Zd!ed,<    ed-d.      Zded/<   y
)0PipelineConfigz'Runtime configuration for the pipeline.r   modezopenai/gpt-4or0   r'   	llm_modelr   r   NzOptional[CharacterTemplate]character_template)r+   rC   r   r_   r   output
output_dirg      @z:Words per second for duration estimation (default 150 wpm)r9   rL   speaking_rate_wpsg      @z!Minimum scene duration in secondsmin_scene_durationg333333?z-Transition duration between scenes in secondstransition_duration   z1Target number of image frames per minute of videorc   frames_per_minuteFz?Generate multiple camera angles for each scene (coverage shots)rt   enable_coverage_shots      rp   z3Number of camera angles to generate per scene (2-5)rX   coverage_angles_per_sceneallzECoverage mode: 'all' (every scene) or 'smart' (AI decides key scenes)coverage_mode)r   r   r   r?   r   r    r   r@   r
   r   r   r   r   r   rC   r   r_   r   r   r   r   r   r   r   r   r   r   r   r   r   r     s&   1%**D,*?3Is3&4&;&;O^;6:3:$)-$HNMH&+N&KO^KH-J-$P u  !&7!  "'C"  #Gs  #(U#4  &+I	&s  [M3 r   r   N)"r?   
__future__r   r   r   enumr   typingr   r   pydanticr	   r
   r'   r   r   r$   rC   r_   ri   rw   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s  
 # '    %S$ 3 M	 MhpI p0.Y .I @OY O<I <~Y /9 /d	 i 
y 
) I  y  &i &RY 6I 2)Y )r   