
    pj                        U d Z ddlmZ ddlmZ ddlmZmZ ddlm	Z	 dZ
 ed           G d	 d
                      ZddddZded<   ddZddZddZdS )z@Final short-form voiceover scripts for TrueTrace review renders.    )annotations)	dataclass)ScriptDraftvalidate_script_draft)ValidationResult)zin this videozunlock your full potentialzgame changerzyou won't believeT)frozenc                  ^    e Zd ZU ded<   ded<   ded<   ded<   ded<   dZd	ed
<   dZd	ed<   dS )FinalVoiceoverScriptstrcandidate_idtextlanguagevoiceinttarget_duration_seconds ztuple[str, ...]side_effectsexternal_callsN)__name__
__module____qualname____annotations__r   r   r       T/home/agent/jarvis_runtime/autoshortsbot/AutoShortsBot/autoshorts/audio/voiceover.pyr
   r
      sg         IIIMMMJJJ    $&L&&&&&(N((((((r   r
   )a  Your AI automation works perfectly in the demo. Then one weird email arrives. The name is missing. The format is different. The request is unclear. And suddenly the automation does the wrong thing confidently. That is not an AI problem. That is a workflow problem. Before you automate anything, decide three things. What should go through? What should be reviewed? And what should stop? If your AI does not know what to do with weird inputs, it will break the moment real life shows up.%   )aH  A smart prompt can still build a fragile workflow. The prompt is only one part. A system needs an input boundary, an output standard, a review step, and an action boundary. Without those, the same prompt behaves differently every week. Do not ask for a better prompt first. Ask what the workflow must refuse, review, and repeat.   )a1  AI notes fail when everything looks equally important. A pretty summary is not a decision system. Separate facts from decisions, risks, open questions, and next actions. Now the note tells you what changed, what matters, and what needs a human. Do not ask AI for more notes. Ask it for decision structure.   )%truetrace-ai-automation-quiet-rot-38sz.truetrace-prompt-vs-system-workflow-breaks-35sz'truetrace-ai-notes-equal-importance-34szdict[str, tuple[str, int]]_SCRIPTSr   r   returnc                    | t           vrt          d|            t           |          \  }}t          | |dd|          }t          |          }|j        s't          d                    |j                            |S )Nz unknown TrueTrace candidate id: enzen-GB-RyanNeural)r   r   r   r   r   ; )r   
ValueErrorr
   validate_final_voiceover_scriptis_validjoinerrors)r   r   durationscript
validations        r   build_truetrace_final_voiceoverr,   :   s    8##JLJJKKKl+ND(!!  (  F 188J 7:#455666Mr   	voiceoverr   c                |   t          |           }|j        s't          d                    |j                            | j        dk    rt          d          t          | j        dd| j        dddd| j        		  	        }t          |          }|j        s't          d                    |j                            |S )
zcCreate the render-planning script from the final voiceover so cards/captions match the spoken text.r#   r   zAaccessible script draft is only defined for the weird-email pilotz>Your AI automation works in the demo. Then real life shows up.zMYour AI automation works perfectly in the demo. Then one weird email arrives.)zEThe name is missing. The format is different. The request is unclear.z9Suddenly the automation does the wrong thing confidently.z6That is not an AI problem. That is a workflow problem.zADecide what goes through, what gets reviewed, and what must stop.zwA clean demo inbox is interrupted by one weird email, then splits into three simple paths: go through, review, or stop.z<Plan for the weird input before you automate the normal one.)	brief_idtitlehookscript_outlineretention_beatsvisual_conceptcaptionctaestimated_duration_seconds)
r%   r&   r$   r'   r(   r   r   r   r   r   )r-   r+   draftdraft_validations       r   ,build_accessible_script_draft_from_voiceoverr:   K   s     1;;J 7:#455666!HHH\]]]'N\ ~
+ `J#,#D#  E& -U33$ =#3#:;;<<<Lr   r*   r   c                D    g } j                                         s|                    d            j                                        s|                    d            j        dk    r|                    d            j                                        s|                    d           d j        cxk    rdk    sn |                    d           t           fd	t          D                       r|                    d
           t           j        
                                          dk    r|                    d            j        r|                    d            j        r|                    d           t          | t          |                    S )Nzcandidate_id is requiredztext is requiredr"   z#final voiceover language must be enzvoice is required   -   z1target_duration_seconds must be between 15 and 45c              3  N   K   | ]}|j                                         v V   d S )N)r   casefold).0phraser*   s     r   	<genexpr>z2validate_final_voiceover_script.<locals>.<genexpr>y   s6      
J
J6V[))+++
J
J
J
J
J
Jr   z0voiceover contains generic intro/filler languageZ   z"voiceover must stay under 90 wordsz+voiceover script must not have side effectsz-voiceover script must not have external calls)r&   r(   )r   stripappendr   r   r   r   any_GENERIC_FILLERlensplitr   r   r   tuple)r*   r(   s   ` r   r%   r%   m   s   F$$&& 20111; *()))$;<<<< +)***&06666B6666IJJJ

J
J
J
J/
J
J
JJJ JHIII
6;"$$:;;; ECDDD GEFFFZfFFFFr   N)r   r   r    r
   )r-   r
   r    r   )r*   r
   r    r   )__doc__
__future__r   dataclassesr   autoshorts.content.script_draftr   r   autoshorts.ideas.candidater   rG   r
   r   r   r,   r:   r%   r   r   r   <module>rP      s!   F F F " " " " " " ! ! ! ! ! ! N N N N N N N N 7 7 7 7 7 7 $) ) ) ) ) ) ) )	.70%( (    8   "   DG G G G G Gr   