simbiot-harness/venv/lib/python3.12/site-packages/pydantic_monty/_cli.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

39 lines
1.6 KiB
Python

"""Runs the `monty` binary, forwarding this process's arguments to it.
Reached two ways: `python -m pydantic_monty` (via `__main__.py`) and the
`pydantic-monty` console script the metapackage declares. Both exist because the
binary ships in `pydantic-monty-runtime`, so neither of the other two
distributions provides an executable of its own; the console script deliberately
is NOT named `monty`, since that would collide with — and silently overwrite —
the real binary in the scripts directory, leaving [`find_monty_binary`]
resolving to the shim itself.
"""
from __future__ import annotations
import os
import subprocess
import sys
from ._binary import find_monty_binary
def main() -> int:
"""Hands this process's arguments, streams and exit status to the `monty` binary."""
# find_monty_binary may raise FileNotFoundError, which we let propagate to the caller
binary = find_monty_binary()
argv = [binary, *sys.argv[1:]]
if os.name == 'posix':
# can raise OSError, which we let propagate to the caller
# os.execv never returns, so signals and the exit status are the binary's own
os.execv(binary, argv)
else:
# Windows has no `exec`, so wait on a child instead. Ctrl-C reaches the
# whole console group, so ignore it here and let the binary decide whether
# a SIGINT ends the session — exiting early would orphan it on the terminal.
proc = subprocess.Popen(argv)
while True:
try:
return proc.wait()
except KeyboardInterrupt:
pass