§
    øžyjñ  ã                  ó@   — d Z ddlmZ  eh d£¦  «        Zdd„Zdd„ZdS )uŸ  Resolve gateway ``terminal.cwd`` placeholder values to ``TERMINAL_CWD``.

When ``terminal.cwd`` is unset or a placeholder (``.``, ``auto``, ``cwd``),
the gateway must not blindly map host ``Path.home()`` into container backends.
Docker with workspace mounting still needs an explicit host path signal
(``MESSAGING_CWD`` or an absolute config path) for ``terminal_tool`` to map
``/host/project`` â†’ ``/workspace``.
é    )Úannotations>   ÚcwdÚautoú.Úvalueú
str | NoneÚreturnÚboolc                óV   — | pd                      ¦   «                              ¦   «         dv S )NÚ >   Ú1ÚyesÚtrue)ÚstripÚlower)r   s    ú=/home/ragecks/.hermes/hermes-agent/gateway/cwd_placeholder.pyÚ_truthy_envr      s*   € ØˆK�R×ÒÑ Ô ×&Ò&Ñ(Ô(Ð,@Ð@Ð@ó    Úconfigured_cwdÚstrÚterminal_backendÚmessaging_cwdÚdocker_mount_cwd_to_workspaceÚhome_fallbackc                ó  — | r| t           vr| S |pd                     ¦   «                              ¦   «         }|dk    r|pd                     ¦   «         }|p|S |dk    r%|r#|pd                     ¦   «         }|r|t           vr|S dS )u¶  Return the ``TERMINAL_CWD`` value to set, or ``None`` to leave it unset.

    Cases:
      - **local** + placeholder â†’ ``MESSAGING_CWD`` or ``home_fallback``
      - **docker** + placeholder + mount on + host ``MESSAGING_CWD`` â†’ host path
        (for ``terminal_tool`` ``/workspace`` mapping)
      - **docker** + placeholder + mount off â†’ ``None`` (sandbox default)
      - other non-local backends + placeholder â†’ ``None``
    Úlocalr   ÚdockerN)ÚCWD_PLACEHOLDERSr   r   )r   r   r   r   r   ÚbackendÚ	messagings          r   Ú resolve_placeholder_terminal_cwdr!      s°   € ð" ð ˜.Õ0@Ð@Ð@ØÐàÐ* 7×1Ò1Ñ3Ô3×9Ò9Ñ;Ô;€GØ�'ÒÐØ"Ð( b×/Ò/Ñ1Ô1ˆ	ØÐ)˜MÐ)à�(ÒÐÐ<ÐØ"Ð( b×/Ò/Ñ1Ô1ˆ	Øð 	˜Õ*:Ð:Ð:ØÐàˆ4r   N)r   r   r	   r
   )r   r   r   r   r   r   r   r
   r   r   r	   r   )Ú__doc__Ú
__future__r   Ú	frozensetr   r   r!   © r   r   ú<module>r&      sp   ððð ð #Ð "Ð "Ð "Ð "Ð "à�9Ð1Ð1Ð1Ñ2Ô2Ð ðAð Að Að Aðð ð ð ð ð r   