
    q]^j                        d dl Z d dlZd dlZd dlZd dlmZ  ee                                          j        d         Z	e	dz  Z
e	dz  Ze	dz  Ze	dz  Ze	dz  Ze	d	z  Ze	d
z  Ze	dz  Z ej        dej                  Zd Zd Zedk    rS	  ej         e                       dS # e$ r0Z ede ej                    ej        d           Y dZ[dS dZ[ww xY wdS )    N)Path   zstory/chapterszstory/spoken-narration.txtzstory/story-canon.txtzstory/draft-report.jsonzscript/story-brief.jsonzscript/outline.jsonzscript/identity-registry.jsonzscript/reveal-ledger.jsonu   [^\W_]+(?:['’-][^\W_]+)*c                 r    t          j        |                                                                           S )N)hashlibsha256
read_bytes	hexdigest)paths    script/validate-story.pyshar      s(    >$//++,,66888    c                     t           t          t          t          t          t
          t          g} d t          dd          D             }|                     |           d | D             }|r%t          dd
                    |          z             t          j        t                               d                    }t          j        t                              d                    d	
                    d
 |D                       dz   }t
                              d          }t                              d          }t          t                              |                    }t#          |d         d                   }t#          |d         d                   }	t%          t
                    t%          t                    t%          t                    t%          t                    t%          t                    d}
||k    ||k    ||cxk    o|	k    nc                     d          du                     d          dk                        d          |k                        d          |
d         k                        d          |
d         k                        d          |
d         k    o=                    d          |
d         k    o                    d          |
d         k    t)          fdd D                       d!
}t)          |                                          }||||	gt-          |d"z  d#          |
|d$}t/          t          j        |d%&                     |rd'ndS )(Nc                 ,    g | ]}t           d |ddz  S )zchapter-02dz.txt)CHAPTERS).0indexs     r   
<listcomp>zmain.<locals>.<listcomp>   s,    PPP%5e55555PPPr   r      c                     g | ]B}|                                 r|                                j        d k    3t          |          CS )r   )is_filestatst_sizestrr   r
   s     r   r   zmain.<locals>.<listcomp>   sA    ```TT\\^^`tyy{{GZ^_G_G_s4yyG_G_G_r   zStory gate missing artifacts: z, utf-8encodingz


c              3   f   K   | ],}|                     d                                           V  -dS )r   r   N)	read_textrstripr   s     r   	<genexpr>zmain.<locals>.<genexpr>!   s<      ZZ4>>7>;;BBDDZZZZZZr   
target_wordsminmax)spokencanonoutlineidentityrevealverifiedTchapters
   
word_countspoken_sha256r'   canon_sha256r(   outline_sha256r)   identity_sha256r*   reveal_sha256r+   c              3   n   K   | ]/}                     d i                                |          du V  0dS )checksTN)get)r   keyreports     r   r"   zmain.<locals>.<genexpr>8   s\        Z  ZsHb1155c::dB  Z  Z  Z  Z  Z  Zr   )global_coherencecomprehensiondialogueoriginalityr+   )

exact_joincanon_byte_identical
word_rangereport_verifiedchapter_countreport_word_countreport_spoken_hashreport_canon_hashreport_authority_hashes	qa_checks      )r,   r/   accepted_rangeduration_minutes_at_231_wpmhashesr6   F)ensure_asciir   )BRIEFOUTLINEIDENTITYREVEALREPORTSPOKENCANONrangeextendRuntimeErrorjoinjsonloadsr    lenWORD_REfindallintr   r7   allvaluesroundprintdumps)requiredr-   missingbriefjoinedr'   r(   wordslowhighrL   r6   r,   resultr9   s                 @r   mainrl      s   w&&&%HHPP5B<<PPPHOOH``X```G R;dii>P>PPQQQJu8899EZ(('(::;;F]]ZZQYZZZZZ]aaFw//FOOWO--E''((E
eN#E*
+
+Cu^$U+,,Df++Uw<<MMf++ F & %U****d****!::j11T9J//25#ZZ55>$jj99VH=MM#ZZ776'?J#)::.>#?#?6)CT#T  $AY_YcYcduYvYv  {A  BL  {M  ZM  $A  RX  R\  R\  ]l  Rm  Rm  qw  x@  qA  RA  Z  Z  Z  Z  OY  Z  Z  Z  Z  Z F 6==??##H"%CQU;w|  ~C  FI  ~I  KL  xM  xM  Y_  kq  r  rF	$*V%
0
0
011111ar   __main__zStory gate blocked: )file)r   rY   resyspathlibr   __file__resolveparentsPROJECTr   rS   rT   rR   rN   rO   rP   rQ   compileUNICODEr\   r   rl   __name__exit	Exceptionexcrb   stderr r   r   <module>r~      s{     				 



      
$x..
 
 
"
"
*1
-%%	/	/))	,	,++
)
)44	.	.
"*2BJ
?
?9 9 9%  %  % P z   *S**<<<< s   
B$ $C)%CC