+
    lHàjÐ  ã                  óô   a € 0 t $ R t^ RIHt ^ RIt^ RIHtHtHt ^ RI	H
t
 ^ RIHt RRRR	R
RRRRRRRRR.RR/RRRRR/RRRRR//RR.//tR]R&   R#R R lltR R lt]P"                  ! RR]R  ]R!R"7       R# )$aX  Agent-facing tool: respond to a native JS dialog captured by the CDP supervisor.

Response-only: the agent reads ``pending_dialogs`` from ``browser_snapshot``,
then calls ``browser_dialog(action=...)``. Gated on ``_browser_cdp_check`` so it
appears together with ``browser_cdp``. Design: ``website/docs/developer-guide/browser-supervisor.md``.
)ÚannotationsN)ÚAnyÚDictÚOptional)ÚSUPERVISOR_REGISTRY)ÚregistryÚnameÚbrowser_dialogÚdescriptionu¦  Respond to a native JavaScript dialog (alert / confirm / prompt / beforeunload) that is currently blocking the page.

**Workflow:** call ``browser_snapshot`` first â€” if a dialog is open, it appears in the ``pending_dialogs`` field with ``id``, ``type``, and ``message``. Then call this tool with ``action='accept'`` or ``action='dismiss'``.

**Prompt dialogs:** pass ``prompt_text`` to supply the response string. Ignored for alert/confirm/beforeunload.

**Multiple dialogs:** if more than one dialog is queued (rare â€” happens when a second dialog fires while the first is still open), pass ``dialog_id`` from the snapshot to disambiguate.

**Availability:** only present when a CDP-capable backend is attached â€” Browserbase sessions, local Chromium-family browser via ``/browser connect``, or ``browser.cdp_url`` in config.yaml. Not available on Camofox (REST-only) or the default Playwright local browser (CDP port is hidden).Ú
parametersÚtypeÚobjectÚ
propertiesÚactionÚstringÚenumÚacceptÚdismissz»'accept' clicks OK / returns the prompt text. 'dismiss' clicks Cancel / returns null from prompt(). For ``beforeunload`` dialogs: 'accept' allows the navigation, 'dismiss' keeps the page.Úprompt_textzdResponse string for a ``prompt()`` dialog. Ignored for other dialog types. Defaults to empty string.Ú	dialog_idz~Specific dialog to respond to, from ``browser_snapshot.pending_dialogs[].id``. Required only when multiple dialogs are queued.Úrequiredzdict[str, Any]ÚBROWSER_DIALOG_SCHEMAc          
     ó,   € V ^8„  d   QhRRRRRRRRRR/# )é   r   Ústrr   zOptional[str]r   Útask_idÚreturn© )Úformats   "Ú>/home/ubuntu/.hermes/hermes-agent/tools/browser_dialog_tool.pyÚ__annotate__r    F   sA   € ÷ Yñ YØðYàðYð ðYð ð	Yð
 	ñYó    c                ó~  € \         P                  ! T;'       g    R4      pVf   \        P                  ! RRRR/4      # VP	                  WVR7      pVP                  R4      '       d-   \        P                  ! RRR	V R
VP                  R
/ 4      /4      # \        P                  ! RRRVP                  RR4      /4      # )z@Respond to a pending dialog on the active task's CDP supervisor.ÚdefaultÚsuccessFÚerrorzÔNo CDP supervisor is attached to this task. Either the browser backend doesn't expose CDP (Camofox, default Playwright) or no browser session has been started yet. Call browser_navigate or /browser connect first.)r   r   r   ÚokTr   Údialogzunknown error)r   ÚgetÚjsonÚdumpsÚrespond_to_dialog)r   r   r   r   Ú
supervisorÚresults   &&&&  r   r	   r	   F   s¹   € ô %×(Ò(¨×)=Ð)=°IÓ>€JØÒÜ�zŠzØ�uØðCð
ó ð 	ð ×)Ñ)°Ð\eÐ)Óf€FØ‡z�z�$×ÒÜ�zŠz˜9 d¨H°f¸hÈÏ
É
ÐS[Ð]_ÓH`ÐaÓbÐbÜ�:Š:�y %¨°&·*±*¸WÀoÓ2VÐWÓXÐXr!   c               ó   € V ^8„  d   QhRR/# )r   r   Úboolr   )r   s   "r   r    r    ^   s   € ÷  ñ  ˜tñ  r!   c                 ó   € ^ RI Hp  V ! 4       # )zIGate: same as ``browser_cdp`` so the two tools appear/disappear together.©Ú_browser_cdp_check)Útools.browser_cdp_toolr2   r1   s    r   Ú_browser_dialog_checkr4   ^   s   € å9áÓÐr!   zbrowser-cdpc                óš   € \        V P                  R R4      V P                  R4      V P                  R4      VP                  R4      R7      # )r   Ú r   r   r   )r   r   r   r   )r	   r(   )ÚargsÚkws   &,r   Ú<lambda>r9   i   sA   € œ~°T·X±X¸hÈÓ5KÐY]×YaÑYaÐboÓYpØ8<¿¹ÀÓ8MÐWY×W]ÑW]Ð^gÓWhõ jr!   u   ðŸ’¬)r   ÚtoolsetÚschemaÚhandlerÚcheck_fnÚemoji)NNN)Ú__conditional_annotations__Ú__doc__Ú
__future__r   r)   Útypingr   r   r   Útools.browser_supervisorr   Útools.registryr   r   Ú__annotations__r	   r4   Úregister)r?   s   @r   Ú<module>rG      sÝ   øðôõ #ã ß &Ñ &å 8Ý #ð ÐØð	.ð" Ø�ØØØ˜Ø˜ 9Ð-Øð<ð		ð Ø˜ØðDðð Ø˜Øð=ðð%
ð6 	�X�Jð;ð)3)Ð �~ó 3÷lYõ0 ð 	× Ò Ø	ØØ ñjà"Ø
÷r!   