Validé sur PC Windows (DESKTOP-58D5CAC, 2560x1600) : - 8 clics résolus visuellement (1 anchor_template, 1 som_text_match, 6 som_vlm) - Score moyen 0.75, temps moyen 1.6s - Texte tapé correctement (bonjour, test word, date, email) - 0 retries, 2 actions non vérifiées (OK) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
17 KiB
17 KiB
Design Architecture - Fiches #10-15 Excellence Opérationnelle
Auteur: Dom, Alice Kiro
Date: 15 décembre 2024
Version: 1.0
🏗️ Architecture Technique Détaillée
Vue d'Ensemble
┌─────────────────────────────────────────────────────────────────┐
│ RPA Vision V3 - Excellence Opérationnelle │
├─────────────────────────────────────────────────────────────────┤
│ Fiches #1-9: Fondations Solides (95% précision) │
│ ✅ Data Contracts ✅ BBOX Geometry ✅ Context Hints │
│ ✅ Stable Imports ✅ Smoke Tests ✅ Sniper Mode │
│ ✅ Form Logic ✅ Terrain Mode ✅ PostConditions │
├─────────────────────────────────────────────────────────────────┤
│ Fiches #10-15: Excellence Opérationnelle (98%+ précision) │
│ │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Precision │ │ Environment │ │ Performance │ │
│ │ Metrics Engine │ │ Adapter │ │ Optimizer │ │
│ │ (Fiche #10) │ │ (Fiche #12) │ │ (Fiche #11) │ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
│ │ │ │ │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Predictive │ │ Monitoring │ │ Advanced │ │
│ │ Intelligence │ │ Dashboard │ │ Auto-Healing │ │
│ │ (Fiche #13) │ │ (Fiche #14) │ │ (Fiche #15) │ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
🔧 Composants Détaillés
1. Precision Metrics Engine (Fiche #10)
Architecture
core/precision/
├── __init__.py
├── metrics_engine.py # Moteur principal collecte métriques
├── collectors/
│ ├── __init__.py
│ ├── resolution_collector.py # Métriques résolution cibles
│ ├── performance_collector.py # Métriques performance
│ └── error_collector.py # Métriques erreurs
├── storage/
│ ├── __init__.py
│ ├── timeseries_store.py # Interface TimeSeries
│ ├── influxdb_adapter.py # Adapter InfluxDB
│ └── prometheus_adapter.py # Adapter Prometheus
├── models/
│ ├── __init__.py
│ └── metric_models.py # Modèles données métriques
└── api/
├── __init__.py
└── metrics_api.py # API REST métriques
Intégration TargetResolver
# Extension transparente du TargetResolver existant
class EnhancedTargetResolver(TargetResolver):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.metrics_engine = MetricsEngine()
def resolve(self, target_spec: TargetSpec, screen_state: ScreenState) -> ResolvedTarget:
start_time = time.perf_counter()
# Résolution normale (Fiches #1-9)
result = super().resolve(target_spec, screen_state)
# Collecte métriques (Fiche #10)
duration = time.perf_counter() - start_time
self.metrics_engine.record_resolution(
target_spec=target_spec,
result=result,
duration=duration,
screen_state=screen_state
)
return result
2. Performance Optimizer (Fiche #11)
Cache Multi-Niveaux
core/performance/
├── __init__.py
├── cache_manager.py # Gestionnaire cache principal
├── caches/
│ ├── __init__.py
│ ├── l1_memory_cache.py # Cache L1 mémoire (LRU)
│ ├── l2_disk_cache.py # Cache L2 disque (SSD)
│ └── l3_embedding_cache.py # Cache L3 embeddings
├── optimization/
│ ├── __init__.py
│ ├── parallel_resolver.py # Résolution parallèle
│ ├── gpu_optimizer.py # Optimisation GPU
│ └── memory_manager.py # Gestion mémoire
└── benchmarks/
├── __init__.py
└── performance_tests.py # Tests performance
Stratégie Cache
L1 Cache (Memory): 100MB, TTL 5min, LRU
├── Résolutions récentes (1000 dernières)
├── Embeddings hot (top 100)
└── Screen states actifs
L2 Cache (SSD): 1GB, TTL 1h, LFU
├── Embeddings fréquents
├── UI patterns appris
└── Calibrations environnement
L3 Cache (Network): 10GB, TTL 24h
├── Modèles pré-calculés
├── Datasets training
└── Backups configurations
3. Environment Adapter (Fiche #12)
Détection Multi-Environnements
core/environment/
├── __init__.py
├── detector.py # Détection environnement
├── adapters/
│ ├── __init__.py
│ ├── dpi_adapter.py # Adaptation DPI
│ ├── resolution_adapter.py # Adaptation résolution
│ ├── theme_adapter.py # Adaptation thème
│ └── os_adapter.py # Adaptation OS
├── calibration/
│ ├── __init__.py
│ ├── auto_calibrator.py # Calibration automatique
│ └── threshold_optimizer.py # Optimisation seuils
└── normalization/
├── __init__.py
└── coordinate_normalizer.py # Normalisation coordonnées
Matrice Environnements Supportés
┌─────────────┬─────────┬─────────┬─────────┬─────────┐
│ OS │ Windows │ macOS │ Linux │ Mobile │
├─────────────┼─────────┼─────────┼─────────┼─────────┤
│ DPI │ 100-300%│ 100-200%│ 100-200%│ 200-400%│
│ Résolution │ 1024x768│ 1280x800│ 1920x1080│ Variable│
│ │ à 4K │ à 5K │ à 4K │ │
│ Thème │ Light │ Light │ Light │ Auto │
│ │ Dark │ Dark │ Dark │ │
│ Support │ ✅ Full │ ✅ Full │ ✅ Full │ 🔄 Beta │
└─────────────┴─────────┴─────────┴─────────┴─────────┘
4. Predictive Intelligence (Fiche #13)
Machine Learning Pipeline
core/intelligence/
├── __init__.py
├── learning_engine.py # Moteur apprentissage principal
├── models/
│ ├── __init__.py
│ ├── pattern_learner.py # Apprentissage patterns UI
│ ├── threshold_optimizer.py # Optimisation seuils
│ └── failure_predictor.py # Prédiction échecs
├── training/
│ ├── __init__.py
│ ├── online_trainer.py # Training online
│ └── batch_trainer.py # Training batch
└── evaluation/
├── __init__.py
├── ab_tester.py # A/B testing
└── performance_evaluator.py # Évaluation performance
Algorithmes ML
Pattern Learning:
├── Clustering UI elements (K-means, DBSCAN)
├── Sequence mining workflows (PrefixSpan)
└── Anomaly detection (Isolation Forest)
Threshold Optimization:
├── Bayesian optimization (Gaussian Process)
├── Grid search avec cross-validation
└── Multi-objective optimization (NSGA-II)
Failure Prediction:
├── Classification (Random Forest, XGBoost)
├── Time series forecasting (LSTM)
└── Ensemble methods (Voting, Stacking)
5. Monitoring Dashboard (Fiche #14)
Architecture Full-Stack
monitoring_dashboard/
├── backend/
│ ├── __init__.py
│ ├── app.py # Flask/FastAPI app
│ ├── api/
│ │ ├── __init__.py
│ │ ├── metrics_api.py # API métriques
│ │ ├── alerts_api.py # API alertes
│ │ └── websocket_api.py # WebSocket temps réel
│ ├── services/
│ │ ├── __init__.py
│ │ ├── alert_service.py # Service alertes
│ │ └── diagnostic_service.py # Service diagnostic
│ └── models/
│ ├── __init__.py
│ └── dashboard_models.py # Modèles dashboard
└── frontend/
├── package.json
├── src/
│ ├── components/
│ │ ├── MetricsChart.tsx # Graphiques métriques
│ │ ├── AlertPanel.tsx # Panel alertes
│ │ └── DiagnosticView.tsx # Vue diagnostic
│ ├── hooks/
│ │ ├── useMetrics.ts # Hook métriques
│ │ └── useWebSocket.ts # Hook WebSocket
│ └── utils/
│ └── chartUtils.ts # Utilitaires graphiques
└── public/
└── index.html
Interface Utilisateur
┌─────────────────────────────────────────────────────────────────┐
│ RPA Vision V3 - Monitoring Dashboard │
├─────────────────────────────────────────────────────────────────┤
│ 📊 Métriques Temps Réel 🚨 Alertes (2) ⚙️ Config │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Précision │ │ Latence P95 │ │ Throughput │ │
│ │ 97.8% ↗️ │ │ 45ms ↘️ │ │ 120 ops/sec ↗️ │ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ 📈 Performance Trends (Last 24h) │ │
│ │ [Graphique temps réel avec métriques clés] │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────┐ ┌─────────────────────────────────────────┐ │
│ │ 🚨 Alertes │ │ 🔍 Diagnostic Automatique │ │
│ │ • High latency │ │ • Cache hit rate low → Increase TTL │ │
│ │ • Memory usage │ │ • GPU utilization → Enable batching │ │
│ └─────────────────┘ └─────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
6. Advanced Auto-Healing (Fiche #15)
Architecture Auto-Healing V2
core/healing_v2/
├── __init__.py
├── healing_engine_v2.py # Moteur principal v2
├── detection/
│ ├── __init__.py
│ ├── ui_change_detector.py # Détection changements UI
│ └── failure_detector.py # Détection échecs
├── strategies/
│ ├── __init__.py
│ ├── spatial_recovery.py # Récupération spatiale
│ ├── semantic_recovery.py # Récupération sémantique
│ ├── learning_recovery.py # Récupération apprentissage
│ └── fallback_chain.py # Chaîne fallback
├── learning/
│ ├── __init__.py
│ ├── variant_learner.py # Apprentissage variantes
│ └── pattern_repository.py # Repository patterns
└── integration/
├── __init__.py
└── execution_integration.py # Intégration exécution
Stratégies Récupération
Niveau 1: Spatial Recovery (90% succès)
├── Recherche dans voisinage immédiat
├── Ajustement coordonnées relatives
└── Fallback éléments similaires
Niveau 2: Semantic Recovery (70% succès)
├── Recherche par texte alternatif
├── Recherche par rôle sémantique
└── Recherche par contexte visuel
Niveau 3: Learning Recovery (50% succès)
├── Application patterns appris
├── Utilisation variantes connues
└── Adaptation basée historique
Niveau 4: Human Fallback (100% succès)
├── Notification utilisateur
├── Mode assistance guidée
└── Apprentissage nouvelle variante
🔄 Flux d'Intégration
Workflow Complet
1. User Action Request
↓
2. Enhanced Target Resolver (Fiches #1-9 + #10-15)
├── Environment Detection (Fiche #12)
├── Cache Lookup (Fiche #11)
├── Predictive Optimization (Fiche #13)
└── Metrics Collection (Fiche #10)
↓
3. Action Execution (PostConditions Fiche #9)
├── Success → Metrics Update
└── Failure → Auto-Healing (Fiche #15)
↓
4. Real-time Monitoring (Fiche #14)
├── Dashboard Update
├── Alert Evaluation
└── Diagnostic Generation
Points d'Intégration
# 1. TargetResolver Enhancement
class EnhancedTargetResolver(TargetResolver):
def __init__(self):
super().__init__()
self.metrics_engine = MetricsEngine() # Fiche #10
self.cache_manager = CacheManager() # Fiche #11
self.env_adapter = EnvironmentAdapter() # Fiche #12
self.intelligence = PredictiveIntelligence() # Fiche #13
self.healing_engine = HealingEngineV2() # Fiche #15
# 2. ActionExecutor Enhancement
class EnhancedActionExecutor(ActionExecutor):
def __init__(self):
super().__init__()
self.metrics_engine = MetricsEngine() # Fiche #10
self.healing_engine = HealingEngineV2() # Fiche #15
# 3. Dashboard Integration
class MonitoringDashboard: # Fiche #14
def __init__(self):
self.metrics_api = MetricsAPI()
self.alert_service = AlertService()
self.diagnostic_service = DiagnosticService()
📊 Métriques Architecture
Performance Targets
Component | Latency Target | Throughput Target | Memory Target
------------------------|----------------|-------------------|---------------
Metrics Engine | <1ms overhead | 1000+ metrics/sec | <50MB
Cache Manager | <0.5ms P95 | 10000+ ops/sec | <200MB
Environment Adapter | <50ms detect | 100+ envs/sec | <100MB
Predictive Intelligence | <10ms predict | 1000+ preds/sec | <150MB
Dashboard Backend | <50ms API | 100+ users | <100MB
Auto-Healing Engine | <500ms recover | 10+ recoveries/sec| <100MB
Quality Targets
Metric | Current | Target | Validation
------------------------|---------|--------|------------
Code Coverage | 90% | 95%+ | pytest-cov
Performance Tests | Manual | Auto | CI/CD pipeline
Security Scan | Manual | Auto | bandit + safety
Documentation Coverage | 80% | 95%+ | sphinx-coverage
Status: ✅ DESIGN ARCHITECTURE COMPLET
Prochaine étape: Implémentation Fiche #10 - Precision Metrics Engine