initial: import DOLPHIN baseline 2026-04-21 from dolphinng5_predict working tree

Includes core prod + GREEN/BLUE subsystems:
- prod/ (BLUE harness, configs, scripts, docs)
- nautilus_dolphin/ (GREEN Nautilus-native impl + dvae/ preserved)
- adaptive_exit/ (AEM engine + models/bucket_assignments.pkl)
- Observability/ (EsoF advisor, TUI, dashboards)
- external_factors/ (EsoF producer)
- mc_forewarning_qlabs_fork/ (MC regime/envelope)

Excludes runtime caches, logs, backups, and reproducible artifacts per .gitignore.
This commit is contained in:
hjnormey
2026-04-21 16:58:38 +02:00
commit 01c19662cb
643 changed files with 260241 additions and 0 deletions

View File

@@ -0,0 +1,82 @@
#!/usr/bin/env python3
"""
Example: System Watchdog Service using ServiceBase
"""
import asyncio
from service_base import ServiceBase
class WatchdogService(ServiceBase):
"""
Survival Stack Watchdog - 10s check interval
"""
def __init__(self):
super().__init__(
name='watchdog',
check_interval=10, # Health check every 10s
max_retries=5,
notify_systemd=True
)
self.cat1_ok = True
self.cat2_ok = True
self.last_posture = 'APEX'
async def run_cycle(self):
"""Main cycle - runs every 10s"""
# Check all categories
await self._check_cat1_invariants()
await self._check_cat2_structural()
await self._check_cat3_microstructure()
await self._check_cat4_environmental()
await self._check_cat5_capital()
# Compute posture
posture = self._compute_posture()
if posture != self.last_posture:
self.logger.warning(f"Posture change: {self.last_posture} -> {posture}")
self.last_posture = posture
# Write to Hazelcast
await self._update_safety_ref(posture)
# Sleep until next cycle
await asyncio.sleep(10)
async def _check_cat1_invariants(self):
"""Binary kill switches"""
# Check HZ quorum, heartbeat
pass
async def _check_cat2_structural(self):
"""MC-Forewarner staleness"""
pass
async def _check_cat3_microstructure(self):
"""OB depth/fill quality"""
pass
async def _check_cat4_environmental(self):
"""DVOL spike"""
pass
async def _check_cat5_capital(self):
"""Drawdown check"""
pass
def _compute_posture(self) -> str:
"""Compute Rm and map to posture"""
# Rm = Cat1 × Cat2 × Cat3 × Cat4 × Cat5
# Posture: APEX/STALKER/TURTLE/HIBERNATE
return 'APEX'
async def _update_safety_ref(self, posture: str):
"""Update DOLPHIN_SAFETY AtomicReference"""
pass
async def health_check(self) -> bool:
"""Watchdog health check"""
# If we're running, we're healthy
return True
if __name__ == '__main__':
service = WatchdogService()
service.run()