From e34fb7a29752450dba07bb331c6893b3efcdc2b6 Mon Sep 17 00:00:00 2001 From: Stateflow Labs Date: Tue, 9 Jun 2026 11:34:40 +0700 Subject: [PATCH] Fix encoding: BOM, CRLF, mojibake across all files --- adaptive_runtime/__init__.py | 2 +- adaptive_runtime/core/__init__.py | 2 +- adaptive_runtime/core/confidence_engine.py | 6 +++--- adaptive_runtime/core/context_engine.py | 4 ++-- adaptive_runtime/core/decision_engine.py | 6 +++--- adaptive_runtime/core/recovery_engine.py | 2 +- adaptive_runtime/core/state_engine.py | 2 +- adaptive_runtime/observability/__init__.py | 2 +- adaptive_runtime/observability/logger.py | 2 +- adaptive_runtime/observability/metrics.py | 2 +- adaptive_runtime/runtime/__init__.py | 2 +- adaptive_runtime/runtime/benchmark.py | 2 +- adaptive_runtime/runtime/cache.py | 4 ++-- adaptive_runtime/runtime/event_bus.py | 2 +- adaptive_runtime/runtime/runtime_manager.py | 4 ++-- adaptive_runtime/storage/__init__.py | 2 +- adaptive_runtime/storage/memory_store.py | 2 +- adaptive_runtime/storage/sqlite_store.py | 2 +- 18 files changed, 25 insertions(+), 25 deletions(-) diff --git a/adaptive_runtime/__init__.py b/adaptive_runtime/__init__.py index 1fc2e72..4be5acc 100644 --- a/adaptive_runtime/__init__.py +++ b/adaptive_runtime/__init__.py @@ -1,4 +1,4 @@ -""" +""" Adaptive Runtime """ diff --git a/adaptive_runtime/core/__init__.py b/adaptive_runtime/core/__init__.py index 2d4b02f..00f912e 100644 --- a/adaptive_runtime/core/__init__.py +++ b/adaptive_runtime/core/__init__.py @@ -1,4 +1,4 @@ -from .state_engine import StateEngine +from .state_engine import StateEngine from .context_engine import ContextEngine, ContextResult from .confidence_engine import ConfidenceEngine, ConfidenceResult from .decision_engine import DecisionEngine, DecisionResult diff --git a/adaptive_runtime/core/confidence_engine.py b/adaptive_runtime/core/confidence_engine.py index 5917d56..370ae29 100644 --- a/adaptive_runtime/core/confidence_engine.py +++ b/adaptive_runtime/core/confidence_engine.py @@ -1,4 +1,4 @@ -""" +""" Confidence Engine - adaptive probabilistic confidence scoring. """ @@ -79,7 +79,7 @@ def calculate(self, event: dict, context_risk: str) -> ConfidenceResult: ) metrics.record("confidence.final", final) logger.info( - "Confidence → base=%.2f decay=%.2f hist=%.2f ctx=%.2f final=%.4f", + "Confidence → base=%.2f decay=%.2f hist=%.2f ctx=%.2f final=%.4f", base, decay, hist_weight, ctx_adj, final, ) return result @@ -104,7 +104,7 @@ def _history_weight(self, context_risk: str) -> float: if len(relevant) < 3: return 1.0 success_rate = sum(1 for r in relevant if r.success) / len(relevant) - # Map [0, 1] success rate → [0.6, 1.1] weight + # Map [0, 1] success rate → [0.6, 1.1] weight return 0.6 + success_rate * 0.5 diff --git a/adaptive_runtime/core/context_engine.py b/adaptive_runtime/core/context_engine.py index 403d4ef..65e43df 100644 --- a/adaptive_runtime/core/context_engine.py +++ b/adaptive_runtime/core/context_engine.py @@ -1,4 +1,4 @@ -""" +""" Context Engine - transforms raw events into contextual understanding. """ @@ -85,7 +85,7 @@ def analyze(self, event: dict) -> ContextResult: metrics.record("context.pressure", pressure) logger.info( - "Context → risk=%s stability=%s ctx=%s pressure=%.2f", + "Context → risk=%s stability=%s ctx=%s pressure=%.2f", risk, stability, context_label, pressure, ) return result diff --git a/adaptive_runtime/core/decision_engine.py b/adaptive_runtime/core/decision_engine.py index bf9265b..88801a4 100644 --- a/adaptive_runtime/core/decision_engine.py +++ b/adaptive_runtime/core/decision_engine.py @@ -1,4 +1,4 @@ -""" +""" Decision Engine - generates adaptive runtime decisions. """ @@ -17,7 +17,7 @@ class DecisionResult(BaseModel): metadata: dict = {} -# Each rule: (context_label, risk_level, min_confidence) → action +# Each rule: (context_label, risk_level, min_confidence) → action # Evaluated top-to-bottom; first match wins. _RULES: list[tuple[str | None, str | None, float, str, str]] = [ @@ -78,7 +78,7 @@ def decide( ) metrics.record("decision.confidence", confidence) logger.info( - "Decision → action=%s confidence=%.3f reason=%s priority=%s", + "Decision → action=%s confidence=%.3f reason=%s priority=%s", action, confidence, reason, priority, ) return result diff --git a/adaptive_runtime/core/recovery_engine.py b/adaptive_runtime/core/recovery_engine.py index fffef4a..13fa1fa 100644 --- a/adaptive_runtime/core/recovery_engine.py +++ b/adaptive_runtime/core/recovery_engine.py @@ -1,4 +1,4 @@ -""" +""" Recovery Engine - self-healing runtime resilience. """ diff --git a/adaptive_runtime/core/state_engine.py b/adaptive_runtime/core/state_engine.py index d3413b1..ae422e5 100644 --- a/adaptive_runtime/core/state_engine.py +++ b/adaptive_runtime/core/state_engine.py @@ -1,4 +1,4 @@ -""" +""" State Engine - manages runtime persistence and state memory. """ diff --git a/adaptive_runtime/observability/__init__.py b/adaptive_runtime/observability/__init__.py index 4ff82f0..e854a75 100644 --- a/adaptive_runtime/observability/__init__.py +++ b/adaptive_runtime/observability/__init__.py @@ -1,4 +1,4 @@ -from .logger import get_logger +from .logger import get_logger from .metrics import metrics, MetricsCollector __all__ = ["get_logger", "metrics", "MetricsCollector"] diff --git a/adaptive_runtime/observability/logger.py b/adaptive_runtime/observability/logger.py index c7ed383..aec76c8 100644 --- a/adaptive_runtime/observability/logger.py +++ b/adaptive_runtime/observability/logger.py @@ -1,4 +1,4 @@ -""" +""" Structured logger for Adaptive Runtime. """ diff --git a/adaptive_runtime/observability/metrics.py b/adaptive_runtime/observability/metrics.py index ee50683..5c91bd9 100644 --- a/adaptive_runtime/observability/metrics.py +++ b/adaptive_runtime/observability/metrics.py @@ -1,4 +1,4 @@ -""" +""" In-memory lightweight metrics collector. """ diff --git a/adaptive_runtime/runtime/__init__.py b/adaptive_runtime/runtime/__init__.py index ef327c7..ba7854b 100644 --- a/adaptive_runtime/runtime/__init__.py +++ b/adaptive_runtime/runtime/__init__.py @@ -1,4 +1,4 @@ -from .runtime_manager import Runtime, RuntimeResult +from .runtime_manager import Runtime, RuntimeResult from .event_bus import EventBus from .cache import TTLCache diff --git a/adaptive_runtime/runtime/benchmark.py b/adaptive_runtime/runtime/benchmark.py index 9841111..25e181d 100644 --- a/adaptive_runtime/runtime/benchmark.py +++ b/adaptive_runtime/runtime/benchmark.py @@ -1,4 +1,4 @@ -import asyncio +import asyncio import time import os import sys diff --git a/adaptive_runtime/runtime/cache.py b/adaptive_runtime/runtime/cache.py index 65c8f48..7cd495f 100644 --- a/adaptive_runtime/runtime/cache.py +++ b/adaptive_runtime/runtime/cache.py @@ -1,4 +1,4 @@ -""" +""" Lightweight TTL-based in-memory cache for the runtime. """ @@ -13,7 +13,7 @@ class TTLCache: """ def __init__(self, default_ttl: float = 60.0): - self._store: dict[str, tuple[any, float]] = {} # key → (value, expires_at) + self._store: dict[str, tuple[any, float]] = {} # key → (value, expires_at) self._default_ttl = default_ttl self._lock = Lock() diff --git a/adaptive_runtime/runtime/event_bus.py b/adaptive_runtime/runtime/event_bus.py index f02e6da..7bae19c 100644 --- a/adaptive_runtime/runtime/event_bus.py +++ b/adaptive_runtime/runtime/event_bus.py @@ -1,4 +1,4 @@ -""" +""" Async event bus - pub/sub within a single runtime process. """ diff --git a/adaptive_runtime/runtime/runtime_manager.py b/adaptive_runtime/runtime/runtime_manager.py index f3a878b..8eae0be 100644 --- a/adaptive_runtime/runtime/runtime_manager.py +++ b/adaptive_runtime/runtime/runtime_manager.py @@ -1,4 +1,4 @@ -""" +""" Runtime Manager - central orchestrator of all engines. Usage: @@ -96,7 +96,7 @@ async def stop(self) -> None: async def process(self, event: dict) -> RuntimeResult: """ Full pipeline: - Event → Context → Confidence → Decision → State → Recovery + Event → Context → Confidence → Decision → State → Recovery """ if not self._started: await self.start() diff --git a/adaptive_runtime/storage/__init__.py b/adaptive_runtime/storage/__init__.py index e1d22da..1d7de55 100644 --- a/adaptive_runtime/storage/__init__.py +++ b/adaptive_runtime/storage/__init__.py @@ -1,4 +1,4 @@ -from .sqlite_store import SQLiteStore +from .sqlite_store import SQLiteStore from .memory_store import MemoryStore __all__ = ["SQLiteStore", "MemoryStore"] diff --git a/adaptive_runtime/storage/memory_store.py b/adaptive_runtime/storage/memory_store.py index 0661968..ea019f9 100644 --- a/adaptive_runtime/storage/memory_store.py +++ b/adaptive_runtime/storage/memory_store.py @@ -1,4 +1,4 @@ -""" +""" In-process memory store - useful for testing or ephemeral agents. Mirrors the SQLiteStore async API. """ diff --git a/adaptive_runtime/storage/sqlite_store.py b/adaptive_runtime/storage/sqlite_store.py index 2ae5fd4..e998e6b 100644 --- a/adaptive_runtime/storage/sqlite_store.py +++ b/adaptive_runtime/storage/sqlite_store.py @@ -1,4 +1,4 @@ -""" +""" Async SQLite persistence layer for runtime state and snapshots. """