+
    „WÝj7  ã                  ó  € R t ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
 Rt]R 4       tRR	/R
 ltR tR]! RR04      R]! R04      R]! R04      R]! R04      R]! R04      R]! R04      /tR tR tR tR tR tR tR tR tR tR# )a:  Same-user private bootstrap at the existing HTTP authentication boundary.

This is not remote/exposure delegation. The daemon captures the actual socket
peer before proxy middleware, and the private control channel is the credential
issuer. A browser Origin (including an empty one) always disqualifies this path.
)Úannotations)Úcontextmanager)ÚPath)ÚHTTPException)ÚJSONResponsezx-hermes-gateway-ticketc              #  óÚ   "  € \        V P                  RR4      pVf   Rx € R# ^ RIHpHp \        VR,          4      pV! \        V4      4      p Rx € V! V4       R#   T! T4       i ; i5i)a&  Resolve the request's implicit selectors (omitted / '' / 'current') in the TICKET's home.

``_own_profile`` lets those selectors through unbound; the routes then resolve
``get_hermes_home()`` / ``_default_db_path()``, which is the launch home unless the
task-local override says otherwise. A secondary-profile ticket must read and write its
own profile, never the launch profile's dashboard state. The launch profile's own ticket
binds its home override too, so it never inherits a foreign override that happens to be
ambient in the request context.
Únative_http_principalN)Úreset_hermes_home_overrideÚset_hermes_home_overrideÚ
profile_id)ÚgetattrÚstateÚhermes_constantsr	   r
   r   Ústr)ÚrequestÚgrantr	   r
   ÚhomeÚtokens   &     ÚYC:\Users\johnn\AppData\Local\hermes\hermes-agent\hermes_cli\dashboard_auth\native_http.pyÚnative_profile_scoper      s^   é € ô �G—M‘MÐ#:¸DÓA€EØ‚}ÛÙßUÜ��lÕ#Ó$€DÙ$¤S¨£YÓ/€Eð*Ûá" 5Ö)øÑ" 5Õ)üs   ‚AA+ÁA Á
A+Á
A(Á(A+ÚcurrentTc               óÄ  € ^ RI Hp V eX   \        V \        4      '       dD   V'       d<   V P	                  4       '       d$   V P	                  4       P                  4       R8X  d   R# \        V \        4      '       g   \        R4      h V! V P	                  4       4      P                  4       pT\        T4      8w  d   \        R4      hR#   \         d    \        R4      Rhi ; i)é    )Ú_resolve_profile_dirNr   Úprofile_scope_mismatch)
Úhermes_cli.web_server_profilesr   Ú
isinstancer   ÚstripÚlowerÚPermissionErrorÚresolver   r   )Úvaluer   r   r   Útargets   &&$  r   Ú_own_profiler#   *   sµ   € ÝCà‚}œ E¬3×/Ò/·GØ"'§+¡+§-¢-°5·;±;³=×3FÑ3FÓ3HÈIÔ3UÙÜ�eœS×!Ò!ÜÐ6Ó7Ð7ðBÙ% e§k¡k£mÓ4×<Ñ<Ó>ˆð ”�jÓ!Ô!ÜÐ6Ó7Ð7ñ "øô ô BÜÐ6Ó7¸TÐAðBús   Â$C ÃCc              ƒ  ó¾  "  € V P                   P                  P                  R 4      pVP                  R4      '       * pV P                  P                  R4       F  p\        WAVR7       K  	  V P                  P                  RR4      P                  R^4      ^ ,          P                  4       P                  4       pV'       d6   VR8X  g/   VP                  R	4      '       db   VP                  R
4      '       dK    V P                  4       G Rj  x€L
 p\!        V\"        4      '       d   RV9   d   \        VR,          WR7       VP                  R4      '       d-   V P                  P                  R4      '       g   \%        R4      hVR8X  d   V P&                  R8w  d   \%        R4      hR# VP                  R4      '       dý   VP)                  R4      p\+        W P&                  4      pRRRRRRRR/P                  V4      p	V	'       dG   V P                  P                  V	4      p
V
'       g   \%        R4      hV
 F  p\        WARR7       K  	  R# VR8X  d   V P&                  R8X  d   R# VR9   d   \%        R4      h\        VP                  R ^4      ^ ,          VRR7       V P&                  R9   d   \%        R4      hR# R#  EL³  \        \        3 d    Rp ELÇi ; i5i)Ú/ú/api/profiles/ú/api/cron/jobsÚprofile©r   zcontent-typeÚ Ú;zapplication/jsonzapplication/z+jsonNr   ú/api/profilesÚGETÚsessionsúsessions/sidebarÚrecents_profileúprojects/treeúsessions/pull-requestsFÚactive)r&   r'   z/api/sessionsz/api/fs/downloadz/api/fs/read-data-url>   r3   Úimport>   ÚPATCHÚDELETE)ÚurlÚpathÚrstripÚ
startswithÚquery_paramsÚgetlistr#   ÚheadersÚgetÚsplitr   r   ÚendswithÚjsonÚ
ValueErrorÚUnicodeErrorr   Údictr   ÚmethodÚremoveprefixÚprofile_collection_route)r   r   r8   r   r!   Úcontent_typeÚbodyÚsuffixÚ
collectionÚaggregate_selectorÚvaluess   &&         r   Ú_check_profile_scoperN   :   sz  é € ð �;‰;×Ñ×"Ñ" 3Ó'€DØ—/‘/ð #Pó Qô Q€Gà×%Ñ%×-Ñ-¨iÖ8ˆÜ�U°×8ñ 9à—?‘?×&Ñ& ~°rÓ:×@Ñ@ÀÀaÓHÈÕK×QÑQÓS×YÑYÓ[€Lß˜<Ð+=Ô=Ø×#Ñ# N×3Ò3¸×8MÑ8MÈg×8VÒ8Vð	Ø Ÿ™›×'ˆDô �dœD×!Ò! i°4Ô&7Ü˜˜i�¨*ÕFØ‡�Ð'×(Ò(°×1EÑ1E×1IÑ1IÈ)×1TÒ1Tô Ð6Ó7Ð7ØˆÔà�>‰>˜UÔ"Ü!Ð":Ó;Ð;ñ #à	�‰Ð)×	*Ò	*Ø×"Ñ"Ð#3Ó4ˆÜ-¨d·N±NÓCˆ
à˜	Ð#5Ð7HØ˜YÐ(@À)ð
÷ ‰#ˆj‹/ð 	÷ Ø×)Ñ)×1Ñ1Ð2DÓEˆFßÜ%Ð&>Ó?Ð?Û�ä˜U¸×>ó  ð ˜8Ô#¨¯©¸%Ô(?ÙØÐ/Ô/Ü!Ð":Ó;Ð;ä˜Ÿ™ c¨1Ó-¨aÕ0°*ÀeÕLØ�~‰~Ð!4Ô4ô &Ð&>Ó?Ð?ñ 5ñ) 
+ò (øÜœLÐ)ô 	Ø‹Dð	üsd   ‚CKÃKÃ"KÃ:K ÄK ÄK ÄAKÅ KÅ;AKÇA)KÈ,BKË K ËKËKËKËKr3   r-   ÚPOSTr4   r1   r.   r2   r/   c                óÊ   € V P                  R4      P                  R4      pW P                  R4      8X  d   R# VP                  4       \        P	                  VR4      9   d   V# R# )zTThe collection suffix ``method path`` serves, or None when the path names a profile.r%   r&   N© )r9   rF   ÚupperÚPROFILE_COLLECTION_ROUTESr>   )r8   rE   rJ   s   && r   rG   rG   x   sU   € à�[‰[˜Ó×*Ñ*Ð+;Ó<€FØ—‘˜SÓ!Ô!ÙØ—\‘\“^Ô'@×'DÑ'DÀVÈRÓ'PÔPˆ6ÐZÐVZÐZó    c                ó  € V P                   R9  d   R# V P                  P                  P                  R4      P	                  R4      pWP                  P                  P                  R4      8X  g   V'       d   RV9   d   R# V# )z[The profile a ``PATCH``/``DELETE /api/profiles/<name>`` names, or None for any other route.Nr%   r&   >   r5   r6   )rE   r7   r8   r9   rF   )r   rJ   s   & r   Ú_registry_targetrV   €   sc   € à‡~�~Ð0Ô0ÙØ�[‰[×Ñ×$Ñ$ SÓ)×6Ñ6Ð7GÓH€FØ—‘×!Ñ!×(Ñ(¨Ó-Ô-·V¸sÀf¼}ÙØ€MrT   c                óJ  € \        V 4      pV P                  P                  R4       F  p\        WARR7       K  	  \        W1RR7       Vf   \	        R4      h^ RIHpHp V! V4      pV! V4      V8X  d0   V P                  R8X  d   Wv! V! 4       4      8X  g   \	        R4      hR# R# )ah  A registry grant renames or deletes exactly the profile it was minted for (#140345).

Never the gateway's launch home, which this live process is running in: deleting it or moving
its directory pulls the runtime out from under itself. The default root's rename stays allowed,
because it only sets a presentation ``display_name`` and never moves the directory.
r(   Fr)   Nr   )Úget_default_hermes_rootÚhermes_home_keyr5   )	rV   r;   r<   r#   r   r   rX   rY   rE   )r   r   Úlaunch_homer"   r!   rX   rY   Úlaunchs   &&&     r   Ú_check_registry_scoper\   Š   sœ   € ô ˜gÓ&€FØ×%Ñ%×-Ñ-¨iÖ8ˆÜ�U°×6ñ 9ä�¨UÕ3ØÒäÐ6Ó7Ð7ßIá˜[Ó)€FÙ�zÓ" fÔ,Ø�N‰N˜gÔ%¨&°OÑD[ÓD]Ó4^Ô*^ÜÐ6Ó7Ð7ñ +_ñ -rT   c                ó�  € ^ RI Hp  V P                  VRRR7      pTR
,          Y4R,          ,          8w  d   \        R4      hT#   \         dw    TP                  R8X  dA   TP
                  P                  P                  R4      R8X  d   T P                  TRRR7      p L„\        T4      e   T P                  TRR	R7      p L§h i ; i)r   )Ú_PURPOSE_CAPABILITIESNúnative-http©r   ÚpurposerO   r%   r,   únative-profile-createúnative-profile-registryÚcapabilitiesra   zinvalid native grant)	Úgateway.runtime_bootstrapr^   Úredeemr   rE   r7   r8   r9   rV   )ÚstoreÚticketr   r^   r   s   &&&  r   Ú_redeem_http_ticketri       sº   € Ý?ðØ—‘˜V°¸m�ÓLˆð ˆ^ÕÐ 5¸IÕ6FÕ GÔGÜÐ4Ó5Ð5Ø€Løô ô 	ð �>‰>˜VÔ#¨¯©×(8Ñ(8×(?Ñ(?ÀÓ(DÈÔ(WØ—L‘L °DÐBY�LÓZŠEÜ˜gÓ&Ò2Ø—L‘L °DÐB[�LÓ\ŠEàð	ús   ˆA ÁACÂ !CÃCc                ó    € ^ RI Hp \        V RR4      pVe   VP                  MV! V 4      ;'       g    R.^ ,          pVe   VP                  # R# )r   ©Úall_authoritiesÚsession_authoritiesN)Úgateway.session_authoritiesrl   r   r[   r   )Úrunnerrl   Úregistryr[   s   &   r   Ú_launch_homerq   ´   sQ   € Ý;Ü�vÐ4°dÓ;€HØ (Ò 4ˆX�_Š_¹?È6Ó;R×;\Ð;\ÐW[ÐV\Ð^_Õ:`€FØ &Ò 2ˆ6×ÑÐ<¸Ð<rT   c           	     óô  a	€ ^ RI Hp ^ RIHp \	        V P
                  P                  RR4      p\	        VR/ 4      pV! V4      p\	        VRR4      o	V P                  P                  R4      p\        V4      ^8w  Egs   RV P                  9   Ega   V'       EdX   V^ ,          R9  EgI   VP                  R	4      R
8w  Eg2   \	        VRR4      '       d=   V! W@P                  P                  R4      V P                  P                  4      '       dã   V'       dÛ   S	e×   S	P                  VP                  R4      8w  g·   \        ;QJ d    V	3R lV 4       F  '       g   K   RM	  RM! V	3R lV 4       4      '       gw   VP                  R4      V Uu. uFU  pVf   K	  \	        VRR4      '       d   K  VP                  S	P                   9   g   K;  RVP                  RVP                  /NKW  	  up8w  d   R# VS	3# u upi )zQThe runner's ticket store when *conn* may redeem a private grant here, else None.)Úrestart_wait_readrk   Úgateway_runnerNÚsession_runtime_descriptorÚsession_ticket_storezhermes.gateway_socket_peerÚoriginr   ÚreadyÚ	_drainingTrE   Úinstance_idc              3  ól   <"  € T F)  qR J;'       d    VP                   SP                   8g  x € K+  	  R # 5i)N)rz   )Ú.0Úarg   s   & €r   Ú	<genexpr>Ú _native_store.<locals>.<genexpr>Í   s/   øé € Ð]ÑQ\ÈA˜D�=×GÐG Q§]¡]°e×6GÑ6GÑ%GÔGÓQ\ùs   ƒ4’"4FÚserved_profilesÚretiringr   r   >   ú::1ú	127.0.0.1)Úgateway.drain_controlrs   rn   rl   r   Úappr   Úscoper>   Úlenr=   r7   r8   rz   Úanyr   Úprofile_ids)
ÚconnÚticketsrs   rl   ro   Ú
descriptorÚauthoritiesÚpeerr}   rg   s
   &&       @r   Ú_native_storer�   »   s�  ø€ å7Ý;Ü�T—X‘X—^‘^Ð%5°tÓ<€FÜ˜Ð!=¸rÓB€JÙ! &Ó)€KÜ�FÐ2°DÓ9€EØ�:‰:�>‰>Ð6Ó7€DÜˆG‹˜Õ˜X¨¯©Õ5¿T¸TØ�A�wÐ2Õ2Ø�~‰~˜gÓ&¨'Õ1ô ˜ ¨T×2Ò2Ù)¨&·*±*·.±.ÀÓ2JÈDÏHÉHÏMÉM×ZÒZß %¢-Ø× Ñ  J§N¡N°=Ó$AÔAß‹sÔ]ÑQ\Ó]�s�sŠsÔ]ÑQ\Ó]×]Ò]ð �~‰~Ð/Ó0ÙLWó5nÙLWÀqØô CÜ)0°°JÀ×)Fô CØKLÏ<É<Ð[`×[lÑ[lÑKlô C�˜qŸ|™|¨V°Q·\±\ÓBÉKñ5nô nñ Ø�5ˆ=Ðùò	5ns   ÆG5ÆG5Æ-G5Ç
G5c                óî  € V P                   P                  \        4      pV P                  P                  P                  R4      '       d   \        W4      MRpVf   R# Tw  r4^ RIHp  VP                  V^ ,          RRR7      pVR,          \        R04      8w  g   V! W6R,          4      f   R# V P                  P                  R	4       F  p\        WvR,          4       K  	  V#   \         d     R# i ; i)
aZ  Redeem the ``native-http`` grant a Desktop plugin socket upgrade presents; None when refused.

Same issuer, header, peer/Origin and served-profile rules as HTTP: a plugin socket is the
live twin of the plugin REST call that already rides this grant on a local gateway. The
upgrade's ``profile`` selectors must name the grant's home. Plugin sockets only: ``/api/ws``
and other core streams keep their own purpose-bound credentials. Called once per upgrade, by
``PluginApiWebSocketGate`` ahead of routing, so the grant's profile decides consent and scope
before any route dependency or plugin code runs.
ú/api/plugins/N©Úauthority_for_profile_idr_   r`   rd   z
http:ownerr   r(   )r=   r<   ÚHEADERr7   r8   r:   r�   rn   r“   rf   Ú	frozensetr;   r#   r   )rŠ   r‹   Úgatero   rg   r“   r   r!   s   &       r   Úredeem_native_wsr—   Ø   sÖ   € ð �l‰l×"Ñ"¤6Ó*€GØ+/¯8©8¯=©=×+CÑ+CÀO×+TÒ+TŒ=˜Ô'ÐZ^€DØ‚|ÙØ�M€FÝDðØ—‘˜W Q�Z°DÀ-�ÓPˆØ�.Õ!¤Y°¨~Ó%>Ô>Ù+¨F¸,Õ4GÓHÒPÙØ×&Ñ&×.Ñ.¨yÖ9ˆEÜ˜ lÕ 3Ö4ñ :ð €Løô ô Úðús   Á)AC% Â/4C% Ã%C4Ã3C4c                óŠ   € V P                   P                  P                  R4      '       g   R# \        V P                  RR4      # )zÉThe grant :func:`redeem_native_ws` admitted for this plugin socket, or None (refused).

Never redeems: the gate already did, once, and bound the grant's home and secret scope for
the whole connection.
r‘   Nr   )r7   r8   r:   r   r   )Úwss   &r   Úauthenticate_native_wsrš   ô   s4   € ð �6‰6�;‰;×!Ñ! /×2Ò2ÙÜ�2—8‘8Ð4°dÓ;Ð;rT   c              ƒ  ó^  "  € V P                   P                  \        4      pV'       g   R# ^ RIHp \        W4      pVf   \        RR/RR7      # Vw  rE \        WQ^ ,          V 4      pV! WFR,          4      f   \        R4      h  TR	,          R
8X  d   \        YR,          \        T4      4       M(TR	,          R8w  d   \        YR,          4      G Rj  x€L
  Y`P                  n        R#   \         d    \        RR/RR7      u # i ; i L6  \         d    \        RR/RR7      u # i ; i5i)zLReturn a rejection or stamp a one-request principal; absent header is inert.Nr’   ÚdetailÚUnauthorizedi‘  )Ústatus_coder   zunserved native grantra   rc   rb   r   i“  )r=   r<   r”   rn   r“   r�   r   ri   r   r\   rq   rN   r   r   )r   r‹   r“   r–   ro   rg   r   s   &      r   Úauthenticate_native_httprŸ   ÿ   s(  é € à�o‰o×%Ñ%¤fÓ-€GßÙÝDÜ˜Ó*€DØ‚|Ü˜X ~Ð6ÀCÔHÐHØ�M€FðIä# E°1­:°wÓ?ˆÙ# F°,Õ,?Ó@ÒHÜ!Ð"9Ó:Ð:ð IðSØ�ÕÐ8Ô8Ü! '°Õ+>ÄÈVÓ@TÕUØ�9ÕÐ!8Ô8Ü& w°lÕ0CÓD×DÐDð +0‡M�MÔ'Ùøô ô IÜ˜X ~Ð6ÀCÔHÒHðIúñ EøÜô SÜ˜XÐ'?Ð@ÈcÔRÒRðSüsl   ‚AD-Á/C+ ÂD-Â*D Â0D-Â1#D ÃDÃD ÃD-Ã+DÄD-ÄDÄD-ÄD ÄD*Ä'D-Ä)D*Ä*D-N)Ú__doc__Ú
__future__r   Ú
contextlibr   Úpathlibr   Úfastapir   Ústarlette.responsesr   r”   r   r#   rN   r•   rS   rG   rV   r\   ri   rq   r�   r—   rš   rŸ   rQ   rT   r   Ú<module>r¦      sÉ   ðñõ #å %Ý å !Ý ,à	"€ð ñ*ó ð*ð.8¨tô 8ò 0@ðp ‰i˜ ˜Ó(¨(±I¸v¸hÓ4GØ‘Y ˜wÓ'¨±YÀ¸wÓ5GØ™i¨¨Ó1Ð3EÁyÐRWÐQXÓGYðÐ ò[òò8ò,ò(=òò:ò8<ôrT   