+
    lHàjf  ã                  ó`  € R t ^ RIHt ^RIHtHtHtHt ^RIH	t	 ^RI
HtHtHt ^RIHtHt  ! R R]4      t ! R R	]4      t ! R
 R]4      t ! R R]4      t]! R]	]RR7        ! R R]4      t]! R]	]RR7       ]! R]	]RR7        ! R R]	4      t ! R R]4      t]! R]]RR7        ! R R]	4      t ! R R ]4      t]! R!]]R"R7        ! R# R$]4      t ! R% R&]	4      t ! R' R(]4      t]! R)]]R*R7       ]! R+]	]R,R7        ! R- R.]	4      t ! R/ R0]4      t]! R1]]R2R7        ! R3 R4]	4      t]! R5]]R6R7        ! R7 R8]4      t ]! R9] ]R:R7        ! R; R<]]4      t!]! R]!R=R>7        ! R? R@]4      t"]! RA]"RBR>7        ! RC RD]4      t#]! RE]#RFR>7        ! RG RH]4      t$]! RI]$RJR>7       RK# )La  Bot Screen (``methods_display.py`` / ``methods_display_watch.py``): a profile's headless Xfce
desktop, its takeover lease, the noVNC ticket and the on-host package install.

Every method rides ``profile`` (the desktop routes through ``requestGatewayForProfile``) and answers
for THAT profile's screen. The lease is the whole control model: ``holder`` is ``agent`` or
``human``; ``epoch`` moves on every real transition, so a client (or the agent's fence) can tell an
in-flight result was produced under a lease that has since changed.
)Úannotations)ÚParamsÚPayloadÚResultÚWireEnum)ÚProfileParams)ÚeventÚmethodÚserver_request)ÚServerRequestParamsÚValueResultc                  ó   € ] tR t^tRtRtRtR# )ÚLeaseHolderÚagentÚhuman© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r   Ú__static_attributes__r   ó    ÚB/home/ubuntu/.hermes/hermes-agent/tui_gateway/contracts/display.pyr   r      s   † Ø€EØ„Er   r   c                  ód   € ] tR t^t$ RtR]R&   RtR]R&   RtR]R&   R	]R
&   R]R&   RtR]R&   Rt	R# )ÚDisplayLeasez³``tools/bot_desktop/lease.py::Lease`` as clients may see it: the holder's viewer id is a
capability and never leaves the gateway; ``viewer_hash`` lets the holder recognise itself.r   ÚholderNÚNoneÚ	viewer_idú
str | NoneÚviewer_hashÚfloatÚsinceÚintÚepochÚ ÚstrÚreasonr   )
r   r   r   r   Ú__doc__Ú__annotations__r   r   r&   r   r   r   r   r   r      s8   ‡ ñbð ÓØ€IˆtÓØ"€K�Ó"ØƒLØƒJØ€FˆC×r   r   c                  ó:   € ] tR t^%t$ RtR]R&   R]R&   R]R&   RtR# )	ÚDisplayImageSwitchz[A persisted Docker sandbox kept on the previous default image; the user decides the switch.r%   Úcurrent_imageÚtarget_imager"   Ú
containersr   N)r   r   r   r   r'   r(   r   r   r   r   r*   r*   %   s   ‡ ÙeàÓØÓØ‡Or   r*   c                  óø   € ] tR t^-t$ RtR]R&   R]R&   R]R&   R]R&   R]R	&   R
tR]R&   R
tR]R&   R
tR]R&   R]R&   R
t	R]R&   R
t
R]R&   R
tR]R&   R
tR]R&   R
tR]R&   RtR]R&   R
tR]R&   R]R&   R]R&   RtR
# )ÚDisplayStatusz]``tools/bot_desktop/runtime.py::DesktopStatus`` plus the lease and the profile it speaks for.r%   ÚprofileÚboolÚ	supportedÚ	installedz	list[str]ÚmissingÚrunningNz
int | NoneÚpidr   ÚdisplayÚsocketÚgeometryÚinstall_commandÚbrowserÚblockerÚmemory_available_mbÚmemory_limit_mbÚgatewayÚ	placementzDisplayImageSwitch | NoneÚimage_switchr   ÚleaseÚprofile_keyr   )r   r   r   r   r'   r(   r6   r7   r8   r:   r;   r<   r=   r>   r@   rA   r   r   r   r   r/   r/   -   s–   ‡ ÙgàƒLØƒOØƒOØÓØƒMØ€CˆÓØ€GˆZÓØ€FˆJÓØƒMØ"&€O�ZÓ&Ø€GˆZÓØ€GˆZÓØ&*Ð˜Ó*Ø"&€O�ZÓ&Ø€IˆsÓØ.2€LÐ+Ó2ØÓØ×r   r/   zdisplay.statusz3Runtime + lease snapshot for this profile's screen.)ÚparamsÚresultÚdocc                  ó8   € ] tR t^Kt$ RtRtR]R&   RtR]R&   RtR# )ÚDisplayThumbnailResultzŒ``data_url`` is null while the screen is stopped or while a human holds the lease
(``suppressed``): the frame may show what they are typing.Nr   Údata_urlÚ
suppressedr   )	r   r   r   r   r'   rI   r(   rJ   r   r   r   r   rH   rH   K   s   ‡ ñBð  €HˆjÓØ!€J�
×!r   rH   zdisplay.thumbnailzFOne JPEG grab of the bot's screen; read-only, never changes the lease.zdisplay.startzUStart this profile's Xvnc + Xfce (idempotent); blocks until the display is published.c                  ó&   € ] tR t^Zt$ RtR]R&   RtR# )ÚDisplayStopParamsNúbool | NoneÚforcer   )r   r   r   r   rN   r(   r   r   r   r   rL   rL   Z   s   ‡ Ø€Eˆ;×r   rL   c                  ó"   € ] tR t^^t$ R]R&   RtR# )ÚDisplayStopResultr1   Ústoppedr   N©r   r   r   r   r(   r   r   r   r   rP   rP   ^   s   ‡ Ø‡Mr   rP   zdisplay.stopzWStop the screen. Refused (5300, code viewer_mismatch) while a human holds unless force.c                  ó&   € ] tR t^ft$ RtR]R&   RtR# )ÚDisplayObserveParamsNr   r   r   )r   r   r   r   r   r(   r   r   r   r   rT   rT   f   s   ‡ Ø €Iˆz× r   rT   c                  ó6   € ] tR t^jt$ R]R&   R]R&   R]R&   RtR# )ÚDisplayObserveResultr%   ÚticketÚpathr   r   NrR   r   r   r   rV   rV   j   s   ‡ ØƒKØ
ƒIØ‡Nr   rV   zdisplay.observezaMint a single-use ticket for /api/display/ws and the server-minted viewer id for this connection.c                  ó:   € ] tR t^tt$ R]R&   RtR]R&   R]R&   RtR# )	ÚDisplayInstallResultr1   ÚstartedNr   Úcommandr%   rC   r   )r   r   r   r   r(   r\   r   r   r   r   rZ   rZ   t   s   ‡ ØƒMØ€GˆZÓØ×r   rZ   c                  ó&   € ] tR t^zt$ RtR]R&   RtR# )ÚDisplaySwitchSandboxImageParamsTr1   Úapprover   N)r   r   r   r   r_   r(   r   r   r   r   r^   r^   z   s   ‡ Ø€GˆT×r   r^   c                  ó"   € ] tR t^~t$ R]R&   RtR# )ÚDisplaySwitchSandboxImageResultr%   Údocker_imager   NrR   r   r   r   ra   ra   ~   s   ‡ Ø×r   ra   zdisplay.switchSandboxImagez_Decide the pending default sandbox image switch for this profile; refused when none is pending.zdisplay.installzbRun the distro package install on the gateway host; progress streams as display.install.log/.done.c                  ó0   € ] tR t^Št$ R]R&   RtR]R&   RtR# )ÚDisplayLeaseAcquireParamsr%   r   Nr   r&   r   )r   r   r   r   r(   r&   r   r   r   r   rd   rd   Š   s   ‡ ØƒNØ€FˆJ×r   rd   c                  ó"   € ] tR t^�t$ R]R&   RtR# )ÚDisplayLeaseResultr   rB   r   NrR   r   r   r   rf   rf   �   s   ‡ Ø×r   rf   zdisplay.lease.acquirezUTake over: the human named by a viewer id this connection minted controls the screen.c                  ó4   € ] tR t^—t$ RtR]R&   RtR]R&   RtR# )ÚDisplayLeaseReleaseParamsNr   r   rM   rN   r   )r   r   r   r   r   r(   rN   r   r   r   r   rh   rh   —   s   ‡ Ø €IˆzÓ Ø€Eˆ;×r   rh   zdisplay.lease.releasezWHand back. Without a viewer id the release is refused while a human holds unless force.c                  ó"   € ] tR t^£t$ R]R&   RtR# )ÚDisplayInstallSudoParamsr%   rC   r   NrR   r   r   r   rj   rj   £   s   ‡ Ø×r   rj   zdisplay.install.sudozSMasked sudo password for the Bot Screen package install; app-level (empty session).c                  ó   € ] tR t^®tRtR# )ÚDisplayStatusPayloadr   N)r   r   r   r   r   r   r   r   rl   rl   ®   s   † Ûr   rl   zZThis profile's screen started or stopped (also for transitions made outside hermes serve).)rF   c                  ó,   € ] tR t^¶t$ R]R&   R]R&   RtR# )ÚDisplayLeasePayloadr%   rC   r   rB   r   NrR   r   r   r   rn   rn   ¶   s   ‡ ØÓØ×r   rn   zdisplay.leasez8The takeover lease changed hands; every client repaints.c                  ó,   € ] tR t^¾t$ R]R&   R]R&   RtR# )ÚDisplayInstallLogPayloadr%   rC   Úliner   NrR   r   r   r   rp   rp   ¾   s   ‡ ØÓØ
‡Ir   rp   zdisplay.install.logz#One line of package-manager output.c                  ó6   € ] tR t^Æt$ R]R&   R]R&   R]R&   RtR# )	ÚDisplayInstallDonePayloadr%   rC   r"   Úcoder/   Ústatusr   NrR   r   r   r   rs   rs   Æ   s   ‡ ØÓØ
ƒIØ×r   rs   zdisplay.install.donez\The install ended (0 ok, -1 cancelled, -2 no sudo: the command to run by hand was streamed).N)%r'   Ú
__future__r   Úbaser   r   r   r   Úcommonr   Úregistryr   r	   r
   Úserver_requestsr   r   r   r   r*   r/   rH   rL   rP   rT   rV   rZ   r^   ra   rd   rf   rh   rj   rl   rn   rp   rs   r   r   r   Ú<module>r{      s:  ðñõ #ç 3Ó 3Ý !ß 3Ñ 3ß =ô
�(ô ô
	�6ô 	ô˜ô ô�Fô ñ4 Ð °mØ@õBô"˜Vô "ñ Ð =Ð9OØSõUñ €˜}°]Øbõdô˜ô ô˜ô ñ €~Ð/Ð8IØdõfô!˜=ô !ô˜=ô ñ ÐÐ!5Ð>RØnõpô˜6ô ô mô ô mô ñ Ð#Ð,KÐTsØlõnñ Ð Ð7KØoõqô ô ô
˜ô ñ ÐÐ'@ÐI[Øbõdô ô ñ
 ÐÐ'@ÐI[ØdõfôÐ2ô ñ Ð%Ð.FÈ{Øhõjô	˜=¨'ô 	ñ ÐÐ,Ø
fõhô˜'ô ñ
 €oÐ*Ð0jÕ kô˜wô ñ
 ÐÐ5Ð;`Õ aô ô ñ ÐÐ7Ø
h÷jr   