generated from coulomb/repo-seed
Full TDD implementation of the `bridge` CLI tool covering all phases from BRIDGE-WP-0001: project scaffolding, config loading, state management, audit logging, health checks, tunnel lifecycle manager, and all CLI commands (up/down/restart/status/logs). 77 tests, all green. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
50 lines
993 B
Python
50 lines
993 B
Python
"""Domain models for OpsBridge."""
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass, field
|
|
from enum import Enum
|
|
from typing import Optional
|
|
|
|
|
|
class BridgeState(str, Enum):
|
|
STOPPED = "stopped"
|
|
STARTING = "starting"
|
|
CONNECTED = "connected"
|
|
DEGRADED = "degraded"
|
|
RECONNECTING = "reconnecting"
|
|
FAILED = "failed"
|
|
|
|
|
|
@dataclass
|
|
class ReconnectPolicy:
|
|
max_attempts: int = 0 # 0 = infinite
|
|
backoff_initial: int = 5
|
|
backoff_max: int = 60
|
|
|
|
|
|
@dataclass
|
|
class HealthCheckConfig:
|
|
url: str
|
|
interval_seconds: int = 30
|
|
timeout_seconds: int = 5
|
|
|
|
|
|
@dataclass
|
|
class TunnelConfig:
|
|
name: str
|
|
host: str
|
|
remote_port: int
|
|
local_port: int
|
|
ssh_user: str
|
|
ssh_key: str
|
|
actor: str
|
|
reconnect: ReconnectPolicy = field(default_factory=ReconnectPolicy)
|
|
health_check: Optional[HealthCheckConfig] = None
|
|
|
|
|
|
@dataclass
|
|
class ActorInfo:
|
|
name: str
|
|
actor_class: str # "human" or "automation"
|
|
description: str = ""
|