
    ^h	                         S SK r S SKrS SKJr  SSKJr  S SKJrJrJ	r	  SS\
S\
S\
S	\S
\
4
S jjrS
\
4S jrS\
S
\
4S jr  SS\
S\
S\
S\
S\
S\
S\
S\
S
\
4S jjrS\
S\
S\
S
\
4S jrS\	\\/\4      S
\
4S jrg)    N)chatdbg_config   truncate_proportionally)AnyCallableListbeforetextaftermaxlenreturnc                 v    U(       a2  [        XS5      nU (       a  U S-   OSn U(       a  US-   OSnU  SU SU 3$ g)Ng      ?z:
 
z```
z
```
r   )r
   r   r   r   s       N/home/james-whalen/.local/lib/python3.13/site-packages/chatdbg/util/prompts.py_wrap_itr      sE    &tS9#)%r %2tfGE733    c                  t    U  Vs/ s H  n[        U5      S:  d  M  UPM     n nSR                  U 5      $ s  snf )Nr   r   )lenjoin)argsas     r   _concat_promptr      s3    *t!s1vzAtD*99T? +s   55	user_textc                 (    [        U 5      S:  a  U $ S$ )Nr   zWhat's the bug? Give me a fix.)r   )r   s    r   _user_text_itr      s    I*9P0PPr   stackerrordetailscommand_lineinputshistoryextrac                     [        [        SU 5      [        SX5      [        SU5      [        SU5      [        SU5      [        SU5      [        U5      5      $ )Nz The program has this stack tracez+The program encountered the following errorzThis was the command linezThis was the program's input3This is the history of some debugger commands I ranr   r   r   r   )r   r   r    r!   r"   r#   r$   r   s           r   build_initial_promptr(      sZ     3U;>O,l;/8FPUi  r   c                 V    [        [        SU 5      [        SU5      [        U5      5      $ )Nr&   r   r'   )r#   r$   r   s      r   build_followup_promptr*   0   s,    FPUi  r   	functionsc                    [         R                  S:X  a  [        R                  R	                  [        R                  R                  [        5      S[         R                   S35      n[        R                  R                  U5      (       dA  [        R                  R	                  [        R                  R                  [        5      S5      nO[         R                  nU  Vs/ s H&  n[        R                  " UR                  5      S   PM(     nn[        US5       nUR                  5       nUR                  SSR	                  U5      05      sS S S 5        $ s  snf ! , (       d  f       g = f)	Nr   zinstructions/z.txtzinstructions/default.txtdescriptionrr+   z

)r   instructionsospathr   dirname__file__modelexistsjsonloads__doc__openread
format_map)r+   	file_pathffunction_instructionsfiletemplates         r   initial_instructionsrA   8   s    ""b(GGLLGGOOH%~7K7K6LD'Q
	 ww~~i(()-EI #//	KTU9aTZZ		2=A9U	i	99;""K=R1S#TU 
	 V		s   "-E2E
E,)r   i   )r   r   )r6   r0   chatdbg.util.configr   r   r   typingr   r   r	   strintr   r   r   r(   r*   rA    r   r   <module>rG      s    	 . ) & &S  C c S S 
QS QS Q   	
     	*3 s s s VD3%*)=$> V3 Vr   