feat: pipeline complet MACRO/MÉSO/MICRO — Critic, Observer, Policy, Recovery, Learning, Audit Trail, TaskPlanner

Architecture 3 niveaux implémentée et testée (137 tests unitaires + 21 visuels) :

MÉSO (acteur intelligent) :
- P0 Critic : vérification sémantique post-action via gemma4 (replay_verifier.py)
- P1 Observer : pré-analyse écran avant chaque action (api_stream.py /pre_analyze)
- P2 Grounding/Policy : séparation localisation (grounding.py) et décision (policy.py)
- P3 Recovery : rollback automatique Ctrl+Z/Escape/Alt+F4 (recovery.py)
- P4 Learning : apprentissage runtime avec boucle de consolidation (replay_learner.py)

MACRO (planificateur) :
- TaskPlanner : comprend les ordres en langage naturel via gemma4 (task_planner.py)
- Contexte métier TIM/CIM-10 pour les hôpitaux (domain_context.py)
- Endpoint POST /api/v1/task pour l'exécution par instruction

Traçabilité :
- Audit trail complet avec 18 champs par action (audit_trail.py)
- Endpoints GET /audit/history, /audit/summary, /audit/export (CSV)

Grounding :
- Fix parsing bbox_2d qwen2.5vl (pixels relatifs, pas grille 1000x1000)
- Benchmarks visuels sur captures réelles (3 approches : baseline, zoom, Citrix)
- Reproductibilité validée : variance < 0.008 sur 10 itérations

Sécurité :
- Tokens de production retirés du code source → .env.local
- Secret key aléatoire si non configuré
- Suppression logs qui leakent les tokens

Résultats : 80% de replay (vs 12.5% avant), 100% détection visuelle Citrix JPEG Q20

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dom
2026-04-09 21:03:25 +02:00
parent 72a9651b94
commit 99041f0117
21 changed files with 7810 additions and 110 deletions

View File

@@ -85,7 +85,10 @@ echo ""
# 4. Copier le package agent_v1 (code Python)
# ---------------------------------------------------------------
echo "[4/7] Copie du code agent_v1..."
# Copier tout le dossier en excluant les fichiers inutiles
# Copier tout le dossier en excluant uniquement les artefacts de build/test.
# IMPORTANT : ne PAS exclure les modules Python ui/ (shared_state, chat_window,
# capture_server) — ils sont requis par main.py et causent un crash au demarrage
# s'ils sont absents.
rsync -a \
--exclude='__pycache__' \
--exclude='*.pyc' \
@@ -94,9 +97,6 @@ rsync -a \
--exclude='logs/*.log' \
--exclude='.hypothesis' \
--exclude='*.md' \
--exclude='ui/chat_window.py' \
--exclude='ui/shared_state.py' \
--exclude='ui/capture_server.py' \
"$PROJECT_ROOT/agent_v0/agent_v1/" \
"$PACKAGE_DIR/agent_v1/"
@@ -132,6 +132,56 @@ echo "[6/7] Configuration des packages Python..."
echo " Structure d'imports verifiee"
echo ""
# ---------------------------------------------------------------
# 6b. Verification des modules requis
# ---------------------------------------------------------------
echo "[6b/7] Verification des modules Python requis..."
MISSING=0
REQUIRED_FILES=(
"agent_v1/__init__.py"
"agent_v1/main.py"
"agent_v1/config.py"
"agent_v1/window_info.py"
"agent_v1/window_info_crossplatform.py"
"agent_v1/core/__init__.py"
"agent_v1/core/captor.py"
"agent_v1/core/executor.py"
"agent_v1/network/__init__.py"
"agent_v1/network/streamer.py"
"agent_v1/session/__init__.py"
"agent_v1/session/storage.py"
"agent_v1/ui/__init__.py"
"agent_v1/ui/shared_state.py"
"agent_v1/ui/smart_tray.py"
"agent_v1/ui/chat_window.py"
"agent_v1/ui/capture_server.py"
"agent_v1/ui/notifications.py"
"agent_v1/vision/__init__.py"
"agent_v1/vision/capturer.py"
"agent_v1/vision/blur_sensitive.py"
"agent_v1/vision/system_info.py"
"agent_v1/monitoring/__init__.py"
"lea_ui/__init__.py"
"lea_ui/server_client.py"
"run_agent_v1.py"
)
for req_file in "${REQUIRED_FILES[@]}"; do
if [[ ! -f "$PACKAGE_DIR/$req_file" ]]; then
echo -e " ${RED}MANQUANT : $req_file${NC}"
MISSING=$((MISSING + 1))
fi
done
if [[ $MISSING -gt 0 ]]; then
echo ""
echo -e "${RED} ERREUR : $MISSING fichier(s) requis manquant(s) !${NC}"
echo -e "${RED} Le package est INCOMPLET — corrigez build_package.sh avant de deployer.${NC}"
exit 1
fi
echo -e " ${GREEN}Tous les ${#REQUIRED_FILES[@]} fichiers requis sont presents.${NC}"
echo ""
# ---------------------------------------------------------------
# 7. Creer le zip
# ---------------------------------------------------------------