+
    ~j$                       ^ RI Ht ^ RIt^ RIHtHt ^ RIHtHtH	t	H
t
HtHt ^ RIHtHtHtHtHt ^ RIHt ^RIHtHtHt ^RIHt ^R	IHtHtHtHtH t H!t!H"t"H#t# ^R
I$H%t% ^RI&H't'H(t( ^RI)H*t*H+t+ ^RI,H-t-H.t. ^RI/H0t0 ]'       d   ^RI1H2t2 ]! R4      t3 ! R R]
]3,          4      t4]R1,          t5]R2,          t6]R3,          t7 ! R R]4      t8 ! R R]4      t9 ! R R]4      t: ! R R]4      t; ! R R]4      t< ! R R]4      t= ! R R ]4      t> ! R! R"]4      t? ! R# R$]4      t@ ! R% R&]4      tA ! R' R(]4      tB ! R) R*]4      tC] ! R+ R,]D]4      4       tE ! R- R.]4      tF]]:]8,          ]9,          ];,          ]<,          ]=,          ]?,          ]@,          ]A,          ]C,          ]F,          ],          ]! R/R07      3,          tGR# )4    )annotationsN)Enumunique)TYPE_CHECKING	AnnotatedAnyGenericLiteralTypeVar)	BaseModel
ConfigDictFieldPrivateAttrmodel_validator)Self)AdaptiveInterruptionDetectorInterruptionDetectionErrorOverlappingSpeechEvent)LanguageCode)LLMAgentHandoffChatMessageFunctionCallFunctionCallOutputLLMErrorRealtimeModelRealtimeModelError)logger)AgentMetricsAgentSessionUsage)STTSTTError)TTSTTSError)SpeechHandle)AgentSession
Userdata_Tc                      ] tR t^'tR R lt]R R l4       t]R R l4       t]R R l4       t]R	 R
 l4       t	R R lt
R R ltRtR# )
RunContextc               (    V ^8  d   QhRRRRRRRR/# )	   sessionAgentSession[Userdata_T]speech_handler%   function_callr   returnNone )formats   "p/Users/mitch_tango/dev/rabbit-r1-livekit/agent/.venv/lib/python3.14/site-packages/livekit/agents/voice/events.py__annotate__RunContext.__annotate__)   s4     = = *= $	=
 $= 
=    c               	Z    Wn         W n        W0n        VP                  ^,
          V n        R# )   N)_session_speech_handle_function_call	num_steps_initial_step_idx)selfr,   r.   r/   s   &$$$r4   __init__RunContext.__init__)   s(      ++!.!8!81!<r7   c                   V ^8  d   QhRR/# )r+   r0   r-   r2   )r3   s   "r4   r5   r6   7   s      1 r7   c                	    V P                   # N)r:   r?   s   &r4   r,   RunContext.session6   s    }}r7   c                   V ^8  d   QhRR/# )r+   r0   r%   r2   )r3   s   "r4   r5   r6   ;        # #| #r7   c                	    V P                   # rD   )r;   rE   s   &r4   r.   RunContext.speech_handle:       """r7   c                   V ^8  d   QhRR/# )r+   r0   r   r2   )r3   s   "r4   r5   r6   ?   rH   r7   c                	    V P                   # rD   )r<   rE   s   &r4   r/   RunContext.function_call>   rK   r7   c                   V ^8  d   QhRR/# )r+   r0   r'   r2   )r3   s   "r4   r5   r6   C   s     % %* %r7   c                	.    V P                   P                  # rD   )r,   userdatarE   s   &r4   rQ   RunContext.userdataB   s    ||$$$r7   c                   V ^8  d   QhRR/# r+   r0   r1   r2   )r3   s   "r4   r5   r6   F   s     	7 	7 	7r7   c                (    RV P                   n        R# )zDisable interruptions for this FunctionCall.

Delegates to the SpeechHandle.allow_interruptions setter,
which will raise a RuntimeError if the handle is already interrupted.

Raises:
    RuntimeError: If the SpeechHandle is already interrupted.
FN)r.   allow_interruptionsrE   s   &r4   disallow_interruptions!RunContext.disallow_interruptionsF   s     27.r7   c                   V ^8  d   QhRR/# rT   r2   )r3   s   "r4   r5   r6   Q   s     W W Wr7   c                n   "   V P                   P                  V P                  R7      G Rj  xL
  R#  L5i)a)  Waits for the speech playout corresponding to this function call step.

Unlike `SpeechHandle.wait_for_playout`, which waits for the full
assistant turn to complete (including all function tools),
this method only waits for the assistant's spoken response prior running
this tool to finish playing.)step_idxN)r.   _wait_for_generationr>   rE   s   &r4   wait_for_playoutRunContext.wait_for_playoutQ   s*        55t?U?U5VVVs   *535)r<   r>   r:   r;   N)__name__
__module____qualname____firstlineno__r@   propertyr,   r.   r/   rQ   rW   r]   __static_attributes__r2   r7   r4   r)   r)   '   sh    =   # # # # % %	7W Wr7   r)   c                  j    ] tR t^nt$ RtR]R&   R]R&   R]R&   ]! ]P                  R7      tR]R	&   R
t	R# )UserStateChangedEventuser_state_changedzLiteral['user_state_changed']type	UserState	old_state	new_statedefault_factoryfloat
created_atr2   N
r_   r`   ra   rb   rh   __annotations__r   timero   rd   r2   r7   r4   rf   rf   n   s,    *>D
'>dii8J8r7   rf   c                  j    ] tR t^ut$ RtR]R&   R]R&   R]R&   ]! ]P                  R7      tR]R	&   R
t	R# )AgentStateChangedEventagent_state_changedzLiteral['agent_state_changed']rh   
AgentStaterj   rk   rl   rn   ro   r2   Nrp   r2   r7   r4   rt   rt   u   s,    +@D
(@dii8J8r7   rt   c                      ] tR t^|t$ RtR]R&   R]R&   R]R&   RtR	]R
&   RtR]R&   ]! ]	P                  R7      t
R]R&   RtR# )UserInputTranscribedEventuser_input_transcribedz!Literal['user_input_transcribed']rh   str
transcriptboolis_finalN
str | None
speaker_idzLanguageCode | Nonelanguagerl   rn   ro   r2   )r_   r`   ra   rb   rh   rq   r   r   r   rr   ro   rd   r2   r7   r4   rx   rx   |   s?    .FD
+FON!J
!$(H!(dii8J8r7   rx   c                     a  ] tR t^t$ RtR]R&   R]R&    ]! ]P                  R7      tR]R&   R	t	R
]R&   R	t
R]R&   R V 3R lltRtV ;t# )AgentFalseInterruptionEventagent_false_interruptionz#Literal['agent_false_interruption']rh   r|   resumedrl   rn   ro   NzChatMessage | Nonemessager~   extra_instructionsc                    V ^8  d   QhRRRR/# )r+   namerz   r0   r   r2   )r3   s   "r4   r5   (AgentFalseInterruptionEvent.__annotate__   s     . .S .S .r7   c                	d   < VR9   d   \         P                  ! RV R24       \        SV `  V4      # )r   zAgentFalseInterruptionEvent.z1 is deprecated, automatic resume is now supported)r   r   )r   warningsuper__getattribute__)r?   r   	__class__s   &&r4   r   ,AgentFalseInterruptionEvent.__getattribute__   s7    44NN.tf4ef w'--r7   r2   )r_   r`   ra   rb   rh   rq   r   rr   ro   r   r   r   rd   __classcell__)r   s   @r4   r   r      sK    0JD
-JMCdii8J8 #'G&%)
). .r7   r   c                  d    ] tR t^t$ RtRtR]R&   R]R&   ]! ]P                  R7      t	R]R	&   R
t
R# )MetricsCollectedEventzxDeprecated: use session_usage_updated for usage tracking.
Per-turn latency metrics are available on ChatMessage.metrics.metrics_collectedzLiteral['metrics_collected']rh   r   metricsrl   rn   ro   r2   N)r_   r`   ra   rb   __doc__rh   rq   r   rr   ro   rd   r2   r7   r4   r   r      s.    F *=D
&<dii8J8r7   r   c                  `    ] tR t^t$ RtR]R&   R]R&   ]! ]P                  R7      tR]R&   R	t	R
# )SessionUsageUpdatedEventsession_usage_updatedz Literal['session_usage_updated']rh   r    usagerl   rn   ro   r2   Nrp   r2   r7   r4   r   r      s&    -DD
*Ddii8J8r7   r   c                  &    ] tR t^t$ RtR]R&   RtR# )_TypeDiscriminatorunknownzLiteral['unknown']rh   r2   N)r_   r`   ra   rb   rh   rq   rd   r2   r7   r4   r   r      s    (D
(r7   r   c                  `    ] tR t^t$ RtR]R&   R]R&   ]! ]P                  R7      tR]R&   R	t	R
# )ConversationItemAddedEventconversation_item_addedz"Literal['conversation_item_added']rh   z/ChatMessage | AgentHandoff | _TypeDiscriminatoritemrl   rn   ro   r2   Nrp   r2   r7   r4   r   r      s&    /HD
,H
99dii8J8r7   r   c                     ] tR t^t$ RtRtR]R&   R]R&   R]R&   ]! ]P                  R	7      t	R
]R&   ]
! RR7      tR]R&   ]
! RR7      tR]R&   R R ltR R ltR R lt]R R l4       t]R R l4       t]! RR7      R R l4       tRtR # )!FunctionToolsExecutedEventa  Emitted after a batch of function tools finishes executing.

``function_calls`` and ``function_call_outputs`` are parallel lists: the
output at a given index belongs to the call at the same index. When an
output is present, its ``call_id`` matches the paired function call's
``call_id``. A ``None`` output means the function call did not produce a
value that should be sent back to the LLM, such as when a tool raises
``StopResponse`` or returns an invalid output.
function_tools_executedz"Literal['function_tools_executed']rh   zlist[FunctionCall]function_callszlist[FunctionCallOutput | None]function_call_outputsrl   rn   ro   F)defaultr|   _reply_required_handoff_requiredc                   V ^8  d   QhRR/# )r+   r0   z4list[tuple[FunctionCall, FunctionCallOutput | None]]r2   )r3   s   "r4   r5   'FunctionToolsExecutedEvent.__annotate__   s     X XL Xr7   c                X    \        \        V P                  V P                  RR7      4      # )z2Return calls paired with outputs by list position.F)strict)listzipr   r   rE   s   &r4   zipped!FunctionToolsExecutedEvent.zipped   s#    C++T-G-GPUVWWr7   c                   V ^8  d   QhRR/# rT   r2   )r3   s   "r4   r5   r      s     % %4 %r7   c                	    R V n         R# FNr   rE   s   &r4   cancel_tool_reply,FunctionToolsExecutedEvent.cancel_tool_reply   s
    $r7   c                   V ^8  d   QhRR/# rT   r2   )r3   s   "r4   r5   r      s     ' 'd 'r7   c                	    R V n         R# r   r   rE   s   &r4   cancel_agent_handoff/FunctionToolsExecutedEvent.cancel_agent_handoff   s
    !&r7   c                   V ^8  d   QhRR/# r+   r0   r|   r2   )r3   s   "r4   r5   r      s     $ $ $r7   c                	    V P                   # rD   r   rE   s   &r4   has_tool_reply)FunctionToolsExecutedEvent.has_tool_reply   s    ###r7   c                   V ^8  d   QhRR/# r   r2   )r3   s   "r4   r5   r      s     & &4 &r7   c                	    V P                   # rD   r   rE   s   &r4   has_agent_handoff,FunctionToolsExecutedEvent.has_agent_handoff   s    %%%r7   after)modec                   V ^8  d   QhRR/# )r+   r0   r   r2   )r3   s   "r4   r5   r      s      T r7   c                	v    \        V P                  4      \        V P                  4      8w  d   \        R 4      hV # )zBThe number of function_calls and function_call_outputs must match.)lenr   r   
ValueErrorrE   s   &r4   verify_lists_length.FunctionToolsExecutedEvent.verify_lists_length   s1    t""#s4+E+E'FFabbr7   )r   r   N)r_   r`   ra   rb   r   rh   rq   r   rr   ro   r   r   r   r   r   r   rc   r   r   r   r   rd   r2   r7   r4   r   r      s     0ID
,H&&::dii8J8'6OT6)%8t8X%' $ $ & & '" #r7   r   c                      ] tR t^t$ ]! RR7      tRtR]R&   R]R&    R]R	&    ]! R
RR7      t	R]R&    ]! ]
P                  R7      tR]R&   RtR# )SpeechCreatedEventTarbitrary_types_allowedspeech_createdzLiteral['speech_created']rh   r|   user_initiatedz Literal['say', 'generate_reply']source.)excluder%   r.   rl   rn   ro   r2   N)r_   r`   ra   rb   r   model_configrh   rq   r   r.   rr   ro   rd   r2   r7   r4   r   r      sP    d;L&6D
#6\,,="'T":M<:,dii8J8r7   r   c                      ] tR t^t$ RtR]R&   R]R&    R]R&    R]R&    R	]R
&    ]! ]P                  R7      tR	]R&   Rt	R# )UserTurnExceededEventuser_turn_exceededzLiteral['user_turn_exceeded']rh   rz   r{   accumulated_transcriptintaccumulated_word_countrn   durationrl   ro   r2   Nrp   r2   r7   r4   r   r      sE    *>D
'>OR;<O/dii8J8r7   r   c                  |    ] tR t^t$ ]! RR7      tRtR]R&   R]R&   R]R&   ]! ]	P                  R	7      t
R
]R&   RtR# )
ErrorEventTr   errorzLiteral['error']rh   zVLLMError | STTError | TTSError | RealtimeModelError | InterruptionDetectionError | AnyzDLLM | STT | TTS | RealtimeModel | AdaptiveInterruptionDetector | Anyr   rl   rn   ro   r2   N)r_   r`   ra   rb   r   r   rh   rq   r   rr   ro   rd   r2   r7   r4   r   r      s6    d;L$D
$aaPPdii8J8r7   r   c                  *    ] tR t^tRtRtRtRtRtRt	R# )CloseReasonr   job_shutdownparticipant_disconnectedr   task_completedr2   N)
r_   r`   ra   rb   ERRORJOB_SHUTDOWNPARTICIPANT_DISCONNECTEDUSER_INITIATEDTASK_COMPLETEDrd   r2   r7   r4   r   r      s    E!L9%N%Nr7   r   c                  n    ] tR tRt$ RtR]R&   RtR]R&   R]R	&   ]! ]P                  R
7      t	R]R&   Rt
R# )
CloseEventi  closezLiteral['close']rh   NzWLLMError | STTError | TTSError | RealtimeModelError | InterruptionDetectionError | Noner   r   reasonrl   rn   ro   r2   )r_   r`   ra   rb   rh   rq   r   r   rr   ro   rd   r2   r7   r4   r   r     s:    $D
$ 	 
_ dii8J8r7   r   rh   )discriminator)rg   ru   ry   r   r   overlapping_speechr   r   r   r   r   r   )speaking	listeningaway)initializingidler   thinkingr   )H
__future__r   rr   enumr   r   typingr   r   r   r	   r
   r   pydanticr   r   r   r   r   typing_extensionsr   inference.interruptionr   r   r   r   r   llmr   r   r   r   r   r   r   r   logr   r   r   r    sttr!   r"   ttsr#   r$   r.   r%   agent_sessionr&   r'   r)   
EventTypesri   rv   rf   rt   rx   r   r   r   r   r   r   r   r   r   rz   r   r   
AgentEventr2   r7   r4   <module>r     s   "   K K O O " 
 $	 	 	  5   '+ \"
1W$ 1Wh 
 34	PQ
9I 99Y 99	 9.) .$9I 99y 9) )9 9) )X
9 
99I 99 9 &#t & &9 9  "" 	
  !! !!  	 
  
!
r7   