Pipeline replay visuel : - VLM-first : l'agent appelle Ollama directement pour trouver les éléments - Template matching en fallback (seuil strict 0.90) - Stop immédiat si élément non trouvé (pas de clic blind) - Replay depuis session brute (/replay-session) sans attendre le VLM - Vérification post-action (screenshot hash avant/après) - Gestion des popups (Enter/Escape/Tab+Enter) Worker VLM séparé : - run_worker.py : process distinct du serveur HTTP - Communication par fichiers (_worker_queue.txt + _replay_active.lock) - Le serveur HTTP ne fait plus jamais de VLM → toujours réactif - Service systemd rpa-worker.service Capture clavier : - raw_keys (vk + press/release) pour replay exact indépendant du layout - Fix AZERTY : ToUnicodeEx + AltGr detection - Enter capturé comme \n, Tab comme \t - Filtrage modificateurs seuls (Ctrl/Alt/Shift parasites) - Fusion text_input consécutifs, dédup key_combo Sécurité & Internet : - HTTPS Let's Encrypt (lea.labs + vwb.labs.laurinebazin.design) - Token API fixe dans .env.local - HTTP Basic Auth sur VWB - Security headers (HSTS, CSP, nosniff) - CORS domaines publics, plus de wildcard Infrastructure : - DPI awareness (SetProcessDpiAwareness) Python + Rust - Métadonnées système (dpi_scale, window_bounds, monitors, os_theme) - Template matching multi-scale [0.5, 2.0] - Résolution dynamique (plus de hardcode 1920x1080) - VLM prefill fix (47x speedup, 3.5s au lieu de 180s) Modules : - core/auth/ : credential vault (Fernet AES), TOTP (RFC 6238), auth handler - core/federation/ : LearningPack export/import anonymisé, FAISS global - deploy/ : package Léa (config.txt, Lea.bat, install.bat, LISEZMOI.txt) UX : - Filtrage OS (VWB + Chat montrent que les workflows de l'OS courant) - Bibliothèque persistante (cache local + SQLite) - Clustering hybride (titre fenêtre + DBSCAN) - EdgeConstraints + PostConditions peuplés - GraphBuilder compound actions (toutes les frappes) Agent Rust : - Token Bearer auth (network.rs) - sysinfo.rs (DPI, résolution, window bounds via Win32 API) - config.txt lu automatiquement - Support Chrome/Brave/Firefox (pas que Edge) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
276 lines
8.1 KiB
Bash
Executable File
276 lines
8.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# ============================================================
|
|
# build_lea_exe.sh — Cree un executable Windows autonome via PyInstaller
|
|
#
|
|
# IMPORTANT : Ce script doit tourner SUR WINDOWS (ou dans Wine/WSL
|
|
# avec acces a un Python Windows). PyInstaller ne peut pas produire
|
|
# un .exe Windows depuis Linux natif.
|
|
#
|
|
# Procedure recommandee :
|
|
# 1. Sur le PC Windows (192.168.1.11 ou autre) :
|
|
# - Installer Python 3.12 (https://python.org)
|
|
# - pip install pyinstaller
|
|
# 2. Copier ce script et le dossier agent_v0/ sur le PC Windows
|
|
# 3. Executer depuis PowerShell/cmd :
|
|
# python -m PyInstaller --onefile --windowed ^
|
|
# --name "Lea" ^
|
|
# --add-data "agent_v1;agent_v1" ^
|
|
# --add-data "lea_ui;lea_ui" ^
|
|
# --add-data "config.txt;." ^
|
|
# --hidden-import "pynput.keyboard._win32" ^
|
|
# --hidden-import "pynput.mouse._win32" ^
|
|
# --hidden-import "pystray._win32" ^
|
|
# --hidden-import "plyer.platforms.win.notification" ^
|
|
# --hidden-import "win32api" ^
|
|
# --hidden-import "win32con" ^
|
|
# --hidden-import "win32gui" ^
|
|
# run_agent_v1.py
|
|
#
|
|
# Le .exe resultant sera dans dist/Lea.exe (~50-100 MB)
|
|
#
|
|
# ============================================================
|
|
#
|
|
# OPTION ALTERNATIVE : Python Embedded (recommandee)
|
|
#
|
|
# Python Embedded est un Python portable officiel (pas d'installation).
|
|
# Combine avec le code source, c'est la methode la plus fiable
|
|
# pour les non-informaticiens.
|
|
#
|
|
# Sur une machine Windows :
|
|
# 1. Telecharger Python Embedded 3.12 :
|
|
# https://www.python.org/ftp/python/3.12.9/python-3.12.9-embed-amd64.zip
|
|
#
|
|
# 2. Dezipper dans un dossier temporaire
|
|
#
|
|
# 3. Activer pip dans Python Embedded :
|
|
# - Editer python312._pth, decommenter "import site"
|
|
# - Telecharger get-pip.py : https://bootstrap.pypa.io/get-pip.py
|
|
# - Executer : python.exe get-pip.py
|
|
#
|
|
# 4. Installer les dependances :
|
|
# python.exe -m pip install -r requirements_agent.txt
|
|
#
|
|
# 5. Copier le code source (agent_v1/, lea_ui/, run_agent_v1.py)
|
|
#
|
|
# 6. Zipper le tout → Lea_Portable.zip (~40-60 MB)
|
|
#
|
|
# Le Lea.bat dans ce cas utiliserait :
|
|
# python\python.exe run_agent_v1.py
|
|
# au lieu de .venv\Scripts\python.exe
|
|
#
|
|
# ============================================================
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
|
|
echo "============================================================"
|
|
echo " Build Lea.exe (PyInstaller)"
|
|
echo "============================================================"
|
|
echo ""
|
|
echo " Ce script ne peut pas produire un .exe Windows depuis Linux."
|
|
echo ""
|
|
echo " OPTIONS DISPONIBLES :"
|
|
echo ""
|
|
echo " 1. OPTION VIA PC WINDOWS (recommandee pour .exe) :"
|
|
echo " Copiez le dossier deploy/ sur le PC Windows"
|
|
echo " puis lancez la commande PyInstaller ci-dessous."
|
|
echo ""
|
|
echo " 2. OPTION ZIP + VENV (recommandee pour deploiement rapide) :"
|
|
echo " Lancez ./deploy/build_package.sh"
|
|
echo " Le zip resultant contient install.bat + Lea.bat"
|
|
echo ""
|
|
echo " 3. OPTION PYTHON EMBEDDED (recommandee pour zero install) :"
|
|
echo " Suivez les instructions dans ce script (section ALTERNATIVE)"
|
|
echo ""
|
|
echo "============================================================"
|
|
echo ""
|
|
|
|
# Generer le .spec PyInstaller pour reference
|
|
SPEC_FILE="$SCRIPT_DIR/Lea.spec"
|
|
cat > "$SPEC_FILE" << 'PYINSTALLER_SPEC'
|
|
# -*- mode: python ; coding: utf-8 -*-
|
|
# Lea.spec — Configuration PyInstaller pour l'agent Lea
|
|
#
|
|
# Usage sur Windows :
|
|
# pip install pyinstaller
|
|
# pyinstaller Lea.spec
|
|
#
|
|
# Le .exe resultant sera dans dist/Lea.exe
|
|
|
|
import os
|
|
import sys
|
|
|
|
block_cipher = None
|
|
|
|
# Repertoire de travail (ou se trouve ce .spec)
|
|
SPEC_DIR = os.path.dirname(os.path.abspath(SPEC())) if 'SPEC' in dir() else '.'
|
|
|
|
a = Analysis(
|
|
['run_agent_v1.py'],
|
|
pathex=['.'],
|
|
binaries=[],
|
|
datas=[
|
|
('agent_v1', 'agent_v1'),
|
|
('lea_ui', 'lea_ui'),
|
|
('config.txt', '.'),
|
|
('LISEZMOI.txt', '.'),
|
|
],
|
|
hiddenimports=[
|
|
# pynput backends Windows
|
|
'pynput.keyboard._win32',
|
|
'pynput.mouse._win32',
|
|
# pystray backend Windows
|
|
'pystray._win32',
|
|
# plyer notification Windows
|
|
'plyer.platforms.win',
|
|
'plyer.platforms.win.notification',
|
|
# pywin32
|
|
'win32api',
|
|
'win32con',
|
|
'win32gui',
|
|
'win32com',
|
|
'pythoncom',
|
|
# tkinter (stdlib, parfois manquant dans PyInstaller)
|
|
'tkinter',
|
|
'tkinter.simpledialog',
|
|
'tkinter.messagebox',
|
|
'tkinter.filedialog',
|
|
],
|
|
hookspath=[],
|
|
hooksconfig={},
|
|
runtime_hooks=[],
|
|
excludes=[
|
|
# Exclure les modules lourds non necessaires cote client
|
|
'torch',
|
|
'torchvision',
|
|
'transformers',
|
|
'clip',
|
|
'open_clip',
|
|
'faiss',
|
|
'cv2', # opencv pas obligatoire (blur_sensitive a un fallback)
|
|
'numpy', # requis par PIL mais pas directement
|
|
'scipy',
|
|
'sklearn',
|
|
'matplotlib',
|
|
'pandas',
|
|
'tensorflow',
|
|
],
|
|
win_no_prefer_redirects=False,
|
|
win_private_assemblies=False,
|
|
cipher=block_cipher,
|
|
noarchive=False,
|
|
)
|
|
|
|
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
|
|
|
exe = EXE(
|
|
pyz,
|
|
a.scripts,
|
|
a.binaries,
|
|
a.zipfiles,
|
|
a.datas,
|
|
[],
|
|
name='Lea',
|
|
debug=False,
|
|
bootloader_ignore_signals=False,
|
|
strip=False,
|
|
upx=True,
|
|
upx_exclude=[],
|
|
runtime_tmpdir=None,
|
|
console=False, # --windowed : pas de console visible
|
|
disable_windowed_traceback=False,
|
|
argv_emulation=False,
|
|
target_arch=None,
|
|
codesign_identity=None,
|
|
entitlements_file=None,
|
|
# icon='assets/lea_icon.ico', # Decommenter quand l'icone sera creee
|
|
)
|
|
PYINSTALLER_SPEC
|
|
|
|
echo " Fichier Lea.spec genere dans : $SPEC_FILE"
|
|
echo ""
|
|
echo " Pour builder sur Windows :"
|
|
echo " 1. Copier le dossier Lea/ (apres build_package.sh) sur le PC Windows"
|
|
echo " 2. pip install pyinstaller"
|
|
echo " 3. cd Lea"
|
|
echo " 4. pyinstaller ../Lea.spec"
|
|
echo " 5. Le .exe sera dans dist/Lea.exe"
|
|
echo ""
|
|
|
|
# Generer aussi un script batch pour builder sur Windows
|
|
WIN_BUILD="$SCRIPT_DIR/build_exe_windows.bat"
|
|
cat > "$WIN_BUILD" << 'WIN_BATCH'
|
|
@echo off
|
|
chcp 65001 >nul 2>&1
|
|
title Build Lea.exe
|
|
|
|
echo ============================================================
|
|
echo Build Lea.exe (PyInstaller)
|
|
echo ============================================================
|
|
echo.
|
|
|
|
:: Verifier PyInstaller
|
|
pip show pyinstaller >nul 2>&1
|
|
if errorlevel 1 (
|
|
echo Installation de PyInstaller...
|
|
pip install pyinstaller
|
|
)
|
|
|
|
:: Builder
|
|
echo Build en cours (cela prend 2-5 minutes)...
|
|
echo.
|
|
|
|
pyinstaller --onefile --windowed ^
|
|
--name "Lea" ^
|
|
--add-data "agent_v1;agent_v1" ^
|
|
--add-data "lea_ui;lea_ui" ^
|
|
--add-data "config.txt;." ^
|
|
--add-data "LISEZMOI.txt;." ^
|
|
--hidden-import "pynput.keyboard._win32" ^
|
|
--hidden-import "pynput.mouse._win32" ^
|
|
--hidden-import "pystray._win32" ^
|
|
--hidden-import "plyer.platforms.win.notification" ^
|
|
--hidden-import "win32api" ^
|
|
--hidden-import "win32con" ^
|
|
--hidden-import "win32gui" ^
|
|
--hidden-import "tkinter" ^
|
|
--hidden-import "tkinter.simpledialog" ^
|
|
--hidden-import "tkinter.messagebox" ^
|
|
--exclude-module "torch" ^
|
|
--exclude-module "torchvision" ^
|
|
--exclude-module "transformers" ^
|
|
--exclude-module "clip" ^
|
|
--exclude-module "faiss" ^
|
|
--exclude-module "scipy" ^
|
|
--exclude-module "sklearn" ^
|
|
--exclude-module "matplotlib" ^
|
|
--exclude-module "pandas" ^
|
|
--exclude-module "tensorflow" ^
|
|
run_agent_v1.py
|
|
|
|
if errorlevel 1 (
|
|
echo.
|
|
echo ERREUR : Le build a echoue.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo.
|
|
echo ============================================================
|
|
echo Build termine !
|
|
echo.
|
|
echo Lea.exe est dans le dossier dist\
|
|
echo Taille :
|
|
dir dist\Lea.exe | findstr "Lea.exe"
|
|
echo.
|
|
echo Pour deployer : copiez dist\Lea.exe + config.txt + LISEZMOI.txt
|
|
echo ============================================================
|
|
pause
|
|
WIN_BATCH
|
|
|
|
echo " Script Windows genere : $WIN_BUILD"
|
|
echo ""
|
|
echo "============================================================"
|