
    `gjC                        d Z ddlmZ ddlZddlZddlmZ ddlm	Z
 ddlmZ ddlmZmZmZmZmZmZmZmZmZmZmZ  ej2                  e      Zdeed	fd
eedfdeedfdeedfdeedffZddZddZy)u  google_meet plugin — let the agent join a Meet call, transcribe it, follow up.

v1: transcribe-only. Spawns a headless Chromium via Playwright, joins the Meet
URL, enables live captions, scrapes them into a transcript file. The agent then
has the transcript in its workspace and can do whatever followup work it needs
using its regular tools.

v2 (not in this PR): realtime duplex audio so the agent can speak in the
meeting, via OpenAI Realtime / Gemini Live + BlackHole / PulseAudio null-sink.
``meet_say`` exists as a stub today so the tool surface is stable.

Explicit-by-design: only joins ``https://meet.google.com/`` URLs explicitly
passed in. No calendar scanning, no auto-dial, no consent announcement.
    )annotationsN)process_manager)register_cli)meet_command)MEET_JOIN_SCHEMAMEET_LEAVE_SCHEMAMEET_SAY_SCHEMAMEET_STATUS_SCHEMAMEET_TRANSCRIPT_SCHEMAcheck_meet_requirementshandle_meet_joinhandle_meet_leavehandle_meet_sayhandle_meet_statushandle_meet_transcript	meet_joinu   📞meet_statusu   🟢meet_transcriptu   📝
meet_leaveu   👋meet_sayu   🗣️c                     	 t        j                         }|j                  d      r)|j                  d      rt        j                  d       yyy# t        $ r }t
        j                  d|       Y d}~yd}~ww xY w)u  Best-effort cleanup — if a meet bot is still running when the session
    ends, leave the call so we don't orphan a headless Chromium.

    No-ops when nothing is active. Swallows all exceptions — session end must
    not fail because the bot cleanup hit an edge case.
    okalivezsession ended)reasonz-google_meet on_session_end cleanup failed: %sN)pmstatusgetstop	Exceptionloggerdebug)kwargsr   es      O/root/.hermes/venv/lib/python3.12/site-packages/plugins/google_meet/__init__.py_on_session_endr%   2   sb    I::d

7 3GG?+ !4 IDaHHIs   AA 	A:A55A:c           	     <   t        j                         j                         }|dvrt        j	                  d|       yt
        D ]"  \  }}}}| j                  |d||t        |       $ | j                  ddt        t        d	       | j                  d
t               y)zRegister tools, CLI, and lifecycle hooks.

    Called once by the plugin loader when the plugin is enabled via
    ``plugins.enabled`` in config.yaml.
    >   linuxdarwinz@google_meet plugin: platform=%s not supported (linux/macos only)Ngoogle_meet)nametoolsetschemahandlercheck_fnemojimeetz-Google Meet bot (join, transcribe, follow up)zoLet the hermes agent join a Google Meet call and scrape live captions into a transcript. See: hermes meet setup)r*   helpsetup_fn
handler_fndescriptionon_session_end)platformsystemlowerr    info_TOOLSregister_toolr   register_cli_command_register_meet_cli_meet_commandregister_hookr%   )ctxr7   r*   r,   r-   r/   s         r$   registerrA   A   s     __$$&F((N	
 	(. 
$fgu!, 	 	

 <# A  	 &8    )returnNone)__doc__
__future__r   loggingr6   plugins.google_meetr   r   plugins.google_meet.clir   r=   r   r>   plugins.google_meet.toolsr   r   r	   r
   r   r   r   r   r   r   r   	getLogger__name__r    r:   r%   rA    rB   r$   <module>rN      s    #   5 F A    
		8	$ (0@O*0BO.0FO)0AO	R
I&9rB   