INNER CODE UNIT · Python
_workspace_ignore_pattern
omnirexflora-labs/omnicoreagent · src/omnicoreagent/serve/cli.py:413
def _workspace_ignore_pattern(cwd: Path) -> str:
"""The configured workspace folder, anchored at the build context's root.
The 0.5.0 file left out every folder named ``workspace``, so a Python
package of that name was missing from the image. Only the workspace the
agent is configured to use is left out. One outside the build context
(absolute, or ``..``) is not in it, so it needs no rule.
"""
from omnicoreagent.core.workspace.config import DEFAULT_WORKSPACE_DIR
configured = os.environ.get("OMNICOREAGENT_WORKSPACE_DIR") or DEFAULT_WORKSPACE_DIR
try:
relative = (cwd / configured).resolve().relative_to(cwd.resolve())
except ValueError:
return ""
return f"/{relative.as_posix()}" if relative.parts else ""