host_path
tit.server.host_path ¶
Where this server's project directory lives on the host, when that can be known.
GET /api/project reports container_path (what the server itself sees, e.g.
/mnt/000) and host_path (/Users/me/datasets/000). Only the second one lets a
client turn the container paths every artifact carries into something the host's file
manager, a docker run -v for a sibling container, or a "Reveal in Finder" can use.
Until now host_path was os.environ["LOCAL_PROJECT_DIR"] and nothing else, and the v3
compose stack does not put that variable inside the container (the root
docker-compose.yml interpolates it into the volumes: entry only), so every v3 server
answered host_path: null -- while the very same container carried the answer twice over,
in its tit.host_project_dir label and in the bind mount that produced /mnt/<name>.
That forced every client that needs a host path to run docker inspect itself
(dev/smoke.sh, docs/dev/DECISIONS.md ยง 2026-09-03 (One Docker image and a real development loop)).
So: the environment variable stays authoritative when it is set, and when it is not, the
server asks the Docker Engine about its own container through the socket the stack already
mounts for DooD (/var/run/docker.sock) and reads the answer off the container's own
definition:
- the
Mountsentry whoseDestinationis (or contains) the project directory -- itsSourceis the host path, and this also covers a project dir nested inside a mount; - failing that, the
tit.host_project_dirlabel the desktop app stamps on every container it creates (desktop/src/shared/compose.ts'sLABEL_HOST_DIR).
Everything here is best-effort by construction: no socket, no /proc, an engine error, a
server running outside a container at all -- every one of them yields None, the same
answer the route gave before, never an exception on a request path. The lookup result is
cached per project directory, so a running server makes at most one Engine call for it.
clear_cache ¶
host_project_dir ¶
The host directory container_path is mounted from, or None if unknowable.
LOCAL_PROJECT_DIR wins when set (it is what the loader and the packaged app pass, and
it is the documented contract of Project.host_path); otherwise the container's own
definition is consulted once and the result -- including None -- is cached.
Source code in tit/server/host_path.py
host_dir_from_inspect ¶
Pure half of the lookup: a container's inspect payload -> the host path of container_path.
Prefers the bind mount that actually produced the directory (exact destination, or the
closest enclosing one, so /mnt/000 resolves even when the server was pointed at
/mnt/000/sub-project), and falls back to the tit.host_project_dir label.
Source code in tit/server/host_path.py
own_container_id ¶
own_container_id() -> str | None
This process's own container id, or None when not running in one.