
    Jj                    @    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/rurouni/.hermes/hermes-agent/gateway/cwd_placeholder.py_truthy_envr      s*    KR  &&((,@@@    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   