+
    iHàjÁ  ã                   óê   a € R t0 t R t^ RIHt ^ RIt^ RIt^ RIt^ RIHt ]! RRR7       ! R R4      4       t	Rs
] ^ k ]! 4       t]! 0 Rm4      tR R	 ltR
 R ltR R ltR R ltR R ltR R ltR# )a‡  Private bootstrap policy for admission-owned workers: the frozen session config every
config reader returns, plus (troubleshooting workers only) the safe/ignore-user-config bypass.

Stdlib-only: hermes_cli's config/env layer imports it, so it ships in the installer's
hermes_cli + i18n-kernel tail and must never import beyond the standard library.

Bind once in a fresh exec, before config/agent/plugin imports. This is not a
sandbox or a public launch switch: only the managed worker bootstrap consumes
the owner's validated assignment. No environment flag grants this policy and
no reset exists; helper threads see the same immutable snapshot.
)Ú	dataclassN)ÚLockT)ÚfrozenÚslotsc                   ó,   a € ] tR t^t o V 3R ltRtV tR# )Ú_SafeWorkerPolicyc                óJ   <€ V ^8„  d   Qh/ S[ ;R&   S[;R&   S[;R&   S[;R&   # )é   ÚpidÚ	safe_modeÚignore_user_configÚconfig_json)ÚintÚboolÚstr)ÚformatÚ__classdict__s   "€Ú=/home/ubuntu/.hermes/hermes-agent/agent/safe_worker_policy.pyÚ__annotate__Ú_SafeWorkerPolicy.__annotate__   s5   ø‡ ‚ á	�Hñ ñ �Oñ ñ Ññ	 ñ
 Ñò ó    © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__)r   s   @r   r   r      s   ø‡ ‡ „ r   r   c                óH   € V ^8„  d   QhR\         R\         R\        R\        /# ©r	   r   r   ÚconfigÚreturn©r   Údictr   )r   s   "r   r   r   #   s*   € ÷ *ñ *¬4ð *ÄTð *Ü%)ð*Ü.?ñ*r   c                ó´   € \        V 4      \        Jg   \        V4      \        Jd   \        R4      hV '       g   V'       g   \        R4      h\	        V RV4      # )zICalled by the private worker bootstrap, never by the owner or public CLI.z,worker bypass policy fields must be booleansz<ordinary execution binds its config with _bind_worker_configT)Útyper   Ú	TypeErrorÚ
ValueErrorÚ_bind)r   r   r!   s   $$$r   Ú_bind_safe_worker_policyr*   #   sJ   € ô ˆIƒœdÓ"¤dÐ+=Ó&>ÄdÓ&JÜÐFÓGÐGß×+ÜÐWÓXÐXÜ�˜D &Ó)Ð)r   c                ó0   € V ^8„  d   QhR\         R\        /# )r	   r!   r"   )r$   r   )r   s   "r   r   r   -   s   € ÷ 'ñ '¤ð 'Ô):ñ 'r   c                ó   € \        RRV 4      # )u  An ordinary managed worker's frozen session config: every config reader returns it (the
session never follows later profile edits), while plugins, MCP, hooks and providers load as
usual â€” ``safe_worker_enabled()`` stays False. Same one-shot, pre-import rules as bypass.F)r)   )r!   s   &r   Ú_bind_worker_configr-   -   s   € ô �˜˜vÓ&Ð&r   c                óH   € V ^8„  d   QhR\         R\         R\        R\        /# r    r#   )r   s   "r   r   r   4   s)   € ÷ ñ ”Tð ¬tð ¼Tð ÔFWñ r   c                 ó¢  € \        V4      \        Jd   \        R 4      h\        P                  ! VRR7      p\
        ;_uu_ 4        \        e   \        R4      h\        P                  \        P                  4      '       d   \        R4      h\        \        P                  ! 4       WV4      s\        uuRRR4       #   + '       g   i     R# ; i)z#worker config must be a JSON objectF)Ú	allow_nanNzworker policy is already boundz.worker policy must bind before runtime imports)r&   r$   r'   ÚjsonÚdumpsÚ
_bind_lockÚ_policyÚRuntimeErrorÚ_RUNTIME_IMPORTSÚintersectionÚsysÚmodulesr   ÚosÚgetpid)r   r   r!   Ú
serializeds   &&& r   r)   r)   4   s†   € äˆFƒ|œ4ÓÜÐ=Ó>Ð>Ü—’˜F¨eÔ4€Jß	ŽÜÒÜÐ?Ó@Ð@Ü×(Ñ(¬¯©×5Ò5ÜÐOÓPÐPÜ#¤B§I¢I£K°ÐPZÓ[ˆÜ÷ 
��‹ús   Á<B=Â0B=Â=C	c                ó2   € V ^8„  d   QhR\         R,          /# ©r	   r"   N)r   )r   s   "r   r   r   B   s   € ÷ ñ Ô*¨TÕ1ñ r   c                  ó„   € \         e4   \         P                  \        P                  ! 4       8w  d   \	        R4      h\         # )Nz3worker policy cannot cross a fork; use a fresh exec)r4   r
   r:   r;   r5   r   r   r   Ú_current_policyr@   B   s*   € ÜÒœwŸ{™{¬b¯iªi«kÔ9ÜÐPÓQÐQÜ€Nr   c                ó$   € V ^8„  d   QhR\         /# )r	   r"   )r   )r   s   "r   r   r   H   s   € ÷ 3ñ 3œTñ 3r   c                  óF   € \        4       p V R J;'       d    V P                  # )N)r@   r   ©Úpolicys    r   Úsafe_worker_enabledrE   H   s#   € ÜÓ€FØ˜Ð×2Ð2 &×"2Ñ"2Ð2r   c                ó2   € V ^8„  d   QhR\         R,          /# r>   )r$   )r   s   "r   r   r   M   s   € ÷ Jñ J¤ t¥ñ Jr   c                 ób   € \        4       p V e!   \        P                  ! V P                  4      # R# )zHReturn detached explicit config; None means the ordinary loader owns it.N)r@   r1   Úloadsr   rC   s    r   Úworker_config_snapshotrI   M   s)   € äÓ€FØ-3Ò-?Œ4�:Š:�f×(Ñ(Ó)ÐIÀTÐIr   c                óN   € V ^8„  d   Qh/ ^ \         9   d   \        R,          ;R&   # )r	   Nr4   )Ú__conditional_annotations__r   )r   s   "r   r   r      s$   € ÷ 
ñ 
÷4 )Ò (Ô	˜TÕ	!Ñ (ò5
r   >   Ú	providersÚ	run_agentÚmodel_toolsúagent.agent_initúhermes_cli.configúhermes_cli.pluginsúhermes_cli.env_loader)rK   Ú__doc__Údataclassesr   r1   r:   r8   Ú	threadingr   r   r4   r3   Ú	frozensetr6   r*   r-   r)   r@   rE   rI   r   )rK   s   @r   Ú<module>rW      s|   øðö
õ "Û Û 	Û 
Ý ñ �$˜dÔ#÷ð ó $ðð %)€Ó (Ù‹V€
Ùò ó Ð õ*õ'õõõ3÷
Jr   