bef45348f5
tracker-policy-pr / check-pr (pull_request) Successful in 13s
test / integration-docker (pull_request) Successful in 33s
test / unit (pull_request) Successful in 51s
lint / lint (push) Successful in 57s
test / integration-firecracker (pull_request) Successful in 3m25s
test / coverage (pull_request) Successful in 43s
test / publish-infra (pull_request) Has been skipped
Two facade issues from the reorg:
* orchestrator/__init__.py used `__all__ = list(_LAZY)`, which pyright
strict can't analyze (reportUnsupportedDunderAll) — and because it
isn't a static literal, the TYPE_CHECKING re-export imports read as
unused. Replaced with the explicit literal list the other lazy
facades already use.
* manifest/index.py imported six piece types (ManifestAgentProvider,
EGRESS_AUTH_SCHEMES, ManifestEgressConfig/Route, ManifestGitEntry,
ManifestKeyConfig) it never referenced — the package facade re-exports
those straight from their submodules, so index.py needn't import them.
Dropped the dead imports.
pyright: 0 errors (was 24). Full unit suite green (2243).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
104 lines
3.6 KiB
Python
104 lines
3.6 KiB
Python
"""Per-host orchestrator service (PRD 0070).
|
|
|
|
A single persistent per-host service that will run the gateway functions
|
|
(egress / git-gate / supervise), coordinate with the console, and broker
|
|
agent launches. This package is being built bottom-up, starting with the
|
|
backend-neutral "consolidation core" that needs no VM packaging:
|
|
|
|
* `store.registry_store` — the SQLite runtime-state store + fail-closed
|
|
attribution (source IP + per-bottle identity token).
|
|
* `broker` — the signed, structured launch-request contract + a
|
|
`LaunchBroker` (stub for the harness) that verifies
|
|
provenance before acting.
|
|
* `gateway` — the consolidated per-host gateway: the `Gateway`
|
|
lifecycle contract (idempotent singleton). One
|
|
gateway shared by all bottles instead of one per
|
|
bottle; backend impls live under `backend/*/gateway`.
|
|
* `service` — the `Orchestrator`: owns the registry, brokers the
|
|
launch lifecycle (launch/teardown), manages the
|
|
shared gateway, attributes.
|
|
* `server` — the HTTP control-plane RPC (launch / teardown /
|
|
list / attribute / gateway / health).
|
|
|
|
The actual backend-native launch (a real docker/firecracker broker) and
|
|
the egress/git/supervise data plane land in later slices once this core is
|
|
proven (see the PRD sequencing: plain-process dev-harness -> docker
|
|
orchestrator -> firecracker).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING, Any
|
|
|
|
if TYPE_CHECKING:
|
|
from .store.registry_store import BottleRecord, RegistryStore, new_identity_token
|
|
from .broker import (
|
|
BrokerAuthError,
|
|
LaunchBroker,
|
|
LaunchRequest,
|
|
StubBroker,
|
|
sign_request,
|
|
verify_request,
|
|
)
|
|
from .docker_broker import DockerBroker, DockerBrokerError
|
|
from ..gateway import Gateway, GatewayError
|
|
from .service import Orchestrator
|
|
from .server import OrchestratorServer, dispatch, make_server
|
|
|
|
|
|
# Facade name -> submodule that defines it. Lazy so importing a leaf (or the
|
|
# parent package, e.g. via `orchestrator.store.store_manager`) doesn't drag the
|
|
# whole orchestrator — server, docker_broker + the docker backend, http — while
|
|
# `from bot_bottle.orchestrator import RegistryStore` keeps working.
|
|
_LAZY: dict[str, str] = {
|
|
"BottleRecord": ".store.registry_store",
|
|
"RegistryStore": ".store.registry_store",
|
|
"new_identity_token": ".store.registry_store",
|
|
"BrokerAuthError": ".broker",
|
|
"LaunchBroker": ".broker",
|
|
"LaunchRequest": ".broker",
|
|
"StubBroker": ".broker",
|
|
"sign_request": ".broker",
|
|
"verify_request": ".broker",
|
|
"DockerBroker": ".docker_broker",
|
|
"DockerBrokerError": ".docker_broker",
|
|
"Gateway": "..gateway",
|
|
"GatewayError": "..gateway",
|
|
"Orchestrator": ".service",
|
|
"OrchestratorServer": ".server",
|
|
"dispatch": ".server",
|
|
"make_server": ".server",
|
|
}
|
|
|
|
|
|
def __getattr__(name: str) -> Any:
|
|
src = _LAZY.get(name)
|
|
if src is None:
|
|
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
from importlib import import_module
|
|
|
|
value = getattr(import_module(src, __name__), name)
|
|
globals()[name] = value
|
|
return value
|
|
|
|
|
|
__all__ = [
|
|
"BottleRecord",
|
|
"RegistryStore",
|
|
"new_identity_token",
|
|
"BrokerAuthError",
|
|
"LaunchBroker",
|
|
"LaunchRequest",
|
|
"StubBroker",
|
|
"sign_request",
|
|
"verify_request",
|
|
"DockerBroker",
|
|
"DockerBrokerError",
|
|
"Gateway",
|
|
"GatewayError",
|
|
"Orchestrator",
|
|
"OrchestratorServer",
|
|
"dispatch",
|
|
"make_server",
|
|
]
|