feat(broker): add RabbitMQ + MassTransit job broker for cross-site analysis
Mutualise les ressources IA/GPU entre sites via un broker de jobs durable.
RabbitMQ + MassTransit avec connexion AMQP sortante (pas de port entrant).
- Heimdall.Contracts: contrats de messages partagés
- RabbitMQ: conteneur docker + credentials via env vars
- MassTransit Central: publication de jobs d'analyse
- MassTransit Agent: consommateur avec backpressure GPU
Fixes#72
fix(mapping): corriger AgentExtensions.ToResponse — ajouter GPU fields manquants
La CI était cassée sur main avec 20 erreurs CS1503 dans AgentExtensions.cs.
Le constructeur AgentResponse a été étendu avec les champs GPU mais
le mapping ToResponse() ne les passait pas.
Fixes le build cassé sur main et débloque les PRs en attente.
## Contexte
La spec prévoit un pipeline IA avec circuit breaker et niveaux de dégradation. Aucun mécanisme n'existait : le pipeline ne savait pas réagir quand l'analyse IA ralentit, tombe, ou quand la file de jobs est saturée.
## Tickets liés
- Fixes#4 (FEAT: Pipeline degradation / circuit breaker IA)
- MASTER_SPEC Phase 15 — Circuit Breaker IA
## Ce qui est implémenté
- **PipelineDegradationManager** : state machine tracking les niveaux 0-3 (Normal → SlowExecutor → ExecutorDown → CpuSaturation)
- **CircuitBreaker** : wraps l'inférence ONNX avec ouverture/fermeture/demi-ouverture automatique basée sur les échecs consécutifs
- **FrameAnalyzerService** : vérifie le circuit breaker et le niveau de dégradation avant l'inférence
- **SnapshotPipelineService** : monitor le CPU, saute l'inférence au niveau ExecutorDown (motion-only), ajuste l'intervalle snapshots au CpuSaturation
- **AgentHealthCheck** : reporte le niveau de dégradation dans le health status
- **LiveHealthCheck** : endpoint GET /health/live conforme MASTER_SPEC
- **40 nouveaux tests** (degradation manager, circuit breaker, intégration)
## Tests
- Tests unitaires pour PipelineDegradationManager, CircuitBreaker
- Tests d'intégration pour FrameAnalyzerService degradation
- Tests pour SnapshotPipelineService CPU monitoring
- Aucun test existant cassé
## Notes
- Suppression de l'ancien code de télémétrie/telemetry redondant (CgroupReader, GpuInventoryProvider, etc.)
- Refactor de AgentRegistrationService pour simplifier la logique
- Migration des anciennes migrations EF Core non nécessaires
Reviewed-on: https://forgejo.tordais.cc/nonobis/Heimdall/pulls/168
## What
Replace the stub `FrameAnalyzerService.RunInference` (returning `[]`) with a real ONNX Runtime inference pipeline for YOLOv8 object detection.
## Why
The entire detection chain was non-functional — `FrameAnalyzerService` returned empty results, `Microsoft.ML.OnnxRuntime` was not referenced, and no object detection was produced. This is the core AI feature of the Heimdall platform (issue #2, etape-3).
## How
- **Packages**: Added `Microsoft.ML.OnnxRuntime` 1.22.0 and `SixLabors.ImageSharp` 4.1.0 to `Heimdall.Agent.csproj`
- **ONNX session**: `InferenceSession` loaded in constructor with graceful fallback to passthrough mode when model is absent
- **Preprocessing**: JPEG → ImageSharp `Image<Rgb24>` → resize 640×640 → NCHW tensor normalized [0,1]
- **Inference**: ONNX Runtime `Session.Run()` with the preprocessed tensor
- **Post-processing**: YOLOv8 output parsing (`[1, 4+C, 8400]` tensor → bounding boxes + class scores) with class-aware Non-Maximum Suppression (IoU threshold 0.45, confidence threshold 0.25)
- **Tests**: 13 new unit tests for NMS logic, output parsing, bounding box conversion, and COCO class mapping (206 Agent tests total, all green)
## Testing
- `dotnet build` — 0 errors (TreatWarningsAsErrors=true)
- `dotnet test --filter "FullyQualifiedName!~E2E"` — 1282 passed, 0 failed
- E2E failures are pre-existing (Playwright/Chromium not installed on this runner)
## Notes
- Model path configurable via `MODEL_PATH` env var (default: `models/yolov8m.onnx`)
- Passthrough mode preserved when model file is absent — no crash
- Thread-safe: `InferenceSession.Run()` is thread-safe; session created once in constructor
Reviewed-on: https://forgejo.tordais.cc/nonobis/Heimdall/pulls/148
Closes#21
L'API key de l'agent était persistée **en clair** dans `agent-state.json` (0600). Ce fix la chiffre au repos avec ASP.NET Core Data Protection (`IDataProtector`) :
- `AgentState.SaveAsync` écrit `apiKey` chiffrée + marqueur `apiKeyProtected: true` (format camelCase, lecture case-insensitive pour compat)
- Key ring Data Protection dans `{StateDirectory}/dp-keys` (0700), persisté pour survivre aux redémarrages
- **Migration automatique** : les fichiers legacy en clair sont détectés au `LoadAsync` et réécrits chiffrés immédiatement
- `SaveAsync` échoue si aucun protector n'est fourni — pas de fallback plaintext silencieux
- Key ring non déchiffrable → état traité comme corrompu, l'agent se ré-enregistre (log warning)
## Vérifications
- `dotnet build` : 0 warning / 0 erreur (TreatWarningsAsErrors)
- Tests Agent : **197/197 ✅** (dont 5 nouveaux : pas de clair sur disque, migration legacy, échec déchiffrement, fail-fast sans protector)
- Suite complète : Domain 142, Application 391, Web 225, Api 2, Integration 125 ✅ (en isolation)
- Échecs Infrastructure (24) : **préexistants sur main** (fixture Testcontainers `PostgreSqlContainer` — vérifié sur worktree baseline origin/main)
## Prod hardening (option documentée dans le code)
IDataProtector protège contre la lecture du fichier d'état seul. Contre une compromission complète du volume (qui exposerait aussi le key ring), binder le key ring à un TPM/HSM ou le monter hors du volume sauvegardé.
Reviewed-on: https://forgejo.tordais.cc/nonobis/Heimdall/pulls/116