1702664b81
First implementation slice of PRD 0070, the backend-neutral consolidation
core as a plain-process dev-harness (no VM packaging yet):
* orchestrator/registry.py — SQLite (WAL) runtime-state store on the
existing DbStore/TableMigrations base. Live bottle registry keyed by
source IP + per-bottle identity token, with fail-closed attribution:
a request resolves to a bottle only when its source IP AND identity
token both match exactly one active record (unknown/ambiguous IP,
empty token, or token mismatch all deny). Tokens are 256-bit urandom.
* orchestrator/control_plane.py — the HTTP control plane (the universal
transport chosen in 0070): register / deregister / list / attribute /
health. Routing is a pure dispatch() so it is socket-free testable;
Handler/ControlPlaneServer/make_server are a thin stdlib adapter.
register/deregister are the live-reload path; listing redacts tokens.
* orchestrator/__main__.py — `python -m bot_bottle.orchestrator` harness.
Launch/teardown, the launch broker, and the egress/git/supervise data
plane come in later slices. 24 unit tests (attribution matrix, persistence,
dispatch, one real-socket round-trip).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WBMWTEtQdJ4W5UrWuLHCck
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
"""Per-host orchestrator service (PRD 0070).
|
|
|
|
A single persistent per-host service that will run the sidecar 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:
|
|
|
|
* `registry` — the SQLite runtime-state store + fail-closed
|
|
attribution (source IP + per-bottle identity token).
|
|
* `control_plane` — the HTTP control-plane RPC (register / deregister /
|
|
list / attribute / health), with live reload.
|
|
|
|
Launch/teardown, the launch broker, and the actual egress/git/supervise
|
|
data plane land in later slices once this core is proven (see the PRD's
|
|
sequencing: plain-process dev-harness -> docker orchestrator -> firecracker).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from .registry import BottleRecord, RegistryStore, new_identity_token
|
|
from .control_plane import ControlPlaneServer, dispatch, make_server
|
|
|
|
__all__ = [
|
|
"BottleRecord",
|
|
"RegistryStore",
|
|
"new_identity_token",
|
|
"ControlPlaneServer",
|
|
"dispatch",
|
|
"make_server",
|
|
]
|