Initial commit
This commit is contained in:
123
.kiro/specs/assisted-mode-suggestions/design.md
Normal file
123
.kiro/specs/assisted-mode-suggestions/design.md
Normal file
@@ -0,0 +1,123 @@
|
||||
# Design - Mode Assisté avec Suggestions
|
||||
|
||||
## Overview
|
||||
|
||||
Le Mode Assisté détecte quand l'utilisateur commence un workflow connu et propose de le compléter automatiquement. Le système compare les actions en cours avec les workflows sauvegardés et affiche une suggestion si la correspondance est suffisante.
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
User Actions → SessionManager → WorkflowMatcher → SuggestionManager → GUI
|
||||
↓
|
||||
Workflows (JSON)
|
||||
```
|
||||
|
||||
**Flux** :
|
||||
1. L'utilisateur effectue des actions
|
||||
2. SessionManager crée une session en cours
|
||||
3. WorkflowMatcher compare avec les workflows connus
|
||||
4. Si match > 80%, SuggestionManager crée une suggestion
|
||||
5. GUI affiche la suggestion avec timeout de 10s
|
||||
6. Utilisateur accepte (Enter) ou rejette (Escape)
|
||||
7. Si accepté, TaskReplayEngine exécute les étapes restantes
|
||||
|
||||
## Components
|
||||
|
||||
### 1. WorkflowMatcher (Nouveau)
|
||||
|
||||
**Responsabilité** : Comparer les actions courantes avec les workflows connus
|
||||
|
||||
**Méthodes** :
|
||||
```python
|
||||
def match_current_session(session, workflows) -> List[WorkflowMatch]:
|
||||
"""Compare la session courante avec tous les workflows"""
|
||||
|
||||
def calculate_match_score(actions, workflow_steps) -> float:
|
||||
"""Calcule le score de correspondance (0-1)"""
|
||||
|
||||
def find_best_match(matches) -> Optional[WorkflowMatch]:
|
||||
"""Retourne le meilleur match si > 80%"""
|
||||
```
|
||||
|
||||
**Algorithme de matching** :
|
||||
- Comparer les N premières actions avec le début de chaque workflow
|
||||
- Score = (actions_matching / total_actions) * position_similarity
|
||||
- Position similarity : tolérance de 50px
|
||||
|
||||
### 2. SuggestionManager (Existant - À améliorer)
|
||||
|
||||
**Améliorations nécessaires** :
|
||||
- Méthode `check_workflow_match()` : vérifie périodiquement les matchs
|
||||
- Méthode `create_workflow_suggestion()` : crée une suggestion de workflow
|
||||
- Gestion du timeout (10 secondes)
|
||||
- Tracking des rejets pour ajuster la priorité
|
||||
|
||||
### 3. GUI Overlay (Existant - À améliorer)
|
||||
|
||||
**Améliorations** :
|
||||
- Affichage des 3 prochaines étapes
|
||||
- Boutons Enter/Escape bien visibles
|
||||
- Barre de progression pendant l'exécution
|
||||
- Notification de succès/échec
|
||||
|
||||
### 4. TaskReplayEngine (Existant)
|
||||
|
||||
**Utilisation** :
|
||||
- Exécuter les étapes restantes du workflow
|
||||
- Recherche visuelle pour chaque étape
|
||||
- Feedback visuel pendant l'exécution
|
||||
|
||||
## Data Models
|
||||
|
||||
### WorkflowMatch
|
||||
```python
|
||||
@dataclass
|
||||
class WorkflowMatch:
|
||||
workflow_id: str
|
||||
workflow_name: str
|
||||
confidence: float
|
||||
matched_steps: int
|
||||
total_steps: int
|
||||
remaining_steps: List[WorkflowStep]
|
||||
```
|
||||
|
||||
### Suggestion (Existant - À étendre)
|
||||
```python
|
||||
{
|
||||
"type": "workflow",
|
||||
"workflow_id": str,
|
||||
"workflow_name": str,
|
||||
"confidence": float,
|
||||
"current_step": int,
|
||||
"remaining_steps": List[dict],
|
||||
"created_at": datetime,
|
||||
"timeout": 10.0
|
||||
}
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
- **Match échoue** : Continuer en mode manuel, ne pas suggérer
|
||||
- **Exécution échoue** : Arrêter, notifier l'utilisateur, rollback optionnel
|
||||
- **Timeout** : Dismisser la suggestion silencieusement
|
||||
- **Rejet répété** : Réduire la priorité du workflow (confidence *= 0.9)
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
### Unit Tests
|
||||
- Test du matching avec différents workflows
|
||||
- Test du calcul de score
|
||||
- Test de la tolérance de position
|
||||
- Test du timeout
|
||||
|
||||
### Integration Tests
|
||||
- Test du flux complet : action → suggestion → exécution
|
||||
- Test avec workflows réels de la calculatrice
|
||||
- Test des rejets et acceptations
|
||||
|
||||
## Performance
|
||||
|
||||
- **Latence de détection** : < 500ms
|
||||
- **Affichage suggestion** : < 1s après le match
|
||||
- **Exécution par étape** : ~500ms (recherche visuelle + action)
|
||||
- **Fréquence de vérification** : Toutes les 2 secondes en mode Assist
|
||||
63
.kiro/specs/assisted-mode-suggestions/requirements.md
Normal file
63
.kiro/specs/assisted-mode-suggestions/requirements.md
Normal file
@@ -0,0 +1,63 @@
|
||||
# Requirements - Mode Assisté avec Suggestions
|
||||
|
||||
## Introduction
|
||||
|
||||
Ce document spécifie les exigences pour le Mode Assisté de GeniusIA v2. Le système doit détecter quand l'utilisateur commence un workflow connu et proposer de le compléter automatiquement.
|
||||
|
||||
## Glossary
|
||||
|
||||
- **Mode Assisté** : Mode où le système suggère des actions mais attend validation
|
||||
- **Suggestion** : Proposition d'action basée sur un workflow détecté
|
||||
- **Workflow Match** : Correspondance entre les actions courantes et un workflow connu
|
||||
- **Confidence Score** : Score de confiance (0-1) pour une suggestion
|
||||
- **Timeout** : Durée avant qu'une suggestion expire
|
||||
|
||||
## Requirements
|
||||
|
||||
### Requirement 1
|
||||
|
||||
**User Story:** As a user, I want the system to detect when I start a known workflow, so that it can suggest completing it automatically.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN the user performs actions in Assist mode THEN the system SHALL compare them with known workflows
|
||||
2. WHEN the current actions match the beginning of a workflow THEN the system SHALL calculate a confidence score
|
||||
3. WHEN the confidence score exceeds 80% THEN the system SHALL create a suggestion
|
||||
4. WHEN a suggestion is created THEN the system SHALL display it to the user within 1 second
|
||||
5. WHEN multiple workflows match THEN the system SHALL suggest the one with highest confidence
|
||||
|
||||
### Requirement 2
|
||||
|
||||
**User Story:** As a user, I want to accept or reject suggestions easily, so that I can control the automation.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN a suggestion is displayed THEN the system SHALL show the workflow name and remaining steps
|
||||
2. WHEN the user presses Enter THEN the system SHALL accept the suggestion and execute remaining steps
|
||||
3. WHEN the user presses Escape THEN the system SHALL reject the suggestion and continue manual mode
|
||||
4. WHEN the user ignores a suggestion for 10 seconds THEN the system SHALL automatically dismiss it
|
||||
5. WHEN a suggestion is accepted THEN the system SHALL execute steps with visual feedback
|
||||
|
||||
### Requirement 3
|
||||
|
||||
**User Story:** As a user, I want suggestions to be accurate, so that I don't get interrupted with irrelevant proposals.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN calculating workflow match THEN the system SHALL compare action types and positions
|
||||
2. WHEN comparing positions THEN the system SHALL allow 50px tolerance
|
||||
3. WHEN a workflow has been rejected 3 times THEN the system SHALL reduce its suggestion priority
|
||||
4. WHEN a workflow is successfully executed THEN the system SHALL increase its confidence score
|
||||
5. WHEN the user is in a different window THEN the system SHALL only suggest workflows for that window
|
||||
|
||||
### Requirement 4
|
||||
|
||||
**User Story:** As a user, I want to see what the system will do, so that I can trust the automation.
|
||||
|
||||
#### Acceptance Criteria
|
||||
|
||||
1. WHEN displaying a suggestion THEN the system SHALL show the next 3 steps
|
||||
2. WHEN displaying steps THEN the system SHALL include action type and target description
|
||||
3. WHEN a step is executed THEN the system SHALL highlight it visually
|
||||
4. WHEN execution fails THEN the system SHALL stop and notify the user
|
||||
5. WHEN all steps complete THEN the system SHALL show a success notification
|
||||
60
.kiro/specs/assisted-mode-suggestions/tasks.md
Normal file
60
.kiro/specs/assisted-mode-suggestions/tasks.md
Normal file
@@ -0,0 +1,60 @@
|
||||
# Implementation Plan - Mode Assisté avec Suggestions
|
||||
|
||||
- [x] 1. Créer WorkflowMatcher ✅ FAIT
|
||||
- [x] Créer `geniusia2/core/workflow_matcher.py`
|
||||
- [x] Implémenter `match_current_session()`
|
||||
- [x] Implémenter `calculate_match_score()` avec tolérance de position
|
||||
- [x] Implémenter `find_best_match()`
|
||||
- [x] Tests basiques inclus dans le fichier
|
||||
- _Requirements: 1.1, 1.2, 1.3, 3.1, 3.2_
|
||||
|
||||
- [x] 2. Améliorer SuggestionManager ✅ FAIT
|
||||
- [x] Ajouter `check_workflow_match()` pour vérification périodique
|
||||
- [x] Ajouter `create_workflow_suggestion()` avec détails des étapes
|
||||
- [x] Implémenter tracking des rejets (compteur par workflow)
|
||||
- [x] Ajuster la priorité après 3 rejets
|
||||
- [x] Tracking des acceptations pour améliorer la priorité
|
||||
- _Requirements: 1.4, 1.5, 3.3, 3.5_
|
||||
|
||||
- [x] 3. Intégrer dans Orchestrator ✅ FAIT
|
||||
- [x] Ajouter `_check_workflow_match()` pour vérifier les correspondances
|
||||
- [x] Appeler dans `check_for_suggestions()` (déjà appelé périodiquement)
|
||||
- [x] Passer la session courante et les workflows chargés
|
||||
- [x] Créer suggestion de workflow si match trouvé
|
||||
- [x] Priorité aux workflows sur les suggestions classiques
|
||||
- _Requirements: 1.1, 1.4_
|
||||
|
||||
- [ ] 4. Améliorer GUI Overlay ⚠️ PARTIEL
|
||||
- [ ] Afficher les 3 prochaines étapes dans la suggestion
|
||||
- [ ] Ajouter barre de progression pendant l'exécution
|
||||
- [x] Améliorer les boutons Enter/Escape (déjà implémenté)
|
||||
- [ ] Ajouter notification de succès/échec
|
||||
- _Requirements: 2.1, 2.2, 2.3, 4.1, 4.2, 4.5_
|
||||
- _Note: GUI de base fonctionne, améliorations UI/UX à faire_
|
||||
|
||||
- [ ] 5. Améliorer TaskReplayEngine ⚠️ PARTIEL
|
||||
- [ ] Ajouter feedback visuel par étape
|
||||
- [ ] Implémenter arrêt sur échec avec notification
|
||||
- [ ] Ajouter highlighting de l'étape en cours
|
||||
- _Requirements: 2.5, 4.3, 4.4_
|
||||
- _Note: Replay fonctionne, feedback visuel à améliorer_
|
||||
|
||||
- [x] 6. Implémenter timeout et dismiss ✅ FAIT
|
||||
- [x] Timer de 10s dans SuggestionManager (déjà implémenté)
|
||||
- [x] Auto-dismiss après timeout (méthode `check_timeout()`)
|
||||
- [x] Callback `on_suggestion_timeout`
|
||||
- _Requirements: 2.4_
|
||||
|
||||
- [ ] 7. Tester avec workflows Calculatrice
|
||||
- Lancer en mode Assist
|
||||
- Commencer un workflow connu
|
||||
- Vérifier que la suggestion apparaît
|
||||
- Accepter et vérifier l'exécution
|
||||
- Rejeter et vérifier le dismiss
|
||||
- _Requirements: All_
|
||||
|
||||
- [ ] 8. Ajuster les seuils
|
||||
- Tester avec différents seuils de confiance
|
||||
- Ajuster la tolérance de position si nécessaire
|
||||
- Optimiser la fréquence de vérification
|
||||
- _Requirements: 1.3, 3.2_
|
||||
Reference in New Issue
Block a user