generated from coulomb/repo-seed
feat: reachability and consumer profiles (SAND-WP-0011)
Add reachability enrichment (tunnel metadata, ops-bridge pointer), secret_refs boundary resolution, profile.agent-dev and profile.build, CLI reachability show, API endpoint, consumer smoke scripts, and tests.
This commit is contained in:
@@ -26,7 +26,9 @@ from sandboxer.payments.credits import CreditsStore
|
||||
from sandboxer.payments.metering import estimate_cost, settle_usage
|
||||
from sandboxer.placement import resolve_host
|
||||
from sandboxer.profiles.loader import load_profile
|
||||
from sandboxer.reachability.enrich import enrich_reachability
|
||||
from sandboxer.routing.resolver import resolve_extension
|
||||
from sandboxer.secrets.resolver import resolve_setup_secrets
|
||||
from sandboxer.snapshots.store import SnapshotStore
|
||||
from sandboxer.telemetry.export import export_telemetry
|
||||
from sandboxer.telemetry.introspection import (
|
||||
@@ -127,7 +129,11 @@ class SandboxManager:
|
||||
provision_before = collect_host_snapshot(resolved_host)
|
||||
|
||||
try:
|
||||
handle = backend.provision(profile, request.inputs, resolved_host)
|
||||
secret_bundle = resolve_setup_secrets(profile)
|
||||
provision_inputs = dict(request.inputs)
|
||||
handle = backend.provision(profile, provision_inputs, resolved_host)
|
||||
if secret_bundle:
|
||||
handle["_secret_refs"] = secret_bundle
|
||||
status.sandbox_id = handle["sandbox_id"]
|
||||
status.inputs["compose_file"] = handle.get("compose_file", "")
|
||||
status.inputs["ssh_user"] = handle.get("ssh_user", "")
|
||||
@@ -139,6 +145,7 @@ class SandboxManager:
|
||||
status.inputs["provider_sandbox_id"] = handle.get("provider_sandbox_id", "")
|
||||
status.inputs["provider"] = handle.get("provider", "")
|
||||
reach = backend.wait_ready(handle)
|
||||
reach = enrich_reachability(reach, profile, handle)
|
||||
status.reachability = Reachability(**reach)
|
||||
status.state = SandboxState.READY
|
||||
status.ready_at = utcnow()
|
||||
@@ -178,6 +185,14 @@ class SandboxManager:
|
||||
def get(self, sandbox_id: str) -> SandboxStatus | None:
|
||||
return self.store.get(sandbox_id)
|
||||
|
||||
def reachability_report(self, sandbox_id: str) -> dict:
|
||||
status = self.store.get(sandbox_id)
|
||||
if not status:
|
||||
raise KeyError(f"Sandbox not found: {sandbox_id}")
|
||||
from sandboxer.reachability.enrich import build_reachability_report
|
||||
|
||||
return build_reachability_report(status)
|
||||
|
||||
def list(self) -> list[SandboxStatus]:
|
||||
return sorted(self.store.list_all(), key=lambda s: s.created_at, reverse=True)
|
||||
|
||||
@@ -453,7 +468,11 @@ class SandboxManager:
|
||||
status.inputs["vm_host"] = handle.get("vm_host", "")
|
||||
status.inputs["endpoint"] = handle.get("endpoint", "")
|
||||
status.inputs["restored_from"] = record.snapshot_id
|
||||
secret_bundle = resolve_setup_secrets(profile)
|
||||
if secret_bundle:
|
||||
handle["_secret_refs"] = secret_bundle
|
||||
reach = backend.wait_ready(handle)
|
||||
reach = enrich_reachability(reach, profile, handle)
|
||||
status.reachability = Reachability(**reach)
|
||||
status.state = SandboxState.READY
|
||||
status.ready_at = utcnow()
|
||||
|
||||
Reference in New Issue
Block a user