simbiot-harness/venv/lib/python3.12/site-packages/strands/sandbox/errors.py
Simbiot Harness b60439152b Simbiot Harness v0.1: тактовая лестница на Strands + CQRS/ES-спина
- harness/es.py: append-only event store + проекции (образец — кооп-портал)
- harness/levels.py: уровни 1с/1м/1ч/1д, контекст ∝ масштабу
- harness/scheduler.py: уровневые потоки, идемпотентные тики, absorbed-стабы
- harness/isolated_runner.py + _llm_worker.py: LLM-тик в сабпроцессе
  (глобальный asyncio-рантайм Strands не переживает 2+ create_harness)
- cli.py: init/task/tasks/status/events + requeue (написан самим минутным агентом)
- 9router: отдельный ключ sk-simbiot, модель auto (glm-5.3 первым)
2026-09-29 15:28:50 +00:00

42 lines
1.6 KiB
Python

"""Error types raised by sandbox execution and file operations.
Mirrors ``strands-ts/src/sandbox/errors.ts``. Each error subclasses its stdlib
equivalent so existing ``except TimeoutError`` / ``except FileNotFoundError``
handlers keep working, while giving callers a sandbox-specific type to branch on.
"""
class SandboxTimeoutError(TimeoutError):
"""Raised by sandbox execution when the configured ``timeout`` elapses.
``stdout`` and ``stderr`` hold whatever the process wrote before it was killed.
"""
def __init__(self, seconds: float | None, stdout: str = "", stderr: str = "") -> None:
"""Initialize the error with the timeout duration and the output captured so far.
Args:
seconds: The timeout duration, in seconds, that elapsed.
stdout: Standard output captured before the kill.
stderr: Standard error captured before the kill.
"""
super().__init__(f"Execution timed out after {seconds} seconds")
self.stdout = stdout
self.stderr = stderr
class SandboxPathNotFoundError(FileNotFoundError):
"""Raised by :meth:`~strands.sandbox.base.Sandbox.list_files` when the path does not exist.
Distinguishes genuine absence (a missing path, or a file where a directory
was expected) from permission or transport failures, which raise plain
:class:`OSError`/:class:`FileNotFoundError`.
"""
def __init__(self, path: str) -> None:
"""Initialize the error with the missing path.
Args:
path: The path that does not exist.
"""
super().__init__(f"Path not found: {path}")