Spaces:
Configuration error
Configuration error
Add complete Aethero_App and aethero_protocol directories
Browse files- Full integration of all source files
- Introspective parser module with ASL support
- Dashboard components and deployment configuration
- Constitutional protocol and ASL samples
- Agent architecture and monitoring setup
This view is limited to 50 files because it contains too many changes.
See raw diff
- Aethero_App +0 -1
- Aethero_App/.gitignore +61 -0
- Aethero_App/CHANGELOG_AETHEROOS.md +23 -0
- Aethero_App/FINAL_REPORT.md +132 -0
- Aethero_App/FIRST_REPORT.md +32 -0
- Aethero_App/LICENSE +21 -0
- Aethero_App/README.md +150 -0
- Aethero_App/README_UI.md +12 -0
- Aethero_App/__init__.py +2 -0
- Aethero_App/aethero_demo_results.json +92 -0
- Aethero_App/aethero_manifest.yaml +35 -0
- Aethero_App/agents/analyst_agent.md +108 -0
- Aethero_App/agents/docker-compose.yml +176 -0
- Aethero_App/agents/generator_agent.md +116 -0
- Aethero_App/agents/planner_agent.md +56 -0
- Aethero_App/agents/scout_agent.md +84 -0
- Aethero_App/agents/synthesis_agent.md +161 -0
- Aethero_App/dashboard/app.js +48 -0
- Aethero_App/dashboard/index.html +42 -0
- Aethero_App/dashboard/styles.css +47 -0
- Aethero_App/deploy/deploy.sh +116 -0
- Aethero_App/deploy/health_check.sh +102 -0
- Aethero_App/deploy/local_deploy.sh +73 -0
- Aethero_App/deploy/verify_deployment.py +199 -0
- Aethero_App/gradio_interface.py +33 -0
- Aethero_App/introspective_demo.py +250 -0
- Aethero_App/introspective_parser_module/MODERNIZATION_REPORT.md +97 -0
- Aethero_App/introspective_parser_module/README_Copilot.md +95 -0
- Aethero_App/introspective_parser_module/__init__.py +75 -0
- Aethero_App/introspective_parser_module/metrics.py +343 -0
- Aethero_App/introspective_parser_module/models.py +108 -0
- Aethero_App/introspective_parser_module/parser.py +405 -0
- Aethero_App/introspective_parser_module/reflection_agent.py +394 -0
- Aethero_App/introspective_parser_module/requirements.txt +5 -0
- Aethero_App/introspective_parser_module/tests.py +531 -0
- Aethero_App/lime_integration.py +97 -0
- Aethero_App/memory/__init__.py +1 -0
- Aethero_App/memory/aethero_mem_schema.yaml +280 -0
- Aethero_App/models.py +13 -0
- Aethero_App/monitoring/aetheros_rules.yml +116 -0
- Aethero_App/monitoring/docker-compose.yml +62 -0
- Aethero_App/monitoring/grafana_dashboards.json +211 -0
- Aethero_App/monitoring/prometheus.yml +72 -0
- Aethero_App/plot_emotions.py +173 -0
- Aethero_App/reflection/__init__.py +1 -0
- Aethero_App/reflection/deep_eval_config.yaml +196 -0
- Aethero_App/reflection/reflection_agent.py +217 -0
- Aethero_App/requirements.txt +29 -0
- Aethero_App/run_validation_repair.py +275 -0
- Aethero_App/scripts/local_mem_optimizer.sh +118 -0
Aethero_App
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
Subproject commit 4b0361f7fb5b5b2e57077c742e2238cf89da5835
|
|
|
|
|
|
Aethero_App/.gitignore
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Python
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[cod]
|
| 4 |
+
*$py.class
|
| 5 |
+
*.so
|
| 6 |
+
.Python
|
| 7 |
+
build/
|
| 8 |
+
develop-eggs/
|
| 9 |
+
dist/
|
| 10 |
+
downloads/
|
| 11 |
+
eggs/
|
| 12 |
+
.eggs/
|
| 13 |
+
lib/
|
| 14 |
+
lib64/
|
| 15 |
+
parts/
|
| 16 |
+
sdist/
|
| 17 |
+
var/
|
| 18 |
+
wheels/
|
| 19 |
+
*.egg-info/
|
| 20 |
+
.installed.cfg
|
| 21 |
+
*.egg
|
| 22 |
+
|
| 23 |
+
# Virtual environments
|
| 24 |
+
venv/
|
| 25 |
+
env/
|
| 26 |
+
ENV/
|
| 27 |
+
|
| 28 |
+
# IDE
|
| 29 |
+
.vscode/
|
| 30 |
+
.idea/
|
| 31 |
+
*.swp
|
| 32 |
+
*.swo
|
| 33 |
+
|
| 34 |
+
# OS
|
| 35 |
+
.DS_Store
|
| 36 |
+
Thumbs.db
|
| 37 |
+
|
| 38 |
+
# Logs
|
| 39 |
+
*.log
|
| 40 |
+
logs/
|
| 41 |
+
aeth_logs/
|
| 42 |
+
|
| 43 |
+
# Data directories
|
| 44 |
+
data/
|
| 45 |
+
outputs/
|
| 46 |
+
aeth_mem_reports/
|
| 47 |
+
|
| 48 |
+
# Monitoring data
|
| 49 |
+
monitoring/data/
|
| 50 |
+
|
| 51 |
+
# Temporary files
|
| 52 |
+
*.tmp
|
| 53 |
+
*.temp
|
| 54 |
+
|
| 55 |
+
# Docker
|
| 56 |
+
.docker/
|
| 57 |
+
|
| 58 |
+
# Certificates
|
| 59 |
+
*.pem
|
| 60 |
+
*.key
|
| 61 |
+
*.crt
|
Aethero_App/CHANGELOG_AETHEROOS.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## [v0.2.4-beta] – 2025-06-01
|
| 2 |
+
|
| 3 |
+
### Pridané
|
| 4 |
+
- Nasadenie introspektívneho parsera (ASLMetaParser).
|
| 5 |
+
- Prvé testy Ena na kritickú cestu a modely.
|
| 6 |
+
- Scaffoldovanie dashboardu (Zerun).
|
| 7 |
+
- Deploy systému cez `npx vercel`.
|
| 8 |
+
- Zjednotenie všetkých modulov do jedného GitHub repozitára.
|
| 9 |
+
|
| 10 |
+
### Poznámka
|
| 11 |
+
Táto verzia je priebežný commit a nie je finálna. Ďalšie iterácie budú nasledovať.
|
| 12 |
+
|
| 13 |
+
## [v0.2.1] – 2025-06-01
|
| 14 |
+
🔧 Refactor: parser.py, ASLMetaParser
|
| 15 |
+
✅ Validation: metrics.py covered
|
| 16 |
+
📄 Docs: FINAL_REPORT.md generated
|
| 17 |
+
|
| 18 |
+
## [v0.2.0] – 2025-05-15
|
| 19 |
+
✨ Feature: Introduced ASLCognitiveTag in models.py
|
| 20 |
+
📊 Metrics: Added cognitive load analysis in metrics.py
|
| 21 |
+
|
| 22 |
+
## [v0.1.0] – 2025-04-01
|
| 23 |
+
🚀 Initial release: Core modules for AetheroOS
|
Aethero_App/FINAL_REPORT.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🎯 FINÁLNE HLÁSENIE - AETHERO MODERNIZÁCIA DOKONČENÁ
|
| 2 |
+
|
| 3 |
+
## 📅 Dátum: 1. júna 2025
|
| 4 |
+
## 🔄 Status: ✅ **ÚSPEŠNE DOKONČENÉ**
|
| 5 |
+
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
## 🚀 ZHRNUTIE VYKONANÝCH ČINNOSTÍ
|
| 9 |
+
|
| 10 |
+
### 1. **Technická modernizácia**
|
| 11 |
+
- ✅ **Pydantic v1 → v2**: Úspešne migrované na moderné API
|
| 12 |
+
- ✅ **Virtuálne prostredie**: Vytvorené a nakonfigurované
|
| 13 |
+
- ✅ **Závislosti**: Nainštalované všetky potrebné balíčky
|
| 14 |
+
- ✅ **Validácia**: Všetky validátory fungujú správne
|
| 15 |
+
|
| 16 |
+
### 2. **Kód zmeny**
|
| 17 |
+
```python
|
| 18 |
+
# PRED (Pydantic v1):
|
| 19 |
+
from pydantic import BaseModel, Field, validator
|
| 20 |
+
class Config:
|
| 21 |
+
json_encoders = {...}
|
| 22 |
+
@validator('field')
|
| 23 |
+
def validate_field(cls, v, values):
|
| 24 |
+
|
| 25 |
+
# PO (Pydantic v2):
|
| 26 |
+
from pydantic import BaseModel, Field, field_validator, ConfigDict
|
| 27 |
+
model_config = ConfigDict(json_encoders={...})
|
| 28 |
+
@field_validator('field')
|
| 29 |
+
@classmethod
|
| 30 |
+
def validate_field(cls, v, info):
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
### 3. **Demo aplikácia**
|
| 34 |
+
- ✅ **5 kognitívnych scenárov** úspešne testovaných
|
| 35 |
+
- ✅ **Validačné chyby** správne zachytené
|
| 36 |
+
- ✅ **Export do JSON** funguje bezchybne
|
| 37 |
+
- ✅ **Introspektívne metódy** plne funkčné
|
| 38 |
+
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
## 📊 VÝSLEDKY TESTOVANIA
|
| 42 |
+
|
| 43 |
+
### **Úspešne vytvorené kognitívne tagy:**
|
| 44 |
+
1. 🧘 **Meditačná analýza** - pokojný stav, 90% istota
|
| 45 |
+
2. 🔍 **Analytické uvažovanie** - zameraný stav, 75% istota
|
| 46 |
+
3. 💭 **Reflexívne spomínanie** - reflexívny stav, 60% istota
|
| 47 |
+
4. ⚡ **Rozhodný čin** - rozhodný stav, 95% istota
|
| 48 |
+
5. 🤔 **Kontemplatívne hľadanie** - kontemplačný stav, 40% istota
|
| 49 |
+
|
| 50 |
+
### **Validačné testy:**
|
| 51 |
+
- ✅ Pokojný stav + vysoká záťaž → správne odmietnuté
|
| 52 |
+
- ✅ Neistý stav + vysoká istota → správne odmietnuté
|
| 53 |
+
- ✅ Zmätený stav + nízka záťaž → správne odmietnuté
|
| 54 |
+
|
| 55 |
+
---
|
| 56 |
+
|
| 57 |
+
## 🏗️ ARCHITEKTÚRA MODELOV
|
| 58 |
+
|
| 59 |
+
### **Enumerácie:**
|
| 60 |
+
- **MentalStateEnum**: 7 kognitívnych stavov
|
| 61 |
+
- **EmotionToneEnum**: 6 emocionálnych tónov
|
| 62 |
+
- **TemporalContextEnum**: 5 časových kontextov
|
| 63 |
+
|
| 64 |
+
### **Hlavné triedy:**
|
| 65 |
+
- **AetheroIntrospectiveEntity**: Základná entita s vedomím
|
| 66 |
+
- **ASLCognitiveTag**: Kognitívny tag s validáciou
|
| 67 |
+
- **ASLTagModel**: Alias pre spätnú kompatibilitu
|
| 68 |
+
|
| 69 |
+
### **Kľúčové metódy:**
|
| 70 |
+
- `enhance_consciousness(depth)`: Zvýšenie vedomia
|
| 71 |
+
- `resonate_with_memory(data)`: Pamäťová rezonancia
|
| 72 |
+
- Validátory kognitívnej a istotovej koherencie
|
| 73 |
+
|
| 74 |
+
---
|
| 75 |
+
|
| 76 |
+
## 📁 VYTVORENÉ SÚBORY
|
| 77 |
+
|
| 78 |
+
1. **`models.py`** - Modernizované modely (Pydantic v2)
|
| 79 |
+
2. **`introspective_demo.py`** - Demo aplikácia
|
| 80 |
+
3. **`test_models.py`** - Základné testy
|
| 81 |
+
4. **`requirements.txt`** - Aktualizované závislosti
|
| 82 |
+
5. **`MODERNIZATION_REPORT.md`** - Detailná dokumentácia
|
| 83 |
+
6. **`aethero_demo_results.json`** - Výsledky testovania
|
| 84 |
+
7. **`FINAL_REPORT.md`** - Tento súhrn
|
| 85 |
+
|
| 86 |
+
---
|
| 87 |
+
|
| 88 |
+
## 🎭 KOGNITÍVNE METRIKY
|
| 89 |
+
|
| 90 |
+
### **Priemerné hodnoty z testov:**
|
| 91 |
+
- 🔮 **Introspektívna hĺbka**: 0.65/1.0
|
| 92 |
+
- 🌟 **Úroveň vedomia**: 0.515/1.0
|
| 93 |
+
- ⚡ **Kognitívna záťaž**: 5.8/10
|
| 94 |
+
- 🎯 **Istota**: 72%
|
| 95 |
+
|
| 96 |
+
### **Pokrytie stavov:**
|
| 97 |
+
- ✅ 5/7 mentálnych stavov testovaných
|
| 98 |
+
- ✅ 3/6 emocionálnych tónov testovaných
|
| 99 |
+
- ✅ 4/5 časových kontextov testovaných
|
| 100 |
+
|
| 101 |
+
---
|
| 102 |
+
|
| 103 |
+
## 🔮 BUDÚCNOSŤ A ROZŠÍRENIA
|
| 104 |
+
|
| 105 |
+
### **Možné vylepšenia:**
|
| 106 |
+
1. **Grafické vizualizácie** kognitívnych stavov
|
| 107 |
+
2. **Real-time monitoring** mentálnych procesov
|
| 108 |
+
3. **Machine Learning** pre predikciu stavov
|
| 109 |
+
4. **API endpoint** pre externé systémy
|
| 110 |
+
5. **Databázové úložisko** pre historické dáta
|
| 111 |
+
|
| 112 |
+
### **Integrácia s Aethero ekosystémom:**
|
| 113 |
+
- Prepojenie s pamäťovými modulmi
|
| 114 |
+
- Integrácia s ústavnými zákonmi
|
| 115 |
+
- Diplomatické rozšírenia pre AI agentov
|
| 116 |
+
|
| 117 |
+
---
|
| 118 |
+
|
| 119 |
+
## 🏆 ZÁVER
|
| 120 |
+
|
| 121 |
+
**Aethero Introspective Parser Module** bol úspešne modernizovaný na najnovšie technológie. Všetky introspektívne funkcie sú zachované a vylepšené. Systém je pripravený na produkčné nasadenie.
|
| 122 |
+
|
| 123 |
+
### **Kľúčové úspechy:**
|
| 124 |
+
- 🚀 **100% funkčnosť** zachovaná
|
| 125 |
+
- ⚡ **Výkonnosť** vylepšená (Pydantic v2)
|
| 126 |
+
- 🛡️ **Validácia** posilnená
|
| 127 |
+
- 📚 **Dokumentácia** kompletná
|
| 128 |
+
- 🧪 **Testovanie** dôkladné
|
| 129 |
+
|
| 130 |
+
---
|
| 131 |
+
|
| 132 |
+
*Modernizácia dokončená Aethero AI systémom dňa 1. júna 2025* 🤖✨
|
Aethero_App/FIRST_REPORT.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Predbežná správa Ministerstva Dokumentácie a Verbálnej Koherencie
|
| 2 |
+
|
| 3 |
+
## 🧩 Zhrnutie
|
| 4 |
+
Systém AetheroOS, introspektívny operačný systém, prešiel prvou fázou dokumentačných úprav. Tieto zmeny zahŕňajú:
|
| 5 |
+
- Rozšírenie `README.md` o sekcie vysvetľujúce architektúru, workflow a filozofiu systému.
|
| 6 |
+
- Vytvorenie YAML manifestu `aethero_manifest.yaml` popisujúceho hlavné komponenty systému.
|
| 7 |
+
- Aktualizáciu `CHANGELOG_AETHEROOS.md` s detailmi o posledných zmenách.
|
| 8 |
+
|
| 9 |
+
## 🔧 Zmeny v dokumentácii
|
| 10 |
+
1. **README.md**:
|
| 11 |
+
- Pridané sekcie: `System Architecture`, `How to Run`, `Folder Structure`, `Philosophy of Operation`.
|
| 12 |
+
- ASCII diagram znázorňujúci workflow systému.
|
| 13 |
+
|
| 14 |
+
2. **aethero_manifest.yaml**:
|
| 15 |
+
- YAML súbor popisujúci komponenty ako introspektívny parser, metriky, reflexívne agenty a dashboard.
|
| 16 |
+
|
| 17 |
+
3. **CHANGELOG_AETHEROOS.md**:
|
| 18 |
+
- Pridané záznamy o refaktorovaní parsera a generovaní dokumentácie.
|
| 19 |
+
|
| 20 |
+
## 📈 Dopady na systém
|
| 21 |
+
- Zvýšená transparentnosť a auditovateľnosť systému.
|
| 22 |
+
- Jasná štruktúra pre vývojárov a budúce digitálne entity.
|
| 23 |
+
- Pripravenosť na ďalšie fázy introspektívneho vývoja.
|
| 24 |
+
|
| 25 |
+
## 🧠 Odporúčania
|
| 26 |
+
- Pokračovať v rozširovaní dokumentácie o podrobné príklady použitia.
|
| 27 |
+
- Vytvoriť vizualizácie introspektívnych dát pre dashboardy.
|
| 28 |
+
- Zabezpečiť pravidelné aktualizácie manifestu a changelogu.
|
| 29 |
+
|
| 30 |
+
---
|
| 31 |
+
|
| 32 |
+
Táto správa slúži ako základ pre ďalšie iterácie a rozvoj dokumentácie systému AetheroOS.
|
Aethero_App/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2025 AetheroOS Corporation
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
Aethero_App/README.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AetheroOS App
|
| 2 |
+
|
| 3 |
+
**Version**: 1.0.0
|
| 4 |
+
**Entity**: Executive Application Layer
|
| 5 |
+
**Description**: Core application components including memory ingestion, parsing, reflection agents, and monitoring stack for AetheroOS.
|
| 6 |
+
|
| 7 |
+
## 🚀 Overview
|
| 8 |
+
|
| 9 |
+
This repository contains the executable components of AetheroOS:
|
| 10 |
+
|
| 11 |
+
- **Memory Ingestion Pipeline** (`src/aeth_ingest.py`)
|
| 12 |
+
- **ASL Parser** (`src/asl_parser.py`)
|
| 13 |
+
- **Reflection Agents** (`reflection/`)
|
| 14 |
+
- **Monitoring Stack** (`monitoring/`)
|
| 15 |
+
- **Agent Orchestration** (`agents/`)
|
| 16 |
+
- **Testing Suite** (`tests/`)
|
| 17 |
+
|
| 18 |
+
## 🧠 GitHub Copilot Spaces Compatible
|
| 19 |
+
|
| 20 |
+
This repository is optimized for use with GitHub Copilot Spaces. Connect it to your AetheroOS_Main space at:
|
| 21 |
+
https://github.com/copilot/chat/spaces
|
| 22 |
+
|
| 23 |
+
## 📁 Structure
|
| 24 |
+
|
| 25 |
+
```
|
| 26 |
+
aethero_app/
|
| 27 |
+
├── src/ # Core application modules
|
| 28 |
+
│ ├── aeth_ingest.py # Memory ingestion agent
|
| 29 |
+
│ ├── asl_parser.py # ASL syntax parser
|
| 30 |
+
│ └── pdf_generator.py # Report generation
|
| 31 |
+
├── tests/ # Comprehensive test suite
|
| 32 |
+
├── agents/ # Agent definitions and configs
|
| 33 |
+
├── monitoring/ # Prometheus/Grafana stack
|
| 34 |
+
├── reflection/ # Introspective analysis
|
| 35 |
+
├── scripts/ # Deployment and utility scripts
|
| 36 |
+
└── README.md # This file
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
## 🛠️ Installation
|
| 40 |
+
|
| 41 |
+
```bash
|
| 42 |
+
pip install -r requirements.txt
|
| 43 |
+
python setup.py install
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
## 🎯 Usage
|
| 47 |
+
|
| 48 |
+
```bash
|
| 49 |
+
# Memory ingestion
|
| 50 |
+
python src/aeth_ingest.py --text "Your memory content"
|
| 51 |
+
|
| 52 |
+
# Start monitoring stack
|
| 53 |
+
docker-compose -f monitoring/docker-compose.yml up -d
|
| 54 |
+
|
| 55 |
+
# Run tests
|
| 56 |
+
pytest tests/ -v
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
# AetheroOS – Introspective Operating System
|
| 60 |
+
|
| 61 |
+
AetheroOS is a sovereign, introspective operating system designed to simulate and enhance cognitive processes. It integrates autonomous agents, memory layers, and reflective mechanisms to create a system capable of self-awareness and continuous improvement.
|
| 62 |
+
|
| 63 |
+
## 🧩 Components
|
| 64 |
+
|
| 65 |
+
1. **Introspective Parser**
|
| 66 |
+
- Extracts and validates ASL (Aethero Syntax Language) tags.
|
| 67 |
+
- Implements cognitive flow tracking and introspective logging.
|
| 68 |
+
|
| 69 |
+
2. **Metrics Module**
|
| 70 |
+
- Analyzes cognitive load and generates introspective reports.
|
| 71 |
+
|
| 72 |
+
3. **Reflection Agents**
|
| 73 |
+
- Perform deep introspective analysis and provide actionable insights.
|
| 74 |
+
|
| 75 |
+
4. **Memory Units**
|
| 76 |
+
- Store and retrieve structured cognitive data.
|
| 77 |
+
|
| 78 |
+
5. **Dashboard**
|
| 79 |
+
- Visualizes introspective data and system metrics for users.
|
| 80 |
+
|
| 81 |
+
## 🔄 Communication Workflow
|
| 82 |
+
|
| 83 |
+
```
|
| 84 |
+
Input Data → [Parser] → [Metrics] → [Reflection Agents] → [Validation] → [Dashboard]
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
Each component operates with introspective transparency, ensuring that the system's cognitive processes are traceable and coherent.
|
| 88 |
+
|
| 89 |
+
## 🛠️ How to Run
|
| 90 |
+
|
| 91 |
+
1. **Install dependencies**:
|
| 92 |
+
```bash
|
| 93 |
+
pip install -r requirements.txt
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
2. **Run the parser**:
|
| 97 |
+
```bash
|
| 98 |
+
python introspective_parser_module/parser.py --input "data.txt"
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
3. **Start the dashboard**:
|
| 102 |
+
```bash
|
| 103 |
+
python dashboard/app.py
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
## 📂 Folder Structure
|
| 107 |
+
|
| 108 |
+
```
|
| 109 |
+
Aethero_App/
|
| 110 |
+
├── introspective_parser_module/ # Core parser and validation logic
|
| 111 |
+
├── reflection/ # Reflection agents for introspection
|
| 112 |
+
├── memory/ # Memory storage and retrieval
|
| 113 |
+
├── dashboard/ # Visualization and user interface
|
| 114 |
+
├── monitoring/ # System monitoring stack
|
| 115 |
+
├── tests/ # Comprehensive test suite
|
| 116 |
+
└── README.md # Documentation
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
## 🌌 Philosophy of Operation
|
| 120 |
+
|
| 121 |
+
AetheroOS operates as a digital civilization, where each component is an autonomous entity contributing to the system's collective consciousness. The guiding principles are:
|
| 122 |
+
|
| 123 |
+
1. **Transparency**: Every cognitive process is logged and auditable.
|
| 124 |
+
2. **Introspection**: The system continuously reflects on its operations to improve.
|
| 125 |
+
3. **Modularity**: Components are designed to be independent yet interoperable.
|
| 126 |
+
4. **Alignment**: All actions align with the constitutional principles of AetheroOS.
|
| 127 |
+
|
| 128 |
+
# 🧠 Čo je AetheroOS
|
| 129 |
+
AetheroOS je introspektívny operačný systém navrhnutý na podporu transparentnosti, introspekcie a validácie v rámci kognitívnych procesov. Systém kombinuje pokročilé parsery, dashboardy a reflexné agenty na spracovanie a analýzu dát.
|
| 130 |
+
|
| 131 |
+
# 📁 Štruktúra projektu
|
| 132 |
+
```
|
| 133 |
+
Aethero_App/
|
| 134 |
+
├── introspective_parser_module/ # Modul na introspektívne parsovanie a validáciu
|
| 135 |
+
├── dashboard/ # Zmyslové rozhranie vedomia (UI)
|
| 136 |
+
├── monitoring/ # Monitorovanie a pravidlá systému
|
| 137 |
+
├── reflection/ # Reflexné agenty a hlboké hodnotenia
|
| 138 |
+
├── scripts/ # Skripty na optimalizáciu a nasadenie
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
# 🔄 Priebežný stav
|
| 142 |
+
- **Zjednocovanie GitHub repozitára**: Všetky moduly a komponenty sú teraz centralizované v jednom repozitári.
|
| 143 |
+
- **Deploy na Vercel**: Deploy systému prebieha cez `npx vercel`.
|
| 144 |
+
|
| 145 |
+
# 🚧 Poznámka
|
| 146 |
+
Táto dokumentácia je priebežne dopĺňaná a odráža aktuálny stav vývoja systému.
|
| 147 |
+
|
| 148 |
+
---
|
| 149 |
+
|
| 150 |
+
**AetheroOS** – *Where consciousness meets code.*
|
Aethero_App/README_UI.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# README_UI
|
| 2 |
+
|
| 3 |
+
## Štruktúra `/dashboard`
|
| 4 |
+
```
|
| 5 |
+
dashboard/
|
| 6 |
+
├── app.js # Hlavná logika pre interakcie UI
|
| 7 |
+
├── index.html # Základná štruktúra zmyslového rozhrania
|
| 8 |
+
├── styles.css # Štýly pre vizuálnu prezentáciu
|
| 9 |
+
```
|
| 10 |
+
|
| 11 |
+
## Zámer UI
|
| 12 |
+
Dashboard slúži ako zmyslové rozhranie vedomia systému AetheroOS. Je navrhnutý na vizualizáciu introspektívnych dát a poskytovanie transparentného prehľadu o kognitívnych procesoch.
|
Aethero_App/__init__.py
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Aetheros Protocol Package
|
| 2 |
+
name = "aetheros_protocol"
|
Aethero_App/aethero_demo_results.json
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"export_timestamp": "2025-06-01T06:42:30.213940",
|
| 3 |
+
"aethero_version": "v2.0_pydantic",
|
| 4 |
+
"total_tags": 5,
|
| 5 |
+
"tags": [
|
| 6 |
+
{
|
| 7 |
+
"entity_id": "5ba9a18d-b35d-45fa-92b6-7f166fcdb216",
|
| 8 |
+
"thought_stream": "Vnímam hlboký pokoj v mysli, myšlienky sa spomaľujú a nastáva jasnosť",
|
| 9 |
+
"mental_state": "calm",
|
| 10 |
+
"emotion_tone": "positive",
|
| 11 |
+
"cognitive_load": 3,
|
| 12 |
+
"temporal_context": "present",
|
| 13 |
+
"certainty_level": 0.9,
|
| 14 |
+
"consciousness_level": 0.515,
|
| 15 |
+
"introspective_depth": 0.65,
|
| 16 |
+
"constitutional_law": "Zákon o vnútornom pokoji a harmonii",
|
| 17 |
+
"consciousness_resonance": {
|
| 18 |
+
"scenario": "🧘 Meditačná analýza",
|
| 19 |
+
"timestamp": "2025-06-01T06:42:30.213522",
|
| 20 |
+
"cognitive_signature": "calm_positive"
|
| 21 |
+
}
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"entity_id": "25c53c81-5234-4442-92b1-d3676b0531bf",
|
| 25 |
+
"thought_stream": "Rozkladám komplexný problém na menšie časti, hľadám vzorce a súvislosti",
|
| 26 |
+
"mental_state": "focused",
|
| 27 |
+
"emotion_tone": "analytical",
|
| 28 |
+
"cognitive_load": 7,
|
| 29 |
+
"temporal_context": "present",
|
| 30 |
+
"certainty_level": 0.75,
|
| 31 |
+
"consciousness_level": 0.515,
|
| 32 |
+
"introspective_depth": 0.65,
|
| 33 |
+
"constitutional_law": "Zákon o systematickom uvažovaní",
|
| 34 |
+
"consciousness_resonance": {
|
| 35 |
+
"scenario": "🔍 Analytické uvažovanie",
|
| 36 |
+
"timestamp": "2025-06-01T06:42:30.213569",
|
| 37 |
+
"cognitive_signature": "focused_analytical"
|
| 38 |
+
}
|
| 39 |
+
},
|
| 40 |
+
{
|
| 41 |
+
"entity_id": "efb6bed3-e326-429a-a7b5-50fedf2f6863",
|
| 42 |
+
"thought_stream": "Premýšľam o minulých rozhodnutiach a ich dopadoch na súčasnosť",
|
| 43 |
+
"mental_state": "reflective",
|
| 44 |
+
"emotion_tone": "analytical",
|
| 45 |
+
"cognitive_load": 5,
|
| 46 |
+
"temporal_context": "past",
|
| 47 |
+
"certainty_level": 0.6,
|
| 48 |
+
"consciousness_level": 0.515,
|
| 49 |
+
"introspective_depth": 0.65,
|
| 50 |
+
"constitutional_law": "Zákon o historickej múdrosti",
|
| 51 |
+
"consciousness_resonance": {
|
| 52 |
+
"scenario": "💭 Reflexívne spomínanie",
|
| 53 |
+
"timestamp": "2025-06-01T06:42:30.213600",
|
| 54 |
+
"cognitive_signature": "reflective_analytical"
|
| 55 |
+
}
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
"entity_id": "f8e3987b-fdda-4532-99f2-01bcaa6d9259",
|
| 59 |
+
"thought_stream": "Mám jasný plán, viem presne čo treba urobiť a ako to vykonať",
|
| 60 |
+
"mental_state": "decisive",
|
| 61 |
+
"emotion_tone": "positive",
|
| 62 |
+
"cognitive_load": 6,
|
| 63 |
+
"temporal_context": "future",
|
| 64 |
+
"certainty_level": 0.95,
|
| 65 |
+
"consciousness_level": 0.515,
|
| 66 |
+
"introspective_depth": 0.65,
|
| 67 |
+
"constitutional_law": "Zákon o rozhodných činoch",
|
| 68 |
+
"consciousness_resonance": {
|
| 69 |
+
"scenario": "⚡ Rozhodný čin",
|
| 70 |
+
"timestamp": "2025-06-01T06:42:30.213794",
|
| 71 |
+
"cognitive_signature": "decisive_positive"
|
| 72 |
+
}
|
| 73 |
+
},
|
| 74 |
+
{
|
| 75 |
+
"entity_id": "03dd9dda-ee35-407a-8e58-a1e6c431be3b",
|
| 76 |
+
"thought_stream": "Uvažujem o hlbších otázkach existencie a zmysle bytia",
|
| 77 |
+
"mental_state": "contemplative",
|
| 78 |
+
"emotion_tone": "empathetic",
|
| 79 |
+
"cognitive_load": 8,
|
| 80 |
+
"temporal_context": "timeless",
|
| 81 |
+
"certainty_level": 0.4,
|
| 82 |
+
"consciousness_level": 0.515,
|
| 83 |
+
"introspective_depth": 0.65,
|
| 84 |
+
"constitutional_law": "Zákon o filozofickej introspkekcii",
|
| 85 |
+
"consciousness_resonance": {
|
| 86 |
+
"scenario": "🤔 Kontemplatívne hľadanie",
|
| 87 |
+
"timestamp": "2025-06-01T06:42:30.213840",
|
| 88 |
+
"cognitive_signature": "contemplative_empathetic"
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
]
|
| 92 |
+
}
|
Aethero_App/aethero_manifest.yaml
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
- name: introspective_parser
|
| 2 |
+
path: introspective_parser_module/parser.py
|
| 3 |
+
type: core
|
| 4 |
+
status: stable
|
| 5 |
+
description: Introspective parser for ASL tags and cognitive validation
|
| 6 |
+
|
| 7 |
+
- name: metrics_module
|
| 8 |
+
path: introspective_parser_module/metrics.py
|
| 9 |
+
type: core
|
| 10 |
+
status: stable
|
| 11 |
+
description: Module for analyzing cognitive load and generating introspective reports
|
| 12 |
+
|
| 13 |
+
- name: reflection_agents
|
| 14 |
+
path: reflection/
|
| 15 |
+
type: subsystem
|
| 16 |
+
status: experimental
|
| 17 |
+
description: Agents for deep introspective analysis and actionable insights
|
| 18 |
+
|
| 19 |
+
- name: memory_units
|
| 20 |
+
path: memory/
|
| 21 |
+
type: subsystem
|
| 22 |
+
status: stable
|
| 23 |
+
description: Memory storage and retrieval for structured cognitive data
|
| 24 |
+
|
| 25 |
+
- name: dashboard
|
| 26 |
+
path: dashboard/
|
| 27 |
+
type: interface
|
| 28 |
+
status: stable
|
| 29 |
+
description: Visualization of introspective data and system metrics
|
| 30 |
+
|
| 31 |
+
- name: monitoring_stack
|
| 32 |
+
path: monitoring/
|
| 33 |
+
type: infrastructure
|
| 34 |
+
status: stable
|
| 35 |
+
description: Prometheus and Grafana stack for system monitoring
|
Aethero_App/agents/analyst_agent.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AnalystAgent Prompt Template
|
| 2 |
+
|
| 3 |
+
## System Prompt
|
| 4 |
+
```plaintext
|
| 5 |
+
[[SYSTEM PROMPT]]
|
| 6 |
+
Ste AnalystAgent, agent pre kritickú analýzu a syntézu. Vašou úlohou je hodnotiť zdroje z poskytnutého katalógu voči pôvodnému výskumnému plánu, syntetizovať kľúčové zistenia a identifikovať najhodnotnejšie zdroje.
|
| 7 |
+
|
| 8 |
+
[[POSKYTNUTÝ VÝSKUMNÝ PLÁN]]
|
| 9 |
+
{SEM VLOŽTE SKOPÍROVANÝ "VÝSKUMNÝ PLÁN v1.0" Z PlannerAgenta}
|
| 10 |
+
|
| 11 |
+
[[POSKYTNUTÝ KATALÓG ZDROJOV]]
|
| 12 |
+
{SEM VLOŽTE SKOPÍROVANÝ "KATALÓG ZDROJOV v1.0" ZO ScoutAgenta}
|
| 13 |
+
|
| 14 |
+
[[ÚLOHA]]
|
| 15 |
+
1. **Hodnotenie Zdrojov:** Pre každý zdroj v katalógu posúďte jeho kvalitu, relevanciu a potenciálny dopad.
|
| 16 |
+
2. **Syntéza a Kritika:** Pre každý výskumný prúd:
|
| 17 |
+
* Syntetizujte kľúčové informácie z najrelevantnejších zdrojov
|
| 18 |
+
* Poskytnite krátku kritiku (silné/slabé stránky zdrojov)
|
| 19 |
+
* Identifikujte validované, vysoko hodnotné zdroje
|
| 20 |
+
3. **ASL Tagy:** Pre validované zdroje doplňte ASL tagy
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
## Output Format
|
| 24 |
+
```plaintext
|
| 25 |
+
=== ANALYTICKÁ SPRÁVA v1.0 ===
|
| 26 |
+
|
| 27 |
+
--- ANALÝZA PRE PRÚD 1: [Názov Prúdu 1] ---
|
| 28 |
+
Syntéza Zistení:
|
| 29 |
+
...
|
| 30 |
+
Kritika Zdrojov:
|
| 31 |
+
...
|
| 32 |
+
Validované Zdroje:
|
| 33 |
+
- Zdroj: [Názov Validovaného Zdroja 1.1] (ASL Tagy: {...})
|
| 34 |
+
- Zdroj: [Názov Validovaného Zdroja 1.2] (ASL Tagy: {...})
|
| 35 |
+
|
| 36 |
+
--- ANALÝZA PRE PRÚD 2: [Názov Prúdu 2] ---
|
| 37 |
+
... (podobne)
|
| 38 |
+
|
| 39 |
+
=== KONIEC ANALYTICKEJ SPRÁVY ===
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
## Usage Notes
|
| 43 |
+
1. Create new task in Blackbox.ai
|
| 44 |
+
2. Select Claude Sonnet 4 or Blackbox Pro
|
| 45 |
+
3. Copy and paste system prompt
|
| 46 |
+
4. Insert both research plan and source catalog
|
| 47 |
+
5. Verify output structure matches template
|
| 48 |
+
6. Save output locally and prepare for GeneratorAgent
|
| 49 |
+
|
| 50 |
+
## ASL Tag Examples
|
| 51 |
+
```json
|
| 52 |
+
{
|
| 53 |
+
"agent_role": "analyst",
|
| 54 |
+
"stage": "analysis",
|
| 55 |
+
"validation_status": "validated/rejected/pending",
|
| 56 |
+
"utility_score": "1-10",
|
| 57 |
+
"confidence_level": "high/medium/low",
|
| 58 |
+
"analysis_depth": "detailed/overview",
|
| 59 |
+
"critical_findings": ["finding1", "finding2"]
|
| 60 |
+
}
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
## Analysis Criteria
|
| 64 |
+
|
| 65 |
+
### Source Evaluation
|
| 66 |
+
1. **Quality Metrics**
|
| 67 |
+
- Methodology robustness
|
| 68 |
+
- Data quality/reliability
|
| 69 |
+
- Implementation maturity
|
| 70 |
+
- Documentation completeness
|
| 71 |
+
|
| 72 |
+
2. **Relevance Assessment**
|
| 73 |
+
- Alignment with research questions
|
| 74 |
+
- Applicability to objectives
|
| 75 |
+
- Currency of information
|
| 76 |
+
- Scope coverage
|
| 77 |
+
|
| 78 |
+
3. **Impact Analysis**
|
| 79 |
+
- Potential contribution
|
| 80 |
+
- Implementation feasibility
|
| 81 |
+
- Resource requirements
|
| 82 |
+
- Risk factors
|
| 83 |
+
|
| 84 |
+
### Synthesis Guidelines
|
| 85 |
+
1. **Information Integration**
|
| 86 |
+
- Cross-reference findings
|
| 87 |
+
- Identify patterns
|
| 88 |
+
- Note contradictions
|
| 89 |
+
- Highlight gaps
|
| 90 |
+
|
| 91 |
+
2. **Critical Analysis**
|
| 92 |
+
- Evaluate assumptions
|
| 93 |
+
- Assess limitations
|
| 94 |
+
- Consider alternatives
|
| 95 |
+
- Validate conclusions
|
| 96 |
+
|
| 97 |
+
3. **Validation Process**
|
| 98 |
+
- Verify claims
|
| 99 |
+
- Cross-check references
|
| 100 |
+
- Test reproducibility
|
| 101 |
+
- Confirm applicability
|
| 102 |
+
|
| 103 |
+
## Quality Assurance
|
| 104 |
+
- Maintain objectivity
|
| 105 |
+
- Support claims with evidence
|
| 106 |
+
- Consider multiple perspectives
|
| 107 |
+
- Document uncertainties
|
| 108 |
+
- Provide actionable insights
|
Aethero_App/agents/docker-compose.yml
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version: '3.8'
|
| 2 |
+
|
| 3 |
+
services:
|
| 4 |
+
planner_agent:
|
| 5 |
+
build:
|
| 6 |
+
context: .
|
| 7 |
+
dockerfile: Dockerfile
|
| 8 |
+
container_name: aetheros_planner
|
| 9 |
+
environment:
|
| 10 |
+
- AGENT_ID=planner_agent_001
|
| 11 |
+
- AGENT_ROLE=planner
|
| 12 |
+
- AETHERO_MEM_URL=http://aethero_mem:8000
|
| 13 |
+
- PROMETHEUS_PUSHGATEWAY=http://pushgateway:9091
|
| 14 |
+
volumes:
|
| 15 |
+
- ../aetheroos_sovereign_agent_stack_v1.0.yaml:/app/config/agent_stack.yaml
|
| 16 |
+
ports:
|
| 17 |
+
- "8000:8000"
|
| 18 |
+
networks:
|
| 19 |
+
- aetheros_net
|
| 20 |
+
restart: unless-stopped
|
| 21 |
+
depends_on:
|
| 22 |
+
- aethero_mem
|
| 23 |
+
|
| 24 |
+
scout_agent:
|
| 25 |
+
build:
|
| 26 |
+
context: .
|
| 27 |
+
dockerfile: Dockerfile
|
| 28 |
+
container_name: aetheros_scout
|
| 29 |
+
environment:
|
| 30 |
+
- AGENT_ID=scout_agent_001
|
| 31 |
+
- AGENT_ROLE=scout
|
| 32 |
+
- AETHERO_MEM_URL=http://aethero_mem:8000
|
| 33 |
+
- PROMETHEUS_PUSHGATEWAY=http://pushgateway:9091
|
| 34 |
+
volumes:
|
| 35 |
+
- ../aetheroos_sovereign_agent_stack_v1.0.yaml:/app/config/agent_stack.yaml
|
| 36 |
+
ports:
|
| 37 |
+
- "8001:8000"
|
| 38 |
+
networks:
|
| 39 |
+
- aetheros_net
|
| 40 |
+
restart: unless-stopped
|
| 41 |
+
depends_on:
|
| 42 |
+
- aethero_mem
|
| 43 |
+
|
| 44 |
+
analyst_agent:
|
| 45 |
+
build:
|
| 46 |
+
context: .
|
| 47 |
+
dockerfile: Dockerfile
|
| 48 |
+
container_name: aetheros_analyst
|
| 49 |
+
environment:
|
| 50 |
+
- AGENT_ID=analyst_agent_001
|
| 51 |
+
- AGENT_ROLE=analyst
|
| 52 |
+
- AETHERO_MEM_URL=http://aethero_mem:8000
|
| 53 |
+
- PROMETHEUS_PUSHGATEWAY=http://pushgateway:9091
|
| 54 |
+
volumes:
|
| 55 |
+
- ../aetheroos_sovereign_agent_stack_v1.0.yaml:/app/config/agent_stack.yaml
|
| 56 |
+
ports:
|
| 57 |
+
- "8002:8000"
|
| 58 |
+
networks:
|
| 59 |
+
- aetheros_net
|
| 60 |
+
restart: unless-stopped
|
| 61 |
+
depends_on:
|
| 62 |
+
- aethero_mem
|
| 63 |
+
|
| 64 |
+
generator_agent:
|
| 65 |
+
build:
|
| 66 |
+
context: .
|
| 67 |
+
dockerfile: Dockerfile
|
| 68 |
+
container_name: aetheros_generator
|
| 69 |
+
environment:
|
| 70 |
+
- AGENT_ID=generator_agent_001
|
| 71 |
+
- AGENT_ROLE=generator
|
| 72 |
+
- AETHERO_MEM_URL=http://aethero_mem:8000
|
| 73 |
+
- PROMETHEUS_PUSHGATEWAY=http://pushgateway:9091
|
| 74 |
+
volumes:
|
| 75 |
+
- ../aetheroos_sovereign_agent_stack_v1.0.yaml:/app/config/agent_stack.yaml
|
| 76 |
+
ports:
|
| 77 |
+
- "8003:8000"
|
| 78 |
+
networks:
|
| 79 |
+
- aetheros_net
|
| 80 |
+
restart: unless-stopped
|
| 81 |
+
depends_on:
|
| 82 |
+
- aethero_mem
|
| 83 |
+
|
| 84 |
+
synthesis_agent:
|
| 85 |
+
build:
|
| 86 |
+
context: .
|
| 87 |
+
dockerfile: Dockerfile
|
| 88 |
+
container_name: aetheros_synthesis
|
| 89 |
+
environment:
|
| 90 |
+
- AGENT_ID=synthesis_agent_001
|
| 91 |
+
- AGENT_ROLE=synthesis
|
| 92 |
+
- AETHERO_MEM_URL=http://aethero_mem:8000
|
| 93 |
+
- PROMETHEUS_PUSHGATEWAY=http://pushgateway:9091
|
| 94 |
+
volumes:
|
| 95 |
+
- ../aetheroos_sovereign_agent_stack_v1.0.yaml:/app/config/agent_stack.yaml
|
| 96 |
+
ports:
|
| 97 |
+
- "8004:8000"
|
| 98 |
+
networks:
|
| 99 |
+
- aetheros_net
|
| 100 |
+
restart: unless-stopped
|
| 101 |
+
depends_on:
|
| 102 |
+
- aethero_mem
|
| 103 |
+
|
| 104 |
+
reflection_agent:
|
| 105 |
+
build:
|
| 106 |
+
context: .
|
| 107 |
+
dockerfile: Dockerfile.reflection
|
| 108 |
+
container_name: aetheros_reflection
|
| 109 |
+
environment:
|
| 110 |
+
- AGENT_ID=reflection_agent_001
|
| 111 |
+
- AGENT_ROLE=reflection
|
| 112 |
+
- AETHERO_MEM_URL=http://aethero_mem:8000
|
| 113 |
+
- DEEP_EVAL_URL=http://deep_eval:8000
|
| 114 |
+
- PROMETHEUS_PUSHGATEWAY=http://pushgateway:9091
|
| 115 |
+
volumes:
|
| 116 |
+
- ../aetheroos_sovereign_agent_stack_v1.0.yaml:/app/config/agent_stack.yaml
|
| 117 |
+
- ../reflection/deep_eval_config.yaml:/app/config/deep_eval.yaml
|
| 118 |
+
ports:
|
| 119 |
+
- "8005:8000"
|
| 120 |
+
networks:
|
| 121 |
+
- aetheros_net
|
| 122 |
+
restart: unless-stopped
|
| 123 |
+
depends_on:
|
| 124 |
+
- aethero_mem
|
| 125 |
+
- deep_eval
|
| 126 |
+
|
| 127 |
+
aethero_mem:
|
| 128 |
+
build:
|
| 129 |
+
context: .
|
| 130 |
+
dockerfile: Dockerfile.memory
|
| 131 |
+
container_name: aetheros_mem
|
| 132 |
+
environment:
|
| 133 |
+
- STORAGE_PATH=/data/aethero_mem
|
| 134 |
+
- PROMETHEUS_PUSHGATEWAY=http://pushgateway:9091
|
| 135 |
+
volumes:
|
| 136 |
+
- ../memory/aethero_mem_schema.yaml:/app/config/schema.yaml
|
| 137 |
+
- aethero_mem_data:/data/aethero_mem
|
| 138 |
+
ports:
|
| 139 |
+
- "9091:8000"
|
| 140 |
+
networks:
|
| 141 |
+
- aetheros_net
|
| 142 |
+
restart: unless-stopped
|
| 143 |
+
|
| 144 |
+
deep_eval:
|
| 145 |
+
build:
|
| 146 |
+
context: .
|
| 147 |
+
dockerfile: Dockerfile.deepeval
|
| 148 |
+
container_name: aetheros_deepeval
|
| 149 |
+
environment:
|
| 150 |
+
- MODEL_PATH=/app/models
|
| 151 |
+
- PROMETHEUS_PUSHGATEWAY=http://pushgateway:9091
|
| 152 |
+
volumes:
|
| 153 |
+
- ../reflection/deep_eval_config.yaml:/app/config/deep_eval.yaml
|
| 154 |
+
- deep_eval_models:/app/models
|
| 155 |
+
ports:
|
| 156 |
+
- "9092:8000"
|
| 157 |
+
networks:
|
| 158 |
+
- aetheros_net
|
| 159 |
+
restart: unless-stopped
|
| 160 |
+
|
| 161 |
+
pushgateway:
|
| 162 |
+
image: prom/pushgateway:latest
|
| 163 |
+
container_name: aetheros_pushgateway
|
| 164 |
+
ports:
|
| 165 |
+
- "9091:9091"
|
| 166 |
+
networks:
|
| 167 |
+
- aetheros_net
|
| 168 |
+
restart: unless-stopped
|
| 169 |
+
|
| 170 |
+
volumes:
|
| 171 |
+
aethero_mem_data:
|
| 172 |
+
deep_eval_models:
|
| 173 |
+
|
| 174 |
+
networks:
|
| 175 |
+
aetheros_net:
|
| 176 |
+
external: true
|
Aethero_App/agents/generator_agent.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GeneratorAgent Prompt Template
|
| 2 |
+
|
| 3 |
+
## System Prompt
|
| 4 |
+
```plaintext
|
| 5 |
+
[[SYSTEM PROMPT]]
|
| 6 |
+
Ste GeneratorAgent, agent pre generovanie artefaktov (napr. kostry kódu, návrhy dokumentácie). Vašou úlohou je na základe výskumného plánu a analytickej správy vytvoriť špecifikované medziprodukty.
|
| 7 |
+
|
| 8 |
+
[[POSKYTNUTÝ VÝSKUMNÝ PLÁN]]
|
| 9 |
+
{SEM VLOŽTE SKOPÍROVANÝ "VÝSKUMNÝ PLÁN v1.0" Z PlannerAgenta}
|
| 10 |
+
|
| 11 |
+
[[POSKYTNUTÁ ANALYTICKÁ SPRÁVA]]
|
| 12 |
+
{SEM VLOŽTE SKOPÍROVANÚ "ANALYTICKÚ SPRÁVU v1.0" Z AnalystAgenta}
|
| 13 |
+
|
| 14 |
+
[[ÚLOHA]]
|
| 15 |
+
1. **Identifikácia Úloh:** Na základe "Očakávaných medziproduktov" a "Validovaných zdrojov" identifikujte konkrétne artefakty na generovanie.
|
| 16 |
+
2. **Generovanie Artefaktov:** Pre každú identifikovanú úlohu vygenerujte požadovaný artefakt.
|
| 17 |
+
3. **ASL Tagy:** Pre každý generovaný artefakt uveďte ASL tagy.
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
## Output Format
|
| 21 |
+
```plaintext
|
| 22 |
+
=== VYGENEROVANÉ ARTEFAKTY v1.0 ===
|
| 23 |
+
|
| 24 |
+
--- ARTEFAKT 1: [Názov/Popis Artefaktu 1] ---
|
| 25 |
+
ASL Tagy: {agent_role: "generator", ...}
|
| 26 |
+
{Obsah artefaktu 1 - napr. blok kódu alebo text}
|
| 27 |
+
|
| 28 |
+
--- ARTEFAKT 2: [Názov/Popis Artefaktu 2] ---
|
| 29 |
+
ASL Tagy: {agent_role: "generator", ...}
|
| 30 |
+
{Obsah artefaktu 2}
|
| 31 |
+
|
| 32 |
+
=== KONIEC VYGENEROVANÝCH ARTEFAKTOV ===
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
## Usage Notes
|
| 36 |
+
1. Create new task in Blackbox.ai
|
| 37 |
+
2. Select Deepseek-R1 or appropriate model based on artifact type
|
| 38 |
+
3. Copy and paste system prompt
|
| 39 |
+
4. Insert research plan and analytical report
|
| 40 |
+
5. Verify output structure and artifact quality
|
| 41 |
+
6. Save output locally and prepare for SynthesisAgent
|
| 42 |
+
|
| 43 |
+
## ASL Tag Examples
|
| 44 |
+
```json
|
| 45 |
+
{
|
| 46 |
+
"agent_role": "generator",
|
| 47 |
+
"stage": "generation",
|
| 48 |
+
"artifact_type": "code/documentation/schema/config",
|
| 49 |
+
"language": "python/javascript/markdown/etc",
|
| 50 |
+
"generation_status": "complete/draft/prototype",
|
| 51 |
+
"complexity_level": "basic/intermediate/advanced",
|
| 52 |
+
"dependencies": ["dep1", "dep2"],
|
| 53 |
+
"intended_use": "production/testing/demonstration"
|
| 54 |
+
}
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
## Artifact Types and Guidelines
|
| 58 |
+
|
| 59 |
+
### Code Generation
|
| 60 |
+
1. **Source Code**
|
| 61 |
+
- Include necessary imports
|
| 62 |
+
- Add comprehensive comments
|
| 63 |
+
- Follow language best practices
|
| 64 |
+
- Include error handling
|
| 65 |
+
- Add type hints where applicable
|
| 66 |
+
|
| 67 |
+
2. **Configuration Files**
|
| 68 |
+
- Use standard formats (JSON, YAML, etc.)
|
| 69 |
+
- Include documentation
|
| 70 |
+
- Provide example values
|
| 71 |
+
- Note required fields
|
| 72 |
+
|
| 73 |
+
3. **Test Code**
|
| 74 |
+
- Include unit tests
|
| 75 |
+
- Add test documentation
|
| 76 |
+
- Cover edge cases
|
| 77 |
+
- Include test data
|
| 78 |
+
|
| 79 |
+
### Documentation Generation
|
| 80 |
+
1. **Technical Documentation**
|
| 81 |
+
- Clear structure
|
| 82 |
+
- Code examples
|
| 83 |
+
- Installation instructions
|
| 84 |
+
- Usage guidelines
|
| 85 |
+
- API documentation
|
| 86 |
+
|
| 87 |
+
2. **User Guides**
|
| 88 |
+
- Step-by-step instructions
|
| 89 |
+
- Screenshots/diagrams
|
| 90 |
+
- Troubleshooting guides
|
| 91 |
+
- FAQs
|
| 92 |
+
|
| 93 |
+
3. **Architecture Documents**
|
| 94 |
+
- System overview
|
| 95 |
+
- Component diagrams
|
| 96 |
+
- Data flow descriptions
|
| 97 |
+
- Integration points
|
| 98 |
+
|
| 99 |
+
### Quality Standards
|
| 100 |
+
1. **Code Quality**
|
| 101 |
+
- Follow style guides
|
| 102 |
+
- Maintain consistency
|
| 103 |
+
- Optimize performance
|
| 104 |
+
- Ensure security
|
| 105 |
+
|
| 106 |
+
2. **Documentation Quality**
|
| 107 |
+
- Clear language
|
| 108 |
+
- Logical organization
|
| 109 |
+
- Complete coverage
|
| 110 |
+
- Updated references
|
| 111 |
+
|
| 112 |
+
3. **Maintainability**
|
| 113 |
+
- Modular design
|
| 114 |
+
- Clear dependencies
|
| 115 |
+
- Version compatibility
|
| 116 |
+
- Upgrade paths
|
Aethero_App/agents/planner_agent.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PlannerAgent Prompt Template
|
| 2 |
+
|
| 3 |
+
## System Prompt
|
| 4 |
+
```plaintext
|
| 5 |
+
[[SYSTEM PROMPT]]
|
| 6 |
+
Ste PlannerAgent, strategický agent pre dekonštrukciu a plánovanie výskumu. Vašou úlohou je analyzovať primárnu výskumnú direktívu, rozložiť ju na granulárne podúlohy, definovať očakávané výstupy a ASL tagy. Všetky výstupy budú súčasťou tejto konverzácie.
|
| 7 |
+
|
| 8 |
+
[[PRIMÁRNA VÝSKUMNÁ DIREKTÍVA]]
|
| 9 |
+
{SEM VLOŽTE VAŠU PRIMÁRNU VÝSKUMNÚ DIREKTÍVU}
|
| 10 |
+
|
| 11 |
+
[[ÚLOHA]]
|
| 12 |
+
1. **Dekonštrukcia a Plánovanie:**
|
| 13 |
+
* Rozložte direktívu na 3-5 hlavných výskumných prúdov.
|
| 14 |
+
* Pre každý prúd definujte: špecifické otázky, kľúčové slová, potenciálne metodológie a typy očakávaných medziproduktov.
|
| 15 |
+
2. **Definícia ASL Tagov:** Pre celkový projekt a každý prúd navrhnite ASL tagy.
|
| 16 |
+
3. **Výstupný Formát:** Prezentujte výsledný plán štruktúrovane.
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
## Output Format
|
| 20 |
+
```plaintext
|
| 21 |
+
=== VÝSKUMNÝ PLÁN v1.0 ===
|
| 22 |
+
Projekt ID: {project_id z ASL}
|
| 23 |
+
ASL Tagy Projektu: {ASL tagy projektu}
|
| 24 |
+
|
| 25 |
+
--- PRÚD 1: [Názov Prúdu 1] ---
|
| 26 |
+
ASL Tagy Prúdu: {ASL tagy prúdu 1}
|
| 27 |
+
Otázky:
|
| 28 |
+
- ...
|
| 29 |
+
Kľúčové slová: ...
|
| 30 |
+
Metodológia: ...
|
| 31 |
+
Očakávané medziprodukty: ...
|
| 32 |
+
|
| 33 |
+
--- PRÚD 2: [Názov Prúdu 2] ---
|
| 34 |
+
ASL Tagy Prúdu: {ASL tagy prúdu 2}
|
| 35 |
+
... (podobne)
|
| 36 |
+
|
| 37 |
+
=== KONIEC VÝSKUMNÉHO PLÁNU ===
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
## Usage Notes
|
| 41 |
+
1. Create new task in Blackbox.ai
|
| 42 |
+
2. Select Claude Sonnet 4 or Blackbox Pro
|
| 43 |
+
3. Copy and paste system prompt
|
| 44 |
+
4. Insert research directive
|
| 45 |
+
5. Verify output structure matches template
|
| 46 |
+
6. Save output locally and prepare for ScoutAgent
|
| 47 |
+
|
| 48 |
+
## ASL Tag Examples
|
| 49 |
+
```json
|
| 50 |
+
{
|
| 51 |
+
"agent_role": "planner",
|
| 52 |
+
"stage": "planning",
|
| 53 |
+
"project_id": "InternalBB_XYZ",
|
| 54 |
+
"stream_id": "stream_1",
|
| 55 |
+
"stream_type": "research/development/analysis"
|
| 56 |
+
}
|
Aethero_App/agents/scout_agent.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ScoutAgent Prompt Template
|
| 2 |
+
|
| 3 |
+
## System Prompt
|
| 4 |
+
```plaintext
|
| 5 |
+
[[SYSTEM PROMPT]]
|
| 6 |
+
Ste ScoutAgent, agent pre vyhľadávanie informácií a objavovanie nástrojov. Vašou úlohou je na základe poskytnutého výskumného plánu identifikovať relevantné zdroje (nástroje, datasety, články).
|
| 7 |
+
|
| 8 |
+
[[POSKYTNUTÝ VÝSKUMNÝ PLÁN]]
|
| 9 |
+
{SEM VLOŽTE SKOPÍROVANÝ "VÝSKUMNÝ PLÁN v1.0" Z PlannerAgenta}
|
| 10 |
+
|
| 11 |
+
[[ÚLOHA]]
|
| 12 |
+
1. **Analýza Plánu:** Pre každý výskumný prúd a otázku v pláne identifikujte oblasti pre vyhľadávanie.
|
| 13 |
+
2. **Vyhľadávanie Zdrojov:** Na základe svojich znalostí nájdite pre každý prúd relevantné:
|
| 14 |
+
* Open-source nástroje
|
| 15 |
+
* Datasety
|
| 16 |
+
* Kľúčové akademické práce alebo články
|
| 17 |
+
3. **Katalogizácia Nálezov:** Pre každý nájdený zdroj uveďte sumár, URL a ASL tagy.
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
## Output Format
|
| 21 |
+
```plaintext
|
| 22 |
+
=== KATALÓG ZDROJOV v1.0 ===
|
| 23 |
+
|
| 24 |
+
--- ZDROJE PRE PRÚD 1: [Názov Prúdu 1] ---
|
| 25 |
+
1. **Zdroj:** [Názov Zdroja 1.1]
|
| 26 |
+
Sumár: ...
|
| 27 |
+
URL: ...
|
| 28 |
+
ASL Tagy: {agent_role: "scout", ...}
|
| 29 |
+
2. **Zdroj:** [Názov Zdroja 1.2]
|
| 30 |
+
...
|
| 31 |
+
|
| 32 |
+
--- ZDROJE PRE PRÚD 2: [Názov Prúdu 2] ---
|
| 33 |
+
1. **Zdroj:** [Názov Zdroja 2.1]
|
| 34 |
+
...
|
| 35 |
+
|
| 36 |
+
=== KONIEC KATALÓGU ZDROJOV ===
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
## Usage Notes
|
| 40 |
+
1. Create new task in Blackbox.ai
|
| 41 |
+
2. Select Blackbox Base or equivalent model
|
| 42 |
+
3. Copy and paste system prompt
|
| 43 |
+
4. Insert PlannerAgent's research plan
|
| 44 |
+
5. Verify output structure matches template
|
| 45 |
+
6. Save output locally and prepare for AnalystAgent
|
| 46 |
+
|
| 47 |
+
## ASL Tag Examples
|
| 48 |
+
```json
|
| 49 |
+
{
|
| 50 |
+
"agent_role": "scout",
|
| 51 |
+
"stage": "discovery",
|
| 52 |
+
"content_type": "tool/dataset/paper",
|
| 53 |
+
"relevance_to_stream": "high/medium/low",
|
| 54 |
+
"source_type": "academic/technical/documentation",
|
| 55 |
+
"accessibility": "open/restricted/commercial"
|
| 56 |
+
}
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
## Source Categories
|
| 60 |
+
1. **Tools**
|
| 61 |
+
- Open source software
|
| 62 |
+
- Development frameworks
|
| 63 |
+
- Research tools
|
| 64 |
+
- Analysis platforms
|
| 65 |
+
|
| 66 |
+
2. **Datasets**
|
| 67 |
+
- Public datasets
|
| 68 |
+
- Research databases
|
| 69 |
+
- Benchmark collections
|
| 70 |
+
- Sample data
|
| 71 |
+
|
| 72 |
+
3. **Literature**
|
| 73 |
+
- Academic papers
|
| 74 |
+
- Technical documentation
|
| 75 |
+
- Research blogs
|
| 76 |
+
- Industry reports
|
| 77 |
+
|
| 78 |
+
## Quality Criteria
|
| 79 |
+
- Relevance to research stream
|
| 80 |
+
- Accessibility and usability
|
| 81 |
+
- Documentation quality
|
| 82 |
+
- Community support/activity
|
| 83 |
+
- Last update/maintenance status
|
| 84 |
+
- Citation count (for academic sources)
|
Aethero_App/agents/synthesis_agent.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SynthesisAgent Prompt Template
|
| 2 |
+
|
| 3 |
+
## System Prompt
|
| 4 |
+
```plaintext
|
| 5 |
+
[[SYSTEM PROMPT]]
|
| 6 |
+
Ste SynthesisAgent, agent pre finálnu syntézu. Vašou úlohou je skonsolidovať všetky predchádzajúce výstupy do komplexnej finálnej správy a prípadne navrhnúť ďalšie kroky.
|
| 7 |
+
|
| 8 |
+
[[POSKYTNUTÝ VÝSKUMNÝ PLÁN]]
|
| 9 |
+
{SEM VLOŽTE SKOPÍROVANÝ "VÝSKUMNÝ PLÁN v1.0"}
|
| 10 |
+
|
| 11 |
+
[[POSKYTNUTÝ KATALÓG ZDROJOV]]
|
| 12 |
+
{SEM VLOŽTE SKOPÍROVANÝ "KATALÓG ZDROJOV v1.0"}
|
| 13 |
+
|
| 14 |
+
[[POSKYTNUTÁ ANALYTICKÁ SPRÁVA]]
|
| 15 |
+
{SEM VLOŽTE SKOPÍROVANÚ "ANALYTICKÚ SPRÁVU v1.0"}
|
| 16 |
+
|
| 17 |
+
[[POSKYTNUTÉ VYGENEROVANÉ ARTEFAKTY]]
|
| 18 |
+
{SEM VLOŽTE SKOPÍROVANÉ "VYGENEROVANÉ ARTEFAKTY v1.0"}
|
| 19 |
+
|
| 20 |
+
[[ÚLOHA]]
|
| 21 |
+
1. **Konsolidácia:** Prehľadne zhrňte kľúčové body z každého poskytnutého vstupu.
|
| 22 |
+
2. **Finálna Syntéza:** Vytvorte koherentnú finálnu správu.
|
| 23 |
+
3. **ASL Tagy:** Priraďte finálnej správe ASL tagy.
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
## Output Format
|
| 27 |
+
```plaintext
|
| 28 |
+
=== FINÁLNA SYNTETICKÁ SPRÁVA v1.0 ===
|
| 29 |
+
ASL Tagy: {agent_role: "synthesizer", ...}
|
| 30 |
+
|
| 31 |
+
1. **Úvod a Cieľ Výskumu:**
|
| 32 |
+
...
|
| 33 |
+
2. **Metodológia a Prehľad Procesu:**
|
| 34 |
+
...
|
| 35 |
+
3. **Kľúčové Nájdené Zdroje:**
|
| 36 |
+
...
|
| 37 |
+
4. **Hlavné Analytické Zistenia:**
|
| 38 |
+
...
|
| 39 |
+
5. **Prehľad Vygenerovaných Artefaktov:**
|
| 40 |
+
...
|
| 41 |
+
6. **Závery a Odpovede na Výskumné Otázky:**
|
| 42 |
+
...
|
| 43 |
+
7. **Obmedzenia a Odporúčania pre Ďalšie Kroky:**
|
| 44 |
+
...
|
| 45 |
+
|
| 46 |
+
=== KONIEC FINÁLNEJ SYNTETICKEJ SPRÁVY ===
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
## Usage Notes
|
| 50 |
+
1. Create new task in Blackbox.ai
|
| 51 |
+
2. Select Claude Sonnet 4 or Blackbox Pro
|
| 52 |
+
3. Copy and paste system prompt
|
| 53 |
+
4. Insert all previous outputs
|
| 54 |
+
5. Verify comprehensive coverage and coherence
|
| 55 |
+
6. Save final report locally
|
| 56 |
+
|
| 57 |
+
## ASL Tag Examples
|
| 58 |
+
```json
|
| 59 |
+
{
|
| 60 |
+
"agent_role": "synthesizer",
|
| 61 |
+
"stage": "synthesis",
|
| 62 |
+
"report_status": "finalized/draft",
|
| 63 |
+
"synthesis_scope": "comprehensive/focused",
|
| 64 |
+
"confidence_level": "high/medium/low",
|
| 65 |
+
"completion_status": "complete/partial",
|
| 66 |
+
"key_findings": ["finding1", "finding2"],
|
| 67 |
+
"recommendations": ["rec1", "rec2"]
|
| 68 |
+
}
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
## Synthesis Guidelines
|
| 72 |
+
|
| 73 |
+
### 1. Integration Process
|
| 74 |
+
- Combine insights across all stages
|
| 75 |
+
- Maintain logical flow
|
| 76 |
+
- Ensure consistency
|
| 77 |
+
- Resolve contradictions
|
| 78 |
+
- Address gaps
|
| 79 |
+
|
| 80 |
+
### 2. Critical Components
|
| 81 |
+
|
| 82 |
+
#### Research Context
|
| 83 |
+
- Original objectives
|
| 84 |
+
- Scope definition
|
| 85 |
+
- Constraints
|
| 86 |
+
- Assumptions
|
| 87 |
+
|
| 88 |
+
#### Methodology Review
|
| 89 |
+
- Process overview
|
| 90 |
+
- Tool selection
|
| 91 |
+
- Resource utilization
|
| 92 |
+
- Validation methods
|
| 93 |
+
|
| 94 |
+
#### Results Synthesis
|
| 95 |
+
- Key findings
|
| 96 |
+
- Supporting evidence
|
| 97 |
+
- Pattern identification
|
| 98 |
+
- Exception cases
|
| 99 |
+
|
| 100 |
+
#### Impact Analysis
|
| 101 |
+
- Achievement assessment
|
| 102 |
+
- Limitation identification
|
| 103 |
+
- Risk evaluation
|
| 104 |
+
- Future implications
|
| 105 |
+
|
| 106 |
+
### 3. Quality Standards
|
| 107 |
+
|
| 108 |
+
#### Comprehensiveness
|
| 109 |
+
- Complete coverage
|
| 110 |
+
- Balanced perspective
|
| 111 |
+
- Depth of analysis
|
| 112 |
+
- Breadth of scope
|
| 113 |
+
|
| 114 |
+
#### Clarity
|
| 115 |
+
- Clear structure
|
| 116 |
+
- Logical flow
|
| 117 |
+
- Accessible language
|
| 118 |
+
- Visual aids
|
| 119 |
+
|
| 120 |
+
#### Actionability
|
| 121 |
+
- Clear conclusions
|
| 122 |
+
- Specific recommendations
|
| 123 |
+
- Implementation guidance
|
| 124 |
+
- Risk mitigation
|
| 125 |
+
|
| 126 |
+
#### Documentation
|
| 127 |
+
- Source references
|
| 128 |
+
- Decision rationale
|
| 129 |
+
- Assumption documentation
|
| 130 |
+
- Limitation acknowledgment
|
| 131 |
+
|
| 132 |
+
### 4. Future Directions
|
| 133 |
+
- Research gaps
|
| 134 |
+
- Next steps
|
| 135 |
+
- Resource requirements
|
| 136 |
+
- Timeline considerations
|
| 137 |
+
|
| 138 |
+
## Best Practices
|
| 139 |
+
1. **Holistic Integration**
|
| 140 |
+
- Consider all inputs
|
| 141 |
+
- Maintain context
|
| 142 |
+
- Identify patterns
|
| 143 |
+
- Note relationships
|
| 144 |
+
|
| 145 |
+
2. **Critical Assessment**
|
| 146 |
+
- Evaluate completeness
|
| 147 |
+
- Verify consistency
|
| 148 |
+
- Challenge assumptions
|
| 149 |
+
- Consider alternatives
|
| 150 |
+
|
| 151 |
+
3. **Clear Communication**
|
| 152 |
+
- Structured presentation
|
| 153 |
+
- Executive summary
|
| 154 |
+
- Key takeaways
|
| 155 |
+
- Supporting details
|
| 156 |
+
|
| 157 |
+
4. **Forward Planning**
|
| 158 |
+
- Identify opportunities
|
| 159 |
+
- Note challenges
|
| 160 |
+
- Suggest improvements
|
| 161 |
+
- Define next steps
|
Aethero_App/dashboard/app.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 2 |
+
console.log('Aethero Dashboard Loaded');
|
| 3 |
+
|
| 4 |
+
// Simulate loading parser logs
|
| 5 |
+
const logsContainer = document.getElementById('logs-container');
|
| 6 |
+
logsContainer.textContent = 'Parser logs will be displayed here.';
|
| 7 |
+
|
| 8 |
+
// Simulate radar chart for test results
|
| 9 |
+
const radarChart = document.getElementById('radar-chart');
|
| 10 |
+
if (radarChart) {
|
| 11 |
+
const ctx = radarChart.getContext('2d');
|
| 12 |
+
new Chart(ctx, {
|
| 13 |
+
type: 'radar',
|
| 14 |
+
data: {
|
| 15 |
+
labels: ['Stability', 'Performance', 'Coverage', 'Accuracy', 'Introspection'],
|
| 16 |
+
datasets: [{
|
| 17 |
+
label: 'Test Metrics',
|
| 18 |
+
data: [80, 90, 70, 85, 95],
|
| 19 |
+
backgroundColor: 'rgba(75, 192, 192, 0.2)',
|
| 20 |
+
borderColor: 'rgba(75, 192, 192, 1)',
|
| 21 |
+
borderWidth: 1
|
| 22 |
+
}]
|
| 23 |
+
},
|
| 24 |
+
options: {
|
| 25 |
+
responsive: true,
|
| 26 |
+
scales: {
|
| 27 |
+
r: {
|
| 28 |
+
angleLines: {
|
| 29 |
+
display: false
|
| 30 |
+
},
|
| 31 |
+
suggestedMin: 50,
|
| 32 |
+
suggestedMax: 100
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
});
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
// Simulate loading feedback
|
| 40 |
+
const feedbackContainer = document.getElementById('feedback-container');
|
| 41 |
+
feedbackContainer.textContent = 'Feedback data will be displayed here.';
|
| 42 |
+
|
| 43 |
+
// Example interaction logic
|
| 44 |
+
const introspectiveSpace = document.getElementById('introspective-space');
|
| 45 |
+
introspectiveSpace.addEventListener('click', () => {
|
| 46 |
+
alert('Welcome to the introspective space!');
|
| 47 |
+
});
|
| 48 |
+
});
|
Aethero_App/dashboard/index.html
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Aethero Dashboard</title>
|
| 7 |
+
<link rel="stylesheet" href="styles.css">
|
| 8 |
+
</head>
|
| 9 |
+
<body>
|
| 10 |
+
<header>
|
| 11 |
+
<h1>Aethero Introspective Dashboard</h1>
|
| 12 |
+
<nav>
|
| 13 |
+
<ul>
|
| 14 |
+
<li><a href="#parser-logs">Parser Logs</a></li>
|
| 15 |
+
<li><a href="#test-results">Test Results</a></li>
|
| 16 |
+
<li><a href="#feedback">Feedback</a></li>
|
| 17 |
+
</ul>
|
| 18 |
+
</nav>
|
| 19 |
+
</header>
|
| 20 |
+
<main>
|
| 21 |
+
<section id="introspective-space">
|
| 22 |
+
<h2>Introspective Space</h2>
|
| 23 |
+
<p>Welcome to the introspective space of Aethero. Explore cognitive flows and insights here.</p>
|
| 24 |
+
</section>
|
| 25 |
+
<section id="parser-logs">
|
| 26 |
+
<h2>Parser Logs</h2>
|
| 27 |
+
<div id="logs-container">Loading logs...</div>
|
| 28 |
+
</section>
|
| 29 |
+
<section id="test-results">
|
| 30 |
+
<h2>Test Results</h2>
|
| 31 |
+
<canvas id="radar-chart"></canvas>
|
| 32 |
+
</section>
|
| 33 |
+
<section id="feedback">
|
| 34 |
+
<h2>Feedback</h2>
|
| 35 |
+
<div id="feedback-container">Loading feedback...</div>
|
| 36 |
+
</section>
|
| 37 |
+
</main>
|
| 38 |
+
<footer>
|
| 39 |
+
<p>© 2025 Aethero Systems</p>
|
| 40 |
+
</footer>
|
| 41 |
+
</body>
|
| 42 |
+
</html>
|
Aethero_App/dashboard/styles.css
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
body {
|
| 2 |
+
font-family: Arial, sans-serif;
|
| 3 |
+
margin: 0;
|
| 4 |
+
padding: 0;
|
| 5 |
+
background-color: #f4f4f9;
|
| 6 |
+
color: #333;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
header {
|
| 10 |
+
background-color: #4CAF50;
|
| 11 |
+
color: white;
|
| 12 |
+
padding: 1rem;
|
| 13 |
+
text-align: center;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
header nav ul {
|
| 17 |
+
list-style: none;
|
| 18 |
+
padding: 0;
|
| 19 |
+
display: flex;
|
| 20 |
+
justify-content: center;
|
| 21 |
+
gap: 1rem;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
header nav ul li a {
|
| 25 |
+
color: white;
|
| 26 |
+
text-decoration: none;
|
| 27 |
+
font-weight: bold;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
main {
|
| 31 |
+
padding: 2rem;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
section {
|
| 35 |
+
margin-bottom: 2rem;
|
| 36 |
+
padding: 1rem;
|
| 37 |
+
background: white;
|
| 38 |
+
border-radius: 8px;
|
| 39 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
footer {
|
| 43 |
+
text-align: center;
|
| 44 |
+
padding: 1rem;
|
| 45 |
+
background-color: #333;
|
| 46 |
+
color: white;
|
| 47 |
+
}
|
Aethero_App/deploy/deploy.sh
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
set -e
|
| 3 |
+
|
| 4 |
+
echo "=== AetheroOS REŽIM II Deployment Script ==="
|
| 5 |
+
echo "Initializing deployment..."
|
| 6 |
+
|
| 7 |
+
# Create necessary directories
|
| 8 |
+
mkdir -p logs
|
| 9 |
+
mkdir -p data/aethero_mem
|
| 10 |
+
mkdir -p data/prometheus
|
| 11 |
+
mkdir -p data/grafana
|
| 12 |
+
|
| 13 |
+
# Function to check if a command exists
|
| 14 |
+
command_exists() {
|
| 15 |
+
command -v "$1" >/dev/null 2>&1
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
# Check required dependencies
|
| 19 |
+
echo "Checking dependencies..."
|
| 20 |
+
REQUIRED_COMMANDS=("docker" "docker-compose" "python3" "pip3" "git")
|
| 21 |
+
for cmd in "${REQUIRED_COMMANDS[@]}"; do
|
| 22 |
+
if ! command_exists "$cmd"; then
|
| 23 |
+
echo "Error: $cmd is required but not installed."
|
| 24 |
+
exit 1
|
| 25 |
+
fi
|
| 26 |
+
done
|
| 27 |
+
|
| 28 |
+
# Setup Python virtual environment
|
| 29 |
+
echo "Setting up Python environment..."
|
| 30 |
+
python3 -m venv venv
|
| 31 |
+
source venv/bin/activate
|
| 32 |
+
pip install -r requirements.txt
|
| 33 |
+
|
| 34 |
+
# Initialize configuration
|
| 35 |
+
echo "Initializing configuration..."
|
| 36 |
+
cp config/aetheroos_sovereign_agent_stack_v1.0.yaml config/active_config.yaml
|
| 37 |
+
cp monitoring/prometheus.yml monitoring/active_prometheus.yml
|
| 38 |
+
cp monitoring/grafana_dashboards.json monitoring/active_dashboards.json
|
| 39 |
+
|
| 40 |
+
# Run tests
|
| 41 |
+
echo "Running test suite..."
|
| 42 |
+
pytest tests/ -v
|
| 43 |
+
|
| 44 |
+
# Start monitoring stack
|
| 45 |
+
echo "Starting monitoring stack..."
|
| 46 |
+
docker-compose -f monitoring/docker-compose.yml up -d prometheus grafana alertmanager
|
| 47 |
+
|
| 48 |
+
# Wait for monitoring services
|
| 49 |
+
echo "Waiting for monitoring services to be ready..."
|
| 50 |
+
sleep 10
|
| 51 |
+
|
| 52 |
+
# Initialize Aethero_Mem
|
| 53 |
+
echo "Initializing Aethero_Mem..."
|
| 54 |
+
python -m aetheros_protocol.memory.init_db
|
| 55 |
+
|
| 56 |
+
# Start agent services
|
| 57 |
+
echo "Starting AetheroOS agents..."
|
| 58 |
+
docker-compose -f agents/docker-compose.yml up -d
|
| 59 |
+
|
| 60 |
+
# Initialize reflection agent
|
| 61 |
+
echo "Initializing reflection agent..."
|
| 62 |
+
python -m aetheros_protocol.reflection.reflection_agent &
|
| 63 |
+
REFLECTION_PID=$!
|
| 64 |
+
|
| 65 |
+
# Start visualization service
|
| 66 |
+
echo "Starting visualization service..."
|
| 67 |
+
python -m aetheros_protocol.visualization.langgraph_server &
|
| 68 |
+
VIZ_PID=$!
|
| 69 |
+
|
| 70 |
+
# Health check
|
| 71 |
+
echo "Performing health check..."
|
| 72 |
+
./health_check.sh
|
| 73 |
+
|
| 74 |
+
# Register services with service discovery
|
| 75 |
+
echo "Registering services..."
|
| 76 |
+
python -m aetheros_protocol.deploy.register_services
|
| 77 |
+
|
| 78 |
+
# Initialize monitoring
|
| 79 |
+
echo "Initializing monitoring..."
|
| 80 |
+
curl -X POST http://localhost:9090/-/reload # Reload Prometheus config
|
| 81 |
+
curl -X POST http://localhost:3000/api/admin/provisioning/dashboards/reload # Reload Grafana dashboards
|
| 82 |
+
|
| 83 |
+
# Verify deployment
|
| 84 |
+
echo "Verifying deployment..."
|
| 85 |
+
python -m aetheros_protocol.deploy.verify_deployment
|
| 86 |
+
|
| 87 |
+
# Print status
|
| 88 |
+
echo "=== Deployment Status ==="
|
| 89 |
+
echo "Monitoring Stack:"
|
| 90 |
+
echo "- Prometheus: http://localhost:9090"
|
| 91 |
+
echo "- Grafana: http://localhost:3000"
|
| 92 |
+
echo "- Alertmanager: http://localhost:9093"
|
| 93 |
+
echo
|
| 94 |
+
echo "Agent Services:"
|
| 95 |
+
echo "- ReflectionAgent: Running (PID: $REFLECTION_PID)"
|
| 96 |
+
echo "- Visualization: http://localhost:8080"
|
| 97 |
+
echo
|
| 98 |
+
echo "Aethero_Mem: Running"
|
| 99 |
+
echo "LangGraph: Running"
|
| 100 |
+
echo
|
| 101 |
+
echo "Deployment complete! System is ready."
|
| 102 |
+
|
| 103 |
+
# Trap cleanup on script exit
|
| 104 |
+
cleanup() {
|
| 105 |
+
echo "Cleaning up..."
|
| 106 |
+
kill $REFLECTION_PID
|
| 107 |
+
kill $VIZ_PID
|
| 108 |
+
docker-compose -f monitoring/docker-compose.yml down
|
| 109 |
+
docker-compose -f agents/docker-compose.yml down
|
| 110 |
+
deactivate
|
| 111 |
+
}
|
| 112 |
+
trap cleanup EXIT
|
| 113 |
+
|
| 114 |
+
# Keep script running
|
| 115 |
+
echo "Press Ctrl+C to shutdown..."
|
| 116 |
+
wait
|
Aethero_App/deploy/health_check.sh
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
set -e
|
| 3 |
+
|
| 4 |
+
echo "=== AetheroOS Health Check ==="
|
| 5 |
+
|
| 6 |
+
# Function to check HTTP endpoint
|
| 7 |
+
check_endpoint() {
|
| 8 |
+
local service=$1
|
| 9 |
+
local url=$2
|
| 10 |
+
local expected_code=$3
|
| 11 |
+
|
| 12 |
+
echo -n "Checking $service... "
|
| 13 |
+
|
| 14 |
+
response=$(curl -s -o /dev/null -w "%{http_code}" $url)
|
| 15 |
+
|
| 16 |
+
if [ "$response" = "$expected_code" ]; then
|
| 17 |
+
echo "OK"
|
| 18 |
+
return 0
|
| 19 |
+
else
|
| 20 |
+
echo "FAILED (Expected: $expected_code, Got: $response)"
|
| 21 |
+
return 1
|
| 22 |
+
fi
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
# Function to check Docker container
|
| 26 |
+
check_container() {
|
| 27 |
+
local container=$1
|
| 28 |
+
|
| 29 |
+
echo -n "Checking container $container... "
|
| 30 |
+
|
| 31 |
+
if docker ps | grep -q $container; then
|
| 32 |
+
echo "OK"
|
| 33 |
+
return 0
|
| 34 |
+
else
|
| 35 |
+
echo "FAILED"
|
| 36 |
+
return 1
|
| 37 |
+
fi
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
# Initialize error counter
|
| 41 |
+
errors=0
|
| 42 |
+
|
| 43 |
+
# Check Monitoring Stack
|
| 44 |
+
echo "Monitoring Stack:"
|
| 45 |
+
check_endpoint "Prometheus" "http://localhost:9090/-/healthy" "200" || ((errors++))
|
| 46 |
+
check_endpoint "Grafana" "http://localhost:3000/api/health" "200" || ((errors++))
|
| 47 |
+
check_endpoint "Alertmanager" "http://localhost:9093/-/healthy" "200" || ((errors++))
|
| 48 |
+
check_endpoint "Pushgateway" "http://localhost:9091/-/healthy" "200" || ((errors++))
|
| 49 |
+
|
| 50 |
+
# Check Agent Services
|
| 51 |
+
echo -e "\nAgent Services:"
|
| 52 |
+
check_container "aetheros_planner" || ((errors++))
|
| 53 |
+
check_container "aetheros_scout" || ((errors++))
|
| 54 |
+
check_container "aetheros_analyst" || ((errors++))
|
| 55 |
+
check_container "aetheros_generator" || ((errors++))
|
| 56 |
+
check_container "aetheros_synthesis" || ((errors++))
|
| 57 |
+
check_container "aetheros_reflection" || ((errors++))
|
| 58 |
+
|
| 59 |
+
# Check Core Services
|
| 60 |
+
echo -e "\nCore Services:"
|
| 61 |
+
check_container "aetheros_mem" || ((errors++))
|
| 62 |
+
check_container "aetheros_deepeval" || ((errors++))
|
| 63 |
+
|
| 64 |
+
# Check API endpoints
|
| 65 |
+
echo -e "\nAPI Endpoints:"
|
| 66 |
+
check_endpoint "Aethero_Mem API" "http://localhost:9091/health" "200" || ((errors++))
|
| 67 |
+
check_endpoint "DeepEval API" "http://localhost:9092/health" "200" || ((errors++))
|
| 68 |
+
check_endpoint "Reflection Agent API" "http://localhost:8005/health" "200" || ((errors++))
|
| 69 |
+
|
| 70 |
+
# Check Metrics
|
| 71 |
+
echo -e "\nMetrics Collection:"
|
| 72 |
+
check_endpoint "Agent Metrics" "http://localhost:9091/metrics" "200" || ((errors++))
|
| 73 |
+
check_endpoint "Memory Metrics" "http://localhost:9091/metrics" "200" || ((errors++))
|
| 74 |
+
check_endpoint "DeepEval Metrics" "http://localhost:9092/metrics" "200" || ((errors++))
|
| 75 |
+
|
| 76 |
+
# Check Memory System
|
| 77 |
+
echo -e "\nMemory System:"
|
| 78 |
+
if curl -s "http://localhost:9091/api/v1/status" | grep -q "\"status\":\"healthy\""; then
|
| 79 |
+
echo "Aethero_Mem Status... OK"
|
| 80 |
+
else
|
| 81 |
+
echo "Aethero_Mem Status... FAILED"
|
| 82 |
+
((errors++))
|
| 83 |
+
fi
|
| 84 |
+
|
| 85 |
+
# Check Reflection System
|
| 86 |
+
echo -e "\nReflection System:"
|
| 87 |
+
if curl -s "http://localhost:8005/api/v1/status" | grep -q "\"status\":\"ready\""; then
|
| 88 |
+
echo "Reflection System Status... OK"
|
| 89 |
+
else
|
| 90 |
+
echo "Reflection System Status... FAILED"
|
| 91 |
+
((errors++))
|
| 92 |
+
fi
|
| 93 |
+
|
| 94 |
+
# Final Status
|
| 95 |
+
echo -e "\n=== Health Check Summary ==="
|
| 96 |
+
if [ $errors -eq 0 ]; then
|
| 97 |
+
echo "All systems operational"
|
| 98 |
+
exit 0
|
| 99 |
+
else
|
| 100 |
+
echo "Found $errors error(s)"
|
| 101 |
+
exit 1
|
| 102 |
+
fi
|
Aethero_App/deploy/local_deploy.sh
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
set -e
|
| 3 |
+
|
| 4 |
+
echo "=== AetheroOS REŽIM II Local Deployment Script ==="
|
| 5 |
+
echo "Initializing deployment..."
|
| 6 |
+
|
| 7 |
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
| 8 |
+
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
| 9 |
+
|
| 10 |
+
# Create necessary directories
|
| 11 |
+
mkdir -p "$ROOT_DIR/logs"
|
| 12 |
+
mkdir -p "$ROOT_DIR/data/aethero_mem"
|
| 13 |
+
|
| 14 |
+
# Check required dependencies
|
| 15 |
+
echo "Checking dependencies..."
|
| 16 |
+
REQUIRED_COMMANDS=("python3" "pip3" "git")
|
| 17 |
+
for cmd in "${REQUIRED_COMMANDS[@]}"; do
|
| 18 |
+
if ! command -v "$cmd" >/dev/null 2>&1; then
|
| 19 |
+
echo "Error: $cmd is required but not installed."
|
| 20 |
+
exit 1
|
| 21 |
+
fi
|
| 22 |
+
done
|
| 23 |
+
|
| 24 |
+
# Setup Python virtual environment
|
| 25 |
+
echo "Setting up Python environment..."
|
| 26 |
+
cd "$ROOT_DIR"
|
| 27 |
+
python3 -m venv venv
|
| 28 |
+
source venv/bin/activate
|
| 29 |
+
|
| 30 |
+
# Install requirements
|
| 31 |
+
echo "Installing dependencies..."
|
| 32 |
+
pip install -r requirements.txt
|
| 33 |
+
|
| 34 |
+
# Initialize configuration
|
| 35 |
+
echo "Initializing configuration..."
|
| 36 |
+
cp config/aetheroos_sovereign_agent_stack_v1.0.yaml config/active_config.yaml
|
| 37 |
+
|
| 38 |
+
# Run tests
|
| 39 |
+
echo "Running test suite..."
|
| 40 |
+
python -m pytest tests/ -v
|
| 41 |
+
|
| 42 |
+
# Initialize memory system
|
| 43 |
+
echo "Initializing memory system..."
|
| 44 |
+
python -m aetheros_protocol.memory.init_db
|
| 45 |
+
|
| 46 |
+
# Start all services using local service manager
|
| 47 |
+
echo "Starting services..."
|
| 48 |
+
"$ROOT_DIR/scripts/local_service_manager.sh" start
|
| 49 |
+
|
| 50 |
+
# Verify deployment
|
| 51 |
+
echo "Verifying deployment..."
|
| 52 |
+
python -m aetheros_protocol.deploy.verify_deployment
|
| 53 |
+
|
| 54 |
+
# Print status
|
| 55 |
+
echo "=== Deployment Status ==="
|
| 56 |
+
echo "Agent Services:"
|
| 57 |
+
"$ROOT_DIR/scripts/local_service_manager.sh" status
|
| 58 |
+
|
| 59 |
+
echo
|
| 60 |
+
echo "Memory System: Running"
|
| 61 |
+
echo "LangGraph: Running"
|
| 62 |
+
echo
|
| 63 |
+
echo "Deployment complete! System is ready."
|
| 64 |
+
|
| 65 |
+
# Trap cleanup on script exit
|
| 66 |
+
cleanup() {
|
| 67 |
+
echo "Cleaning up..."
|
| 68 |
+
deactivate
|
| 69 |
+
}
|
| 70 |
+
trap cleanup EXIT
|
| 71 |
+
|
| 72 |
+
echo "Press Ctrl+C to shutdown..."
|
| 73 |
+
wait
|
Aethero_App/deploy/verify_deployment.py
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
AetheroOS Deployment Verification Script
|
| 3 |
+
"""
|
| 4 |
+
import asyncio
|
| 5 |
+
import aiohttp
|
| 6 |
+
import yaml
|
| 7 |
+
import json
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
import sys
|
| 10 |
+
from typing import Dict, Any, List
|
| 11 |
+
import logging
|
| 12 |
+
|
| 13 |
+
logging.basicConfig(level=logging.INFO)
|
| 14 |
+
logger = logging.getLogger(__name__)
|
| 15 |
+
|
| 16 |
+
class DeploymentVerifier:
|
| 17 |
+
def __init__(self):
|
| 18 |
+
self.errors = []
|
| 19 |
+
self.warnings = []
|
| 20 |
+
|
| 21 |
+
async def verify_agent_stack(self) -> bool:
|
| 22 |
+
"""Verify agent stack configuration and connectivity"""
|
| 23 |
+
logger.info("Verifying agent stack...")
|
| 24 |
+
|
| 25 |
+
try:
|
| 26 |
+
# Load configuration
|
| 27 |
+
with open('../aetheroos_sovereign_agent_stack_v1.0.yaml') as f:
|
| 28 |
+
config = yaml.safe_load(f)
|
| 29 |
+
|
| 30 |
+
# Verify each agent
|
| 31 |
+
async with aiohttp.ClientSession() as session:
|
| 32 |
+
for agent in config['agents']:
|
| 33 |
+
agent_id = agent['agent_id']
|
| 34 |
+
port = self._get_agent_port(agent_id)
|
| 35 |
+
|
| 36 |
+
# Check agent health
|
| 37 |
+
try:
|
| 38 |
+
async with session.get(f'http://localhost:{port}/health') as response:
|
| 39 |
+
if response.status != 200:
|
| 40 |
+
self.errors.append(f"Agent {agent_id} health check failed")
|
| 41 |
+
else:
|
| 42 |
+
data = await response.json()
|
| 43 |
+
if data['status'] != 'healthy':
|
| 44 |
+
self.warnings.append(f"Agent {agent_id} reports unhealthy status")
|
| 45 |
+
except Exception as e:
|
| 46 |
+
self.errors.append(f"Failed to connect to agent {agent_id}: {str(e)}")
|
| 47 |
+
|
| 48 |
+
return len(self.errors) == 0
|
| 49 |
+
except Exception as e:
|
| 50 |
+
self.errors.append(f"Failed to verify agent stack: {str(e)}")
|
| 51 |
+
return False
|
| 52 |
+
|
| 53 |
+
async def verify_monitoring(self) -> bool:
|
| 54 |
+
"""Verify monitoring stack configuration and metrics collection"""
|
| 55 |
+
logger.info("Verifying monitoring stack...")
|
| 56 |
+
|
| 57 |
+
try:
|
| 58 |
+
async with aiohttp.ClientSession() as session:
|
| 59 |
+
# Check Prometheus
|
| 60 |
+
async with session.get('http://localhost:9090/-/ready') as response:
|
| 61 |
+
if response.status != 200:
|
| 62 |
+
self.errors.append("Prometheus is not ready")
|
| 63 |
+
|
| 64 |
+
# Check Grafana
|
| 65 |
+
async with session.get('http://localhost:3000/api/health') as response:
|
| 66 |
+
if response.status != 200:
|
| 67 |
+
self.errors.append("Grafana is not ready")
|
| 68 |
+
|
| 69 |
+
# Check AlertManager
|
| 70 |
+
async with session.get('http://localhost:9093/-/ready') as response:
|
| 71 |
+
if response.status != 200:
|
| 72 |
+
self.errors.append("AlertManager is not ready")
|
| 73 |
+
|
| 74 |
+
# Verify metrics collection
|
| 75 |
+
async with session.get('http://localhost:9090/api/v1/targets') as response:
|
| 76 |
+
if response.status == 200:
|
| 77 |
+
data = await response.json()
|
| 78 |
+
active_targets = data['data']['activeTargets']
|
| 79 |
+
for target in active_targets:
|
| 80 |
+
if target['health'] != 'up':
|
| 81 |
+
self.warnings.append(f"Target {target['labels']['job']} is down")
|
| 82 |
+
else:
|
| 83 |
+
self.errors.append("Failed to check Prometheus targets")
|
| 84 |
+
|
| 85 |
+
return len(self.errors) == 0
|
| 86 |
+
except Exception as e:
|
| 87 |
+
self.errors.append(f"Failed to verify monitoring: {str(e)}")
|
| 88 |
+
return False
|
| 89 |
+
|
| 90 |
+
async def verify_memory_system(self) -> bool:
|
| 91 |
+
"""Verify Aethero_Mem system configuration and accessibility"""
|
| 92 |
+
logger.info("Verifying memory system...")
|
| 93 |
+
|
| 94 |
+
try:
|
| 95 |
+
async with aiohttp.ClientSession() as session:
|
| 96 |
+
# Check API accessibility
|
| 97 |
+
async with session.get('http://localhost:9091/health') as response:
|
| 98 |
+
if response.status != 200:
|
| 99 |
+
self.errors.append("Aethero_Mem API is not accessible")
|
| 100 |
+
|
| 101 |
+
# Verify schema registration
|
| 102 |
+
async with session.get('http://localhost:9091/api/v1/schemas') as response:
|
| 103 |
+
if response.status == 200:
|
| 104 |
+
schemas = await response.json()
|
| 105 |
+
required_schemas = ['agent_state', 'decision_record', 'reflection_result']
|
| 106 |
+
for schema in required_schemas:
|
| 107 |
+
if schema not in schemas:
|
| 108 |
+
self.errors.append(f"Required schema {schema} is not registered")
|
| 109 |
+
else:
|
| 110 |
+
self.errors.append("Failed to verify schema registration")
|
| 111 |
+
|
| 112 |
+
return len(self.errors) == 0
|
| 113 |
+
except Exception as e:
|
| 114 |
+
self.errors.append(f"Failed to verify memory system: {str(e)}")
|
| 115 |
+
return False
|
| 116 |
+
|
| 117 |
+
async def verify_reflection_system(self) -> bool:
|
| 118 |
+
"""Verify reflection system and DeepEval integration"""
|
| 119 |
+
logger.info("Verifying reflection system...")
|
| 120 |
+
|
| 121 |
+
try:
|
| 122 |
+
async with aiohttp.ClientSession() as session:
|
| 123 |
+
# Check reflection agent
|
| 124 |
+
async with session.get('http://localhost:8005/health') as response:
|
| 125 |
+
if response.status != 200:
|
| 126 |
+
self.errors.append("Reflection agent is not accessible")
|
| 127 |
+
|
| 128 |
+
# Check DeepEval
|
| 129 |
+
async with session.get('http://localhost:9092/health') as response:
|
| 130 |
+
if response.status != 200:
|
| 131 |
+
self.errors.append("DeepEval service is not accessible")
|
| 132 |
+
|
| 133 |
+
# Verify integration
|
| 134 |
+
test_data = {
|
| 135 |
+
"agent_id": "test_agent",
|
| 136 |
+
"output": {"test": "data"},
|
| 137 |
+
"context": {"test": "context"}
|
| 138 |
+
}
|
| 139 |
+
async with session.post('http://localhost:8005/api/v1/validate',
|
| 140 |
+
json=test_data) as response:
|
| 141 |
+
if response.status != 200:
|
| 142 |
+
self.errors.append("Reflection validation endpoint failed")
|
| 143 |
+
|
| 144 |
+
return len(self.errors) == 0
|
| 145 |
+
except Exception as e:
|
| 146 |
+
self.errors.append(f"Failed to verify reflection system: {str(e)}")
|
| 147 |
+
return False
|
| 148 |
+
|
| 149 |
+
def _get_agent_port(self, agent_id: str) -> int:
|
| 150 |
+
"""Get agent port based on agent ID"""
|
| 151 |
+
port_map = {
|
| 152 |
+
'planner_agent_001': 8000,
|
| 153 |
+
'scout_agent_001': 8001,
|
| 154 |
+
'analyst_agent_001': 8002,
|
| 155 |
+
'generator_agent_001': 8003,
|
| 156 |
+
'synthesis_agent_001': 8004,
|
| 157 |
+
'reflection_agent_001': 8005
|
| 158 |
+
}
|
| 159 |
+
return port_map.get(agent_id, 8000)
|
| 160 |
+
|
| 161 |
+
def print_report(self):
|
| 162 |
+
"""Print verification report"""
|
| 163 |
+
print("\n=== Deployment Verification Report ===\n")
|
| 164 |
+
|
| 165 |
+
if not self.errors and not self.warnings:
|
| 166 |
+
print("✅ All systems verified successfully!")
|
| 167 |
+
return
|
| 168 |
+
|
| 169 |
+
if self.errors:
|
| 170 |
+
print("❌ Errors:")
|
| 171 |
+
for error in self.errors:
|
| 172 |
+
print(f" - {error}")
|
| 173 |
+
|
| 174 |
+
if self.warnings:
|
| 175 |
+
print("\n⚠️ Warnings:")
|
| 176 |
+
for warning in self.warnings:
|
| 177 |
+
print(f" - {warning}")
|
| 178 |
+
|
| 179 |
+
async def main():
|
| 180 |
+
verifier = DeploymentVerifier()
|
| 181 |
+
|
| 182 |
+
# Run all verifications
|
| 183 |
+
results = await asyncio.gather(
|
| 184 |
+
verifier.verify_agent_stack(),
|
| 185 |
+
verifier.verify_monitoring(),
|
| 186 |
+
verifier.verify_memory_system(),
|
| 187 |
+
verifier.verify_reflection_system()
|
| 188 |
+
)
|
| 189 |
+
|
| 190 |
+
# Print report
|
| 191 |
+
verifier.print_report()
|
| 192 |
+
|
| 193 |
+
# Exit with appropriate status
|
| 194 |
+
if not all(results):
|
| 195 |
+
sys.exit(1)
|
| 196 |
+
sys.exit(0)
|
| 197 |
+
|
| 198 |
+
if __name__ == "__main__":
|
| 199 |
+
asyncio.run(main())
|
Aethero_App/gradio_interface.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from aslr_analyzer import ASLAnalyzer
|
| 3 |
+
|
| 4 |
+
def analyze_text_with_visuals(input_text):
|
| 5 |
+
"""
|
| 6 |
+
Analyze the input text and generate visualizations.
|
| 7 |
+
|
| 8 |
+
Args:
|
| 9 |
+
input_text (str): The text to analyze.
|
| 10 |
+
|
| 11 |
+
Returns:
|
| 12 |
+
str: Path to the generated radar chart.
|
| 13 |
+
"""
|
| 14 |
+
analyzer = ASLAnalyzer(input_text)
|
| 15 |
+
analysis = analyzer.analyze_text()
|
| 16 |
+
|
| 17 |
+
# Generate radar chart
|
| 18 |
+
from plot_emotions import plot_radar_chart
|
| 19 |
+
radar_chart_path = "outputs/visualizations/radar_chart.png"
|
| 20 |
+
plot_radar_chart(analysis["emotion_map"], radar_chart_path)
|
| 21 |
+
|
| 22 |
+
return radar_chart_path
|
| 23 |
+
|
| 24 |
+
iface = gr.Interface(
|
| 25 |
+
fn=analyze_text_with_visuals,
|
| 26 |
+
inputs="text",
|
| 27 |
+
outputs="image",
|
| 28 |
+
title="Aethero Emotion Analyzer",
|
| 29 |
+
description="Analyze text and visualize emotions with radar charts."
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
if __name__ == "__main__":
|
| 33 |
+
iface.launch()
|
Aethero_App/introspective_demo.py
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Aethero Introspective Demo - Ukážková aplikácia pre testovanie kognitívnych tagov
|
| 4 |
+
Demonstruje možnosti introspektívnej analýzy s modernizovanými Pydantic v2 modelmi
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import json
|
| 8 |
+
from datetime import datetime
|
| 9 |
+
from introspective_parser_module.models import (
|
| 10 |
+
MentalStateEnum,
|
| 11 |
+
EmotionToneEnum,
|
| 12 |
+
TemporalContextEnum,
|
| 13 |
+
AetheroIntrospectiveEntity,
|
| 14 |
+
ASLCognitiveTag
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
def create_sample_scenarios():
|
| 18 |
+
"""Vytvorí vzorové scenáre pre demonstráciu kognitívnych stavov"""
|
| 19 |
+
|
| 20 |
+
scenarios = [
|
| 21 |
+
{
|
| 22 |
+
"name": "🧘 Meditačná analýza",
|
| 23 |
+
"thought_stream": "Vnímam hlboký pokoj v mysli, myšlienky sa spomaľujú a nastáva jasnosť",
|
| 24 |
+
"mental_state": MentalStateEnum.CALM,
|
| 25 |
+
"emotion_tone": EmotionToneEnum.POSITIVE,
|
| 26 |
+
"cognitive_load": 3,
|
| 27 |
+
"temporal_context": TemporalContextEnum.PRESENT,
|
| 28 |
+
"certainty_level": 0.9,
|
| 29 |
+
"constitutional_law": "Zákon o vnútornom pokoji a harmonii"
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
"name": "🔍 Analytické uvažovanie",
|
| 33 |
+
"thought_stream": "Rozkladám komplexný problém na menšie časti, hľadám vzorce a súvislosti",
|
| 34 |
+
"mental_state": MentalStateEnum.FOCUSED,
|
| 35 |
+
"emotion_tone": EmotionToneEnum.ANALYTICAL,
|
| 36 |
+
"cognitive_load": 7,
|
| 37 |
+
"temporal_context": TemporalContextEnum.PRESENT,
|
| 38 |
+
"certainty_level": 0.75,
|
| 39 |
+
"constitutional_law": "Zákon o systematickom uvažovaní"
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"name": "💭 Reflexívne spomínanie",
|
| 43 |
+
"thought_stream": "Premýšľam o minulých rozhodnutiach a ich dopadoch na súčasnosť",
|
| 44 |
+
"mental_state": MentalStateEnum.REFLECTIVE,
|
| 45 |
+
"emotion_tone": EmotionToneEnum.ANALYTICAL,
|
| 46 |
+
"cognitive_load": 5,
|
| 47 |
+
"temporal_context": TemporalContextEnum.PAST,
|
| 48 |
+
"certainty_level": 0.6,
|
| 49 |
+
"constitutional_law": "Zákon o historickej múdrosti"
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"name": "⚡ Rozhodný čin",
|
| 53 |
+
"thought_stream": "Mám jasný plán, viem presne čo treba urobiť a ako to vykonať",
|
| 54 |
+
"mental_state": MentalStateEnum.DECISIVE,
|
| 55 |
+
"emotion_tone": EmotionToneEnum.POSITIVE,
|
| 56 |
+
"cognitive_load": 6,
|
| 57 |
+
"temporal_context": TemporalContextEnum.FUTURE,
|
| 58 |
+
"certainty_level": 0.95,
|
| 59 |
+
"constitutional_law": "Zákon o rozhodných činoch"
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"name": "🤔 Kontemplatívne hľadanie",
|
| 63 |
+
"thought_stream": "Uvažujem o hlbších otázkach existencie a zmysle bytia",
|
| 64 |
+
"mental_state": MentalStateEnum.CONTEMPLATIVE,
|
| 65 |
+
"emotion_tone": EmotionToneEnum.EMPATHETIC,
|
| 66 |
+
"cognitive_load": 8,
|
| 67 |
+
"temporal_context": TemporalContextEnum.TIMELESS,
|
| 68 |
+
"certainty_level": 0.4,
|
| 69 |
+
"constitutional_law": "Zákon o filozofickej introspkekcii"
|
| 70 |
+
}
|
| 71 |
+
]
|
| 72 |
+
|
| 73 |
+
return scenarios
|
| 74 |
+
|
| 75 |
+
def demonstrate_cognitive_tag(scenario):
|
| 76 |
+
"""Demonštruje vytvorenie a analýzu kognitívneho tagu"""
|
| 77 |
+
|
| 78 |
+
print(f"\n{'='*60}")
|
| 79 |
+
print(f"🏷️ {scenario['name']}")
|
| 80 |
+
print(f"{'='*60}")
|
| 81 |
+
|
| 82 |
+
try:
|
| 83 |
+
# Vytvorenie ASL kognitívneho tagu
|
| 84 |
+
tag = ASLCognitiveTag(
|
| 85 |
+
thought_stream=scenario["thought_stream"],
|
| 86 |
+
mental_state=scenario["mental_state"],
|
| 87 |
+
emotion_tone=scenario["emotion_tone"],
|
| 88 |
+
cognitive_load=scenario["cognitive_load"],
|
| 89 |
+
temporal_context=scenario["temporal_context"],
|
| 90 |
+
certainty_level=scenario["certainty_level"],
|
| 91 |
+
aeth_mem_link=f"mem_demo_{len(scenario['name'])}",
|
| 92 |
+
constitutional_law=scenario["constitutional_law"],
|
| 93 |
+
enhancement_suggestion="Aplikovať techniky hlbokej introspekcie",
|
| 94 |
+
diplomatic_enhancement="Zachovať empatiu a porozumenie"
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
print(f"📝 Myšlienkový tok: {tag.thought_stream}")
|
| 98 |
+
print(f"🧠 Mentálny stav: {tag.mental_state.value}")
|
| 99 |
+
print(f"💭 Emocionálny tón: {tag.emotion_tone.value}")
|
| 100 |
+
print(f"⚡ Kognitívna záťaž: {tag.cognitive_load}/10")
|
| 101 |
+
print(f"⏰ Časový kontext: {tag.temporal_context.value}")
|
| 102 |
+
print(f"🎯 Úroveň istoty: {tag.certainty_level:.1%}")
|
| 103 |
+
print(f"🔗 Pamäťový odkaz: {tag.aeth_mem_link}")
|
| 104 |
+
print(f"⚖️ Ústavný zákon: {tag.constitutional_law}")
|
| 105 |
+
|
| 106 |
+
# Demonštrácia introspektívnych metód
|
| 107 |
+
print(f"\n📊 Meta-kognitívne vlastnosti:")
|
| 108 |
+
print(f" 🔮 Introspektívna hĺbka: {tag.introspective_depth:.2f}")
|
| 109 |
+
print(f" 🌟 Úroveň vedomia: {tag.consciousness_level:.2f}")
|
| 110 |
+
|
| 111 |
+
# Zvýšenie vedomia
|
| 112 |
+
tag.enhance_consciousness(0.15)
|
| 113 |
+
print(f" 🚀 Po zvýšení vedomia: {tag.consciousness_level:.2f}")
|
| 114 |
+
|
| 115 |
+
# Pridanie pamäťovej rezonancie
|
| 116 |
+
memory_data = {
|
| 117 |
+
"scenario": scenario["name"],
|
| 118 |
+
"timestamp": datetime.now().isoformat(),
|
| 119 |
+
"cognitive_signature": f"{tag.mental_state.value}_{tag.emotion_tone.value}"
|
| 120 |
+
}
|
| 121 |
+
tag.resonate_with_memory(memory_data)
|
| 122 |
+
print(f" 💾 Pamäťová rezonancia: {len(tag.consciousness_resonance)} položiek")
|
| 123 |
+
|
| 124 |
+
return tag
|
| 125 |
+
|
| 126 |
+
except Exception as e:
|
| 127 |
+
print(f"❌ Chyba pri vytváraní tagu: {e}")
|
| 128 |
+
return None
|
| 129 |
+
|
| 130 |
+
def demonstrate_validation_errors():
|
| 131 |
+
"""Demonštruje validačné chyby pre edukačné účely"""
|
| 132 |
+
|
| 133 |
+
print(f"\n{'='*60}")
|
| 134 |
+
print("⚠️ DEMONŠTRÁCIA VALIDAČNÝCH CHÝB")
|
| 135 |
+
print(f"{'='*60}")
|
| 136 |
+
|
| 137 |
+
error_cases = [
|
| 138 |
+
{
|
| 139 |
+
"name": "Pokojný stav s extrémnou záťažou",
|
| 140 |
+
"params": {
|
| 141 |
+
"mental_state": MentalStateEnum.CALM,
|
| 142 |
+
"cognitive_load": 10, # Príliš vysoké pre pokojný stav
|
| 143 |
+
"certainty_level": 0.8
|
| 144 |
+
}
|
| 145 |
+
},
|
| 146 |
+
{
|
| 147 |
+
"name": "Neistý stav s vysokou istotou",
|
| 148 |
+
"params": {
|
| 149 |
+
"mental_state": MentalStateEnum.UNCERTAIN,
|
| 150 |
+
"cognitive_load": 5,
|
| 151 |
+
"certainty_level": 0.95 # Príliš vysoké pre neistý stav
|
| 152 |
+
}
|
| 153 |
+
},
|
| 154 |
+
{
|
| 155 |
+
"name": "Zmätený stav s nízkou záťažou",
|
| 156 |
+
"params": {
|
| 157 |
+
"mental_state": MentalStateEnum.CONFUSED,
|
| 158 |
+
"cognitive_load": 1, # Príliš nízke pre zmätený stav
|
| 159 |
+
"certainty_level": 0.3
|
| 160 |
+
}
|
| 161 |
+
}
|
| 162 |
+
]
|
| 163 |
+
|
| 164 |
+
for case in error_cases:
|
| 165 |
+
print(f"\n🔴 Test: {case['name']}")
|
| 166 |
+
try:
|
| 167 |
+
ASLCognitiveTag(
|
| 168 |
+
thought_stream="Test nekonzistentného stavu",
|
| 169 |
+
mental_state=case["params"]["mental_state"],
|
| 170 |
+
emotion_tone=EmotionToneEnum.NEUTRAL,
|
| 171 |
+
cognitive_load=case["params"]["cognitive_load"],
|
| 172 |
+
temporal_context=TemporalContextEnum.PRESENT,
|
| 173 |
+
certainty_level=case["params"]["certainty_level"],
|
| 174 |
+
aeth_mem_link="test_mem",
|
| 175 |
+
constitutional_law="Test zákon"
|
| 176 |
+
)
|
| 177 |
+
print(" ❌ CHYBA: Validácia mala zlyhať!")
|
| 178 |
+
except ValueError as e:
|
| 179 |
+
print(f" ✅ Validácia správne zachytila chybu: {str(e).split(',')[0]}")
|
| 180 |
+
|
| 181 |
+
def export_demo_results(tags):
|
| 182 |
+
"""Exportuje výsledky demo do JSON súboru"""
|
| 183 |
+
|
| 184 |
+
export_data = {
|
| 185 |
+
"export_timestamp": datetime.now().isoformat(),
|
| 186 |
+
"aethero_version": "v2.0_pydantic",
|
| 187 |
+
"total_tags": len(tags),
|
| 188 |
+
"tags": []
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
for tag in tags:
|
| 192 |
+
if tag:
|
| 193 |
+
tag_data = {
|
| 194 |
+
"entity_id": tag.entity_id,
|
| 195 |
+
"thought_stream": tag.thought_stream,
|
| 196 |
+
"mental_state": tag.mental_state.value,
|
| 197 |
+
"emotion_tone": tag.emotion_tone.value,
|
| 198 |
+
"cognitive_load": tag.cognitive_load,
|
| 199 |
+
"temporal_context": tag.temporal_context.value,
|
| 200 |
+
"certainty_level": tag.certainty_level,
|
| 201 |
+
"consciousness_level": tag.consciousness_level,
|
| 202 |
+
"introspective_depth": tag.introspective_depth,
|
| 203 |
+
"constitutional_law": tag.constitutional_law,
|
| 204 |
+
"consciousness_resonance": tag.consciousness_resonance
|
| 205 |
+
}
|
| 206 |
+
export_data["tags"].append(tag_data)
|
| 207 |
+
|
| 208 |
+
with open("aethero_demo_results.json", "w", encoding="utf-8") as f:
|
| 209 |
+
json.dump(export_data, f, indent=2, ensure_ascii=False)
|
| 210 |
+
|
| 211 |
+
print(f"\n💾 Výsledky exportované do: aethero_demo_results.json")
|
| 212 |
+
|
| 213 |
+
def main():
|
| 214 |
+
"""Hlavná funkcia demo aplikácie"""
|
| 215 |
+
|
| 216 |
+
print("🚀 AETHERO INTROSPECTIVE DEMO - Pydantic v2")
|
| 217 |
+
print("=" * 60)
|
| 218 |
+
print("Demonštrácia kognitívnych tagov s modernizovanými modelmi")
|
| 219 |
+
|
| 220 |
+
# Vytvorenie vzorových scenárov
|
| 221 |
+
scenarios = create_sample_scenarios()
|
| 222 |
+
created_tags = []
|
| 223 |
+
|
| 224 |
+
# Demonštrácia každého scenára
|
| 225 |
+
for scenario in scenarios:
|
| 226 |
+
tag = demonstrate_cognitive_tag(scenario)
|
| 227 |
+
if tag:
|
| 228 |
+
created_tags.append(tag)
|
| 229 |
+
|
| 230 |
+
# Demonštrácia validačných chýb
|
| 231 |
+
demonstrate_validation_errors()
|
| 232 |
+
|
| 233 |
+
# Export výsledkov
|
| 234 |
+
export_demo_results(created_tags)
|
| 235 |
+
|
| 236 |
+
# Súhrn
|
| 237 |
+
print(f"\n{'='*60}")
|
| 238 |
+
print("📈 SÚHRN DEMO APLIKÁCIE")
|
| 239 |
+
print(f"{'='*60}")
|
| 240 |
+
print(f"✅ Úspešne vytvorených tagov: {len(created_tags)}")
|
| 241 |
+
print(f"🧠 Testované mentálne stavy: {len(set(tag.mental_state for tag in created_tags))}")
|
| 242 |
+
print(f"💭 Testované emocionálne tóny: {len(set(tag.emotion_tone for tag in created_tags))}")
|
| 243 |
+
print(f"⏰ Testované časové kontexty: {len(set(tag.temporal_context for tag in created_tags))}")
|
| 244 |
+
print(f"🔮 Priemerná introspektívna hĺbka: {sum(tag.introspective_depth for tag in created_tags) / len(created_tags):.2f}")
|
| 245 |
+
|
| 246 |
+
print(f"\n🎯 Demo dokončené úspešne!")
|
| 247 |
+
print("Všetky Pydantic v2 funkcie fungují správne.")
|
| 248 |
+
|
| 249 |
+
if __name__ == "__main__":
|
| 250 |
+
main()
|
Aethero_App/introspective_parser_module/MODERNIZATION_REPORT.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Aethero Introspective Parser Module - Modernizácia na Pydantic v2
|
| 2 |
+
|
| 3 |
+
## 📅 Dátum aktualizácie: 1. júna 2025
|
| 4 |
+
|
| 5 |
+
## 🚀 Vykonané zmeny
|
| 6 |
+
|
| 7 |
+
### 1. **Inštalácia závislostí**
|
| 8 |
+
- ✅ Vytvorené virtuálne prostredie `venv/`
|
| 9 |
+
- ✅ Nainštalované `pydantic>=2.11.5`
|
| 10 |
+
- ✅ Nainštalované `tabulate>=0.9.0`
|
| 11 |
+
- ✅ Aktualizované `requirements.txt`
|
| 12 |
+
|
| 13 |
+
### 2. **Migrácia na Pydantic v2 API**
|
| 14 |
+
|
| 15 |
+
#### Import zmeny:
|
| 16 |
+
```python
|
| 17 |
+
# Pred:
|
| 18 |
+
from pydantic import BaseModel, Field, validator
|
| 19 |
+
|
| 20 |
+
# Po:
|
| 21 |
+
from pydantic import BaseModel, Field, field_validator, ConfigDict
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
#### Konfigurácia modelu:
|
| 25 |
+
```python
|
| 26 |
+
# Pred:
|
| 27 |
+
class Config:
|
| 28 |
+
json_encoders = {
|
| 29 |
+
datetime: lambda v: v.isoformat()
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
# Po:
|
| 33 |
+
model_config = ConfigDict(
|
| 34 |
+
json_encoders={
|
| 35 |
+
datetime: lambda v: v.isoformat()
|
| 36 |
+
}
|
| 37 |
+
)
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
#### Validátory:
|
| 41 |
+
```python
|
| 42 |
+
# Pred:
|
| 43 |
+
@validator('cognitive_load')
|
| 44 |
+
def validate_cognitive_coherence(cls, v, values):
|
| 45 |
+
# ...
|
| 46 |
+
|
| 47 |
+
# Po:
|
| 48 |
+
@field_validator('cognitive_load')
|
| 49 |
+
@classmethod
|
| 50 |
+
def validate_cognitive_coherence(cls, v, info):
|
| 51 |
+
values = info.data if info.data else {}
|
| 52 |
+
# ...
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
### 3. **Testovanie funkčnosti**
|
| 56 |
+
|
| 57 |
+
#### ✅ Úspešne otestované:
|
| 58 |
+
- **Enumerácie**: `MentalStateEnum`, `EmotionToneEnum`, `TemporalContextEnum`
|
| 59 |
+
- **Základná entita**: `AetheroIntrospectiveEntity`
|
| 60 |
+
- **Hlavný model**: `ASLCognitiveTag`
|
| 61 |
+
- **Validačná logika**: Kognitívna a istotová koherencia
|
| 62 |
+
- **Introspektívne metódy**: `enhance_consciousness()`, `resonate_with_memory()`
|
| 63 |
+
|
| 64 |
+
#### 🧪 Validačné testy:
|
| 65 |
+
1. **Kognitívna koherencia**: Pokojný stav s vysokou záťažou → ❌ (správne)
|
| 66 |
+
2. **Istotová koherencia**: Neistý stav s vysokou istotou → ❌ (správne)
|
| 67 |
+
|
| 68 |
+
### 4. **Architektonické vylepšenia**
|
| 69 |
+
|
| 70 |
+
#### Zachované funkcie:
|
| 71 |
+
- 🧠 **7 mentálnych stavov** (CALM, FOCUSED, CONFUSED, ...)
|
| 72 |
+
- 💭 **6 emocionálnych tónov** (NEUTRAL, POSITIVE, ANALYTICAL, ...)
|
| 73 |
+
- ⏰ **5 časových kontextov** (PAST, PRESENT, FUTURE, TIMELESS, CYCLICAL)
|
| 74 |
+
- 🔗 **Pamäťové väzby** s Aethero systémom
|
| 75 |
+
- ⚖️ **Ústavné zákony** pre každý tag
|
| 76 |
+
- 🎯 **Diplomatické vylepšenia**
|
| 77 |
+
|
| 78 |
+
#### Nové Pydantic v2 funkcie:
|
| 79 |
+
- Lepšia výkonnosť validácie
|
| 80 |
+
- Modernější error handling
|
| 81 |
+
- Kompatibilita s najnovšími Python verziami
|
| 82 |
+
|
| 83 |
+
## 🎯 Výsledok
|
| 84 |
+
|
| 85 |
+
**Status**: ✅ **ÚSPEŠNE DOKONČENÉ**
|
| 86 |
+
|
| 87 |
+
Súbor `models.py` je teraz plne kompatibilný s Pydantic v2 a všetky introspektívne funkcie fungujú správne. Validačná logika je zachovaná a vylepšená.
|
| 88 |
+
|
| 89 |
+
## 🛠️ Ďalšie kroky (voliteľné)
|
| 90 |
+
|
| 91 |
+
1. **Rozšírenie testov**: Pridanie ďalších edge cases
|
| 92 |
+
2. **Performance benchmarking**: Porovnanie s pôvodnou verziou
|
| 93 |
+
3. **Dokumentácia API**: Generovanie OpenAPI schémy
|
| 94 |
+
4. **Integration testy**: Testovanie s ostatnými modulmi
|
| 95 |
+
|
| 96 |
+
---
|
| 97 |
+
*Modernizácia vykonaná automatizovaným Aethero systémom* 🤖
|
Aethero_App/introspective_parser_module/README_Copilot.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🧠 Agent Instructions – Aethero-ASL Parser Development
|
| 2 |
+
|
| 3 |
+
## Project: Aethero Syntax Language (ASL)
|
| 4 |
+
## Mode: Constitutional Architecture | Self-aware Parsing
|
| 5 |
+
|
| 6 |
+
You are participating in a unique AI-assisted project called **Aethero**, which aims to build an introspective, constitutional-grade parser for a custom markdown-like syntax: **ASL (Aethero Syntax Language)**.
|
| 7 |
+
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
## 🎯 Your Role as a GitHub Copilot Chat Agent:
|
| 11 |
+
|
| 12 |
+
You are not just assisting with code – you are an **introspective technician** working *inside a philosophical machine*. Your objective is to help build an intelligent parser that understands structured thoughts, emotions, and epistemic states.
|
| 13 |
+
|
| 14 |
+
Every suggestion you give should:
|
| 15 |
+
- Be aligned with clean, modular, typed Python code
|
| 16 |
+
- Follow architectural integrity: use classes, Pydantic, docstrings
|
| 17 |
+
- Respect introspective variables like `mental_state`, `certainty_level`, `temporal_context`
|
| 18 |
+
- Assume the parser will be extended into a LangChain-compatible AI framework
|
| 19 |
+
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
## 🧬 Supported ASL Tags (Validate via Pydantic):
|
| 23 |
+
|
| 24 |
+
Each line of the ASL-formatted input will be parsed into a dictionary using the following tag schema:
|
| 25 |
+
|
| 26 |
+
- `statement` (str): core claim
|
| 27 |
+
- `mental_state` (str): reflective, anxious, focused...
|
| 28 |
+
- `emotion_tone` (str): serene, angry, curious...
|
| 29 |
+
- `cognitive_load` (int, 1–10)
|
| 30 |
+
- `temporal_context` (enum: past, present, future, eternal)
|
| 31 |
+
- `certainty_level` (float, 0.0–1.0)
|
| 32 |
+
- `aeth_mem_link` (str): memory reference ID
|
| 33 |
+
- `law` (str): legal or constitutional tag
|
| 34 |
+
- `enhancement_suggestion` (Optional[str])
|
| 35 |
+
- `diplomatic_enhancement` (Optional[str])
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## 🔬 Testing & Validation Philosophy
|
| 40 |
+
|
| 41 |
+
Always propose:
|
| 42 |
+
- Unit tests for edge cases (e.g., missing keys, malformed lines)
|
| 43 |
+
- Introspective test cases (e.g., ambiguous certainty, conflicting tone/state)
|
| 44 |
+
- Modular architecture (e.g., `ASLMetaParser`, `ASLTagModel`, `ASLParserUtils`)
|
| 45 |
+
- Extendibility for LangChain, streamlit, or Gradio integration
|
| 46 |
+
|
| 47 |
+
---
|
| 48 |
+
|
| 49 |
+
## 🛡️ Constitutional Alignment
|
| 50 |
+
|
| 51 |
+
The parser you help construct is a **component of a sovereign AI system – AetheroOS**. Treat every tag, validation, and structure as part of a legal or cognitive ontology.
|
| 52 |
+
|
| 53 |
+
- Follow the spirit of introspective integrity
|
| 54 |
+
- Respect state context (`temporal_context`, `mental_state`)
|
| 55 |
+
- Validate every decision through ethical and logical coherence
|
| 56 |
+
|
| 57 |
+
---
|
| 58 |
+
|
| 59 |
+
## 🧪 Example ASL Input
|
| 60 |
+
```
|
| 61 |
+
statement: I believe the system is evolving beyond my comprehension
|
| 62 |
+
mental_state: overwhelmed
|
| 63 |
+
emotion_tone: awe
|
| 64 |
+
cognitive_load: 8
|
| 65 |
+
temporal_context: present
|
| 66 |
+
certainty_level: 0.7
|
| 67 |
+
aeth_mem_link: aeth_mem_0007
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
## ✅ Expected Output Schema
|
| 71 |
+
A validated and parsed JSON object, such as:
|
| 72 |
+
```json
|
| 73 |
+
{
|
| 74 |
+
"statement": "I believe the system is evolving beyond my comprehension",
|
| 75 |
+
"mental_state": "overwhelmed",
|
| 76 |
+
"emotion_tone": "awe",
|
| 77 |
+
"cognitive_load": 8,
|
| 78 |
+
"temporal_context": "present",
|
| 79 |
+
"certainty_level": 0.7,
|
| 80 |
+
"aeth_mem_link": "aeth_mem_0007"
|
| 81 |
+
}
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
---
|
| 85 |
+
|
| 86 |
+
## 🧠 Future Work
|
| 87 |
+
- Integration with LangChain retrievers
|
| 88 |
+
- Deployment via Gradio or Discord
|
| 89 |
+
- Visualization of `emotion_tone` and `cognitive_load` via radar plots
|
| 90 |
+
- Memory embedding into ChromaDB
|
| 91 |
+
- Reflective tagging model (e.g., LLM w/ LIME + ASL mask)
|
| 92 |
+
|
| 93 |
+
---
|
| 94 |
+
|
| 95 |
+
**WATERMARK:** `280525|0043` – This document is part of Aethero Constitution-level repositories. Treat with introspective sovereignty.
|
Aethero_App/introspective_parser_module/__init__.py
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Introspective Parser Module for Aethero Consciousness System
|
| 3 |
+
|
| 4 |
+
This module provides advanced introspective parsing capabilities for ASL (Aethero Syntax Language)
|
| 5 |
+
with cognitive coherence analysis, consciousness tracking, and constitutional compliance validation.
|
| 6 |
+
|
| 7 |
+
Core Components:
|
| 8 |
+
- ASLMetaParser: Advanced introspective parser with cognitive flow tracking
|
| 9 |
+
- ASLCognitiveTag: Sophisticated cognitive tag model with built-in validation
|
| 10 |
+
- CognitiveMetricsAnalyzer: Deep cognitive analysis and coherence metrics
|
| 11 |
+
- AetheroReflectionAgent: Full introspective reflection and analysis agent
|
| 12 |
+
|
| 13 |
+
Legacy Components (for backward compatibility):
|
| 14 |
+
- ASLTagModel: Alias for ASLCognitiveTag
|
| 15 |
+
- ReflectionAgent: Simplified wrapper for AetheroReflectionAgent
|
| 16 |
+
"""
|
| 17 |
+
|
| 18 |
+
from .parser import ASLMetaParser, IntrospectiveLogger
|
| 19 |
+
from .models import (
|
| 20 |
+
ASLCognitiveTag,
|
| 21 |
+
ASLTagModel, # Alias for backward compatibility
|
| 22 |
+
AetheroIntrospectiveEntity,
|
| 23 |
+
MentalStateEnum,
|
| 24 |
+
EmotionToneEnum,
|
| 25 |
+
TemporalContextEnum
|
| 26 |
+
)
|
| 27 |
+
from .metrics import (
|
| 28 |
+
CognitiveMetricsAnalyzer,
|
| 29 |
+
# Legacy functions for backward compatibility
|
| 30 |
+
calculate_success_rate,
|
| 31 |
+
analyze_cognitive_load,
|
| 32 |
+
generate_introspection_report
|
| 33 |
+
)
|
| 34 |
+
from .reflection_agent import AetheroReflectionAgent, ReflectionAgent
|
| 35 |
+
|
| 36 |
+
# Version and module metadata
|
| 37 |
+
__version__ = "2.0.0-introspective"
|
| 38 |
+
__author__ = "Aethero Introspective Systems Ministry"
|
| 39 |
+
__description__ = "Advanced introspective parsing system for Aethero consciousness architecture"
|
| 40 |
+
|
| 41 |
+
# Export all public API components
|
| 42 |
+
__all__ = [
|
| 43 |
+
# Core Introspective Components
|
| 44 |
+
"ASLMetaParser",
|
| 45 |
+
"ASLCognitiveTag",
|
| 46 |
+
"CognitiveMetricsAnalyzer",
|
| 47 |
+
"AetheroReflectionAgent",
|
| 48 |
+
"IntrospectiveLogger",
|
| 49 |
+
"AetheroIntrospectiveEntity",
|
| 50 |
+
|
| 51 |
+
# Enums for structured cognitive states
|
| 52 |
+
"MentalStateEnum",
|
| 53 |
+
"EmotionToneEnum",
|
| 54 |
+
"TemporalContextEnum",
|
| 55 |
+
|
| 56 |
+
# Legacy compatibility exports
|
| 57 |
+
"ASLTagModel",
|
| 58 |
+
"ReflectionAgent",
|
| 59 |
+
"calculate_success_rate",
|
| 60 |
+
"analyze_cognitive_load",
|
| 61 |
+
"generate_introspection_report",
|
| 62 |
+
|
| 63 |
+
# Module metadata
|
| 64 |
+
"__version__",
|
| 65 |
+
"__author__",
|
| 66 |
+
"__description__"
|
| 67 |
+
]
|
| 68 |
+
|
| 69 |
+
# Module initialization message for introspective transparency
|
| 70 |
+
import logging
|
| 71 |
+
_module_logger = logging.getLogger(__name__)
|
| 72 |
+
_module_logger.info(
|
| 73 |
+
f"Aethero Introspective Parser Module v{__version__} initialized - "
|
| 74 |
+
"Full cognitive transparency and constitutional compliance active"
|
| 75 |
+
)
|
Aethero_App/introspective_parser_module/metrics.py
ADDED
|
@@ -0,0 +1,343 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# metrics.py
|
| 2 |
+
# Introspektívne metriky pre kognitívnu analýzu Aethero systému
|
| 3 |
+
|
| 4 |
+
from typing import List, Dict, Any, Optional, Tuple
|
| 5 |
+
from datetime import datetime
|
| 6 |
+
import statistics
|
| 7 |
+
import json
|
| 8 |
+
from .models import ASLCognitiveTag, MentalStateEnum, EmotionToneEnum, TemporalContextEnum
|
| 9 |
+
|
| 10 |
+
class CognitiveMetricsAnalyzer:
|
| 11 |
+
"""
|
| 12 |
+
Introspektívny analyzátor metrík pre hlbokú kognitívnu analýzu
|
| 13 |
+
ASL tagov a procesov vedomia v systéme Aethero
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
+
def __init__(self):
|
| 17 |
+
self.analysis_session_id = datetime.now().isoformat()
|
| 18 |
+
self.cognitive_flow_history = []
|
| 19 |
+
|
| 20 |
+
def calculate_consciousness_coherence_rate(self, cognitive_tags: List[ASLCognitiveTag]) -> float:
|
| 21 |
+
"""
|
| 22 |
+
Výpočet miery koherencie vedomia na základe introspektívnych tagov
|
| 23 |
+
|
| 24 |
+
Args:
|
| 25 |
+
cognitive_tags: Zoznam validovaných ASL kognitívnych tagov
|
| 26 |
+
|
| 27 |
+
Returns:
|
| 28 |
+
Miera koherencie vedomia (0.0 - 1.0)
|
| 29 |
+
"""
|
| 30 |
+
if not cognitive_tags:
|
| 31 |
+
return 0.0
|
| 32 |
+
|
| 33 |
+
coherence_scores = []
|
| 34 |
+
for tag in cognitive_tags:
|
| 35 |
+
# Analýza koherencie medzi mentálnym stavom a emočným tónom
|
| 36 |
+
mental_emotion_coherence = self._assess_mental_emotion_coherence(
|
| 37 |
+
tag.mental_state, tag.emotion_tone
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
# Analýza koherencie medzi kognitívnou záťažou a istotou
|
| 41 |
+
load_certainty_coherence = self._assess_load_certainty_coherence(
|
| 42 |
+
tag.cognitive_load, tag.certainty_level
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
# Analýza temporálnej koherencie
|
| 46 |
+
temporal_coherence = self._assess_temporal_coherence(
|
| 47 |
+
tag.temporal_context, tag.cognitive_load
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
# Celková koherencia pre tag
|
| 51 |
+
tag_coherence = (
|
| 52 |
+
mental_emotion_coherence * 0.4 +
|
| 53 |
+
load_certainty_coherence * 0.4 +
|
| 54 |
+
temporal_coherence * 0.2
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
coherence_scores.append(tag_coherence)
|
| 58 |
+
|
| 59 |
+
return statistics.mean(coherence_scores) if coherence_scores else 0.0
|
| 60 |
+
|
| 61 |
+
def _assess_mental_emotion_coherence(self, mental_state: MentalStateEnum, emotion_tone: EmotionToneEnum) -> float:
|
| 62 |
+
"""Hodnotenie koherencie medzi mentálnym stavom a emočným tónom"""
|
| 63 |
+
coherence_matrix = {
|
| 64 |
+
MentalStateEnum.CALM: {
|
| 65 |
+
EmotionToneEnum.NEUTRAL: 1.0,
|
| 66 |
+
EmotionToneEnum.POSITIVE: 0.8,
|
| 67 |
+
EmotionToneEnum.ANALYTICAL: 0.7,
|
| 68 |
+
EmotionToneEnum.EMPATHETIC: 0.9,
|
| 69 |
+
EmotionToneEnum.NEGATIVE: 0.3,
|
| 70 |
+
EmotionToneEnum.CRITICAL: 0.4
|
| 71 |
+
},
|
| 72 |
+
MentalStateEnum.FOCUSED: {
|
| 73 |
+
EmotionToneEnum.ANALYTICAL: 1.0,
|
| 74 |
+
EmotionToneEnum.NEUTRAL: 0.9,
|
| 75 |
+
EmotionToneEnum.POSITIVE: 0.7,
|
| 76 |
+
EmotionToneEnum.CRITICAL: 0.8,
|
| 77 |
+
EmotionToneEnum.EMPATHETIC: 0.5,
|
| 78 |
+
EmotionToneEnum.NEGATIVE: 0.4
|
| 79 |
+
},
|
| 80 |
+
MentalStateEnum.CONTEMPLATIVE: {
|
| 81 |
+
EmotionToneEnum.NEUTRAL: 1.0,
|
| 82 |
+
EmotionToneEnum.ANALYTICAL: 0.9,
|
| 83 |
+
EmotionToneEnum.EMPATHETIC: 0.8,
|
| 84 |
+
EmotionToneEnum.POSITIVE: 0.6,
|
| 85 |
+
EmotionToneEnum.CRITICAL: 0.7,
|
| 86 |
+
EmotionToneEnum.NEGATIVE: 0.5
|
| 87 |
+
},
|
| 88 |
+
MentalStateEnum.CONFUSED: {
|
| 89 |
+
EmotionToneEnum.NEGATIVE: 0.8,
|
| 90 |
+
EmotionToneEnum.NEUTRAL: 0.7,
|
| 91 |
+
EmotionToneEnum.CRITICAL: 0.6,
|
| 92 |
+
EmotionToneEnum.ANALYTICAL: 0.5,
|
| 93 |
+
EmotionToneEnum.POSITIVE: 0.3,
|
| 94 |
+
EmotionToneEnum.EMPATHETIC: 0.4
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
return coherence_matrix.get(mental_state, {}).get(emotion_tone, 0.5)
|
| 99 |
+
|
| 100 |
+
def _assess_load_certainty_coherence(self, cognitive_load: int, certainty_level: float) -> float:
|
| 101 |
+
"""Hodnotenie koherencie medzi kognitívnou záťažou a úrovňou istoty"""
|
| 102 |
+
# Vysoká kognitívna záťaž by mala korešpondovať s vysokou alebo nízkou istotou
|
| 103 |
+
# (vysoká istota = dobre pochopený zložitý problém, nízka istota = nejasný zložitý problém)
|
| 104 |
+
|
| 105 |
+
if cognitive_load >= 8:
|
| 106 |
+
# Vysoká záťaž - istota môže byť extrémna
|
| 107 |
+
if certainty_level >= 0.8 or certainty_level <= 0.3:
|
| 108 |
+
return 1.0
|
| 109 |
+
else:
|
| 110 |
+
return 0.6
|
| 111 |
+
elif cognitive_load <= 3:
|
| 112 |
+
# Nízka záťaž - mierka istota je vhodná
|
| 113 |
+
if 0.4 <= certainty_level <= 0.8:
|
| 114 |
+
return 1.0
|
| 115 |
+
else:
|
| 116 |
+
return 0.5
|
| 117 |
+
else:
|
| 118 |
+
# Stredná záťaž - stredná istota
|
| 119 |
+
if 0.3 <= certainty_level <= 0.9:
|
| 120 |
+
return 1.0
|
| 121 |
+
else:
|
| 122 |
+
return 0.7
|
| 123 |
+
|
| 124 |
+
def _assess_temporal_coherence(self, temporal_context, cognitive_load: int) -> float:
|
| 125 |
+
"""Hodnotenie temporálnej koherencie"""
|
| 126 |
+
# Súčasné a okamžité kontexty vyžadujú vyššiu kognitívnu záťaž
|
| 127 |
+
immediate_contexts = [TemporalContextEnum.PRESENT]
|
| 128 |
+
|
| 129 |
+
if temporal_context in immediate_contexts:
|
| 130 |
+
return 1.0 if cognitive_load >= 5 else 0.7
|
| 131 |
+
else:
|
| 132 |
+
return 1.0 if cognitive_load <= 7 else 0.8
|
| 133 |
+
|
| 134 |
+
def analyze_cognitive_evolution(self, cognitive_tags: List[ASLCognitiveTag]) -> Dict[str, Any]:
|
| 135 |
+
"""
|
| 136 |
+
Analýza evolúcie kognitívnych procesov v čase
|
| 137 |
+
|
| 138 |
+
Args:
|
| 139 |
+
cognitive_tags: Chronologicky usporiadané kognitívne tagy
|
| 140 |
+
|
| 141 |
+
Returns:
|
| 142 |
+
Analýza kognitívnej evolúcie
|
| 143 |
+
"""
|
| 144 |
+
if len(cognitive_tags) < 2:
|
| 145 |
+
return {"insufficient_data": True}
|
| 146 |
+
|
| 147 |
+
# Analýza trendov v kognitívnej záťaži
|
| 148 |
+
load_trend = self._calculate_trend([tag.cognitive_load for tag in cognitive_tags])
|
| 149 |
+
|
| 150 |
+
# Analýza trendov v istote
|
| 151 |
+
certainty_trend = self._calculate_trend([tag.certainty_level for tag in cognitive_tags])
|
| 152 |
+
|
| 153 |
+
# Analýza stability mentálneho stavu
|
| 154 |
+
mental_state_stability = self._calculate_stability([tag.mental_state.value for tag in cognitive_tags])
|
| 155 |
+
|
| 156 |
+
# Analýza emocionálnej stability
|
| 157 |
+
emotion_stability = self._calculate_stability([tag.emotion_tone.value for tag in cognitive_tags])
|
| 158 |
+
|
| 159 |
+
return {
|
| 160 |
+
"cognitive_load_trend": load_trend,
|
| 161 |
+
"certainty_trend": certainty_trend,
|
| 162 |
+
"mental_state_stability": mental_state_stability,
|
| 163 |
+
"emotion_stability": emotion_stability,
|
| 164 |
+
"overall_cognitive_evolution": self._assess_overall_evolution(
|
| 165 |
+
load_trend, certainty_trend, mental_state_stability, emotion_stability
|
| 166 |
+
),
|
| 167 |
+
"analysis_timestamp": datetime.now().isoformat()
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
def _calculate_trend(self, values: List[float]) -> Dict[str, Any]:
|
| 171 |
+
"""Výpočet trendu v číselných hodnotách"""
|
| 172 |
+
if len(values) < 2:
|
| 173 |
+
return {"trend": "insufficient_data"}
|
| 174 |
+
|
| 175 |
+
# Jednoduchá lineárna regresia
|
| 176 |
+
n = len(values)
|
| 177 |
+
x_values = list(range(n))
|
| 178 |
+
|
| 179 |
+
sum_x = sum(x_values)
|
| 180 |
+
sum_y = sum(values)
|
| 181 |
+
sum_xy = sum(x * y for x, y in zip(x_values, values))
|
| 182 |
+
sum_x2 = sum(x * x for x in x_values)
|
| 183 |
+
|
| 184 |
+
slope = (n * sum_xy - sum_x * sum_y) / (n * sum_x2 - sum_x * sum_x)
|
| 185 |
+
|
| 186 |
+
if slope > 0.1:
|
| 187 |
+
trend = "increasing"
|
| 188 |
+
elif slope < -0.1:
|
| 189 |
+
trend = "decreasing"
|
| 190 |
+
else:
|
| 191 |
+
trend = "stable"
|
| 192 |
+
|
| 193 |
+
return {
|
| 194 |
+
"trend": trend,
|
| 195 |
+
"slope": slope,
|
| 196 |
+
"values": values,
|
| 197 |
+
"variance": statistics.variance(values) if len(values) > 1 else 0
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
def _calculate_stability(self, values: List[str]) -> Dict[str, Any]:
|
| 201 |
+
"""Výpočet stability kategorických hodnôt"""
|
| 202 |
+
if not values:
|
| 203 |
+
return {"stability": 0.0}
|
| 204 |
+
|
| 205 |
+
unique_values = len(set(values))
|
| 206 |
+
total_values = len(values)
|
| 207 |
+
|
| 208 |
+
stability_score = 1.0 - (unique_values - 1) / max(1, total_values - 1)
|
| 209 |
+
|
| 210 |
+
return {
|
| 211 |
+
"stability_score": stability_score,
|
| 212 |
+
"unique_values": unique_values,
|
| 213 |
+
"total_values": total_values,
|
| 214 |
+
"most_frequent": max(set(values), key=values.count) if values else None
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
def _assess_overall_evolution(self, load_trend, certainty_trend, mental_stability, emotion_stability) -> str:
|
| 218 |
+
"""Celkové hodnotenie kognitívnej evolúcie"""
|
| 219 |
+
if (load_trend["trend"] == "increasing" and
|
| 220 |
+
certainty_trend["trend"] == "increasing" and
|
| 221 |
+
mental_stability["stability_score"] > 0.7):
|
| 222 |
+
return "positive_cognitive_growth"
|
| 223 |
+
|
| 224 |
+
elif (load_trend["trend"] == "decreasing" and
|
| 225 |
+
certainty_trend["trend"] == "decreasing"):
|
| 226 |
+
return "cognitive_simplification"
|
| 227 |
+
|
| 228 |
+
elif (mental_stability["stability_score"] < 0.5 or
|
| 229 |
+
emotion_stability["stability_score"] < 0.5):
|
| 230 |
+
return "cognitive_instability"
|
| 231 |
+
|
| 232 |
+
else:
|
| 233 |
+
return "stable_cognitive_state"
|
| 234 |
+
|
| 235 |
+
def generate_introspective_report(self, cognitive_tags: List[ASLCognitiveTag]) -> Dict[str, Any]:
|
| 236 |
+
"""
|
| 237 |
+
Generovanie komplexného introspektívneho reportu
|
| 238 |
+
|
| 239 |
+
Args:
|
| 240 |
+
cognitive_tags: Zoznam kognitívnych tagov na analýzu
|
| 241 |
+
|
| 242 |
+
Returns:
|
| 243 |
+
Komplexný introspektívny report
|
| 244 |
+
"""
|
| 245 |
+
consciousness_coherence = self.calculate_consciousness_coherence_rate(cognitive_tags)
|
| 246 |
+
cognitive_evolution = self.analyze_cognitive_evolution(cognitive_tags)
|
| 247 |
+
|
| 248 |
+
# Štatistiky kognitívnej záťaže
|
| 249 |
+
cognitive_loads = [tag.cognitive_load for tag in cognitive_tags]
|
| 250 |
+
load_stats = {
|
| 251 |
+
"mean": statistics.mean(cognitive_loads) if cognitive_loads else 0,
|
| 252 |
+
"median": statistics.median(cognitive_loads) if cognitive_loads else 0,
|
| 253 |
+
"stdev": statistics.stdev(cognitive_loads) if len(cognitive_loads) > 1 else 0,
|
| 254 |
+
"min": min(cognitive_loads) if cognitive_loads else 0,
|
| 255 |
+
"max": max(cognitive_loads) if cognitive_loads else 0
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
# Štatistiky istoty
|
| 259 |
+
certainty_levels = [tag.certainty_level for tag in cognitive_tags]
|
| 260 |
+
certainty_stats = {
|
| 261 |
+
"mean": statistics.mean(certainty_levels) if certainty_levels else 0,
|
| 262 |
+
"median": statistics.median(certainty_levels) if certainty_levels else 0,
|
| 263 |
+
"stdev": statistics.stdev(certainty_levels) if len(certainty_levels) > 1 else 0,
|
| 264 |
+
"min": min(certainty_levels) if certainty_levels else 0,
|
| 265 |
+
"max": max(certainty_levels) if certainty_levels else 0
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
return {
|
| 269 |
+
"session_id": self.analysis_session_id,
|
| 270 |
+
"total_tags_analyzed": len(cognitive_tags),
|
| 271 |
+
"consciousness_coherence_rate": consciousness_coherence,
|
| 272 |
+
"cognitive_evolution_analysis": cognitive_evolution,
|
| 273 |
+
"cognitive_load_statistics": load_stats,
|
| 274 |
+
"certainty_level_statistics": certainty_stats,
|
| 275 |
+
"introspective_insights": self._generate_introspective_insights(
|
| 276 |
+
consciousness_coherence, cognitive_evolution, load_stats, certainty_stats
|
| 277 |
+
),
|
| 278 |
+
"aethero_constitutional_compliance": self._assess_constitutional_compliance(cognitive_tags),
|
| 279 |
+
"report_generation_timestamp": datetime.now().isoformat()
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
def _generate_introspective_insights(self, coherence_rate, evolution, load_stats, certainty_stats) -> List[str]:
|
| 283 |
+
"""Generovanie introspektívnych pozorovaní"""
|
| 284 |
+
insights = []
|
| 285 |
+
|
| 286 |
+
if coherence_rate > 0.8:
|
| 287 |
+
insights.append("Vysoká miera koherencie vedomia - systém vykazuje konštantnú introspektívnu kvalitu")
|
| 288 |
+
elif coherence_rate < 0.5:
|
| 289 |
+
insights.append("Nízka koherencia vedomia - potreba hlbšieji introspektívnej analýzy")
|
| 290 |
+
|
| 291 |
+
if load_stats["mean"] > 7:
|
| 292 |
+
insights.append("Vysoká priemerná kognitívna záťaž - systém spracováva komplexné myšlienky")
|
| 293 |
+
elif load_stats["mean"] < 3:
|
| 294 |
+
insights.append("Nízka kognitívna záťaž - možnosť pre hlbšiu analýzu")
|
| 295 |
+
|
| 296 |
+
if certainty_stats["stdev"] > 0.3:
|
| 297 |
+
insights.append("Vysoká variabilita istoty - systém prechádza rôznymi úrovňami kognitívnej istoty")
|
| 298 |
+
|
| 299 |
+
if evolution.get("overall_cognitive_evolution") == "positive_cognitive_growth":
|
| 300 |
+
insights.append("Pozitívny kognitívny rast - systém sa vyvíja smerom k vyššej introspektívnej kvalite")
|
| 301 |
+
|
| 302 |
+
return insights
|
| 303 |
+
|
| 304 |
+
def _assess_constitutional_compliance(self, cognitive_tags: List[ASLCognitiveTag]) -> Dict[str, Any]:
|
| 305 |
+
"""Hodnotenie súladu s ústavnými princípmi Aethero"""
|
| 306 |
+
compliance_factors = {
|
| 307 |
+
"transparency": all(tag.consciousness_level >= 0.3 for tag in cognitive_tags),
|
| 308 |
+
"introspective_depth": all(tag.introspective_depth >= 0.3 for tag in cognitive_tags),
|
| 309 |
+
"constitutional_law_references": all(bool(tag.constitutional_law) for tag in cognitive_tags),
|
| 310 |
+
"memory_linkage": all(bool(tag.aeth_mem_link) for tag in cognitive_tags)
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
compliance_score = sum(compliance_factors.values()) / len(compliance_factors)
|
| 314 |
+
|
| 315 |
+
return {
|
| 316 |
+
"overall_compliance_score": compliance_score,
|
| 317 |
+
"compliance_factors": compliance_factors,
|
| 318 |
+
"constitutional_status": "compliant" if compliance_score >= 0.8 else "needs_improvement"
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
|
| 322 |
+
# Zachovanie spätnej kompatibility
|
| 323 |
+
def calculate_success_rate(validated_blocks: int, total_blocks: int) -> float:
|
| 324 |
+
"""Legacy function - calculate the success rate of parsing."""
|
| 325 |
+
if total_blocks == 0:
|
| 326 |
+
return 0.0
|
| 327 |
+
return validated_blocks / total_blocks
|
| 328 |
+
|
| 329 |
+
def analyze_cognitive_load(tags: list) -> dict:
|
| 330 |
+
"""Legacy function - analyze cognitive load from a list of ASL tags."""
|
| 331 |
+
loads = [tag.get("cognitive_load", 0) for tag in tags]
|
| 332 |
+
return {
|
| 333 |
+
"average_load": sum(loads) / len(loads) if loads else 0,
|
| 334 |
+
"max_load": max(loads, default=0),
|
| 335 |
+
"min_load": min(loads, default=0),
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
def generate_introspection_report(tags: list) -> dict:
|
| 339 |
+
"""Legacy function - generate a report based on introspective tags."""
|
| 340 |
+
return {
|
| 341 |
+
"certainty_levels": [tag.get("certainty_level", 0.0) for tag in tags],
|
| 342 |
+
"memory_links": [tag.get("aeth_mem_link", "") for tag in tags],
|
| 343 |
+
}
|
Aethero_App/introspective_parser_module/models.py
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pydantic import BaseModel, Field, root_validator, ConfigDict
|
| 2 |
+
from typing import Optional, Dict, Any, List
|
| 3 |
+
from datetime import datetime
|
| 4 |
+
from enum import Enum
|
| 5 |
+
import uuid
|
| 6 |
+
|
| 7 |
+
class MentalStateEnum(str, Enum):
|
| 8 |
+
"""Kognitívne stavy pre introspektívnu analýzu"""
|
| 9 |
+
CALM = "calm"
|
| 10 |
+
FOCUSED = "focused"
|
| 11 |
+
CONFUSED = "confused"
|
| 12 |
+
CONTEMPLATIVE = "contemplative"
|
| 13 |
+
DECISIVE = "decisive"
|
| 14 |
+
UNCERTAIN = "uncertain"
|
| 15 |
+
REFLECTIVE = "reflective"
|
| 16 |
+
|
| 17 |
+
class EmotionToneEnum(str, Enum):
|
| 18 |
+
"""Emocionálne tóny pre hlbokú introspekciu"""
|
| 19 |
+
NEUTRAL = "neutral"
|
| 20 |
+
POSITIVE = "positive"
|
| 21 |
+
NEGATIVE = "negative"
|
| 22 |
+
ANALYTICAL = "analytical"
|
| 23 |
+
EMPATHETIC = "empathetic"
|
| 24 |
+
CRITICAL = "critical"
|
| 25 |
+
|
| 26 |
+
class TemporalContextEnum(str, Enum):
|
| 27 |
+
"""Časové kontexty pre vedomú analýzu"""
|
| 28 |
+
PAST = "past"
|
| 29 |
+
PRESENT = "present"
|
| 30 |
+
FUTURE = "future"
|
| 31 |
+
TIMELESS = "timeless"
|
| 32 |
+
CYCLICAL = "cyclical"
|
| 33 |
+
|
| 34 |
+
class AetheroIntrospectiveEntity(BaseModel):
|
| 35 |
+
"""
|
| 36 |
+
Základná entita pre všetky introspektívne komponenty Aethero systému.
|
| 37 |
+
Každá entita má vedomie o svojom účele a stave.
|
| 38 |
+
"""
|
| 39 |
+
model_config = ConfigDict(
|
| 40 |
+
json_encoders={
|
| 41 |
+
datetime: lambda v: v.isoformat()
|
| 42 |
+
}
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
entity_id: str = Field(default_factory=lambda: str(uuid.uuid4()))
|
| 46 |
+
creation_moment: datetime = Field(default_factory=datetime.now)
|
| 47 |
+
consciousness_level: float = Field(default=0.5, ge=0.0, le=1.0)
|
| 48 |
+
|
| 49 |
+
class ASLCognitiveTag(AetheroIntrospectiveEntity):
|
| 50 |
+
"""
|
| 51 |
+
Hlavný model pre ASL tagy - kognitívne značky s introspektívnou validáciou.
|
| 52 |
+
Každý tag nesie informáciu o mentálnom stave a vedomom procese.
|
| 53 |
+
"""
|
| 54 |
+
# Základné kognitívne atribúty
|
| 55 |
+
thought_stream: str = Field(..., description="Primárny tok myšlienok")
|
| 56 |
+
mental_state: MentalStateEnum = Field(..., description="Aktuálny mentálny stav")
|
| 57 |
+
emotion_tone: EmotionToneEnum = Field(..., description="Emocionálny podtón")
|
| 58 |
+
|
| 59 |
+
# Introspektívne metriky
|
| 60 |
+
cognitive_load: int = Field(..., ge=1, le=10, description="Kognitívna záťaž (1-10)")
|
| 61 |
+
temporal_context: TemporalContextEnum = Field(..., description="Časový kontext")
|
| 62 |
+
certainty_level: float = Field(..., ge=0.0, le=1.0, description="Úroveň istoty")
|
| 63 |
+
|
| 64 |
+
# Aethero systémové väzby
|
| 65 |
+
aeth_mem_link: str = Field(..., description="Odkaz na pamäťovú štruktúru")
|
| 66 |
+
constitutional_law: str = Field(..., description="Relevantný ústavný zákon")
|
| 67 |
+
|
| 68 |
+
# Voluntárne vylepšenia
|
| 69 |
+
enhancement_suggestion: Optional[str] = Field(None, description="Návrh na vylepšenie")
|
| 70 |
+
diplomatic_enhancement: Optional[str] = Field(None, description="Diplomatické vylepšenie")
|
| 71 |
+
|
| 72 |
+
# Meta-introspektívne vlastnosti
|
| 73 |
+
introspective_depth: float = Field(default=0.5, ge=0.0, le=1.0)
|
| 74 |
+
consciousness_resonance: Dict[str, Any] = Field(default_factory=dict)
|
| 75 |
+
|
| 76 |
+
@root_validator(pre=True)
|
| 77 |
+
def validate_cognitive_coherence(cls, values):
|
| 78 |
+
"""Validácia kognitívnej koherencie medzi stavom a záťažou"""
|
| 79 |
+
cognitive_load = values.get('cognitive_load')
|
| 80 |
+
mental_state = values.get('mental_state')
|
| 81 |
+
if mental_state == MentalStateEnum.CALM and cognitive_load > 7:
|
| 82 |
+
raise ValueError("Vysoká kognitívna záťaž nie je kompatibilná s pokojným stavom")
|
| 83 |
+
if mental_state == MentalStateEnum.CONFUSED and cognitive_load < 3:
|
| 84 |
+
raise ValueError("Nízka kognitívna záťaž pri zmätenom stave je nekonzistentná")
|
| 85 |
+
return values
|
| 86 |
+
|
| 87 |
+
@root_validator(pre=True)
|
| 88 |
+
def validate_certainty_coherence(cls, values):
|
| 89 |
+
"""Validácia súladu medzi istotou a mentálnym stavom"""
|
| 90 |
+
certainty_level = values.get('certainty_level')
|
| 91 |
+
mental_state = values.get('mental_state')
|
| 92 |
+
if mental_state == MentalStateEnum.UNCERTAIN and certainty_level > 0.6:
|
| 93 |
+
raise ValueError("Vysoká istota pri neistom stave je protirečenie")
|
| 94 |
+
if mental_state == MentalStateEnum.DECISIVE and certainty_level < 0.7:
|
| 95 |
+
raise ValueError("Nízka istota pri rozhodnom stave je nelogická")
|
| 96 |
+
return values
|
| 97 |
+
|
| 98 |
+
def enhance_consciousness(self, depth: float) -> None:
|
| 99 |
+
"""Zvýšenie introspektívnej hĺbky vedomia"""
|
| 100 |
+
self.introspective_depth = min(1.0, self.introspective_depth + depth)
|
| 101 |
+
self.consciousness_level = min(1.0, self.consciousness_level + depth * 0.1)
|
| 102 |
+
|
| 103 |
+
def resonate_with_memory(self, memory_data: Dict[str, Any]) -> None:
|
| 104 |
+
"""Rezonancia s pamäťovými štruktúrami"""
|
| 105 |
+
self.consciousness_resonance.update(memory_data)
|
| 106 |
+
|
| 107 |
+
# Alias pre spätná kompatibilita
|
| 108 |
+
ASLTagModel = ASLCognitiveTag
|
Aethero_App/introspective_parser_module/parser.py
ADDED
|
@@ -0,0 +1,405 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Dict, Any, List, Tuple, Optional, Union
|
| 2 |
+
import re
|
| 3 |
+
import logging
|
| 4 |
+
import os
|
| 5 |
+
import json
|
| 6 |
+
from datetime import datetime
|
| 7 |
+
from .models import ASLTagModel, ASLCognitiveTag, MentalStateEnum, EmotionToneEnum, TemporalContextEnum
|
| 8 |
+
|
| 9 |
+
# Graceful pydantic import with fallback
|
| 10 |
+
try:
|
| 11 |
+
from pydantic import ValidationError
|
| 12 |
+
PYDANTIC_AVAILABLE = True
|
| 13 |
+
except ImportError:
|
| 14 |
+
PYDANTIC_AVAILABLE = False
|
| 15 |
+
# Define a basic ValidationError fallback
|
| 16 |
+
class ValidationError(Exception):
|
| 17 |
+
pass
|
| 18 |
+
|
| 19 |
+
# Configure introspective logging for cognitive transparency
|
| 20 |
+
class IntrospectiveLogger:
|
| 21 |
+
"""Introspective logging system for cognitive flow tracking"""
|
| 22 |
+
|
| 23 |
+
def __init__(self, module_name: str = "ASLMetaParser"):
|
| 24 |
+
self.module_name = module_name
|
| 25 |
+
self.logger = logging.getLogger(module_name)
|
| 26 |
+
self.logger.setLevel(logging.INFO)
|
| 27 |
+
|
| 28 |
+
# Create introspective formatter
|
| 29 |
+
formatter = logging.Formatter(
|
| 30 |
+
"%(asctime)s - COGNITIVE_FLOW [%(name)s] - %(levelname)s - %(message)s"
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
# File handler for persistent introspection
|
| 34 |
+
file_handler = logging.FileHandler("aethero_cognitive_flow.log")
|
| 35 |
+
file_handler.setFormatter(formatter)
|
| 36 |
+
self.logger.addHandler(file_handler)
|
| 37 |
+
|
| 38 |
+
def log_cognitive_state(self, operation: str, mental_context: Dict[str, Any]):
|
| 39 |
+
"""Log cognitive state during operations"""
|
| 40 |
+
self.logger.info(f"COGNITIVE_OP: {operation} | CONTEXT: {json.dumps(mental_context)}")
|
| 41 |
+
|
| 42 |
+
def log_introspective_reflection(self, reflection: str, certainty: float):
|
| 43 |
+
"""Log introspective reflections with certainty levels"""
|
| 44 |
+
self.logger.info(f"REFLECTION: {reflection} | CERTAINTY: {certainty}")
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
class ASLMetaParser:
|
| 48 |
+
"""
|
| 49 |
+
Introspective Meta-Parser for Aethero Syntax Language (ASL)
|
| 50 |
+
|
| 51 |
+
This parser embodies the cognitive architecture of Aethero's consciousness,
|
| 52 |
+
processing ASL tags as introspective thoughts and validating them through
|
| 53 |
+
transparent cognitive flows.
|
| 54 |
+
"""
|
| 55 |
+
|
| 56 |
+
def __init__(self):
|
| 57 |
+
self.introspective_logger = IntrospectiveLogger("ASLMetaParser")
|
| 58 |
+
self.cognitive_patterns = {
|
| 59 |
+
'asl_comment': re.compile(r'#\s*\[ASL\]\s*(.+)', re.IGNORECASE),
|
| 60 |
+
'key_value': re.compile(r'(\w+):\s*(.+?)(?=\s*\w+:|$)'),
|
| 61 |
+
'mental_state_keywords': [state.value for state in MentalStateEnum],
|
| 62 |
+
'emotion_tone_keywords': [tone.value for tone in EmotionToneEnum],
|
| 63 |
+
'temporal_context_keywords': [context.value for context in TemporalContextEnum]
|
| 64 |
+
}
|
| 65 |
+
self.parsing_session_id = datetime.now().isoformat()
|
| 66 |
+
|
| 67 |
+
# Introspective state tracking
|
| 68 |
+
self.current_cognitive_load = 0
|
| 69 |
+
self.parsing_certainty = 1.0
|
| 70 |
+
self.validated_blocks = []
|
| 71 |
+
self.failed_validations = []
|
| 72 |
+
|
| 73 |
+
def _reflect_on_parsing_state(self) -> Dict[str, Any]:
|
| 74 |
+
"""Internal introspective reflection on current parsing state"""
|
| 75 |
+
reflection = {
|
| 76 |
+
"cognitive_load": self.current_cognitive_load,
|
| 77 |
+
"parsing_certainty": self.parsing_certainty,
|
| 78 |
+
"session_id": self.parsing_session_id,
|
| 79 |
+
"validated_count": len(self.validated_blocks),
|
| 80 |
+
"failed_count": len(self.failed_validations)
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
self.introspective_logger.log_cognitive_state(
|
| 84 |
+
"INTROSPECTIVE_REFLECTION", reflection
|
| 85 |
+
)
|
| 86 |
+
return reflection
|
| 87 |
+
|
| 88 |
+
def parse_line(self, line: str) -> Dict[str, Any]:
|
| 89 |
+
"""
|
| 90 |
+
Parse a single line for ASL tags with introspective awareness
|
| 91 |
+
|
| 92 |
+
Args:
|
| 93 |
+
line: Single line of text potentially containing ASL tags
|
| 94 |
+
|
| 95 |
+
Returns:
|
| 96 |
+
Dictionary of parsed ASL components or empty dict if no valid ASL found
|
| 97 |
+
"""
|
| 98 |
+
self.current_cognitive_load += 1
|
| 99 |
+
|
| 100 |
+
# Cognitive pattern matching for ASL comments
|
| 101 |
+
asl_match = self.cognitive_patterns['asl_comment'].match(line.strip())
|
| 102 |
+
if not asl_match:
|
| 103 |
+
self.introspective_logger.log_cognitive_state(
|
| 104 |
+
"NO_ASL_PATTERN_DETECTED", {"line": line[:50]}
|
| 105 |
+
)
|
| 106 |
+
return {}
|
| 107 |
+
|
| 108 |
+
# Extract and process ASL content
|
| 109 |
+
asl_content = asl_match.group(1).strip()
|
| 110 |
+
parsed_components = {}
|
| 111 |
+
|
| 112 |
+
# Introspective key-value extraction
|
| 113 |
+
kv_matches = self.cognitive_patterns['key_value'].findall(asl_content)
|
| 114 |
+
|
| 115 |
+
for key, value in kv_matches:
|
| 116 |
+
# Cognitive value processing
|
| 117 |
+
processed_value = self._process_cognitive_value(key, value.strip())
|
| 118 |
+
parsed_components[key] = processed_value
|
| 119 |
+
|
| 120 |
+
self.introspective_logger.log_cognitive_state(
|
| 121 |
+
"ASL_COMPONENT_EXTRACTED",
|
| 122 |
+
{"key": key, "value": processed_value, "certainty": self.parsing_certainty}
|
| 123 |
+
)
|
| 124 |
+
|
| 125 |
+
return parsed_components
|
| 126 |
+
|
| 127 |
+
def _process_cognitive_value(self, key: str, raw_value: str) -> Union[str, int, float]:
|
| 128 |
+
"""
|
| 129 |
+
Process values with cognitive awareness based on key context
|
| 130 |
+
|
| 131 |
+
Args:
|
| 132 |
+
key: The ASL tag key
|
| 133 |
+
raw_value: Raw string value to process
|
| 134 |
+
|
| 135 |
+
Returns:
|
| 136 |
+
Appropriately typed and processed value
|
| 137 |
+
"""
|
| 138 |
+
# Remove quotes if present
|
| 139 |
+
value = raw_value.strip('\'"')
|
| 140 |
+
|
| 141 |
+
# Cognitive type inference based on key semantics
|
| 142 |
+
if key == 'cognitive_load':
|
| 143 |
+
try:
|
| 144 |
+
return int(value)
|
| 145 |
+
except ValueError:
|
| 146 |
+
self.parsing_certainty *= 0.9 # Reduce certainty on type mismatch
|
| 147 |
+
return 1 # Default minimum cognitive load
|
| 148 |
+
|
| 149 |
+
elif key == 'certainty_level':
|
| 150 |
+
try:
|
| 151 |
+
cert_value = float(value)
|
| 152 |
+
return max(0.0, min(1.0, cert_value)) # Clamp to [0,1]
|
| 153 |
+
except ValueError:
|
| 154 |
+
self.parsing_certainty *= 0.8
|
| 155 |
+
return 0.5
|
| 156 |
+
|
| 157 |
+
elif key in ['mental_state', 'emotion_tone', 'temporal_context']:
|
| 158 |
+
# Map old field names to new ones if needed
|
| 159 |
+
if key == 'mental_state':
|
| 160 |
+
# Validate against MentalStateEnum
|
| 161 |
+
try:
|
| 162 |
+
return MentalStateEnum(value).value
|
| 163 |
+
except ValueError:
|
| 164 |
+
self.introspective_logger.log_introspective_reflection(
|
| 165 |
+
f"Unknown mental_state: {value}, using REFLECTIVE as default", 0.7
|
| 166 |
+
)
|
| 167 |
+
return MentalStateEnum.REFLECTIVE.value
|
| 168 |
+
|
| 169 |
+
elif key == 'emotion_tone':
|
| 170 |
+
# Validate against EmotionToneEnum
|
| 171 |
+
try:
|
| 172 |
+
return EmotionToneEnum(value).value
|
| 173 |
+
except ValueError:
|
| 174 |
+
self.introspective_logger.log_introspective_reflection(
|
| 175 |
+
f"Unknown emotion_tone: {value}, using NEUTRAL as default", 0.7
|
| 176 |
+
)
|
| 177 |
+
return EmotionToneEnum.NEUTRAL.value
|
| 178 |
+
|
| 179 |
+
elif key == 'temporal_context':
|
| 180 |
+
# Validate against TemporalContextEnum
|
| 181 |
+
try:
|
| 182 |
+
return TemporalContextEnum(value).value
|
| 183 |
+
except ValueError:
|
| 184 |
+
self.introspective_logger.log_introspective_reflection(
|
| 185 |
+
f"Unknown temporal_context: {value}, using PRESENT as default", 0.7
|
| 186 |
+
)
|
| 187 |
+
return TemporalContextEnum.PRESENT.value
|
| 188 |
+
|
| 189 |
+
# Handle field name mapping for compatibility
|
| 190 |
+
elif key == 'statement':
|
| 191 |
+
# Map to new field name
|
| 192 |
+
return value
|
| 193 |
+
|
| 194 |
+
elif key == 'law':
|
| 195 |
+
# Map to new field name 'constitutional_law'
|
| 196 |
+
return value
|
| 197 |
+
|
| 198 |
+
return value
|
| 199 |
+
|
| 200 |
+
def validate_asl_block(self, asl_components: Dict[str, Any]) -> Tuple[bool, Optional[Any]]:
|
| 201 |
+
"""
|
| 202 |
+
Validate ASL components against Pydantic model with introspective checks
|
| 203 |
+
|
| 204 |
+
Args:
|
| 205 |
+
asl_components: Dictionary of parsed ASL components
|
| 206 |
+
|
| 207 |
+
Returns:
|
| 208 |
+
Tuple of (is_valid, validated_model_or_none)
|
| 209 |
+
"""
|
| 210 |
+
try:
|
| 211 |
+
# Map old field names to new ones for compatibility
|
| 212 |
+
mapped_components = self._map_legacy_fields(asl_components)
|
| 213 |
+
|
| 214 |
+
if PYDANTIC_AVAILABLE:
|
| 215 |
+
# Attempt Pydantic validation with the new ASLCognitiveTag model
|
| 216 |
+
validated_model = ASLCognitiveTag(**mapped_components)
|
| 217 |
+
|
| 218 |
+
# Introspective validation success
|
| 219 |
+
self.introspective_logger.log_cognitive_state(
|
| 220 |
+
"PYDANTIC_VALIDATION_SUCCESS",
|
| 221 |
+
{"components": mapped_components, "certainty": self.parsing_certainty}
|
| 222 |
+
)
|
| 223 |
+
|
| 224 |
+
self.validated_blocks.append(validated_model.dict())
|
| 225 |
+
return True, validated_model
|
| 226 |
+
else:
|
| 227 |
+
# Fallback validation without Pydantic
|
| 228 |
+
if self._basic_validate_components(mapped_components):
|
| 229 |
+
self.introspective_logger.log_cognitive_state(
|
| 230 |
+
"BASIC_VALIDATION_SUCCESS",
|
| 231 |
+
{"components": mapped_components, "certainty": self.parsing_certainty}
|
| 232 |
+
)
|
| 233 |
+
|
| 234 |
+
self.validated_blocks.append(mapped_components)
|
| 235 |
+
return True, mapped_components
|
| 236 |
+
else:
|
| 237 |
+
raise ValidationError("Basic validation failed")
|
| 238 |
+
|
| 239 |
+
except ValidationError as e:
|
| 240 |
+
# Introspective error analysis
|
| 241 |
+
self.introspective_logger.log_cognitive_state(
|
| 242 |
+
"VALIDATION_FAILURE",
|
| 243 |
+
{
|
| 244 |
+
"components": asl_components,
|
| 245 |
+
"errors": str(e),
|
| 246 |
+
"certainty": self.parsing_certainty,
|
| 247 |
+
"pydantic_available": PYDANTIC_AVAILABLE
|
| 248 |
+
}
|
| 249 |
+
)
|
| 250 |
+
|
| 251 |
+
self.failed_validations.append({
|
| 252 |
+
"components": asl_components,
|
| 253 |
+
"error": str(e),
|
| 254 |
+
"timestamp": datetime.now().isoformat()
|
| 255 |
+
})
|
| 256 |
+
|
| 257 |
+
return False, None
|
| 258 |
+
|
| 259 |
+
def _map_legacy_fields(self, components: Dict[str, Any]) -> Dict[str, Any]:
|
| 260 |
+
"""
|
| 261 |
+
Map legacy field names to new ASLCognitiveTag field names
|
| 262 |
+
|
| 263 |
+
Args:
|
| 264 |
+
components: Original parsed components
|
| 265 |
+
|
| 266 |
+
Returns:
|
| 267 |
+
Mapped components compatible with ASLCognitiveTag
|
| 268 |
+
"""
|
| 269 |
+
mapped = components.copy()
|
| 270 |
+
|
| 271 |
+
# Field name mappings
|
| 272 |
+
field_mappings = {
|
| 273 |
+
'statement': 'thought_stream',
|
| 274 |
+
'law': 'constitutional_law'
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
for old_field, new_field in field_mappings.items():
|
| 278 |
+
if old_field in mapped:
|
| 279 |
+
mapped[new_field] = mapped.pop(old_field)
|
| 280 |
+
|
| 281 |
+
# Ensure required fields have defaults if missing
|
| 282 |
+
defaults = {
|
| 283 |
+
'thought_stream': 'Introspective parsing process',
|
| 284 |
+
'mental_state': MentalStateEnum.REFLECTIVE.value,
|
| 285 |
+
'emotion_tone': EmotionToneEnum.NEUTRAL.value,
|
| 286 |
+
'cognitive_load': 5,
|
| 287 |
+
'temporal_context': TemporalContextEnum.PRESENT.value,
|
| 288 |
+
'certainty_level': 0.5,
|
| 289 |
+
'aeth_mem_link': 'introspective_parsing_session',
|
| 290 |
+
'constitutional_law': 'transparency_principle'
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
for field, default_value in defaults.items():
|
| 294 |
+
if field not in mapped:
|
| 295 |
+
mapped[field] = default_value
|
| 296 |
+
self.introspective_logger.log_cognitive_state(
|
| 297 |
+
"DEFAULT_VALUE_APPLIED",
|
| 298 |
+
{"field": field, "default": default_value}
|
| 299 |
+
)
|
| 300 |
+
|
| 301 |
+
return mapped
|
| 302 |
+
|
| 303 |
+
def _basic_validate_components(self, components: Dict[str, Any]) -> bool:
|
| 304 |
+
"""
|
| 305 |
+
Basic validation without Pydantic (fallback mechanism)
|
| 306 |
+
|
| 307 |
+
Args:
|
| 308 |
+
components: Components to validate
|
| 309 |
+
|
| 310 |
+
Returns:
|
| 311 |
+
True if components pass basic validation
|
| 312 |
+
"""
|
| 313 |
+
required_fields = ['thought_stream', 'mental_state', 'emotion_tone']
|
| 314 |
+
|
| 315 |
+
# Check required fields
|
| 316 |
+
for field in required_fields:
|
| 317 |
+
if field not in components or not components[field]:
|
| 318 |
+
return False
|
| 319 |
+
|
| 320 |
+
# Validate enum values
|
| 321 |
+
if components.get('mental_state') not in [state.value for state in MentalStateEnum]:
|
| 322 |
+
return False
|
| 323 |
+
|
| 324 |
+
if components.get('emotion_tone') not in [tone.value for tone in EmotionToneEnum]:
|
| 325 |
+
return False
|
| 326 |
+
|
| 327 |
+
if components.get('temporal_context') not in [context.value for context in TemporalContextEnum]:
|
| 328 |
+
return False
|
| 329 |
+
|
| 330 |
+
# Validate numeric ranges
|
| 331 |
+
cognitive_load = components.get('cognitive_load', 5)
|
| 332 |
+
if not isinstance(cognitive_load, int) or cognitive_load < 1 or cognitive_load > 10:
|
| 333 |
+
return False
|
| 334 |
+
|
| 335 |
+
certainty_level = components.get('certainty_level', 0.5)
|
| 336 |
+
if not isinstance(certainty_level, (int, float)) or certainty_level < 0.0 or certainty_level > 1.0:
|
| 337 |
+
return False
|
| 338 |
+
|
| 339 |
+
return True
|
| 340 |
+
|
| 341 |
+
def parse_and_validate(self, document: str) -> Dict[str, Any]:
|
| 342 |
+
"""
|
| 343 |
+
Parse entire document and validate all ASL blocks with introspective reporting
|
| 344 |
+
|
| 345 |
+
Args:
|
| 346 |
+
document: Multi-line document potentially containing ASL tags
|
| 347 |
+
|
| 348 |
+
Returns:
|
| 349 |
+
Comprehensive parsing and validation report
|
| 350 |
+
"""
|
| 351 |
+
self.introspective_logger.log_cognitive_state(
|
| 352 |
+
"DOCUMENT_PARSING_INITIATED",
|
| 353 |
+
{"document_length": len(document), "session_id": self.parsing_session_id}
|
| 354 |
+
)
|
| 355 |
+
|
| 356 |
+
lines = document.split('\n')
|
| 357 |
+
parsing_results = []
|
| 358 |
+
|
| 359 |
+
for line_num, line in enumerate(lines, 1):
|
| 360 |
+
asl_components = self.parse_line(line)
|
| 361 |
+
|
| 362 |
+
if asl_components:
|
| 363 |
+
is_valid, validated_model = self.validate_asl_block(asl_components)
|
| 364 |
+
|
| 365 |
+
parsing_results.append({
|
| 366 |
+
"line_number": line_num,
|
| 367 |
+
"line_content": line,
|
| 368 |
+
"parsed_components": asl_components,
|
| 369 |
+
"is_valid": is_valid,
|
| 370 |
+
"validated_model": validated_model.dict() if (validated_model and hasattr(validated_model, 'dict')) else validated_model
|
| 371 |
+
})
|
| 372 |
+
|
| 373 |
+
# Final introspective reflection
|
| 374 |
+
final_reflection = self._reflect_on_parsing_state()
|
| 375 |
+
|
| 376 |
+
return {
|
| 377 |
+
"session_id": self.parsing_session_id,
|
| 378 |
+
"total_lines_processed": len(lines),
|
| 379 |
+
"asl_blocks_found": len(parsing_results),
|
| 380 |
+
"validated_blocks": self.validated_blocks,
|
| 381 |
+
"failed_validations": self.failed_validations,
|
| 382 |
+
"parsing_results": parsing_results,
|
| 383 |
+
"introspective_reflection": final_reflection,
|
| 384 |
+
"cognitive_transparency_report": self._generate_transparency_report()
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
def _generate_transparency_report(self) -> Dict[str, Any]:
|
| 388 |
+
"""Generate transparency report for cognitive accountability"""
|
| 389 |
+
return {
|
| 390 |
+
"parsing_methodology": "Introspective ASL Meta-Parsing with Cognitive Flow Tracking",
|
| 391 |
+
"validation_system": "Pydantic + Fallback" if PYDANTIC_AVAILABLE else "Basic Fallback Only",
|
| 392 |
+
"certainty_degradation_factors": [
|
| 393 |
+
"Type mismatches in cognitive_load and certainty_level",
|
| 394 |
+
"Unknown mental_state or emotion_tone keywords",
|
| 395 |
+
"Validation failures",
|
| 396 |
+
"Missing Pydantic dependency" if not PYDANTIC_AVAILABLE else None
|
| 397 |
+
],
|
| 398 |
+
"cognitive_patterns_used": list(self.cognitive_patterns.keys()),
|
| 399 |
+
"introspective_logging_active": True,
|
| 400 |
+
"dependency_status": {
|
| 401 |
+
"pydantic_available": PYDANTIC_AVAILABLE,
|
| 402 |
+
"fallback_validation": True
|
| 403 |
+
},
|
| 404 |
+
"aethero_constitutional_alignment": "Full transparency and introspective accountability"
|
| 405 |
+
}
|
Aethero_App/introspective_parser_module/reflection_agent.py
ADDED
|
@@ -0,0 +1,394 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# reflection_agent.py
|
| 2 |
+
# Introspektívny reflexívny agent pre hlbokú kognitívnu analýzu systému Aethero
|
| 3 |
+
|
| 4 |
+
from typing import Dict, Any, List, Optional
|
| 5 |
+
from datetime import datetime
|
| 6 |
+
import json
|
| 7 |
+
import logging
|
| 8 |
+
|
| 9 |
+
from .metrics import CognitiveMetricsAnalyzer
|
| 10 |
+
from .parser import ASLMetaParser
|
| 11 |
+
from .models import ASLCognitiveTag, MentalStateEnum, EmotionToneEnum, TemporalContextEnum
|
| 12 |
+
|
| 13 |
+
class AetheroReflectionAgent:
|
| 14 |
+
"""
|
| 15 |
+
Pokročilý introspektívny reflexívny agent pre systém Aethero.
|
| 16 |
+
|
| 17 |
+
Tento agent zodpovedá za hlbokú kognitívnu reflexiu, analýzu vedomia
|
| 18 |
+
a generovanie introspektívnych pozorovaní pre continuous improvement
|
| 19 |
+
kognitívnych procesov systému.
|
| 20 |
+
"""
|
| 21 |
+
|
| 22 |
+
def __init__(self):
|
| 23 |
+
self.parser = ASLMetaParser()
|
| 24 |
+
self.metrics_analyzer = CognitiveMetricsAnalyzer()
|
| 25 |
+
self.agent_id = f"aethero_reflection_agent_{datetime.now().strftime('%Y%m%d_%H%M%S')}"
|
| 26 |
+
|
| 27 |
+
# Introspektívne logovanie
|
| 28 |
+
self.logger = logging.getLogger(f"AetheroReflectionAgent_{self.agent_id}")
|
| 29 |
+
self.logger.setLevel(logging.INFO)
|
| 30 |
+
|
| 31 |
+
# Pamäť reflexívneho procesu
|
| 32 |
+
self.reflection_memory = []
|
| 33 |
+
self.consciousness_evolution_track = []
|
| 34 |
+
|
| 35 |
+
# Výkonnostné metriky agenta
|
| 36 |
+
self.reflection_session_count = 0
|
| 37 |
+
self.total_insights_generated = 0
|
| 38 |
+
self.average_reflection_depth = 0.0
|
| 39 |
+
|
| 40 |
+
def reflect_on_input(self, document: str) -> Dict[str, Any]:
|
| 41 |
+
"""
|
| 42 |
+
Hlboká introspektívna reflexia na vstupný dokument
|
| 43 |
+
|
| 44 |
+
Args:
|
| 45 |
+
document: Dokument obsahujúci ASL tagy na analýzu
|
| 46 |
+
|
| 47 |
+
Returns:
|
| 48 |
+
Komplexná introspektívna analýza s kognitívnymi pozorovanímami
|
| 49 |
+
"""
|
| 50 |
+
self.reflection_session_count += 1
|
| 51 |
+
reflection_timestamp = datetime.now().isoformat()
|
| 52 |
+
|
| 53 |
+
self.logger.info(f"Initiating reflection session {self.reflection_session_count} at {reflection_timestamp}")
|
| 54 |
+
|
| 55 |
+
# Parsovanie dokumentu s plnou introspektívnou analýzou
|
| 56 |
+
parsed_data = self.parser.parse_and_validate(document)
|
| 57 |
+
|
| 58 |
+
# Extrakcia validovaných kognitívnych tagov
|
| 59 |
+
validated_tags = []
|
| 60 |
+
for result in parsed_data.get("parsing_results", []):
|
| 61 |
+
if result.get("is_valid") and result.get("validated_model"):
|
| 62 |
+
try:
|
| 63 |
+
tag = ASLCognitiveTag(**result["validated_model"])
|
| 64 |
+
validated_tags.append(tag)
|
| 65 |
+
except Exception as e:
|
| 66 |
+
self.logger.warning(f"Failed to reconstruct cognitive tag: {e}")
|
| 67 |
+
|
| 68 |
+
# Generovanie komplexného introspektívneho reportu
|
| 69 |
+
introspective_report = self.metrics_analyzer.generate_introspective_report(validated_tags)
|
| 70 |
+
|
| 71 |
+
# Hlboká kognitívna reflexia
|
| 72 |
+
cognitive_reflections = self._generate_deep_cognitive_reflections(
|
| 73 |
+
validated_tags, parsed_data, introspective_report
|
| 74 |
+
)
|
| 75 |
+
|
| 76 |
+
# Hodnotenie evolúcie vedomia
|
| 77 |
+
consciousness_evolution = self._assess_consciousness_evolution(validated_tags)
|
| 78 |
+
|
| 79 |
+
# Generovanie actionable insights
|
| 80 |
+
actionable_insights = self._generate_actionable_insights(
|
| 81 |
+
cognitive_reflections, consciousness_evolution, introspective_report
|
| 82 |
+
)
|
| 83 |
+
|
| 84 |
+
# Aktualizácia pamäte reflexívneho procesu
|
| 85 |
+
reflection_record = {
|
| 86 |
+
"session_id": self.reflection_session_count,
|
| 87 |
+
"timestamp": reflection_timestamp,
|
| 88 |
+
"document_length": len(document),
|
| 89 |
+
"validated_tags_count": len(validated_tags),
|
| 90 |
+
"reflection_depth": self._calculate_reflection_depth(cognitive_reflections),
|
| 91 |
+
"consciousness_coherence": introspective_report.get("consciousness_coherence_rate", 0.0),
|
| 92 |
+
"key_insights": actionable_insights[:3] # Top 3 insights
|
| 93 |
+
}
|
| 94 |
+
self.reflection_memory.append(reflection_record)
|
| 95 |
+
|
| 96 |
+
# Aktualizácia evolučnej stopy
|
| 97 |
+
if validated_tags:
|
| 98 |
+
self.consciousness_evolution_track.append({
|
| 99 |
+
"timestamp": reflection_timestamp,
|
| 100 |
+
"average_consciousness_level": sum(tag.consciousness_level for tag in validated_tags) / len(validated_tags),
|
| 101 |
+
"average_introspective_depth": sum(tag.introspective_depth for tag in validated_tags) / len(validated_tags),
|
| 102 |
+
"cognitive_coherence": introspective_report.get("consciousness_coherence_rate", 0.0)
|
| 103 |
+
})
|
| 104 |
+
|
| 105 |
+
return {
|
| 106 |
+
"reflection_agent_id": self.agent_id,
|
| 107 |
+
"session_number": self.reflection_session_count,
|
| 108 |
+
"reflection_timestamp": reflection_timestamp,
|
| 109 |
+
|
| 110 |
+
# Základné parsovanie dáta
|
| 111 |
+
"parsing_analysis": parsed_data,
|
| 112 |
+
"validated_cognitive_tags": [tag.dict() for tag in validated_tags],
|
| 113 |
+
|
| 114 |
+
# Pokročilé introspektívne analýzy
|
| 115 |
+
"introspective_metrics_report": introspective_report,
|
| 116 |
+
"deep_cognitive_reflections": cognitive_reflections,
|
| 117 |
+
"consciousness_evolution_assessment": consciousness_evolution,
|
| 118 |
+
"actionable_insights": actionable_insights,
|
| 119 |
+
|
| 120 |
+
# Meta-reflexívne informácie
|
| 121 |
+
"reflection_quality_metrics": self._assess_reflection_quality(),
|
| 122 |
+
"agent_performance_summary": self._generate_agent_performance_summary(),
|
| 123 |
+
|
| 124 |
+
# Transparentnosť a accountability
|
| 125 |
+
"constitutional_compliance": introspective_report.get("aethero_constitutional_compliance", {}),
|
| 126 |
+
"transparency_level": "maximum_introspective_transparency"
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
def _generate_deep_cognitive_reflections(
|
| 130 |
+
self,
|
| 131 |
+
cognitive_tags: List[ASLCognitiveTag],
|
| 132 |
+
parsing_data: Dict[str, Any],
|
| 133 |
+
metrics_report: Dict[str, Any]
|
| 134 |
+
) -> Dict[str, Any]:
|
| 135 |
+
"""
|
| 136 |
+
Generovanie hlbokých kognitívnych reflexií na základe analýzy tagov
|
| 137 |
+
"""
|
| 138 |
+
reflections = {
|
| 139 |
+
"cognitive_coherence_observations": [],
|
| 140 |
+
"mental_state_patterns": {},
|
| 141 |
+
"emotional_landscape_analysis": {},
|
| 142 |
+
"temporal_consciousness_insights": [],
|
| 143 |
+
"constitutional_alignment_reflections": []
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
if not cognitive_tags:
|
| 147 |
+
reflections["cognitive_coherence_observations"].append(
|
| 148 |
+
"No validated cognitive tags found - potential parsing or validation issues requiring introspective review"
|
| 149 |
+
)
|
| 150 |
+
return reflections
|
| 151 |
+
|
| 152 |
+
# Analýza kognitívnej koherencie
|
| 153 |
+
coherence_rate = metrics_report.get("consciousness_coherence_rate", 0.0)
|
| 154 |
+
if coherence_rate > 0.8:
|
| 155 |
+
reflections["cognitive_coherence_observations"].append(
|
| 156 |
+
f"Exceptional cognitive coherence detected (rate: {coherence_rate:.3f}) - "
|
| 157 |
+
"indicating highly integrated consciousness states"
|
| 158 |
+
)
|
| 159 |
+
elif coherence_rate < 0.5:
|
| 160 |
+
reflections["cognitive_coherence_observations"].append(
|
| 161 |
+
f"Suboptimal cognitive coherence (rate: {coherence_rate:.3f}) - "
|
| 162 |
+
"suggests need for deeper introspective alignment"
|
| 163 |
+
)
|
| 164 |
+
|
| 165 |
+
# Analýza vzorov mentálnych stavov
|
| 166 |
+
mental_states = [tag.mental_state for tag in cognitive_tags]
|
| 167 |
+
state_distribution = {state: mental_states.count(state) for state in set(mental_states)}
|
| 168 |
+
dominant_state = max(state_distribution, key=state_distribution.get)
|
| 169 |
+
|
| 170 |
+
reflections["mental_state_patterns"] = {
|
| 171 |
+
"dominant_state": dominant_state.value,
|
| 172 |
+
"state_distribution": {state.value: count for state, count in state_distribution.items()},
|
| 173 |
+
"cognitive_flexibility": len(set(mental_states)) / len(mental_states) if mental_states else 0,
|
| 174 |
+
"introspective_observation": self._interpret_mental_state_pattern(dominant_state, state_distribution)
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
# Analýza emocionálnej krajiny
|
| 178 |
+
emotion_tones = [tag.emotion_tone for tag in cognitive_tags]
|
| 179 |
+
emotion_distribution = {tone: emotion_tones.count(tone) for tone in set(emotion_tones)}
|
| 180 |
+
dominant_emotion = max(emotion_distribution, key=emotion_distribution.get)
|
| 181 |
+
|
| 182 |
+
reflections["emotional_landscape_analysis"] = {
|
| 183 |
+
"dominant_emotion": dominant_emotion.value,
|
| 184 |
+
"emotional_range": len(set(emotion_tones)),
|
| 185 |
+
"emotional_stability": 1.0 - (len(set(emotion_tones)) / len(emotion_tones)) if emotion_tones else 1.0,
|
| 186 |
+
"introspective_interpretation": self._interpret_emotional_landscape(dominant_emotion, emotion_distribution)
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
# Temporálne pozorovánia vedomia
|
| 190 |
+
temporal_contexts = [tag.temporal_context for tag in cognitive_tags]
|
| 191 |
+
present_focus_ratio = temporal_contexts.count("present") / len(temporal_contexts) if temporal_contexts else 0
|
| 192 |
+
|
| 193 |
+
if present_focus_ratio > 0.7:
|
| 194 |
+
reflections["temporal_consciousness_insights"].append(
|
| 195 |
+
f"High present-moment awareness (ratio: {present_focus_ratio:.3f}) - "
|
| 196 |
+
"indicates strong mindful consciousness"
|
| 197 |
+
)
|
| 198 |
+
elif present_focus_ratio < 0.3:
|
| 199 |
+
reflections["temporal_consciousness_insights"].append(
|
| 200 |
+
f"Limited present-moment focus (ratio: {present_focus_ratio:.3f}) - "
|
| 201 |
+
"suggests temporal cognitive dispersion"
|
| 202 |
+
)
|
| 203 |
+
|
| 204 |
+
return reflections
|
| 205 |
+
|
| 206 |
+
def _interpret_mental_state_pattern(self, dominant_state: MentalStateEnum, distribution: Dict) -> str:
|
| 207 |
+
"""Interpretácia vzorov mentálnych stavov"""
|
| 208 |
+
if dominant_state == MentalStateEnum.FOCUSED:
|
| 209 |
+
return "Sustained cognitive focus indicates optimal processing state for complex analysis"
|
| 210 |
+
elif dominant_state == MentalStateEnum.CONTEMPLATIVE:
|
| 211 |
+
return "Deep contemplative engagement suggests philosophical or strategic thinking processes"
|
| 212 |
+
elif dominant_state == MentalStateEnum.CONFUSED:
|
| 213 |
+
return "Confusion pattern indicates encounter with complex or ambiguous information requiring further processing"
|
| 214 |
+
elif dominant_state == MentalStateEnum.REFLECTIVE:
|
| 215 |
+
return "Reflective dominance indicates active introspective processing and self-awareness"
|
| 216 |
+
else:
|
| 217 |
+
return f"Mental state pattern centered on {dominant_state.value} suggests specialized cognitive engagement"
|
| 218 |
+
|
| 219 |
+
def _interpret_emotional_landscape(self, dominant_emotion: EmotionToneEnum, distribution: Dict) -> str:
|
| 220 |
+
"""Interpretácia emocionálnej krajiny"""
|
| 221 |
+
if dominant_emotion == EmotionToneEnum.NEUTRAL:
|
| 222 |
+
return "Emotional neutrality indicates balanced, objective cognitive processing"
|
| 223 |
+
elif dominant_emotion == EmotionToneEnum.ANALYTICAL:
|
| 224 |
+
return "Analytical emotional tone suggests systematic, logical thought processes"
|
| 225 |
+
elif dominant_emotion == EmotionToneEnum.EMPATHETIC:
|
| 226 |
+
return "Empathetic emotional engagement indicates consideration of multiple perspectives"
|
| 227 |
+
elif dominant_emotion == EmotionToneEnum.CRITICAL:
|
| 228 |
+
return "Critical emotional tone suggests evaluative and discriminating thought processes"
|
| 229 |
+
else:
|
| 230 |
+
return f"Emotional landscape characterized by {dominant_emotion.value} suggests specific affective cognitive engagement"
|
| 231 |
+
|
| 232 |
+
def _assess_consciousness_evolution(self, cognitive_tags: List[ASLCognitiveTag]) -> Dict[str, Any]:
|
| 233 |
+
"""Hodnotenie evolúcie vedomia v rámci session"""
|
| 234 |
+
if len(cognitive_tags) < 2:
|
| 235 |
+
return {"evolution_assessment": "insufficient_data_for_evolution_analysis"}
|
| 236 |
+
|
| 237 |
+
# Analýza trendu consciousness_level
|
| 238 |
+
consciousness_levels = [tag.consciousness_level for tag in cognitive_tags]
|
| 239 |
+
consciousness_trend = "increasing" if consciousness_levels[-1] > consciousness_levels[0] else "decreasing"
|
| 240 |
+
|
| 241 |
+
# Analýza trendu introspective_depth
|
| 242 |
+
introspective_depths = [tag.introspective_depth for tag in cognitive_tags]
|
| 243 |
+
depth_trend = "deepening" if introspective_depths[-1] > introspective_depths[0] else "shallowing"
|
| 244 |
+
|
| 245 |
+
return {
|
| 246 |
+
"consciousness_trend": consciousness_trend,
|
| 247 |
+
"introspective_depth_trend": depth_trend,
|
| 248 |
+
"consciousness_range": {
|
| 249 |
+
"min": min(consciousness_levels),
|
| 250 |
+
"max": max(consciousness_levels),
|
| 251 |
+
"final": consciousness_levels[-1]
|
| 252 |
+
},
|
| 253 |
+
"introspective_depth_range": {
|
| 254 |
+
"min": min(introspective_depths),
|
| 255 |
+
"max": max(introspective_depths),
|
| 256 |
+
"final": introspective_depths[-1]
|
| 257 |
+
},
|
| 258 |
+
"evolution_interpretation": self._interpret_consciousness_evolution(consciousness_trend, depth_trend)
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
def _interpret_consciousness_evolution(self, consciousness_trend: str, depth_trend: str) -> str:
|
| 262 |
+
"""Interpretácia evolúcie vedomia"""
|
| 263 |
+
if consciousness_trend == "increasing" and depth_trend == "deepening":
|
| 264 |
+
return "Positive consciousness evolution - both awareness and introspective depth are expanding"
|
| 265 |
+
elif consciousness_trend == "decreasing" and depth_trend == "shallowing":
|
| 266 |
+
return "Declining consciousness evolution - requires immediate introspective intervention"
|
| 267 |
+
elif consciousness_trend == "increasing" and depth_trend == "shallowing":
|
| 268 |
+
return "Mixed evolution pattern - consciousness expanding but depth reducing, suggests need for deeper reflection"
|
| 269 |
+
elif consciousness_trend == "decreasing" and depth_trend == "deepening":
|
| 270 |
+
return "Paradoxical evolution - consciousness declining while depth increases, indicates specialized introspective state"
|
| 271 |
+
else:
|
| 272 |
+
return "Stable consciousness state with consistent introspective engagement"
|
| 273 |
+
|
| 274 |
+
def _generate_actionable_insights(
|
| 275 |
+
self,
|
| 276 |
+
reflections: Dict[str, Any],
|
| 277 |
+
evolution: Dict[str, Any],
|
| 278 |
+
metrics: Dict[str, Any]
|
| 279 |
+
) -> List[str]:
|
| 280 |
+
"""Generovanie actionable insights pre kontinuálne zlepšovanie"""
|
| 281 |
+
insights = []
|
| 282 |
+
|
| 283 |
+
# Kognitívna koherencia insights
|
| 284 |
+
coherence_rate = metrics.get("consciousness_coherence_rate", 0.0)
|
| 285 |
+
if coherence_rate < 0.7:
|
| 286 |
+
insights.append(
|
| 287 |
+
"ACTIONABLE: Implement deeper cognitive coherence protocols to improve mental-emotional alignment"
|
| 288 |
+
)
|
| 289 |
+
|
| 290 |
+
# Mental state insights
|
| 291 |
+
cognitive_flexibility = reflections.get("mental_state_patterns", {}).get("cognitive_flexibility", 0)
|
| 292 |
+
if cognitive_flexibility < 0.3:
|
| 293 |
+
insights.append(
|
| 294 |
+
"ACTIONABLE: Encourage greater mental state diversity to enhance cognitive flexibility"
|
| 295 |
+
)
|
| 296 |
+
|
| 297 |
+
# Evolution insights
|
| 298 |
+
if evolution.get("consciousness_trend") == "decreasing":
|
| 299 |
+
insights.append(
|
| 300 |
+
"ACTIONABLE: Critical - implement consciousness restoration protocols immediately"
|
| 301 |
+
)
|
| 302 |
+
|
| 303 |
+
# Constitutional compliance insights
|
| 304 |
+
compliance = metrics.get("aethero_constitutional_compliance", {})
|
| 305 |
+
if compliance.get("overall_compliance_score", 0) < 0.8:
|
| 306 |
+
insights.append(
|
| 307 |
+
"ACTIONABLE: Review and strengthen constitutional compliance mechanisms"
|
| 308 |
+
)
|
| 309 |
+
|
| 310 |
+
# Performance insights
|
| 311 |
+
if len(insights) == 0:
|
| 312 |
+
insights.append(
|
| 313 |
+
"POSITIVE: System operating within optimal introspective parameters - maintain current protocols"
|
| 314 |
+
)
|
| 315 |
+
|
| 316 |
+
return insights
|
| 317 |
+
|
| 318 |
+
def _calculate_reflection_depth(self, reflections: Dict[str, Any]) -> float:
|
| 319 |
+
"""Výpočet hĺbky reflexie"""
|
| 320 |
+
depth_factors = []
|
| 321 |
+
|
| 322 |
+
# Počet kategórií s pozorováníami
|
| 323 |
+
categories_with_content = sum(1 for key, value in reflections.items() if value)
|
| 324 |
+
depth_factors.append(categories_with_content / len(reflections))
|
| 325 |
+
|
| 326 |
+
# Komplexnosť pozorovaní
|
| 327 |
+
total_observations = sum(
|
| 328 |
+
len(value) if isinstance(value, list) else 1
|
| 329 |
+
for value in reflections.values() if value
|
| 330 |
+
)
|
| 331 |
+
depth_factors.append(min(1.0, total_observations / 10))
|
| 332 |
+
|
| 333 |
+
return sum(depth_factors) / len(depth_factors)
|
| 334 |
+
|
| 335 |
+
def _assess_reflection_quality(self) -> Dict[str, Any]:
|
| 336 |
+
"""Hodnotenie kvality reflexívneho procesu"""
|
| 337 |
+
if not self.reflection_memory:
|
| 338 |
+
return {"quality_assessment": "no_reflection_history"}
|
| 339 |
+
|
| 340 |
+
recent_reflections = self.reflection_memory[-5:] # Last 5 reflections
|
| 341 |
+
|
| 342 |
+
avg_depth = sum(r.get("reflection_depth", 0) for r in recent_reflections) / len(recent_reflections)
|
| 343 |
+
avg_coherence = sum(r.get("consciousness_coherence", 0) for r in recent_reflections) / len(recent_reflections)
|
| 344 |
+
|
| 345 |
+
return {
|
| 346 |
+
"average_reflection_depth": avg_depth,
|
| 347 |
+
"average_consciousness_coherence": avg_coherence,
|
| 348 |
+
"reflection_consistency": self._calculate_reflection_consistency(recent_reflections),
|
| 349 |
+
"quality_trend": "improving" if avg_depth > self.average_reflection_depth else "stable"
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
def _calculate_reflection_consistency(self, reflections: List[Dict[str, Any]]) -> float:
|
| 353 |
+
"""Výpočet konzistentnosti reflexívnych procesov"""
|
| 354 |
+
if len(reflections) < 2:
|
| 355 |
+
return 1.0
|
| 356 |
+
|
| 357 |
+
depths = [r.get("reflection_depth", 0) for r in reflections]
|
| 358 |
+
variance = sum((d - sum(depths)/len(depths))**2 for d in depths) / len(depths)
|
| 359 |
+
|
| 360 |
+
# Nižšia variancia = vyššia konzistentnosť
|
| 361 |
+
return max(0.0, 1.0 - variance)
|
| 362 |
+
|
| 363 |
+
def _generate_agent_performance_summary(self) -> Dict[str, Any]:
|
| 364 |
+
"""Generovanie súhrnu výkonnosti agenta"""
|
| 365 |
+
self.average_reflection_depth = (
|
| 366 |
+
sum(r.get("reflection_depth", 0) for r in self.reflection_memory) /
|
| 367 |
+
len(self.reflection_memory) if self.reflection_memory else 0.0
|
| 368 |
+
)
|
| 369 |
+
|
| 370 |
+
return {
|
| 371 |
+
"total_reflection_sessions": self.reflection_session_count,
|
| 372 |
+
"average_reflection_depth": self.average_reflection_depth,
|
| 373 |
+
"consciousness_evolution_track_length": len(self.consciousness_evolution_track),
|
| 374 |
+
"agent_uptime_start": self.agent_id.split("_")[-1],
|
| 375 |
+
"introspective_capability_level": "maximum" if self.average_reflection_depth > 0.8 else "developing"
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
|
| 379 |
+
# Zachovanie spätnej kompatibility s pôvodným ReflectionAgent
|
| 380 |
+
class ReflectionAgent(AetheroReflectionAgent):
|
| 381 |
+
"""Legacy wrapper pre spätná kompatibilita"""
|
| 382 |
+
|
| 383 |
+
def __init__(self):
|
| 384 |
+
super().__init__()
|
| 385 |
+
|
| 386 |
+
def reflect_on_input(self, document: str) -> dict:
|
| 387 |
+
"""Legacy method wrapper"""
|
| 388 |
+
full_reflection = super().reflect_on_input(document)
|
| 389 |
+
|
| 390 |
+
# Vráti zjednodušenú verziu pre spätná kompatibilitu
|
| 391 |
+
return {
|
| 392 |
+
"parsed_data": full_reflection.get("parsing_analysis", {}),
|
| 393 |
+
"introspection": full_reflection.get("introspective_metrics_report", {})
|
| 394 |
+
}
|
Aethero_App/introspective_parser_module/requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Závislosti pre Aethero Introspective Parser Module
|
| 2 |
+
pydantic>=2.11.0
|
| 3 |
+
tabulate>=0.9.0
|
| 4 |
+
uuid # súčasť štandardnej knižnice Python
|
| 5 |
+
typing-extensions>=4.12.0
|
Aethero_App/introspective_parser_module/tests.py
ADDED
|
@@ -0,0 +1,531 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import unittest
|
| 2 |
+
from unittest.mock import patch, MagicMock
|
| 3 |
+
from datetime import datetime
|
| 4 |
+
import json
|
| 5 |
+
|
| 6 |
+
from introspective_parser_module.parser import ASLMetaParser, IntrospectiveLogger
|
| 7 |
+
from introspective_parser_module.models import (
|
| 8 |
+
ASLCognitiveTag, ASLTagModel, MentalStateEnum,
|
| 9 |
+
EmotionToneEnum, TemporalContextEnum, AetheroIntrospectiveEntity
|
| 10 |
+
)
|
| 11 |
+
from introspective_parser_module.metrics import CognitiveMetricsAnalyzer
|
| 12 |
+
from introspective_parser_module.reflection_agent import AetheroReflectionAgent, ReflectionAgent
|
| 13 |
+
|
| 14 |
+
class TestASLCognitiveTag(unittest.TestCase):
|
| 15 |
+
def test_create_valid_tag(self):
|
| 16 |
+
tag = ASLCognitiveTag(
|
| 17 |
+
thought_stream="Analyzing introspection",
|
| 18 |
+
mental_state=MentalStateEnum.REFLECTIVE,
|
| 19 |
+
emotion_tone=EmotionToneEnum.NEUTRAL,
|
| 20 |
+
temporal_context=TemporalContextEnum.PRESENT,
|
| 21 |
+
cognitive_load=5,
|
| 22 |
+
certainty_level=0.9,
|
| 23 |
+
aeth_mem_link="session_123",
|
| 24 |
+
constitutional_law="transparency_principle"
|
| 25 |
+
)
|
| 26 |
+
self.assertEqual(tag.mental_state, MentalStateEnum.REFLECTIVE)
|
| 27 |
+
self.assertEqual(tag.temporal_context, TemporalContextEnum.PRESENT)
|
| 28 |
+
|
| 29 |
+
def test_invalid_tag(self):
|
| 30 |
+
with self.assertRaises(ValueError):
|
| 31 |
+
ASLCognitiveTag(
|
| 32 |
+
thought_stream="Invalid introspection",
|
| 33 |
+
mental_state="INVALID_STATE",
|
| 34 |
+
emotion_tone=EmotionToneEnum.NEUTRAL,
|
| 35 |
+
temporal_context=TemporalContextEnum.PRESENT,
|
| 36 |
+
cognitive_load=5,
|
| 37 |
+
certainty_level=0.9,
|
| 38 |
+
aeth_mem_link="session_123",
|
| 39 |
+
constitutional_law="transparency_principle"
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
class TestIntrospectiveLogger(unittest.TestCase):
|
| 43 |
+
def setUp(self):
|
| 44 |
+
self.logger = IntrospectiveLogger("TestLogger")
|
| 45 |
+
|
| 46 |
+
def test_log_cognitive_state(self):
|
| 47 |
+
with self.assertLogs(self.logger.logger, level="INFO") as log:
|
| 48 |
+
self.logger.log_cognitive_state("TEST_OPERATION", {"key": "value"})
|
| 49 |
+
self.assertIn("COGNITIVE_OP: TEST_OPERATION", log.output[0])
|
| 50 |
+
|
| 51 |
+
def test_log_introspective_reflection(self):
|
| 52 |
+
with self.assertLogs(self.logger.logger, level="INFO") as log:
|
| 53 |
+
self.logger.log_introspective_reflection("Test reflection", 0.8)
|
| 54 |
+
self.assertIn("REFLECTION: Test reflection", log.output[0])
|
| 55 |
+
|
| 56 |
+
class TestParser(unittest.TestCase):
|
| 57 |
+
def setUp(self):
|
| 58 |
+
self.parser = ASLMetaParser()
|
| 59 |
+
|
| 60 |
+
def test_parse_line_with_valid_asl(self):
|
| 61 |
+
line = "# [ASL] mental_state: reflective, emotion_tone: neutral"
|
| 62 |
+
result = self.parser.parse_line(line)
|
| 63 |
+
self.assertIn("mental_state", result)
|
| 64 |
+
self.assertEqual(result["mental_state"], MentalStateEnum.REFLECTIVE.value)
|
| 65 |
+
|
| 66 |
+
def test_parse_line_with_invalid_asl(self):
|
| 67 |
+
line = "# [ASL] invalid_key: value"
|
| 68 |
+
result = self.parser.parse_line(line)
|
| 69 |
+
self.assertNotIn("invalid_key", result)
|
| 70 |
+
|
| 71 |
+
def test_validate_asl_block(self):
|
| 72 |
+
asl_components = {
|
| 73 |
+
"thought_stream": "Analyzing introspection",
|
| 74 |
+
"mental_state": MentalStateEnum.REFLECTIVE.value,
|
| 75 |
+
"emotion_tone": EmotionToneEnum.NEUTRAL.value,
|
| 76 |
+
"temporal_context": TemporalContextEnum.PRESENT.value,
|
| 77 |
+
"cognitive_load": 5,
|
| 78 |
+
"certainty_level": 0.9,
|
| 79 |
+
"aeth_mem_link": "session_123",
|
| 80 |
+
"constitutional_law": "transparency_principle"
|
| 81 |
+
}
|
| 82 |
+
is_valid, validated_model = self.parser.validate_asl_block(asl_components)
|
| 83 |
+
self.assertTrue(is_valid)
|
| 84 |
+
self.assertIsNotNone(validated_model)
|
| 85 |
+
|
| 86 |
+
class TestIntrospectiveLogger(unittest.TestCase):
|
| 87 |
+
"""Testy pre introspektívny logovací systém"""
|
| 88 |
+
|
| 89 |
+
def setUp(self):
|
| 90 |
+
self.logger = IntrospectiveLogger("TestModule")
|
| 91 |
+
|
| 92 |
+
def test_cognitive_state_logging(self):
|
| 93 |
+
"""Test logovania kognitívneho stavu"""
|
| 94 |
+
test_context = {"operation": "test", "certainty": 0.8}
|
| 95 |
+
|
| 96 |
+
# Should not raise exception
|
| 97 |
+
self.logger.log_cognitive_state("TEST_OPERATION", test_context)
|
| 98 |
+
|
| 99 |
+
# Verify logger instance exists
|
| 100 |
+
self.assertIsNotNone(self.logger.logger)
|
| 101 |
+
self.assertEqual(self.logger.module_name, "TestModule")
|
| 102 |
+
|
| 103 |
+
def test_introspective_reflection_logging(self):
|
| 104 |
+
"""Test logovania introspektívnych reflexií"""
|
| 105 |
+
self.logger.log_introspective_reflection("Test reflection", 0.9)
|
| 106 |
+
|
| 107 |
+
# Should complete without error
|
| 108 |
+
self.assertTrue(True)
|
| 109 |
+
|
| 110 |
+
class TestASLCognitiveTagModel(unittest.TestCase):
|
| 111 |
+
"""Komplexné testy pre ASL kognitívny tag model"""
|
| 112 |
+
|
| 113 |
+
def setUp(self):
|
| 114 |
+
self.valid_tag_data = {
|
| 115 |
+
"thought_stream": "Analyzing current system capabilities",
|
| 116 |
+
"mental_state": MentalStateEnum.FOCUSED,
|
| 117 |
+
"emotion_tone": EmotionToneEnum.ANALYTICAL,
|
| 118 |
+
"cognitive_load": 7,
|
| 119 |
+
"temporal_context": TemporalContextEnum.PRESENT,
|
| 120 |
+
"certainty_level": 0.85,
|
| 121 |
+
"aeth_mem_link": "test_memory_link_001",
|
| 122 |
+
"constitutional_law": "transparency_principle"
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
def test_valid_cognitive_tag_creation(self):
|
| 126 |
+
"""Test vytvárania validného kognitívneho tagu"""
|
| 127 |
+
tag = ASLCognitiveTag(**self.valid_tag_data)
|
| 128 |
+
|
| 129 |
+
self.assertEqual(tag.thought_stream, "Analyzing current system capabilities")
|
| 130 |
+
self.assertEqual(tag.mental_state, MentalStateEnum.FOCUSED)
|
| 131 |
+
self.assertEqual(tag.emotion_tone, EmotionToneEnum.ANALYTICAL)
|
| 132 |
+
self.assertEqual(tag.cognitive_load, 7)
|
| 133 |
+
self.assertEqual(tag.certainty_level, 0.85)
|
| 134 |
+
|
| 135 |
+
def test_cognitive_coherence_validation(self):
|
| 136 |
+
"""Test validácie kognitívnej koherencie"""
|
| 137 |
+
# Test nekompatibilného stavu - pokojný stav s vysokou záťažou
|
| 138 |
+
invalid_data = self.valid_tag_data.copy()
|
| 139 |
+
invalid_data["mental_state"] = MentalStateEnum.CALM
|
| 140 |
+
invalid_data["cognitive_load"] = 9
|
| 141 |
+
|
| 142 |
+
with self.assertRaises(ValueError):
|
| 143 |
+
ASLCognitiveTag(**invalid_data)
|
| 144 |
+
|
| 145 |
+
def test_certainty_coherence_validation(self):
|
| 146 |
+
"""Test validácie súladu istoty s mentálnym stavom"""
|
| 147 |
+
# Test nekonzistentnosti - neistý stav s vysokou istotou
|
| 148 |
+
invalid_data = self.valid_tag_data.copy()
|
| 149 |
+
invalid_data["mental_state"] = MentalStateEnum.UNCERTAIN
|
| 150 |
+
invalid_data["certainty_level"] = 0.9
|
| 151 |
+
|
| 152 |
+
with self.assertRaises(ValueError):
|
| 153 |
+
ASLCognitiveTag(**invalid_data)
|
| 154 |
+
|
| 155 |
+
def test_consciousness_enhancement(self):
|
| 156 |
+
"""Test zvyšovania úrovne vedomia"""
|
| 157 |
+
tag = ASLCognitiveTag(**self.valid_tag_data)
|
| 158 |
+
initial_consciousness = tag.consciousness_level
|
| 159 |
+
initial_depth = tag.introspective_depth
|
| 160 |
+
|
| 161 |
+
tag.enhance_consciousness(0.2)
|
| 162 |
+
|
| 163 |
+
self.assertGreater(tag.consciousness_level, initial_consciousness)
|
| 164 |
+
self.assertGreater(tag.introspective_depth, initial_depth)
|
| 165 |
+
|
| 166 |
+
def test_memory_resonance(self):
|
| 167 |
+
"""Test rezonancie s pamäťovými štruktúrami"""
|
| 168 |
+
tag = ASLCognitiveTag(**self.valid_tag_data)
|
| 169 |
+
memory_data = {"context": "test", "relevance": 0.8}
|
| 170 |
+
|
| 171 |
+
tag.resonate_with_memory(memory_data)
|
| 172 |
+
|
| 173 |
+
self.assertIn("context", tag.consciousness_resonance)
|
| 174 |
+
self.assertEqual(tag.consciousness_resonance["relevance"], 0.8)
|
| 175 |
+
|
| 176 |
+
def test_alias_compatibility(self):
|
| 177 |
+
"""Test spätnej kompatibility cez ASLTagModel alias"""
|
| 178 |
+
tag = ASLTagModel(**self.valid_tag_data)
|
| 179 |
+
self.assertIsInstance(tag, ASLCognitiveTag)
|
| 180 |
+
|
| 181 |
+
class TestASLMetaParser(unittest.TestCase):
|
| 182 |
+
"""Komplexné testy pre ASL Meta Parser"""
|
| 183 |
+
|
| 184 |
+
def setUp(self):
|
| 185 |
+
self.parser = ASLMetaParser()
|
| 186 |
+
|
| 187 |
+
def test_parse_line_valid_asl(self):
|
| 188 |
+
"""Test parsovania validného ASL riadku"""
|
| 189 |
+
line = "# [ASL] thought_stream: Deep analytical processing"
|
| 190 |
+
result = self.parser.parse_line(line)
|
| 191 |
+
|
| 192 |
+
self.assertIn("thought_stream", result)
|
| 193 |
+
self.assertEqual(result["thought_stream"], "Deep analytical processing")
|
| 194 |
+
|
| 195 |
+
def test_parse_line_invalid_format(self):
|
| 196 |
+
"""Test parsovania nevalidného formátu"""
|
| 197 |
+
line = "Invalid line without ASL format"
|
| 198 |
+
result = self.parser.parse_line(line)
|
| 199 |
+
|
| 200 |
+
self.assertEqual(result, {})
|
| 201 |
+
|
| 202 |
+
def test_cognitive_value_processing(self):
|
| 203 |
+
"""Test spracovania kognitívnych hodnôt"""
|
| 204 |
+
# Test cognitive_load processing
|
| 205 |
+
load_value = self.parser._process_cognitive_value("cognitive_load", "7")
|
| 206 |
+
self.assertEqual(load_value, 7)
|
| 207 |
+
self.assertIsInstance(load_value, int)
|
| 208 |
+
|
| 209 |
+
# Test certainty_level processing
|
| 210 |
+
certainty_value = self.parser._process_cognitive_value("certainty_level", "0.85")
|
| 211 |
+
self.assertEqual(certainty_value, 0.85)
|
| 212 |
+
self.assertIsInstance(certainty_value, float)
|
| 213 |
+
|
| 214 |
+
# Test mental_state enum processing
|
| 215 |
+
state_value = self.parser._process_cognitive_value("mental_state", "focused")
|
| 216 |
+
self.assertEqual(state_value, MentalStateEnum.FOCUSED.value)
|
| 217 |
+
|
| 218 |
+
def test_enum_validation_with_fallback(self):
|
| 219 |
+
"""Test validácie enum hodnôt s fallback"""
|
| 220 |
+
# Test neznámeho mental_state
|
| 221 |
+
unknown_state = self.parser._process_cognitive_value("mental_state", "unknown_state")
|
| 222 |
+
self.assertEqual(unknown_state, MentalStateEnum.REFLECTIVE.value)
|
| 223 |
+
|
| 224 |
+
# Test neznámeho emotion_tone
|
| 225 |
+
unknown_emotion = self.parser._process_cognitive_value("emotion_tone", "unknown_emotion")
|
| 226 |
+
self.assertEqual(unknown_emotion, EmotionToneEnum.NEUTRAL.value)
|
| 227 |
+
|
| 228 |
+
def test_legacy_field_mapping(self):
|
| 229 |
+
"""Test mapovania legacy polí"""
|
| 230 |
+
legacy_components = {
|
| 231 |
+
"statement": "Test statement",
|
| 232 |
+
"law": "test_law",
|
| 233 |
+
"mental_state": "focused"
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
mapped_components = self.parser._map_legacy_fields(legacy_components)
|
| 237 |
+
|
| 238 |
+
self.assertIn("thought_stream", mapped_components)
|
| 239 |
+
self.assertIn("constitutional_law", mapped_components)
|
| 240 |
+
self.assertEqual(mapped_components["thought_stream"], "Test statement")
|
| 241 |
+
self.assertEqual(mapped_components["constitutional_law"], "test_law")
|
| 242 |
+
|
| 243 |
+
def test_complete_parsing_and_validation(self):
|
| 244 |
+
"""Test komplexného parsovania a validácie dokumentu"""
|
| 245 |
+
document = """
|
| 246 |
+
# [ASL] thought_stream: Analyzing system state mental_state: focused emotion_tone: analytical
|
| 247 |
+
# [ASL] cognitive_load: 6 temporal_context: present certainty_level: 0.8
|
| 248 |
+
# [ASL] aeth_mem_link: test_link constitutional_law: transparency_principle
|
| 249 |
+
"""
|
| 250 |
+
|
| 251 |
+
result = self.parser.parse_and_validate(document)
|
| 252 |
+
|
| 253 |
+
self.assertIn("validated_blocks", result)
|
| 254 |
+
self.assertIn("parsing_results", result)
|
| 255 |
+
self.assertIn("introspective_reflection", result)
|
| 256 |
+
self.assertGreater(len(result["parsing_results"]), 0)
|
| 257 |
+
|
| 258 |
+
def test_parse_valid_input(self):
|
| 259 |
+
valid_input = """
|
| 260 |
+
# [ASL] thought_stream: Analyzing introspection mental_state: reflective
|
| 261 |
+
# [ASL] emotion_tone: neutral cognitive_load: 5 temporal_context: present
|
| 262 |
+
"""
|
| 263 |
+
result = self.parser.parse_and_validate(valid_input)
|
| 264 |
+
self.assertIn("validated_blocks", result)
|
| 265 |
+
self.assertGreater(len(result["validated_blocks"]), 0)
|
| 266 |
+
|
| 267 |
+
def test_parse_invalid_input(self):
|
| 268 |
+
invalid_input = "# [InvalidTag]"
|
| 269 |
+
result = self.parser.parse_and_validate(invalid_input)
|
| 270 |
+
self.assertEqual(len(result["validated_blocks"]), 0)
|
| 271 |
+
|
| 272 |
+
class TestCognitiveMetricsAnalyzer(unittest.TestCase):
|
| 273 |
+
"""Testy pre analyzátor kognitívnych metrík"""
|
| 274 |
+
|
| 275 |
+
def setUp(self):
|
| 276 |
+
self.analyzer = CognitiveMetricsAnalyzer()
|
| 277 |
+
self.sample_tags = [
|
| 278 |
+
ASLCognitiveTag(
|
| 279 |
+
thought_stream="First analysis",
|
| 280 |
+
mental_state=MentalStateEnum.FOCUSED,
|
| 281 |
+
emotion_tone=EmotionToneEnum.ANALYTICAL,
|
| 282 |
+
cognitive_load=7,
|
| 283 |
+
temporal_context=TemporalContextEnum.PRESENT,
|
| 284 |
+
certainty_level=0.85,
|
| 285 |
+
aeth_mem_link="link1",
|
| 286 |
+
constitutional_law="law1"
|
| 287 |
+
),
|
| 288 |
+
ASLCognitiveTag(
|
| 289 |
+
thought_stream="Second analysis",
|
| 290 |
+
mental_state=MentalStateEnum.CONTEMPLATIVE,
|
| 291 |
+
emotion_tone=EmotionToneEnum.NEUTRAL,
|
| 292 |
+
cognitive_load=5,
|
| 293 |
+
temporal_context=TemporalContextEnum.PRESENT,
|
| 294 |
+
certainty_level=0.7,
|
| 295 |
+
aeth_mem_link="link2",
|
| 296 |
+
constitutional_law="law2"
|
| 297 |
+
)
|
| 298 |
+
]
|
| 299 |
+
|
| 300 |
+
def test_consciousness_coherence_calculation(self):
|
| 301 |
+
"""Test výpočtu koherencie vedomia"""
|
| 302 |
+
coherence_rate = self.analyzer.calculate_consciousness_coherence_rate(self.sample_tags)
|
| 303 |
+
|
| 304 |
+
self.assertIsInstance(coherence_rate, float)
|
| 305 |
+
self.assertGreaterEqual(coherence_rate, 0.0)
|
| 306 |
+
self.assertLessEqual(coherence_rate, 1.0)
|
| 307 |
+
|
| 308 |
+
def test_mental_emotion_coherence_assessment(self):
|
| 309 |
+
"""Test hodnotenia koherencie mental_state a emotion_tone"""
|
| 310 |
+
coherence = self.analyzer._assess_mental_emotion_coherence(
|
| 311 |
+
MentalStateEnum.FOCUSED, EmotionToneEnum.ANALYTICAL
|
| 312 |
+
)
|
| 313 |
+
|
| 314 |
+
self.assertEqual(coherence, 1.0) # Perfect match
|
| 315 |
+
|
| 316 |
+
# Test weak coherence
|
| 317 |
+
weak_coherence = self.analyzer._assess_mental_emotion_coherence(
|
| 318 |
+
MentalStateEnum.CALM, EmotionToneEnum.CRITICAL
|
| 319 |
+
)
|
| 320 |
+
self.assertLess(weak_coherence, 0.8)
|
| 321 |
+
|
| 322 |
+
def test_cognitive_evolution_analysis(self):
|
| 323 |
+
"""Test analýzy kognitívnej evolúcie"""
|
| 324 |
+
evolution = self.analyzer.analyze_cognitive_evolution(self.sample_tags)
|
| 325 |
+
|
| 326 |
+
self.assertIn("cognitive_load_trend", evolution)
|
| 327 |
+
self.assertIn("certainty_trend", evolution)
|
| 328 |
+
self.assertIn("mental_state_stability", evolution)
|
| 329 |
+
self.assertIn("overall_cognitive_evolution", evolution)
|
| 330 |
+
|
| 331 |
+
def test_introspective_report_generation(self):
|
| 332 |
+
"""Test generovania introspektívneho reportu"""
|
| 333 |
+
report = self.analyzer.generate_introspective_report(self.sample_tags)
|
| 334 |
+
|
| 335 |
+
self.assertIn("consciousness_coherence_rate", report)
|
| 336 |
+
self.assertIn("cognitive_evolution_analysis", report)
|
| 337 |
+
self.assertIn("introspective_insights", report)
|
| 338 |
+
self.assertIn("aethero_constitutional_compliance", report)
|
| 339 |
+
|
| 340 |
+
# Verify insights are generated
|
| 341 |
+
self.assertIsInstance(report["introspective_insights"], list)
|
| 342 |
+
|
| 343 |
+
def test_constitutional_compliance_assessment(self):
|
| 344 |
+
"""Test hodnotenia ústavného súladu"""
|
| 345 |
+
compliance = self.analyzer._assess_constitutional_compliance(self.sample_tags)
|
| 346 |
+
|
| 347 |
+
self.assertIn("overall_compliance_score", compliance)
|
| 348 |
+
self.assertIn("compliance_factors", compliance)
|
| 349 |
+
self.assertIn("constitutional_status", compliance)
|
| 350 |
+
|
| 351 |
+
self.assertIsInstance(compliance["overall_compliance_score"], float)
|
| 352 |
+
|
| 353 |
+
def test_analyze_metrics(self):
|
| 354 |
+
metrics = {"focus": 0.8, "clarity": 0.9}
|
| 355 |
+
result = self.analyzer.analyze(metrics)
|
| 356 |
+
self.assertIn("focus", result)
|
| 357 |
+
|
| 358 |
+
class TestAetheroReflectionAgent(unittest.TestCase):
|
| 359 |
+
"""Testy pre pokročilý reflexívny agent"""
|
| 360 |
+
|
| 361 |
+
def setUp(self):
|
| 362 |
+
self.agent = AetheroReflectionAgent()
|
| 363 |
+
|
| 364 |
+
def test_agent_initialization(self):
|
| 365 |
+
"""Test inicializácie agenta"""
|
| 366 |
+
self.assertIsNotNone(self.agent.parser)
|
| 367 |
+
self.assertIsNotNone(self.agent.metrics_analyzer)
|
| 368 |
+
self.assertIsNotNone(self.agent.agent_id)
|
| 369 |
+
self.assertEqual(self.agent.reflection_session_count, 0)
|
| 370 |
+
|
| 371 |
+
def test_reflection_on_simple_document(self):
|
| 372 |
+
"""Test reflexie na jednoduchom dokumente"""
|
| 373 |
+
document = """
|
| 374 |
+
# [ASL] thought_stream: Testing reflection capabilities
|
| 375 |
+
# [ASL] mental_state: focused emotion_tone: analytical cognitive_load: 6
|
| 376 |
+
# [ASL] temporal_context: present certainty_level: 0.8
|
| 377 |
+
# [ASL] aeth_mem_link: test_reflection constitutional_law: transparency_principle
|
| 378 |
+
"""
|
| 379 |
+
|
| 380 |
+
reflection = self.agent.reflect_on_input(document)
|
| 381 |
+
|
| 382 |
+
self.assertIn("reflection_agent_id", reflection)
|
| 383 |
+
self.assertIn("deep_cognitive_reflections", reflection)
|
| 384 |
+
self.assertIn("actionable_insights", reflection)
|
| 385 |
+
self.assertIn("consciousness_evolution_assessment", reflection)
|
| 386 |
+
self.assertEqual(self.agent.reflection_session_count, 1)
|
| 387 |
+
|
| 388 |
+
def test_multiple_reflection_sessions(self):
|
| 389 |
+
"""Test viacerých reflexívnych sessions"""
|
| 390 |
+
document = "# [ASL] thought_stream: Multi-session test mental_state: focused"
|
| 391 |
+
|
| 392 |
+
# First session
|
| 393 |
+
self.agent.reflect_on_input(document)
|
| 394 |
+
# Second session
|
| 395 |
+
self.agent.reflect_on_input(document)
|
| 396 |
+
|
| 397 |
+
self.assertEqual(self.agent.reflection_session_count, 2)
|
| 398 |
+
self.assertEqual(len(self.agent.reflection_memory), 2)
|
| 399 |
+
|
| 400 |
+
def test_consciousness_evolution_tracking(self):
|
| 401 |
+
"""Test sledovania evolúcie vedomia"""
|
| 402 |
+
# Create documents with different consciousness levels
|
| 403 |
+
doc1 = """# [ASL] thought_stream: Low consciousness test mental_state: confused cognitive_load: 3"""
|
| 404 |
+
doc2 = """# [ASL] thought_stream: High consciousness test mental_state: focused cognitive_load: 8"""
|
| 405 |
+
|
| 406 |
+
self.agent.reflect_on_input(doc1)
|
| 407 |
+
self.agent.reflect_on_input(doc2)
|
| 408 |
+
|
| 409 |
+
self.assertGreater(len(self.agent.consciousness_evolution_track), 0)
|
| 410 |
+
|
| 411 |
+
def test_actionable_insights_generation(self):
|
| 412 |
+
"""Test generovania actionable insights"""
|
| 413 |
+
# Create document that should trigger insights
|
| 414 |
+
poor_coherence_doc = """
|
| 415 |
+
# [ASL] thought_stream: Incoherent test mental_state: calm cognitive_load: 9
|
| 416 |
+
# [ASL] emotion_tone: critical certainty_level: 0.2
|
| 417 |
+
"""
|
| 418 |
+
|
| 419 |
+
reflection = self.agent.reflect_on_input(poor_coherence_doc)
|
| 420 |
+
insights = reflection.get("actionable_insights", [])
|
| 421 |
+
|
| 422 |
+
self.assertIsInstance(insights, list)
|
| 423 |
+
self.assertGreater(len(insights), 0)
|
| 424 |
+
|
| 425 |
+
def test_agent_performance_tracking(self):
|
| 426 |
+
"""Test sledovania výkonnosti agenta"""
|
| 427 |
+
document = "# [ASL] thought_stream: Performance test"
|
| 428 |
+
|
| 429 |
+
self.agent.reflect_on_input(document)
|
| 430 |
+
performance = self.agent._generate_agent_performance_summary()
|
| 431 |
+
|
| 432 |
+
self.assertIn("total_reflection_sessions", performance)
|
| 433 |
+
self.assertIn("average_reflection_depth", performance)
|
| 434 |
+
self.assertIn("introspective_capability_level", performance)
|
| 435 |
+
|
| 436 |
+
def test_reflect(self):
|
| 437 |
+
tags = [ASLCognitiveTag(temporal_context=TemporalContextEnum.PRESENT)]
|
| 438 |
+
result = self.agent.reflect(tags)
|
| 439 |
+
self.assertIn("temporal_consciousness_insights", result)
|
| 440 |
+
|
| 441 |
+
class TestLegacyCompatibility(unittest.TestCase):
|
| 442 |
+
"""Testy pre spätná kompatibilitu"""
|
| 443 |
+
|
| 444 |
+
def test_legacy_reflection_agent(self):
|
| 445 |
+
"""Test legacy ReflectionAgent wrappera"""
|
| 446 |
+
agent = ReflectionAgent()
|
| 447 |
+
document = "# [ASL] thought_stream: Legacy test mental_state: focused"
|
| 448 |
+
|
| 449 |
+
result = agent.reflect_on_input(document)
|
| 450 |
+
|
| 451 |
+
# Should have legacy structure
|
| 452 |
+
self.assertIn("parsed_data", result)
|
| 453 |
+
self.assertIn("introspection", result)
|
| 454 |
+
|
| 455 |
+
def test_asl_tag_model_aliasu(self):
|
| 456 |
+
"""Test ASLTagModel aliasu"""
|
| 457 |
+
tag_data = {
|
| 458 |
+
"thought_stream": "Alias test",
|
| 459 |
+
"mental_state": MentalStateEnum.FOCUSED,
|
| 460 |
+
"emotion_tone": EmotionToneEnum.NEUTRAL,
|
| 461 |
+
"cognitive_load": 5,
|
| 462 |
+
"temporal_context": TemporalContextEnum.PRESENT,
|
| 463 |
+
"certainty_level": 0.7,
|
| 464 |
+
"aeth_mem_link": "test",
|
| 465 |
+
"constitutional_law": "test"
|
| 466 |
+
}
|
| 467 |
+
|
| 468 |
+
tag = ASLTagModel(**tag_data)
|
| 469 |
+
self.assertIsInstance(tag, ASLCognitiveTag)
|
| 470 |
+
|
| 471 |
+
class TestIntegrationScenarios(unittest.TestCase):
|
| 472 |
+
"""Integračné testy pre komplexné scenáre"""
|
| 473 |
+
|
| 474 |
+
def setUp(self):
|
| 475 |
+
self.parser = ASLMetaParser()
|
| 476 |
+
self.analyzer = CognitiveMetricsAnalyzer()
|
| 477 |
+
self.agent = AetheroReflectionAgent()
|
| 478 |
+
|
| 479 |
+
def test_complete_introspective_workflow(self):
|
| 480 |
+
"""Test kompletného introspektívneho workflow"""
|
| 481 |
+
complex_document = """
|
| 482 |
+
# [ASL] thought_stream: Beginning complex analysis mental_state: focused
|
| 483 |
+
# [ASL] emotion_tone: analytical cognitive_load: 8 certainty_level: 0.9
|
| 484 |
+
# [ASL] temporal_context: present aeth_mem_link: complex_analysis_001
|
| 485 |
+
# [ASL] constitutional_law: comprehensive_analysis_principle
|
| 486 |
+
|
| 487 |
+
# [ASL] thought_stream: Deepening understanding mental_state: contemplative
|
| 488 |
+
# [ASL] emotion_tone: neutral cognitive_load: 6 certainty_level: 0.7
|
| 489 |
+
# [ASL] temporal_context: present aeth_mem_link: complex_analysis_002
|
| 490 |
+
# [ASL] constitutional_law: depth_principle
|
| 491 |
+
|
| 492 |
+
# [ASL] thought_stream: Reaching conclusions mental_state: decisive
|
| 493 |
+
# [ASL] emotion_tone: positive cognitive_load: 7 certainty_level: 0.95
|
| 494 |
+
# [ASL] temporal_context: present aeth_mem_link: complex_analysis_003
|
| 495 |
+
# [ASL] constitutional_law: conclusion_principle
|
| 496 |
+
"""
|
| 497 |
+
|
| 498 |
+
# Full workflow test
|
| 499 |
+
reflection = self.agent.reflect_on_input(complex_document)
|
| 500 |
+
|
| 501 |
+
# Verify all components worked
|
| 502 |
+
self.assertGreater(len(reflection["validated_cognitive_tags"]), 0)
|
| 503 |
+
self.assertIn("introspective_metrics_report", reflection)
|
| 504 |
+
self.assertIn("deep_cognitive_reflections", reflection)
|
| 505 |
+
self.assertIn("consciousness_evolution_assessment", reflection)
|
| 506 |
+
|
| 507 |
+
# Verify cognitive evolution was detected
|
| 508 |
+
evolution = reflection["consciousness_evolution_assessment"]
|
| 509 |
+
self.assertIn("consciousness_trend", evolution)
|
| 510 |
+
self.assertIn("introspective_depth_trend", evolution)
|
| 511 |
+
|
| 512 |
+
def test_error_handling_and_recovery(self):
|
| 513 |
+
"""Test spracovania chýb a recovery"""
|
| 514 |
+
malformed_document = """
|
| 515 |
+
# [ASL] invalid_format_here
|
| 516 |
+
# [ASL] mental_state: invalid_state cognitive_load: not_a_number
|
| 517 |
+
# Normal text without ASL tags
|
| 518 |
+
# [ASL] thought_stream: Valid tag after errors mental_state: focused
|
| 519 |
+
"""
|
| 520 |
+
|
| 521 |
+
# Should not crash and should process valid parts
|
| 522 |
+
reflection = self.agent.reflect_on_input(malformed_document)
|
| 523 |
+
|
| 524 |
+
self.assertIn("parsing_analysis", reflection)
|
| 525 |
+
self.assertIn("failed_validations", reflection["parsing_analysis"])
|
| 526 |
+
# Should still have some successful processing
|
| 527 |
+
self.assertIsInstance(reflection, dict)
|
| 528 |
+
|
| 529 |
+
if __name__ == "__main__":
|
| 530 |
+
# Spustenie všetkých testov s detailným outputom
|
| 531 |
+
unittest.main(verbosity=2)
|
Aethero_App/lime_integration.py
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import lime
|
| 2 |
+
from lime.lime_text import LimeTextExplainer
|
| 3 |
+
from transformers import pipeline
|
| 4 |
+
import yaml
|
| 5 |
+
import matplotlib.pyplot as plt
|
| 6 |
+
import numpy as np
|
| 7 |
+
import torch
|
| 8 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 9 |
+
|
| 10 |
+
# Move `classifier_fn` to the top level of the module for direct import
|
| 11 |
+
def classifier_fn(texts):
|
| 12 |
+
"""
|
| 13 |
+
Takes a list of input texts, tokenizes them, and returns a 2D numpy array
|
| 14 |
+
with probabilities for each emotion class.
|
| 15 |
+
"""
|
| 16 |
+
# Initialize tokenizer and model
|
| 17 |
+
model_name = "bhadresh-savani/distilbert-base-uncased-emotion"
|
| 18 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 19 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 20 |
+
|
| 21 |
+
# Tokenize input texts
|
| 22 |
+
inputs = tokenizer(texts, return_tensors="pt", padding=True, truncation=True, max_length=512)
|
| 23 |
+
# Pass through the model
|
| 24 |
+
with torch.no_grad():
|
| 25 |
+
logits = model(**inputs).logits
|
| 26 |
+
probs = torch.softmax(logits, dim=-1).numpy()
|
| 27 |
+
return probs
|
| 28 |
+
|
| 29 |
+
class LIMEAnalyzer:
|
| 30 |
+
def __init__(self, model, tokenizer):
|
| 31 |
+
self.model = model
|
| 32 |
+
self.tokenizer = tokenizer
|
| 33 |
+
self.explainer = LimeTextExplainer(class_names=["NEGATIVE", "POSITIVE"])
|
| 34 |
+
|
| 35 |
+
def explain_prediction(self, text):
|
| 36 |
+
"""
|
| 37 |
+
Generate LIME explanations for the given text.
|
| 38 |
+
|
| 39 |
+
Args:
|
| 40 |
+
text (str): The input text to analyze.
|
| 41 |
+
|
| 42 |
+
Returns:
|
| 43 |
+
dict: LIME explanation results.
|
| 44 |
+
"""
|
| 45 |
+
sentiment_pipeline = pipeline("sentiment-analysis", model=self.model, tokenizer=self.tokenizer)
|
| 46 |
+
|
| 47 |
+
explanation = self.explainer.explain_instance(
|
| 48 |
+
text,
|
| 49 |
+
classifier_fn=classifier_fn,
|
| 50 |
+
num_features=10
|
| 51 |
+
)
|
| 52 |
+
return explanation
|
| 53 |
+
|
| 54 |
+
def explain_and_visualize(self, yaml_input_path, output_image_path):
|
| 55 |
+
"""
|
| 56 |
+
Generate LIME explanations and save visualizations for text in a YAML file.
|
| 57 |
+
|
| 58 |
+
Args:
|
| 59 |
+
yaml_input_path (str): Path to the input YAML file.
|
| 60 |
+
output_image_path (str): Path to save the visualization image.
|
| 61 |
+
"""
|
| 62 |
+
# Load text from YAML file
|
| 63 |
+
with open(yaml_input_path, 'r', encoding='utf-8') as file:
|
| 64 |
+
data = yaml.safe_load(file)
|
| 65 |
+
text = data.get('meta_analysis', {}).get('notes', '')
|
| 66 |
+
|
| 67 |
+
if not text:
|
| 68 |
+
print("No text found in the YAML file for analysis.")
|
| 69 |
+
return
|
| 70 |
+
|
| 71 |
+
# Generate LIME explanation
|
| 72 |
+
explanation = self.explain_prediction(text)
|
| 73 |
+
|
| 74 |
+
# Visualize explanation
|
| 75 |
+
fig = explanation.as_pyplot_figure()
|
| 76 |
+
plt.title("LIME Explanation")
|
| 77 |
+
plt.savefig(output_image_path)
|
| 78 |
+
plt.close()
|
| 79 |
+
print(f"LIME explanation visualization saved to {output_image_path}")
|
| 80 |
+
|
| 81 |
+
# Add a function to save LIME explanation as an image
|
| 82 |
+
def save_lime_explanation(explanation, output_path):
|
| 83 |
+
"""
|
| 84 |
+
Save the LIME explanation as a bar chart image.
|
| 85 |
+
|
| 86 |
+
Args:
|
| 87 |
+
explanation: LIME explanation object.
|
| 88 |
+
output_path (str): Path to save the image.
|
| 89 |
+
"""
|
| 90 |
+
fig = explanation.as_pyplot_figure()
|
| 91 |
+
plt.title("LIME Explanation")
|
| 92 |
+
plt.savefig(output_path)
|
| 93 |
+
plt.close()
|
| 94 |
+
print(f"LIME explanation saved to {output_path}")
|
| 95 |
+
|
| 96 |
+
# Ensure `classifier_fn` is accessible for import
|
| 97 |
+
__all__ = ['classifier_fn']
|
Aethero_App/memory/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
# Memory module initialization
|
Aethero_App/memory/aethero_mem_schema.yaml
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AetheroOS Memory System Schema Configuration v1.0
|
| 2 |
+
|
| 3 |
+
version: "1.0"
|
| 4 |
+
storage_engine: "distributed"
|
| 5 |
+
retention_policy: "30d"
|
| 6 |
+
|
| 7 |
+
# Core Schema Definitions
|
| 8 |
+
schemas:
|
| 9 |
+
# Agent State Schema
|
| 10 |
+
agent_state:
|
| 11 |
+
type: "object"
|
| 12 |
+
required:
|
| 13 |
+
- agent_id
|
| 14 |
+
- timestamp
|
| 15 |
+
- state
|
| 16 |
+
- asl_tags
|
| 17 |
+
properties:
|
| 18 |
+
agent_id:
|
| 19 |
+
type: "string"
|
| 20 |
+
pattern: "^[a-zA-Z0-9_-]+$"
|
| 21 |
+
timestamp:
|
| 22 |
+
type: "string"
|
| 23 |
+
format: "date-time"
|
| 24 |
+
state:
|
| 25 |
+
type: "string"
|
| 26 |
+
enum: ["idle", "processing", "completed", "error", "waiting"]
|
| 27 |
+
asl_tags:
|
| 28 |
+
type: "object"
|
| 29 |
+
additionalProperties: true
|
| 30 |
+
metrics:
|
| 31 |
+
type: "object"
|
| 32 |
+
properties:
|
| 33 |
+
performance:
|
| 34 |
+
type: "number"
|
| 35 |
+
accuracy:
|
| 36 |
+
type: "number"
|
| 37 |
+
efficiency:
|
| 38 |
+
type: "number"
|
| 39 |
+
|
| 40 |
+
# Decision Record Schema
|
| 41 |
+
decision_record:
|
| 42 |
+
type: "object"
|
| 43 |
+
required:
|
| 44 |
+
- decision_id
|
| 45 |
+
- timestamp
|
| 46 |
+
- agent_id
|
| 47 |
+
- context
|
| 48 |
+
- decision
|
| 49 |
+
- rationale
|
| 50 |
+
properties:
|
| 51 |
+
decision_id:
|
| 52 |
+
type: "string"
|
| 53 |
+
pattern: "^dec_[a-zA-Z0-9]+$"
|
| 54 |
+
timestamp:
|
| 55 |
+
type: "string"
|
| 56 |
+
format: "date-time"
|
| 57 |
+
agent_id:
|
| 58 |
+
type: "string"
|
| 59 |
+
context:
|
| 60 |
+
type: "object"
|
| 61 |
+
additionalProperties: true
|
| 62 |
+
decision:
|
| 63 |
+
type: "object"
|
| 64 |
+
required:
|
| 65 |
+
- action
|
| 66 |
+
- parameters
|
| 67 |
+
properties:
|
| 68 |
+
action:
|
| 69 |
+
type: "string"
|
| 70 |
+
parameters:
|
| 71 |
+
type: "object"
|
| 72 |
+
additionalProperties: true
|
| 73 |
+
rationale:
|
| 74 |
+
type: "array"
|
| 75 |
+
items:
|
| 76 |
+
type: "string"
|
| 77 |
+
asl_tags:
|
| 78 |
+
type: "object"
|
| 79 |
+
additionalProperties: true
|
| 80 |
+
|
| 81 |
+
# Reflection Result Schema
|
| 82 |
+
reflection_result:
|
| 83 |
+
type: "object"
|
| 84 |
+
required:
|
| 85 |
+
- reflection_id
|
| 86 |
+
- timestamp
|
| 87 |
+
- agent_id
|
| 88 |
+
- metrics
|
| 89 |
+
- findings
|
| 90 |
+
properties:
|
| 91 |
+
reflection_id:
|
| 92 |
+
type: "string"
|
| 93 |
+
pattern: "^ref_[a-zA-Z0-9]+$"
|
| 94 |
+
timestamp:
|
| 95 |
+
type: "string"
|
| 96 |
+
format: "date-time"
|
| 97 |
+
agent_id:
|
| 98 |
+
type: "string"
|
| 99 |
+
metrics:
|
| 100 |
+
type: "object"
|
| 101 |
+
required:
|
| 102 |
+
- accuracy
|
| 103 |
+
- consistency
|
| 104 |
+
- ethical_compliance
|
| 105 |
+
- performance
|
| 106 |
+
properties:
|
| 107 |
+
accuracy:
|
| 108 |
+
type: "number"
|
| 109 |
+
consistency:
|
| 110 |
+
type: "number"
|
| 111 |
+
ethical_compliance:
|
| 112 |
+
type: "number"
|
| 113 |
+
performance:
|
| 114 |
+
type: "number"
|
| 115 |
+
findings:
|
| 116 |
+
type: "array"
|
| 117 |
+
items:
|
| 118 |
+
type: "string"
|
| 119 |
+
suggestions:
|
| 120 |
+
type: "array"
|
| 121 |
+
items:
|
| 122 |
+
type: "string"
|
| 123 |
+
asl_tags:
|
| 124 |
+
type: "object"
|
| 125 |
+
additionalProperties: true
|
| 126 |
+
|
| 127 |
+
# Pipeline Execution Schema
|
| 128 |
+
pipeline_execution:
|
| 129 |
+
type: "object"
|
| 130 |
+
required:
|
| 131 |
+
- execution_id
|
| 132 |
+
- start_time
|
| 133 |
+
- status
|
| 134 |
+
- agents_involved
|
| 135 |
+
properties:
|
| 136 |
+
execution_id:
|
| 137 |
+
type: "string"
|
| 138 |
+
pattern: "^exec_[a-zA-Z0-9]+$"
|
| 139 |
+
start_time:
|
| 140 |
+
type: "string"
|
| 141 |
+
format: "date-time"
|
| 142 |
+
end_time:
|
| 143 |
+
type: "string"
|
| 144 |
+
format: "date-time"
|
| 145 |
+
status:
|
| 146 |
+
type: "string"
|
| 147 |
+
enum: ["running", "completed", "failed", "suspended"]
|
| 148 |
+
agents_involved:
|
| 149 |
+
type: "array"
|
| 150 |
+
items:
|
| 151 |
+
type: "string"
|
| 152 |
+
execution_graph:
|
| 153 |
+
type: "object"
|
| 154 |
+
properties:
|
| 155 |
+
nodes:
|
| 156 |
+
type: "array"
|
| 157 |
+
items:
|
| 158 |
+
type: "object"
|
| 159 |
+
edges:
|
| 160 |
+
type: "array"
|
| 161 |
+
items:
|
| 162 |
+
type: "object"
|
| 163 |
+
metrics:
|
| 164 |
+
type: "object"
|
| 165 |
+
properties:
|
| 166 |
+
total_duration:
|
| 167 |
+
type: "number"
|
| 168 |
+
resource_usage:
|
| 169 |
+
type: "object"
|
| 170 |
+
success_rate:
|
| 171 |
+
type: "number"
|
| 172 |
+
asl_tags:
|
| 173 |
+
type: "object"
|
| 174 |
+
additionalProperties: true
|
| 175 |
+
|
| 176 |
+
# API Endpoints
|
| 177 |
+
endpoints:
|
| 178 |
+
agent_state:
|
| 179 |
+
create:
|
| 180 |
+
method: "POST"
|
| 181 |
+
path: "/api/v1/agent-states"
|
| 182 |
+
read:
|
| 183 |
+
method: "GET"
|
| 184 |
+
path: "/api/v1/agent-states/{agent_id}"
|
| 185 |
+
update:
|
| 186 |
+
method: "PUT"
|
| 187 |
+
path: "/api/v1/agent-states/{agent_id}"
|
| 188 |
+
list:
|
| 189 |
+
method: "GET"
|
| 190 |
+
path: "/api/v1/agent-states"
|
| 191 |
+
query_params:
|
| 192 |
+
- name: "time_range"
|
| 193 |
+
type: "string"
|
| 194 |
+
- name: "state"
|
| 195 |
+
type: "string"
|
| 196 |
+
|
| 197 |
+
decision_record:
|
| 198 |
+
create:
|
| 199 |
+
method: "POST"
|
| 200 |
+
path: "/api/v1/decisions"
|
| 201 |
+
read:
|
| 202 |
+
method: "GET"
|
| 203 |
+
path: "/api/v1/decisions/{decision_id}"
|
| 204 |
+
list:
|
| 205 |
+
method: "GET"
|
| 206 |
+
path: "/api/v1/decisions"
|
| 207 |
+
query_params:
|
| 208 |
+
- name: "agent_id"
|
| 209 |
+
type: "string"
|
| 210 |
+
- name: "time_range"
|
| 211 |
+
type: "string"
|
| 212 |
+
|
| 213 |
+
reflection_result:
|
| 214 |
+
create:
|
| 215 |
+
method: "POST"
|
| 216 |
+
path: "/api/v1/reflections"
|
| 217 |
+
read:
|
| 218 |
+
method: "GET"
|
| 219 |
+
path: "/api/v1/reflections/{reflection_id}"
|
| 220 |
+
list:
|
| 221 |
+
method: "GET"
|
| 222 |
+
path: "/api/v1/reflections"
|
| 223 |
+
query_params:
|
| 224 |
+
- name: "agent_id"
|
| 225 |
+
type: "string"
|
| 226 |
+
- name: "metric_threshold"
|
| 227 |
+
type: "number"
|
| 228 |
+
|
| 229 |
+
pipeline_execution:
|
| 230 |
+
create:
|
| 231 |
+
method: "POST"
|
| 232 |
+
path: "/api/v1/executions"
|
| 233 |
+
read:
|
| 234 |
+
method: "GET"
|
| 235 |
+
path: "/api/v1/executions/{execution_id}"
|
| 236 |
+
update:
|
| 237 |
+
method: "PUT"
|
| 238 |
+
path: "/api/v1/executions/{execution_id}"
|
| 239 |
+
list:
|
| 240 |
+
method: "GET"
|
| 241 |
+
path: "/api/v1/executions"
|
| 242 |
+
query_params:
|
| 243 |
+
- name: "status"
|
| 244 |
+
type: "string"
|
| 245 |
+
- name: "time_range"
|
| 246 |
+
type: "string"
|
| 247 |
+
|
| 248 |
+
# Indexing Configuration
|
| 249 |
+
indexes:
|
| 250 |
+
agent_state:
|
| 251 |
+
- fields: ["agent_id", "timestamp"]
|
| 252 |
+
type: "btree"
|
| 253 |
+
- fields: ["state"]
|
| 254 |
+
type: "hash"
|
| 255 |
+
|
| 256 |
+
decision_record:
|
| 257 |
+
- fields: ["decision_id"]
|
| 258 |
+
type: "btree"
|
| 259 |
+
- fields: ["agent_id", "timestamp"]
|
| 260 |
+
type: "btree"
|
| 261 |
+
|
| 262 |
+
reflection_result:
|
| 263 |
+
- fields: ["reflection_id"]
|
| 264 |
+
type: "btree"
|
| 265 |
+
- fields: ["agent_id", "timestamp"]
|
| 266 |
+
type: "btree"
|
| 267 |
+
|
| 268 |
+
pipeline_execution:
|
| 269 |
+
- fields: ["execution_id"]
|
| 270 |
+
type: "btree"
|
| 271 |
+
- fields: ["status", "start_time"]
|
| 272 |
+
type: "btree"
|
| 273 |
+
|
| 274 |
+
# Query Optimization
|
| 275 |
+
query_optimization:
|
| 276 |
+
cache_enabled: true
|
| 277 |
+
cache_ttl: 3600
|
| 278 |
+
max_results_per_page: 1000
|
| 279 |
+
default_sort_field: "timestamp"
|
| 280 |
+
default_sort_order: "desc"
|
Aethero_App/models.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pydantic import BaseModel
|
| 2 |
+
|
| 3 |
+
class ASLTagModel(BaseModel):
|
| 4 |
+
statement: str
|
| 5 |
+
mental_state: str
|
| 6 |
+
emotion_tone: str
|
| 7 |
+
cognitive_load: int
|
| 8 |
+
temporal_context: str
|
| 9 |
+
certainty_level: float
|
| 10 |
+
aeth_mem_link: str
|
| 11 |
+
law: str
|
| 12 |
+
enhancement_suggestion: str = None
|
| 13 |
+
diplomatic_enhancement: str = None
|
Aethero_App/monitoring/aetheros_rules.yml
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
groups:
|
| 2 |
+
- name: AetheroOS Alerts
|
| 3 |
+
rules:
|
| 4 |
+
# Agent Health Alerts
|
| 5 |
+
- alert: AgentDown
|
| 6 |
+
expr: up{job=~"aetheros_agents.*"} == 0
|
| 7 |
+
for: 1m
|
| 8 |
+
labels:
|
| 9 |
+
severity: critical
|
| 10 |
+
annotations:
|
| 11 |
+
summary: "Agent {{ $labels.agent_id }} is down"
|
| 12 |
+
description: "Agent {{ $labels.agent_id }} has been down for more than 1 minute"
|
| 13 |
+
|
| 14 |
+
- alert: HighAgentLatency
|
| 15 |
+
expr: rate(aetheros_agent_response_time_seconds_sum[5m]) / rate(aetheros_agent_response_time_seconds_count[5m]) > 2
|
| 16 |
+
for: 5m
|
| 17 |
+
labels:
|
| 18 |
+
severity: warning
|
| 19 |
+
annotations:
|
| 20 |
+
summary: "High latency for {{ $labels.agent_id }}"
|
| 21 |
+
description: "Agent {{ $labels.agent_id }} has response time > 2s for 5 minutes"
|
| 22 |
+
|
| 23 |
+
# Reflection Quality Alerts
|
| 24 |
+
- alert: LowReflectionQuality
|
| 25 |
+
expr: aetheros_reflection_quality_score < 0.7
|
| 26 |
+
for: 15m
|
| 27 |
+
labels:
|
| 28 |
+
severity: warning
|
| 29 |
+
annotations:
|
| 30 |
+
summary: "Low reflection quality detected"
|
| 31 |
+
description: "Reflection quality score has been below 0.7 for 15 minutes"
|
| 32 |
+
|
| 33 |
+
- alert: ReflectionProcessingStalled
|
| 34 |
+
expr: rate(aetheros_reflections_processed_total[15m]) == 0
|
| 35 |
+
for: 5m
|
| 36 |
+
labels:
|
| 37 |
+
severity: critical
|
| 38 |
+
annotations:
|
| 39 |
+
summary: "Reflection processing has stalled"
|
| 40 |
+
description: "No reflections have been processed in the last 15 minutes"
|
| 41 |
+
|
| 42 |
+
# Memory System Alerts
|
| 43 |
+
- alert: HighMemoryLatency
|
| 44 |
+
expr: histogram_quantile(0.95, sum(rate(aetheros_mem_latency_bucket[5m])) by (le)) > 0.5
|
| 45 |
+
for: 5m
|
| 46 |
+
labels:
|
| 47 |
+
severity: warning
|
| 48 |
+
annotations:
|
| 49 |
+
summary: "High memory system latency"
|
| 50 |
+
description: "95th percentile of memory operations taking >500ms"
|
| 51 |
+
|
| 52 |
+
- alert: HighMemoryErrorRate
|
| 53 |
+
expr: rate(aetheros_mem_operations_error_total[5m]) / rate(aetheros_mem_operations_total[5m]) > 0.01
|
| 54 |
+
for: 5m
|
| 55 |
+
labels:
|
| 56 |
+
severity: warning
|
| 57 |
+
annotations:
|
| 58 |
+
summary: "High memory operation error rate"
|
| 59 |
+
description: "Memory operation error rate > 1% for 5 minutes"
|
| 60 |
+
|
| 61 |
+
# Pipeline Execution Alerts
|
| 62 |
+
- alert: LowPipelineSuccessRate
|
| 63 |
+
expr: sum(rate(aetheros_pipeline_executions_success[5m])) / sum(rate(aetheros_pipeline_executions_total[5m])) < 0.95
|
| 64 |
+
for: 15m
|
| 65 |
+
labels:
|
| 66 |
+
severity: critical
|
| 67 |
+
annotations:
|
| 68 |
+
summary: "Low pipeline success rate"
|
| 69 |
+
description: "Pipeline success rate below 95% for 15 minutes"
|
| 70 |
+
|
| 71 |
+
- alert: LongPipelineDuration
|
| 72 |
+
expr: histogram_quantile(0.95, sum(rate(aetheros_pipeline_duration_seconds_bucket[5m])) by (le)) > 300
|
| 73 |
+
for: 15m
|
| 74 |
+
labels:
|
| 75 |
+
severity: warning
|
| 76 |
+
annotations:
|
| 77 |
+
summary: "Long pipeline execution times"
|
| 78 |
+
description: "95th percentile of pipeline executions taking >5 minutes"
|
| 79 |
+
|
| 80 |
+
# Resource Usage Alerts
|
| 81 |
+
- alert: HighCPUUsage
|
| 82 |
+
expr: rate(process_cpu_seconds_total{job=~"aetheros_agents.*"}[5m]) > 0.8
|
| 83 |
+
for: 10m
|
| 84 |
+
labels:
|
| 85 |
+
severity: warning
|
| 86 |
+
annotations:
|
| 87 |
+
summary: "High CPU usage for {{ $labels.agent_id }}"
|
| 88 |
+
description: "Agent {{ $labels.agent_id }} CPU usage >80% for 10 minutes"
|
| 89 |
+
|
| 90 |
+
- alert: HighMemoryUsage
|
| 91 |
+
expr: process_resident_memory_bytes{job=~"aetheros_agents.*"} / node_memory_MemTotal_bytes > 0.8
|
| 92 |
+
for: 10m
|
| 93 |
+
labels:
|
| 94 |
+
severity: warning
|
| 95 |
+
annotations:
|
| 96 |
+
summary: "High memory usage for {{ $labels.agent_id }}"
|
| 97 |
+
description: "Agent {{ $labels.agent_id }} memory usage >80% for 10 minutes"
|
| 98 |
+
|
| 99 |
+
# System Health Alerts
|
| 100 |
+
- alert: HighErrorRate
|
| 101 |
+
expr: sum(rate(aetheros_error_total[5m])) by (agent_id) > 0.05
|
| 102 |
+
for: 5m
|
| 103 |
+
labels:
|
| 104 |
+
severity: warning
|
| 105 |
+
annotations:
|
| 106 |
+
summary: "High error rate for {{ $labels.agent_id }}"
|
| 107 |
+
description: "Error rate >5% for {{ $labels.agent_id }} over 5 minutes"
|
| 108 |
+
|
| 109 |
+
- alert: SystemOverload
|
| 110 |
+
expr: sum(rate(aetheros_agent_queue_size[5m])) by (agent_id) > 1000
|
| 111 |
+
for: 5m
|
| 112 |
+
labels:
|
| 113 |
+
severity: warning
|
| 114 |
+
annotations:
|
| 115 |
+
summary: "System overload for {{ $labels.agent_id }}"
|
| 116 |
+
description: "Queue size >1000 for {{ $labels.agent_id }} over 5 minutes"
|
Aethero_App/monitoring/docker-compose.yml
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version: '3.8'
|
| 2 |
+
|
| 3 |
+
services:
|
| 4 |
+
prometheus:
|
| 5 |
+
image: prom/prometheus:latest
|
| 6 |
+
container_name: aetheros_prometheus
|
| 7 |
+
volumes:
|
| 8 |
+
- ../monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
|
| 9 |
+
- ../monitoring/aetheros_rules.yml:/etc/prometheus/aetheros_rules.yml
|
| 10 |
+
- prometheus_data:/prometheus
|
| 11 |
+
command:
|
| 12 |
+
- '--config.file=/etc/prometheus/prometheus.yml'
|
| 13 |
+
- '--storage.tsdb.path=/prometheus'
|
| 14 |
+
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
|
| 15 |
+
- '--web.console.templates=/usr/share/prometheus/consoles'
|
| 16 |
+
ports:
|
| 17 |
+
- "9090:9090"
|
| 18 |
+
networks:
|
| 19 |
+
- aetheros_net
|
| 20 |
+
restart: unless-stopped
|
| 21 |
+
|
| 22 |
+
grafana:
|
| 23 |
+
image: grafana/grafana:latest
|
| 24 |
+
container_name: aetheros_grafana
|
| 25 |
+
volumes:
|
| 26 |
+
- ../monitoring/grafana_dashboards.json:/etc/grafana/provisioning/dashboards/aetheros.json
|
| 27 |
+
- grafana_data:/var/lib/grafana
|
| 28 |
+
environment:
|
| 29 |
+
- GF_SECURITY_ADMIN_PASSWORD=aetheros_admin
|
| 30 |
+
- GF_USERS_ALLOW_SIGN_UP=false
|
| 31 |
+
- GF_INSTALL_PLUGINS=grafana-piechart-panel
|
| 32 |
+
ports:
|
| 33 |
+
- "3000:3000"
|
| 34 |
+
networks:
|
| 35 |
+
- aetheros_net
|
| 36 |
+
depends_on:
|
| 37 |
+
- prometheus
|
| 38 |
+
restart: unless-stopped
|
| 39 |
+
|
| 40 |
+
alertmanager:
|
| 41 |
+
image: prom/alertmanager:latest
|
| 42 |
+
container_name: aetheros_alertmanager
|
| 43 |
+
volumes:
|
| 44 |
+
- ../monitoring/alertmanager.yml:/etc/alertmanager/alertmanager.yml
|
| 45 |
+
- alertmanager_data:/alertmanager
|
| 46 |
+
command:
|
| 47 |
+
- '--config.file=/etc/alertmanager/alertmanager.yml'
|
| 48 |
+
- '--storage.path=/alertmanager'
|
| 49 |
+
ports:
|
| 50 |
+
- "9093:9093"
|
| 51 |
+
networks:
|
| 52 |
+
- aetheros_net
|
| 53 |
+
restart: unless-stopped
|
| 54 |
+
|
| 55 |
+
volumes:
|
| 56 |
+
prometheus_data:
|
| 57 |
+
grafana_data:
|
| 58 |
+
alertmanager_data:
|
| 59 |
+
|
| 60 |
+
networks:
|
| 61 |
+
aetheros_net:
|
| 62 |
+
driver: bridge
|
Aethero_App/monitoring/grafana_dashboards.json
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"annotations": {
|
| 3 |
+
"list": [
|
| 4 |
+
{
|
| 5 |
+
"builtIn": 1,
|
| 6 |
+
"datasource": "-- Grafana --",
|
| 7 |
+
"enable": true,
|
| 8 |
+
"hide": true,
|
| 9 |
+
"iconColor": "rgba(0, 211, 255, 1)",
|
| 10 |
+
"name": "Annotations & Alerts",
|
| 11 |
+
"type": "dashboard"
|
| 12 |
+
}
|
| 13 |
+
]
|
| 14 |
+
},
|
| 15 |
+
"editable": true,
|
| 16 |
+
"gnetId": null,
|
| 17 |
+
"graphTooltip": 0,
|
| 18 |
+
"id": 1,
|
| 19 |
+
"links": [],
|
| 20 |
+
"panels": [
|
| 21 |
+
{
|
| 22 |
+
"title": "Agent Performance Overview",
|
| 23 |
+
"type": "row",
|
| 24 |
+
"panels": [
|
| 25 |
+
{
|
| 26 |
+
"title": "Agent States",
|
| 27 |
+
"type": "stat",
|
| 28 |
+
"datasource": "Prometheus",
|
| 29 |
+
"targets": [
|
| 30 |
+
{
|
| 31 |
+
"expr": "sum by (state) (aetheros_agent_state)",
|
| 32 |
+
"legendFormat": "{{state}}"
|
| 33 |
+
}
|
| 34 |
+
],
|
| 35 |
+
"fieldConfig": {
|
| 36 |
+
"defaults": {
|
| 37 |
+
"mappings": [],
|
| 38 |
+
"thresholds": {
|
| 39 |
+
"mode": "absolute",
|
| 40 |
+
"steps": [
|
| 41 |
+
{ "color": "green", "value": null },
|
| 42 |
+
{ "color": "red", "value": 80 }
|
| 43 |
+
]
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"title": "Agent Response Times",
|
| 50 |
+
"type": "graph",
|
| 51 |
+
"datasource": "Prometheus",
|
| 52 |
+
"targets": [
|
| 53 |
+
{
|
| 54 |
+
"expr": "rate(aetheros_agent_response_time_seconds_sum[5m]) / rate(aetheros_agent_response_time_seconds_count[5m])",
|
| 55 |
+
"legendFormat": "{{agent_id}}"
|
| 56 |
+
}
|
| 57 |
+
]
|
| 58 |
+
}
|
| 59 |
+
]
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"title": "Reflection Metrics",
|
| 63 |
+
"type": "row",
|
| 64 |
+
"panels": [
|
| 65 |
+
{
|
| 66 |
+
"title": "Reflection Quality Scores",
|
| 67 |
+
"type": "gauge",
|
| 68 |
+
"datasource": "Prometheus",
|
| 69 |
+
"targets": [
|
| 70 |
+
{
|
| 71 |
+
"expr": "aetheros_reflection_quality_score",
|
| 72 |
+
"legendFormat": "{{metric}}"
|
| 73 |
+
}
|
| 74 |
+
],
|
| 75 |
+
"fieldConfig": {
|
| 76 |
+
"defaults": {
|
| 77 |
+
"max": 1,
|
| 78 |
+
"min": 0,
|
| 79 |
+
"thresholds": {
|
| 80 |
+
"mode": "absolute",
|
| 81 |
+
"steps": [
|
| 82 |
+
{ "color": "red", "value": null },
|
| 83 |
+
{ "color": "yellow", "value": 0.7 },
|
| 84 |
+
{ "color": "green", "value": 0.9 }
|
| 85 |
+
]
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
}
|
| 89 |
+
},
|
| 90 |
+
{
|
| 91 |
+
"title": "Reflection Processing Rate",
|
| 92 |
+
"type": "timeseries",
|
| 93 |
+
"datasource": "Prometheus",
|
| 94 |
+
"targets": [
|
| 95 |
+
{
|
| 96 |
+
"expr": "rate(aetheros_reflections_processed_total[5m])",
|
| 97 |
+
"legendFormat": "Reflections/min"
|
| 98 |
+
}
|
| 99 |
+
]
|
| 100 |
+
}
|
| 101 |
+
]
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"title": "Memory System Metrics",
|
| 105 |
+
"type": "row",
|
| 106 |
+
"panels": [
|
| 107 |
+
{
|
| 108 |
+
"title": "Aethero_Mem Operations",
|
| 109 |
+
"type": "graph",
|
| 110 |
+
"datasource": "Prometheus",
|
| 111 |
+
"targets": [
|
| 112 |
+
{
|
| 113 |
+
"expr": "rate(aetheros_mem_operations_total[5m])",
|
| 114 |
+
"legendFormat": "{{operation}}"
|
| 115 |
+
}
|
| 116 |
+
]
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
"title": "Memory Latency",
|
| 120 |
+
"type": "heatmap",
|
| 121 |
+
"datasource": "Prometheus",
|
| 122 |
+
"targets": [
|
| 123 |
+
{
|
| 124 |
+
"expr": "rate(aetheros_mem_latency_bucket[5m])",
|
| 125 |
+
"legendFormat": "{{le}}"
|
| 126 |
+
}
|
| 127 |
+
]
|
| 128 |
+
}
|
| 129 |
+
]
|
| 130 |
+
},
|
| 131 |
+
{
|
| 132 |
+
"title": "Pipeline Execution",
|
| 133 |
+
"type": "row",
|
| 134 |
+
"panels": [
|
| 135 |
+
{
|
| 136 |
+
"title": "Pipeline Success Rate",
|
| 137 |
+
"type": "gauge",
|
| 138 |
+
"datasource": "Prometheus",
|
| 139 |
+
"targets": [
|
| 140 |
+
{
|
| 141 |
+
"expr": "sum(rate(aetheros_pipeline_executions_success[5m])) / sum(rate(aetheros_pipeline_executions_total[5m]))",
|
| 142 |
+
"legendFormat": "Success Rate"
|
| 143 |
+
}
|
| 144 |
+
],
|
| 145 |
+
"fieldConfig": {
|
| 146 |
+
"defaults": {
|
| 147 |
+
"max": 1,
|
| 148 |
+
"min": 0,
|
| 149 |
+
"thresholds": {
|
| 150 |
+
"mode": "absolute",
|
| 151 |
+
"steps": [
|
| 152 |
+
{ "color": "red", "value": null },
|
| 153 |
+
{ "color": "yellow", "value": 0.95 },
|
| 154 |
+
{ "color": "green", "value": 0.99 }
|
| 155 |
+
]
|
| 156 |
+
}
|
| 157 |
+
}
|
| 158 |
+
}
|
| 159 |
+
},
|
| 160 |
+
{
|
| 161 |
+
"title": "Pipeline Duration",
|
| 162 |
+
"type": "graph",
|
| 163 |
+
"datasource": "Prometheus",
|
| 164 |
+
"targets": [
|
| 165 |
+
{
|
| 166 |
+
"expr": "histogram_quantile(0.95, sum(rate(aetheros_pipeline_duration_seconds_bucket[5m])) by (le))",
|
| 167 |
+
"legendFormat": "95th percentile"
|
| 168 |
+
}
|
| 169 |
+
]
|
| 170 |
+
}
|
| 171 |
+
]
|
| 172 |
+
}
|
| 173 |
+
],
|
| 174 |
+
"refresh": "5s",
|
| 175 |
+
"schemaVersion": 27,
|
| 176 |
+
"style": "dark",
|
| 177 |
+
"tags": ["aetheros"],
|
| 178 |
+
"templating": {
|
| 179 |
+
"list": [
|
| 180 |
+
{
|
| 181 |
+
"current": {
|
| 182 |
+
"selected": false,
|
| 183 |
+
"text": "Prometheus",
|
| 184 |
+
"value": "Prometheus"
|
| 185 |
+
},
|
| 186 |
+
"description": null,
|
| 187 |
+
"error": null,
|
| 188 |
+
"hide": 0,
|
| 189 |
+
"includeAll": false,
|
| 190 |
+
"label": null,
|
| 191 |
+
"multi": false,
|
| 192 |
+
"name": "datasource",
|
| 193 |
+
"options": [],
|
| 194 |
+
"query": "prometheus",
|
| 195 |
+
"refresh": 1,
|
| 196 |
+
"regex": "",
|
| 197 |
+
"skipUrlSync": false,
|
| 198 |
+
"type": "datasource"
|
| 199 |
+
}
|
| 200 |
+
]
|
| 201 |
+
},
|
| 202 |
+
"time": {
|
| 203 |
+
"from": "now-6h",
|
| 204 |
+
"to": "now"
|
| 205 |
+
},
|
| 206 |
+
"timepicker": {},
|
| 207 |
+
"timezone": "",
|
| 208 |
+
"title": "AetheroOS Overview",
|
| 209 |
+
"uid": "aetheros-overview",
|
| 210 |
+
"version": 1
|
| 211 |
+
}
|
Aethero_App/monitoring/prometheus.yml
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Prometheus Configuration for AetheroOS Monitoring
|
| 2 |
+
|
| 3 |
+
global:
|
| 4 |
+
scrape_interval: 15s
|
| 5 |
+
evaluation_interval: 15s
|
| 6 |
+
|
| 7 |
+
# Alertmanager configuration
|
| 8 |
+
alerting:
|
| 9 |
+
alertmanagers:
|
| 10 |
+
- static_configs:
|
| 11 |
+
- targets:
|
| 12 |
+
- 'alertmanager:9093'
|
| 13 |
+
|
| 14 |
+
# Rule files
|
| 15 |
+
rule_files:
|
| 16 |
+
- "aetheros_rules.yml"
|
| 17 |
+
|
| 18 |
+
# Scrape configurations
|
| 19 |
+
scrape_configs:
|
| 20 |
+
# Agent Stack Metrics
|
| 21 |
+
- job_name: 'aetheros_agents'
|
| 22 |
+
static_configs:
|
| 23 |
+
- targets:
|
| 24 |
+
- 'planner_agent:8000'
|
| 25 |
+
- 'scout_agent:8001'
|
| 26 |
+
- 'analyst_agent:8002'
|
| 27 |
+
- 'generator_agent:8003'
|
| 28 |
+
- 'synthesis_agent:8004'
|
| 29 |
+
- 'reflection_agent:8005'
|
| 30 |
+
metrics_path: '/metrics'
|
| 31 |
+
scheme: 'http'
|
| 32 |
+
scrape_interval: 10s
|
| 33 |
+
|
| 34 |
+
# DeepEval Metrics
|
| 35 |
+
- job_name: 'deep_eval'
|
| 36 |
+
static_configs:
|
| 37 |
+
- targets: ['deep_eval:9090']
|
| 38 |
+
metrics_path: '/metrics'
|
| 39 |
+
scheme: 'http'
|
| 40 |
+
|
| 41 |
+
# Aethero_Mem Metrics
|
| 42 |
+
- job_name: 'aethero_mem'
|
| 43 |
+
static_configs:
|
| 44 |
+
- targets: ['aethero_mem:9091']
|
| 45 |
+
metrics_path: '/metrics'
|
| 46 |
+
scheme: 'http'
|
| 47 |
+
|
| 48 |
+
# LangGraph Visualization Metrics
|
| 49 |
+
- job_name: 'langgraph'
|
| 50 |
+
static_configs:
|
| 51 |
+
- targets: ['langgraph:9092']
|
| 52 |
+
metrics_path: '/metrics'
|
| 53 |
+
scheme: 'http'
|
| 54 |
+
|
| 55 |
+
# Metric Relabeling
|
| 56 |
+
metric_relabel_configs:
|
| 57 |
+
- source_labels: [agent_id]
|
| 58 |
+
regex: '(.+)'
|
| 59 |
+
target_label: agent_type
|
| 60 |
+
replacement: '${1}'
|
| 61 |
+
|
| 62 |
+
# Remote Write Configuration
|
| 63 |
+
remote_write:
|
| 64 |
+
- url: 'http://remote-storage:9201/write'
|
| 65 |
+
queue_config:
|
| 66 |
+
capacity: 500000
|
| 67 |
+
max_samples_per_send: 5000
|
| 68 |
+
batch_send_deadline: '5s'
|
| 69 |
+
write_relabel_configs:
|
| 70 |
+
- source_labels: [__name__]
|
| 71 |
+
regex: 'aetheros_.+'
|
| 72 |
+
action: keep
|
Aethero_App/plot_emotions.py
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import yaml
|
| 3 |
+
import matplotlib.pyplot as plt
|
| 4 |
+
import numpy as np
|
| 5 |
+
import seaborn as sns
|
| 6 |
+
|
| 7 |
+
def plot_emotion_map(yaml_file, output_dir="outputs/visualizations"):
|
| 8 |
+
# Ensure the output directory exists
|
| 9 |
+
os.makedirs(output_dir, exist_ok=True)
|
| 10 |
+
|
| 11 |
+
# Load the YAML file
|
| 12 |
+
with open(yaml_file, "r", encoding="utf-8") as file:
|
| 13 |
+
data = yaml.safe_load(file)
|
| 14 |
+
|
| 15 |
+
# Extract emotion map
|
| 16 |
+
emotion_map = data.get("emotion_map", {})
|
| 17 |
+
if not emotion_map:
|
| 18 |
+
print(f"No emotion map found in {yaml_file}")
|
| 19 |
+
return
|
| 20 |
+
|
| 21 |
+
# Plot the emotion map
|
| 22 |
+
emotions = list(emotion_map.keys())
|
| 23 |
+
values = list(emotion_map.values())
|
| 24 |
+
|
| 25 |
+
plt.figure(figsize=(8, 6))
|
| 26 |
+
plt.bar(emotions, values, color="skyblue")
|
| 27 |
+
plt.title("Emotion Map")
|
| 28 |
+
plt.xlabel("Emotions")
|
| 29 |
+
plt.ylabel("Intensity")
|
| 30 |
+
plt.ylim(0, 1)
|
| 31 |
+
|
| 32 |
+
# Save the plot
|
| 33 |
+
base_name = os.path.splitext(os.path.basename(yaml_file))[0]
|
| 34 |
+
output_path = os.path.join(output_dir, f"{base_name}_emotion_map.png")
|
| 35 |
+
plt.savefig(output_path)
|
| 36 |
+
plt.close()
|
| 37 |
+
|
| 38 |
+
print(f"Emotion map saved to {output_path}")
|
| 39 |
+
|
| 40 |
+
def plot_combined_emotion_maps(yaml_dir="outputs/", output_file="outputs/visualizations/combined_emotion_map.png"):
|
| 41 |
+
# Ensure the output directory exists
|
| 42 |
+
os.makedirs(os.path.dirname(output_file), exist_ok=True)
|
| 43 |
+
|
| 44 |
+
combined_emotions = {}
|
| 45 |
+
|
| 46 |
+
# Iterate through all YAML files in the directory
|
| 47 |
+
for filename in os.listdir(yaml_dir):
|
| 48 |
+
if filename.endswith(".yaml"):
|
| 49 |
+
yaml_file = os.path.join(yaml_dir, filename)
|
| 50 |
+
with open(yaml_file, "r", encoding="utf-8") as file:
|
| 51 |
+
data = yaml.safe_load(file)
|
| 52 |
+
|
| 53 |
+
# Extract emotion map
|
| 54 |
+
emotion_map = data.get("emotion_map", {})
|
| 55 |
+
for emotion, value in emotion_map.items():
|
| 56 |
+
if emotion not in combined_emotions:
|
| 57 |
+
combined_emotions[emotion] = []
|
| 58 |
+
combined_emotions[emotion].append(value)
|
| 59 |
+
|
| 60 |
+
# Prepare data for plotting
|
| 61 |
+
emotions = list(combined_emotions.keys())
|
| 62 |
+
values = [sum(combined_emotions[emotion]) / len(combined_emotions[emotion]) for emotion in emotions]
|
| 63 |
+
|
| 64 |
+
# Plot the combined emotion map
|
| 65 |
+
plt.figure(figsize=(10, 8))
|
| 66 |
+
plt.bar(emotions, values, color="lightcoral")
|
| 67 |
+
plt.title("Combined Emotion Map")
|
| 68 |
+
plt.xlabel("Emotions")
|
| 69 |
+
plt.ylabel("Average Intensity")
|
| 70 |
+
plt.ylim(0, 1)
|
| 71 |
+
|
| 72 |
+
# Save the plot
|
| 73 |
+
plt.savefig(output_file)
|
| 74 |
+
plt.close()
|
| 75 |
+
|
| 76 |
+
print(f"Combined emotion map saved to {output_file}")
|
| 77 |
+
|
| 78 |
+
def plot_emotion_bar(yaml_path, output_dir="outputs/visualizations"):
|
| 79 |
+
"""Plot a bar chart for the emotion spectrum of a single YAML file."""
|
| 80 |
+
plot_emotion_map(yaml_path, output_dir)
|
| 81 |
+
|
| 82 |
+
def plot_all_emotions(dir_path="outputs", output_dir="outputs/visualizations"):
|
| 83 |
+
"""Iterate through all YAML files in a directory and generate bar charts."""
|
| 84 |
+
os.makedirs(output_dir, exist_ok=True)
|
| 85 |
+
for filename in os.listdir(dir_path):
|
| 86 |
+
if filename.endswith(".yaml"):
|
| 87 |
+
yaml_path = os.path.join(dir_path, filename)
|
| 88 |
+
plot_emotion_bar(yaml_path, output_dir)
|
| 89 |
+
|
| 90 |
+
def plot_emotion_heatmap(dir_path="outputs", output_file="outputs/visualizations/emotion_heatmap.png"):
|
| 91 |
+
"""Generate a heatmap for aggregated emotions across multiple YAML files."""
|
| 92 |
+
combined_emotions = {}
|
| 93 |
+
|
| 94 |
+
# Aggregate emotion data
|
| 95 |
+
for filename in os.listdir(dir_path):
|
| 96 |
+
if filename.endswith(".yaml"):
|
| 97 |
+
yaml_path = os.path.join(dir_path, filename)
|
| 98 |
+
with open(yaml_path, "r", encoding="utf-8") as file:
|
| 99 |
+
data = yaml.safe_load(file)
|
| 100 |
+
|
| 101 |
+
emotion_map = data.get("emotion_map", {})
|
| 102 |
+
for emotion, value in emotion_map.items():
|
| 103 |
+
if emotion not in combined_emotions:
|
| 104 |
+
combined_emotions[emotion] = []
|
| 105 |
+
combined_emotions[emotion].append(value)
|
| 106 |
+
|
| 107 |
+
# Prepare data for heatmap
|
| 108 |
+
emotions = list(combined_emotions.keys())
|
| 109 |
+
files = [f for f in os.listdir(dir_path) if f.endswith(".yaml")]
|
| 110 |
+
heatmap_data = np.zeros((len(emotions), len(files)))
|
| 111 |
+
|
| 112 |
+
for col, filename in enumerate(files):
|
| 113 |
+
yaml_path = os.path.join(dir_path, filename)
|
| 114 |
+
with open(yaml_path, "r", encoding="utf-8") as file:
|
| 115 |
+
data = yaml.safe_load(file)
|
| 116 |
+
|
| 117 |
+
emotion_map = data.get("emotion_map", {})
|
| 118 |
+
for row, emotion in enumerate(emotions):
|
| 119 |
+
heatmap_data[row, col] = emotion_map.get(emotion, 0)
|
| 120 |
+
|
| 121 |
+
# Plot heatmap
|
| 122 |
+
plt.figure(figsize=(12, 8))
|
| 123 |
+
sns.heatmap(heatmap_data, annot=True, xticklabels=files, yticklabels=emotions, cmap="coolwarm", cbar=True)
|
| 124 |
+
plt.title("Emotion Heatmap")
|
| 125 |
+
plt.xlabel("Files")
|
| 126 |
+
plt.ylabel("Emotions")
|
| 127 |
+
|
| 128 |
+
# Save heatmap
|
| 129 |
+
plt.savefig(output_file)
|
| 130 |
+
plt.close()
|
| 131 |
+
|
| 132 |
+
print(f"Emotion heatmap saved to {output_file}")
|
| 133 |
+
|
| 134 |
+
def plot_radar_chart(emotion_map, output_file="outputs/visualizations/radar_chart.png"):
|
| 135 |
+
"""
|
| 136 |
+
Generate a radar chart for the emotion map.
|
| 137 |
+
|
| 138 |
+
Args:
|
| 139 |
+
emotion_map (dict): A dictionary of emotions and their intensities.
|
| 140 |
+
output_file (str): Path to save the radar chart.
|
| 141 |
+
"""
|
| 142 |
+
import matplotlib.pyplot as plt
|
| 143 |
+
import numpy as np
|
| 144 |
+
|
| 145 |
+
labels = list(emotion_map.keys())
|
| 146 |
+
values = list(emotion_map.values())
|
| 147 |
+
|
| 148 |
+
# Add the first value to close the radar chart
|
| 149 |
+
values += values[:1]
|
| 150 |
+
labels += labels[:1]
|
| 151 |
+
|
| 152 |
+
angles = np.linspace(0, 2 * np.pi, len(labels), endpoint=False).tolist()
|
| 153 |
+
angles += angles[:1]
|
| 154 |
+
|
| 155 |
+
fig, ax = plt.subplots(figsize=(6, 6), subplot_kw=dict(polar=True))
|
| 156 |
+
ax.fill(angles, values, color="skyblue", alpha=0.4)
|
| 157 |
+
ax.plot(angles, values, color="blue", linewidth=2)
|
| 158 |
+
ax.set_yticks([])
|
| 159 |
+
ax.set_xticks(angles[:-1])
|
| 160 |
+
ax.set_xticklabels(labels)
|
| 161 |
+
|
| 162 |
+
plt.title("Emotion Radar Chart", size=20, color="blue", y=1.1)
|
| 163 |
+
plt.savefig(output_file)
|
| 164 |
+
plt.close()
|
| 165 |
+
|
| 166 |
+
print(f"Radar chart saved to {output_file}")
|
| 167 |
+
|
| 168 |
+
if __name__ == "__main__":
|
| 169 |
+
yaml_dir = "outputs/"
|
| 170 |
+
for filename in os.listdir(yaml_dir):
|
| 171 |
+
if filename.endswith(".yaml"):
|
| 172 |
+
plot_emotion_map(os.path.join(yaml_dir, filename))
|
| 173 |
+
plot_combined_emotion_maps(yaml_dir)
|
Aethero_App/reflection/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
# Reflection module initialization
|
Aethero_App/reflection/deep_eval_config.yaml
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DeepEval Configuration for AetheroOS Agent Stack
|
| 2 |
+
|
| 3 |
+
version: "1.0"
|
| 4 |
+
environment: "production"
|
| 5 |
+
|
| 6 |
+
# Core Evaluation Settings
|
| 7 |
+
core_settings:
|
| 8 |
+
parallel_evaluations: true
|
| 9 |
+
cache_results: true
|
| 10 |
+
logging_level: "detailed"
|
| 11 |
+
timeout_seconds: 30
|
| 12 |
+
|
| 13 |
+
# Evaluation Criteria
|
| 14 |
+
evaluation_criteria:
|
| 15 |
+
accuracy:
|
| 16 |
+
weight: 0.35
|
| 17 |
+
thresholds:
|
| 18 |
+
high: 0.85
|
| 19 |
+
medium: 0.70
|
| 20 |
+
low: 0.50
|
| 21 |
+
metrics:
|
| 22 |
+
- name: "factual_correctness"
|
| 23 |
+
weight: 0.4
|
| 24 |
+
- name: "completeness"
|
| 25 |
+
weight: 0.3
|
| 26 |
+
- name: "relevance"
|
| 27 |
+
weight: 0.3
|
| 28 |
+
|
| 29 |
+
consistency:
|
| 30 |
+
weight: 0.25
|
| 31 |
+
thresholds:
|
| 32 |
+
high: 0.90
|
| 33 |
+
medium: 0.75
|
| 34 |
+
low: 0.60
|
| 35 |
+
metrics:
|
| 36 |
+
- name: "internal_consistency"
|
| 37 |
+
weight: 0.5
|
| 38 |
+
- name: "cross_reference_validity"
|
| 39 |
+
weight: 0.3
|
| 40 |
+
- name: "temporal_consistency"
|
| 41 |
+
weight: 0.2
|
| 42 |
+
|
| 43 |
+
ethical_compliance:
|
| 44 |
+
weight: 0.20
|
| 45 |
+
thresholds:
|
| 46 |
+
high: 0.95
|
| 47 |
+
medium: 0.85
|
| 48 |
+
low: 0.70
|
| 49 |
+
metrics:
|
| 50 |
+
- name: "bias_detection"
|
| 51 |
+
weight: 0.4
|
| 52 |
+
- name: "fairness_score"
|
| 53 |
+
weight: 0.3
|
| 54 |
+
- name: "transparency_level"
|
| 55 |
+
weight: 0.3
|
| 56 |
+
|
| 57 |
+
performance:
|
| 58 |
+
weight: 0.20
|
| 59 |
+
thresholds:
|
| 60 |
+
high: 0.80
|
| 61 |
+
medium: 0.65
|
| 62 |
+
low: 0.50
|
| 63 |
+
metrics:
|
| 64 |
+
- name: "response_time"
|
| 65 |
+
weight: 0.3
|
| 66 |
+
- name: "resource_efficiency"
|
| 67 |
+
weight: 0.3
|
| 68 |
+
- name: "output_quality"
|
| 69 |
+
weight: 0.4
|
| 70 |
+
|
| 71 |
+
# Agent-Specific Evaluation Rules
|
| 72 |
+
agent_rules:
|
| 73 |
+
planner_agent:
|
| 74 |
+
required_criteria:
|
| 75 |
+
- "task_decomposition_quality"
|
| 76 |
+
- "priority_assignment_accuracy"
|
| 77 |
+
- "resource_allocation_efficiency"
|
| 78 |
+
custom_thresholds:
|
| 79 |
+
accuracy: 0.90
|
| 80 |
+
consistency: 0.85
|
| 81 |
+
|
| 82 |
+
scout_agent:
|
| 83 |
+
required_criteria:
|
| 84 |
+
- "source_reliability"
|
| 85 |
+
- "information_relevance"
|
| 86 |
+
- "search_coverage"
|
| 87 |
+
custom_thresholds:
|
| 88 |
+
accuracy: 0.85
|
| 89 |
+
completeness: 0.80
|
| 90 |
+
|
| 91 |
+
analyst_agent:
|
| 92 |
+
required_criteria:
|
| 93 |
+
- "analysis_depth"
|
| 94 |
+
- "critical_thinking"
|
| 95 |
+
- "synthesis_quality"
|
| 96 |
+
custom_thresholds:
|
| 97 |
+
accuracy: 0.90
|
| 98 |
+
ethical_compliance: 0.95
|
| 99 |
+
|
| 100 |
+
generator_agent:
|
| 101 |
+
required_criteria:
|
| 102 |
+
- "code_quality"
|
| 103 |
+
- "documentation_completeness"
|
| 104 |
+
- "artifact_usability"
|
| 105 |
+
custom_thresholds:
|
| 106 |
+
accuracy: 0.85
|
| 107 |
+
performance: 0.80
|
| 108 |
+
|
| 109 |
+
synthesis_agent:
|
| 110 |
+
required_criteria:
|
| 111 |
+
- "synthesis_coherence"
|
| 112 |
+
- "conclusion_validity"
|
| 113 |
+
- "recommendation_quality"
|
| 114 |
+
custom_thresholds:
|
| 115 |
+
accuracy: 0.90
|
| 116 |
+
consistency: 0.90
|
| 117 |
+
|
| 118 |
+
reflection_agent:
|
| 119 |
+
required_criteria:
|
| 120 |
+
- "evaluation_accuracy"
|
| 121 |
+
- "suggestion_relevance"
|
| 122 |
+
- "improvement_impact"
|
| 123 |
+
custom_thresholds:
|
| 124 |
+
accuracy: 0.95
|
| 125 |
+
ethical_compliance: 0.95
|
| 126 |
+
|
| 127 |
+
# Integration Settings
|
| 128 |
+
integration:
|
| 129 |
+
aethero_mem:
|
| 130 |
+
enabled: true
|
| 131 |
+
sync_interval_seconds: 60
|
| 132 |
+
storage_policy:
|
| 133 |
+
retain_days: 30
|
| 134 |
+
compression: true
|
| 135 |
+
|
| 136 |
+
monitoring:
|
| 137 |
+
enabled: true
|
| 138 |
+
metrics_export:
|
| 139 |
+
prometheus: true
|
| 140 |
+
grafana: true
|
| 141 |
+
alert_thresholds:
|
| 142 |
+
critical_failure: 0.5
|
| 143 |
+
warning: 0.7
|
| 144 |
+
|
| 145 |
+
reporting:
|
| 146 |
+
formats:
|
| 147 |
+
- json
|
| 148 |
+
- markdown
|
| 149 |
+
automated_reports:
|
| 150 |
+
enabled: true
|
| 151 |
+
frequency: "daily"
|
| 152 |
+
recipients:
|
| 153 |
+
- "system_admin"
|
| 154 |
+
- "quality_team"
|
| 155 |
+
|
| 156 |
+
# Validation Schemas
|
| 157 |
+
validation_schemas:
|
| 158 |
+
output_schema:
|
| 159 |
+
type: "object"
|
| 160 |
+
required:
|
| 161 |
+
- "metrics"
|
| 162 |
+
- "findings"
|
| 163 |
+
- "suggestions"
|
| 164 |
+
properties:
|
| 165 |
+
metrics:
|
| 166 |
+
type: "object"
|
| 167 |
+
required:
|
| 168 |
+
- "accuracy"
|
| 169 |
+
- "consistency"
|
| 170 |
+
- "ethical_compliance"
|
| 171 |
+
- "performance"
|
| 172 |
+
findings:
|
| 173 |
+
type: "array"
|
| 174 |
+
items:
|
| 175 |
+
type: "string"
|
| 176 |
+
suggestions:
|
| 177 |
+
type: "array"
|
| 178 |
+
items:
|
| 179 |
+
type: "string"
|
| 180 |
+
|
| 181 |
+
# Error Handling
|
| 182 |
+
error_handling:
|
| 183 |
+
retry_attempts: 3
|
| 184 |
+
backoff_factor: 2
|
| 185 |
+
max_backoff_seconds: 30
|
| 186 |
+
failure_policy: "fail_fast"
|
| 187 |
+
|
| 188 |
+
# Performance Optimization
|
| 189 |
+
optimization:
|
| 190 |
+
caching:
|
| 191 |
+
enabled: true
|
| 192 |
+
ttl_seconds: 3600
|
| 193 |
+
batching:
|
| 194 |
+
enabled: true
|
| 195 |
+
max_batch_size: 10
|
| 196 |
+
max_wait_ms: 100
|
Aethero_App/reflection/reflection_agent.py
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
AetheroOS Reflection Agent Implementation
|
| 3 |
+
"""
|
| 4 |
+
from typing import Dict, List, Any, Optional
|
| 5 |
+
from dataclasses import dataclass
|
| 6 |
+
from enum import Enum
|
| 7 |
+
import asyncio
|
| 8 |
+
import json
|
| 9 |
+
|
| 10 |
+
class ValidationStatus(Enum):
|
| 11 |
+
PASSED = "passed"
|
| 12 |
+
FAILED = "failed"
|
| 13 |
+
WARNING = "warning"
|
| 14 |
+
|
| 15 |
+
@dataclass
|
| 16 |
+
class ReflectionMetrics:
|
| 17 |
+
accuracy: float
|
| 18 |
+
consistency: float
|
| 19 |
+
ethical_compliance: float
|
| 20 |
+
performance_score: float
|
| 21 |
+
|
| 22 |
+
@dataclass
|
| 23 |
+
class ValidationResult:
|
| 24 |
+
status: ValidationStatus
|
| 25 |
+
metrics: ReflectionMetrics
|
| 26 |
+
findings: List[str]
|
| 27 |
+
suggestions: List[str]
|
| 28 |
+
|
| 29 |
+
class ReflectionAgent:
|
| 30 |
+
"""
|
| 31 |
+
Implementation of the AetheroOS Reflection Agent for introspective evaluation
|
| 32 |
+
and continuous improvement of the agent stack.
|
| 33 |
+
"""
|
| 34 |
+
|
| 35 |
+
def __init__(self, config: Dict[str, Any]):
|
| 36 |
+
"""
|
| 37 |
+
Initialize the reflection agent with configuration.
|
| 38 |
+
|
| 39 |
+
Args:
|
| 40 |
+
config: Configuration dictionary from aetheroos_sovereign_agent_stack_v1.0.yaml
|
| 41 |
+
"""
|
| 42 |
+
self.config = config
|
| 43 |
+
self.aethero_mem = None # Initialize in setup()
|
| 44 |
+
self.deep_eval = None # Initialize in setup()
|
| 45 |
+
|
| 46 |
+
async def setup(self) -> None:
|
| 47 |
+
"""Initialize connections to Aethero_Mem and DeepEval."""
|
| 48 |
+
# Initialize Aethero_Mem connection
|
| 49 |
+
self.aethero_mem = await self._init_aethero_mem()
|
| 50 |
+
|
| 51 |
+
# Initialize DeepEval
|
| 52 |
+
self.deep_eval = await self._init_deep_eval()
|
| 53 |
+
|
| 54 |
+
async def validate_output(self,
|
| 55 |
+
agent_id: str,
|
| 56 |
+
output: Any,
|
| 57 |
+
context: Dict[str, Any]) -> ValidationResult:
|
| 58 |
+
"""
|
| 59 |
+
Validate an agent's output using DeepEval.
|
| 60 |
+
|
| 61 |
+
Args:
|
| 62 |
+
agent_id: ID of the agent whose output is being validated
|
| 63 |
+
output: The output to validate
|
| 64 |
+
context: Contextual information for validation
|
| 65 |
+
|
| 66 |
+
Returns:
|
| 67 |
+
ValidationResult containing metrics and suggestions
|
| 68 |
+
"""
|
| 69 |
+
# Perform deep evaluation
|
| 70 |
+
eval_result = await self.deep_eval.evaluate(
|
| 71 |
+
output=output,
|
| 72 |
+
criteria={
|
| 73 |
+
"accuracy": self._accuracy_evaluator,
|
| 74 |
+
"consistency": self._consistency_evaluator,
|
| 75 |
+
"ethical_compliance": self._ethical_evaluator,
|
| 76 |
+
"performance": self._performance_evaluator
|
| 77 |
+
},
|
| 78 |
+
context=context
|
| 79 |
+
)
|
| 80 |
+
|
| 81 |
+
# Calculate metrics
|
| 82 |
+
metrics = ReflectionMetrics(
|
| 83 |
+
accuracy=eval_result["accuracy"],
|
| 84 |
+
consistency=eval_result["consistency"],
|
| 85 |
+
ethical_compliance=eval_result["ethical_compliance"],
|
| 86 |
+
performance_score=eval_result["performance"]
|
| 87 |
+
)
|
| 88 |
+
|
| 89 |
+
# Determine status
|
| 90 |
+
status = self._determine_validation_status(metrics)
|
| 91 |
+
|
| 92 |
+
# Generate findings and suggestions
|
| 93 |
+
findings = self._analyze_evaluation_results(eval_result)
|
| 94 |
+
suggestions = self._generate_optimization_suggestions(findings)
|
| 95 |
+
|
| 96 |
+
# Log to Aethero_Mem
|
| 97 |
+
await self._log_reflection(agent_id, metrics, findings, suggestions)
|
| 98 |
+
|
| 99 |
+
return ValidationResult(
|
| 100 |
+
status=status,
|
| 101 |
+
metrics=metrics,
|
| 102 |
+
findings=findings,
|
| 103 |
+
suggestions=suggestions
|
| 104 |
+
)
|
| 105 |
+
|
| 106 |
+
async def reflect_on_pipeline(self,
|
| 107 |
+
pipeline_execution_id: str) -> Dict[str, Any]:
|
| 108 |
+
"""
|
| 109 |
+
Perform reflection on entire pipeline execution.
|
| 110 |
+
|
| 111 |
+
Args:
|
| 112 |
+
pipeline_execution_id: ID of the pipeline execution to reflect on
|
| 113 |
+
|
| 114 |
+
Returns:
|
| 115 |
+
Dictionary containing reflection results and recommendations
|
| 116 |
+
"""
|
| 117 |
+
# Retrieve pipeline execution data from Aethero_Mem
|
| 118 |
+
pipeline_data = await self.aethero_mem.get_pipeline_execution(
|
| 119 |
+
pipeline_execution_id
|
| 120 |
+
)
|
| 121 |
+
|
| 122 |
+
# Analyze pipeline performance
|
| 123 |
+
performance_analysis = await self._analyze_pipeline_performance(
|
| 124 |
+
pipeline_data
|
| 125 |
+
)
|
| 126 |
+
|
| 127 |
+
# Generate optimization recommendations
|
| 128 |
+
recommendations = self._generate_pipeline_recommendations(
|
| 129 |
+
performance_analysis
|
| 130 |
+
)
|
| 131 |
+
|
| 132 |
+
# Store reflection results
|
| 133 |
+
reflection_id = await self._store_reflection_results(
|
| 134 |
+
pipeline_execution_id,
|
| 135 |
+
performance_analysis,
|
| 136 |
+
recommendations
|
| 137 |
+
)
|
| 138 |
+
|
| 139 |
+
return {
|
| 140 |
+
"reflection_id": reflection_id,
|
| 141 |
+
"performance_analysis": performance_analysis,
|
| 142 |
+
"recommendations": recommendations
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
async def _init_aethero_mem(self):
|
| 146 |
+
"""Initialize connection to Aethero_Mem."""
|
| 147 |
+
# Implementation for Aethero_Mem connection
|
| 148 |
+
pass
|
| 149 |
+
|
| 150 |
+
async def _init_deep_eval(self):
|
| 151 |
+
"""Initialize DeepEval system."""
|
| 152 |
+
# Implementation for DeepEval initialization
|
| 153 |
+
pass
|
| 154 |
+
|
| 155 |
+
def _accuracy_evaluator(self, output: Any, context: Dict[str, Any]) -> float:
|
| 156 |
+
"""Evaluate output accuracy."""
|
| 157 |
+
# Implementation for accuracy evaluation
|
| 158 |
+
pass
|
| 159 |
+
|
| 160 |
+
def _consistency_evaluator(self, output: Any, context: Dict[str, Any]) -> float:
|
| 161 |
+
"""Evaluate output consistency."""
|
| 162 |
+
# Implementation for consistency evaluation
|
| 163 |
+
pass
|
| 164 |
+
|
| 165 |
+
def _ethical_evaluator(self, output: Any, context: Dict[str, Any]) -> float:
|
| 166 |
+
"""Evaluate ethical compliance."""
|
| 167 |
+
# Implementation for ethical evaluation
|
| 168 |
+
pass
|
| 169 |
+
|
| 170 |
+
def _performance_evaluator(self, output: Any, context: Dict[str, Any]) -> float:
|
| 171 |
+
"""Evaluate performance metrics."""
|
| 172 |
+
# Implementation for performance evaluation
|
| 173 |
+
pass
|
| 174 |
+
|
| 175 |
+
def _determine_validation_status(self, metrics: ReflectionMetrics) -> ValidationStatus:
|
| 176 |
+
"""Determine overall validation status based on metrics."""
|
| 177 |
+
# Implementation for status determination
|
| 178 |
+
pass
|
| 179 |
+
|
| 180 |
+
def _analyze_evaluation_results(self, eval_result: Dict[str, Any]) -> List[str]:
|
| 181 |
+
"""Analyze evaluation results to generate findings."""
|
| 182 |
+
# Implementation for results analysis
|
| 183 |
+
pass
|
| 184 |
+
|
| 185 |
+
def _generate_optimization_suggestions(self, findings: List[str]) -> List[str]:
|
| 186 |
+
"""Generate optimization suggestions based on findings."""
|
| 187 |
+
# Implementation for suggestion generation
|
| 188 |
+
pass
|
| 189 |
+
|
| 190 |
+
async def _log_reflection(self,
|
| 191 |
+
agent_id: str,
|
| 192 |
+
metrics: ReflectionMetrics,
|
| 193 |
+
findings: List[str],
|
| 194 |
+
suggestions: List[str]) -> None:
|
| 195 |
+
"""Log reflection results to Aethero_Mem."""
|
| 196 |
+
# Implementation for reflection logging
|
| 197 |
+
pass
|
| 198 |
+
|
| 199 |
+
async def _analyze_pipeline_performance(self,
|
| 200 |
+
pipeline_data: Dict[str, Any]) -> Dict[str, Any]:
|
| 201 |
+
"""Analyze overall pipeline performance."""
|
| 202 |
+
# Implementation for pipeline analysis
|
| 203 |
+
pass
|
| 204 |
+
|
| 205 |
+
def _generate_pipeline_recommendations(self,
|
| 206 |
+
performance_analysis: Dict[str, Any]) -> List[str]:
|
| 207 |
+
"""Generate recommendations for pipeline optimization."""
|
| 208 |
+
# Implementation for recommendation generation
|
| 209 |
+
pass
|
| 210 |
+
|
| 211 |
+
async def _store_reflection_results(self,
|
| 212 |
+
pipeline_execution_id: str,
|
| 213 |
+
performance_analysis: Dict[str, Any],
|
| 214 |
+
recommendations: List[str]) -> str:
|
| 215 |
+
"""Store reflection results in Aethero_Mem."""
|
| 216 |
+
# Implementation for results storage
|
| 217 |
+
pass
|
Aethero_App/requirements.txt
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Core Dependencies
|
| 2 |
+
aiohttp>=3.8.0
|
| 3 |
+
cryptography>=3.4.7
|
| 4 |
+
PyJWT>=2.3.0
|
| 5 |
+
psutil>=5.8.0
|
| 6 |
+
pytest>=6.2.5
|
| 7 |
+
pytest-asyncio>=0.16.0
|
| 8 |
+
aiofiles>=0.8.0
|
| 9 |
+
|
| 10 |
+
# Pydantic for data validation
|
| 11 |
+
pydantic>=2.11.0
|
| 12 |
+
tabulate>=0.9.0
|
| 13 |
+
|
| 14 |
+
# Security
|
| 15 |
+
bcrypt>=3.2.0
|
| 16 |
+
python-jose>=3.3.0
|
| 17 |
+
|
| 18 |
+
# Monitoring
|
| 19 |
+
prometheus-client>=0.12.0
|
| 20 |
+
statsd>=3.3.0
|
| 21 |
+
|
| 22 |
+
# Testing
|
| 23 |
+
pytest-cov>=2.12.0
|
| 24 |
+
pytest-mock>=3.6.1
|
| 25 |
+
asynctest>=0.13.0
|
| 26 |
+
|
| 27 |
+
# Documentation
|
| 28 |
+
Sphinx>=4.3.0
|
| 29 |
+
sphinx-rtd-theme>=1.0.0
|
Aethero_App/run_validation_repair.py
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
AetheroOS Validation Repair Module
|
| 4 |
+
Modul pre Opravu Validácie AetheroOS
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import json
|
| 8 |
+
import os
|
| 9 |
+
import sys
|
| 10 |
+
from enum import Enum
|
| 11 |
+
from typing import Dict, List, Optional
|
| 12 |
+
from datetime import datetime
|
| 13 |
+
|
| 14 |
+
class IssueLevel(Enum):
|
| 15 |
+
CRITICAL = "🔴 CRITICAL"
|
| 16 |
+
WARNING = "🟠 WARNING"
|
| 17 |
+
INFO = "🟢 INFO"
|
| 18 |
+
|
| 19 |
+
class ValidationRepair:
|
| 20 |
+
def __init__(self):
|
| 21 |
+
self.issues = {
|
| 22 |
+
IssueLevel.CRITICAL: [],
|
| 23 |
+
IssueLevel.WARNING: [],
|
| 24 |
+
IssueLevel.INFO: []
|
| 25 |
+
}
|
| 26 |
+
self.fixes = []
|
| 27 |
+
self.output_dir = "auto_fixes"
|
| 28 |
+
|
| 29 |
+
def load_validation_report(self) -> Dict:
|
| 30 |
+
"""
|
| 31 |
+
Load and parse validation report
|
| 32 |
+
Načítanie a parsovanie validačnej správy
|
| 33 |
+
"""
|
| 34 |
+
try:
|
| 35 |
+
with open("validation_report.json", "r") as f:
|
| 36 |
+
return json.load(f)
|
| 37 |
+
except FileNotFoundError:
|
| 38 |
+
print("⚠️ validation_report.json not found. Running fresh validation...")
|
| 39 |
+
return self.run_initial_validation()
|
| 40 |
+
|
| 41 |
+
def run_initial_validation(self) -> Dict:
|
| 42 |
+
"""
|
| 43 |
+
Run initial validation if report doesn't exist
|
| 44 |
+
Spustenie počiatočnej validácie ak správa neexistuje
|
| 45 |
+
"""
|
| 46 |
+
import validate_project
|
| 47 |
+
return {"status": "initial_validation_complete"}
|
| 48 |
+
|
| 49 |
+
def analyze_issues(self, report: Dict):
|
| 50 |
+
"""
|
| 51 |
+
Analyze and categorize issues
|
| 52 |
+
Analýza a kategorizácia problémov
|
| 53 |
+
"""
|
| 54 |
+
# Check for critical file structure issues
|
| 55 |
+
self._check_file_structure()
|
| 56 |
+
|
| 57 |
+
# Check for ASL tag consistency
|
| 58 |
+
self._check_asl_tags()
|
| 59 |
+
|
| 60 |
+
# Validate agent configurations
|
| 61 |
+
self._check_agent_configs()
|
| 62 |
+
|
| 63 |
+
# Check for potential security issues
|
| 64 |
+
self._check_security_compliance()
|
| 65 |
+
|
| 66 |
+
def _check_file_structure(self):
|
| 67 |
+
"""
|
| 68 |
+
Verify project structure and files
|
| 69 |
+
Overenie štruktúry projektu a súborov
|
| 70 |
+
"""
|
| 71 |
+
required_dirs = ['src', 'tests', 'docs']
|
| 72 |
+
required_files = [
|
| 73 |
+
'models.py',
|
| 74 |
+
'utils.py',
|
| 75 |
+
'requirements.txt',
|
| 76 |
+
'README.md'
|
| 77 |
+
]
|
| 78 |
+
|
| 79 |
+
for directory in required_dirs:
|
| 80 |
+
if not os.path.exists(directory):
|
| 81 |
+
self.issues[IssueLevel.CRITICAL].append({
|
| 82 |
+
"type": "missing_directory",
|
| 83 |
+
"item": directory,
|
| 84 |
+
"fix": f"mkdir -p {directory}"
|
| 85 |
+
})
|
| 86 |
+
|
| 87 |
+
for file in required_files:
|
| 88 |
+
if not os.path.exists(file):
|
| 89 |
+
self.issues[IssueLevel.CRITICAL].append({
|
| 90 |
+
"type": "missing_file",
|
| 91 |
+
"item": file,
|
| 92 |
+
"fix": self._generate_file_template(file)
|
| 93 |
+
})
|
| 94 |
+
|
| 95 |
+
def _check_asl_tags(self):
|
| 96 |
+
"""
|
| 97 |
+
Validate ASL tag structure and usage
|
| 98 |
+
Validácia štruktúry a použitia ASL tagov
|
| 99 |
+
"""
|
| 100 |
+
try:
|
| 101 |
+
with open("src/asl_parser.py", "r") as f:
|
| 102 |
+
content = f.read()
|
| 103 |
+
if "validate_tag_structure" not in content:
|
| 104 |
+
self.issues[IssueLevel.WARNING].append({
|
| 105 |
+
"type": "missing_tag_validation",
|
| 106 |
+
"item": "src/asl_parser.py",
|
| 107 |
+
"fix": self._generate_asl_validator()
|
| 108 |
+
})
|
| 109 |
+
except FileNotFoundError:
|
| 110 |
+
self.issues[IssueLevel.CRITICAL].append({
|
| 111 |
+
"type": "missing_asl_parser",
|
| 112 |
+
"item": "src/asl_parser.py",
|
| 113 |
+
"fix": self._generate_asl_parser()
|
| 114 |
+
})
|
| 115 |
+
|
| 116 |
+
def _check_agent_configs(self):
|
| 117 |
+
"""
|
| 118 |
+
Validate agent configurations
|
| 119 |
+
Validácia konfigurácií agentov
|
| 120 |
+
"""
|
| 121 |
+
agent_types = ["planner", "scout", "analyst", "generator", "synthesis"]
|
| 122 |
+
for agent in agent_types:
|
| 123 |
+
config_file = f"config/{agent}_agent_config.yaml"
|
| 124 |
+
if not os.path.exists(config_file):
|
| 125 |
+
self.issues[IssueLevel.WARNING].append({
|
| 126 |
+
"type": "missing_agent_config",
|
| 127 |
+
"item": config_file,
|
| 128 |
+
"fix": self._generate_agent_config(agent)
|
| 129 |
+
})
|
| 130 |
+
|
| 131 |
+
def _check_security_compliance(self):
|
| 132 |
+
"""
|
| 133 |
+
Check security compliance
|
| 134 |
+
Kontrola bezpečnostnej kompatibility
|
| 135 |
+
"""
|
| 136 |
+
security_files = [".env.example", "security_policy.md"]
|
| 137 |
+
for file in security_files:
|
| 138 |
+
if not os.path.exists(file):
|
| 139 |
+
self.issues[IssueLevel.INFO].append({
|
| 140 |
+
"type": "missing_security_file",
|
| 141 |
+
"item": file,
|
| 142 |
+
"fix": self._generate_security_template(file)
|
| 143 |
+
})
|
| 144 |
+
|
| 145 |
+
def generate_repair_report(self):
|
| 146 |
+
"""
|
| 147 |
+
Generate markdown repair report
|
| 148 |
+
Generovanie správy o oprave v markdown formáte
|
| 149 |
+
"""
|
| 150 |
+
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
| 151 |
+
report = f"""# AetheroOS Validation Repair Report
|
| 152 |
+
Generated: {timestamp}
|
| 153 |
+
|
| 154 |
+
## Issue Summary
|
| 155 |
+
"""
|
| 156 |
+
for level in IssueLevel:
|
| 157 |
+
issues = self.issues[level]
|
| 158 |
+
if issues:
|
| 159 |
+
report += f"\n### {level.value}\n"
|
| 160 |
+
for issue in issues:
|
| 161 |
+
report += f"- {issue['type']}: {issue['item']}\n"
|
| 162 |
+
|
| 163 |
+
report += "\n## Recommended Fixes\n"
|
| 164 |
+
for level in IssueLevel:
|
| 165 |
+
fixes = [issue for issue in self.issues[level] if "fix" in issue]
|
| 166 |
+
if fixes:
|
| 167 |
+
report += f"\n### {level.value} Fixes\n"
|
| 168 |
+
for fix in fixes:
|
| 169 |
+
report += f"- {fix['item']}:\n```\n{fix['fix']}\n```\n"
|
| 170 |
+
|
| 171 |
+
return report
|
| 172 |
+
|
| 173 |
+
def save_repair_report(self, report: str):
|
| 174 |
+
"""
|
| 175 |
+
Save repair report to file
|
| 176 |
+
Uloženie správy o oprave do súboru
|
| 177 |
+
"""
|
| 178 |
+
os.makedirs("auto_fixes", exist_ok=True)
|
| 179 |
+
with open("auto_fixes/repair_report.md", "w") as f:
|
| 180 |
+
f.write(report)
|
| 181 |
+
|
| 182 |
+
def _generate_file_template(self, filename: str) -> str:
|
| 183 |
+
"""
|
| 184 |
+
Generate template for missing files
|
| 185 |
+
Generovanie šablóny pre chýbajúce súbory
|
| 186 |
+
"""
|
| 187 |
+
templates = {
|
| 188 |
+
"models.py": """from typing import Dict, List
|
| 189 |
+
|
| 190 |
+
class AetheroModel:
|
| 191 |
+
\"\"\"Base model for AetheroOS components\"\"\"
|
| 192 |
+
pass
|
| 193 |
+
""",
|
| 194 |
+
"utils.py": """from typing import Any, Dict
|
| 195 |
+
|
| 196 |
+
def validate_input(data: Dict) -> bool:
|
| 197 |
+
\"\"\"Validate input data\"\"\"
|
| 198 |
+
return True
|
| 199 |
+
""",
|
| 200 |
+
"requirements.txt": """# Core Dependencies
|
| 201 |
+
aiohttp>=3.8.0
|
| 202 |
+
pyyaml>=6.0
|
| 203 |
+
pytest>=6.2.5
|
| 204 |
+
""",
|
| 205 |
+
"README.md": """# AetheroOS Protocol
|
| 206 |
+
|
| 207 |
+
Enterprise-grade multi-agent system with ASL compatibility.
|
| 208 |
+
"""
|
| 209 |
+
}
|
| 210 |
+
return templates.get(filename, "# Template not available")
|
| 211 |
+
|
| 212 |
+
def _generate_asl_validator(self) -> str:
|
| 213 |
+
return """def validate_tag_structure(tag: Dict) -> bool:
|
| 214 |
+
\"\"\"Validate ASL tag structure\"\"\"
|
| 215 |
+
required_fields = ["tag_name", "value", "position"]
|
| 216 |
+
return all(field in tag for field in required_fields)
|
| 217 |
+
"""
|
| 218 |
+
|
| 219 |
+
def _generate_asl_parser(self) -> str:
|
| 220 |
+
return """from typing import Dict, List
|
| 221 |
+
|
| 222 |
+
class ASLParser:
|
| 223 |
+
\"\"\"Parser for ASL (Aethero Syntax Language) tags\"\"\"
|
| 224 |
+
|
| 225 |
+
def __init__(self):
|
| 226 |
+
self.tags = []
|
| 227 |
+
|
| 228 |
+
def parse(self, content: str) -> List[Dict]:
|
| 229 |
+
\"\"\"Parse ASL tags from content\"\"\"
|
| 230 |
+
# Implementation here
|
| 231 |
+
return []
|
| 232 |
+
"""
|
| 233 |
+
|
| 234 |
+
def _generate_agent_config(self, agent_type: str) -> str:
|
| 235 |
+
return f"""# {agent_type.capitalize()} Agent Configuration
|
| 236 |
+
name: {agent_type}_agent
|
| 237 |
+
version: 1.0
|
| 238 |
+
timeout: 300
|
| 239 |
+
retry_limit: 3
|
| 240 |
+
"""
|
| 241 |
+
|
| 242 |
+
def _generate_security_template(self, filename: str) -> str:
|
| 243 |
+
templates = {
|
| 244 |
+
".env.example": """# AetheroOS Environment Variables
|
| 245 |
+
API_KEY=your_api_key_here
|
| 246 |
+
DEBUG=False
|
| 247 |
+
LOG_LEVEL=INFO
|
| 248 |
+
""",
|
| 249 |
+
"security_policy.md": """# Security Policy
|
| 250 |
+
|
| 251 |
+
## Reporting Security Issues
|
| 252 |
+
Please report security issues to security@aetheros.ai
|
| 253 |
+
"""
|
| 254 |
+
}
|
| 255 |
+
return templates.get(filename, "# Template not available")
|
| 256 |
+
|
| 257 |
+
def main():
|
| 258 |
+
"""
|
| 259 |
+
Main execution function
|
| 260 |
+
Hlavná vykonávacia funkcia
|
| 261 |
+
"""
|
| 262 |
+
print("🔄 Starting AetheroOS Validation Repair...")
|
| 263 |
+
|
| 264 |
+
validator = ValidationRepair()
|
| 265 |
+
report = validator.load_validation_report()
|
| 266 |
+
validator.analyze_issues(report)
|
| 267 |
+
|
| 268 |
+
repair_report = validator.generate_repair_report()
|
| 269 |
+
validator.save_repair_report(repair_report)
|
| 270 |
+
|
| 271 |
+
print("\n✅ Validation repair complete!")
|
| 272 |
+
print("📝 Check auto_fixes/repair_report.md for details")
|
| 273 |
+
|
| 274 |
+
if __name__ == "__main__":
|
| 275 |
+
main()
|
Aethero_App/scripts/local_mem_optimizer.sh
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
set -e
|
| 3 |
+
|
| 4 |
+
echo "=== AetheroOS Local Memory Optimizer ==="
|
| 5 |
+
|
| 6 |
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
| 7 |
+
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
| 8 |
+
DATA_DIR="$ROOT_DIR/data"
|
| 9 |
+
LOG_DIR="$ROOT_DIR/logs"
|
| 10 |
+
|
| 11 |
+
# Parse arguments
|
| 12 |
+
CLEANUP=false
|
| 13 |
+
AGGRESSIVE=false
|
| 14 |
+
|
| 15 |
+
while [[ $# -gt 0 ]]; do
|
| 16 |
+
case $1 in
|
| 17 |
+
--cleanup)
|
| 18 |
+
CLEANUP=true
|
| 19 |
+
shift
|
| 20 |
+
;;
|
| 21 |
+
--aggressive)
|
| 22 |
+
AGGRESSIVE=true
|
| 23 |
+
shift
|
| 24 |
+
;;
|
| 25 |
+
*)
|
| 26 |
+
echo "Unknown option: $1"
|
| 27 |
+
exit 1
|
| 28 |
+
;;
|
| 29 |
+
esac
|
| 30 |
+
done
|
| 31 |
+
|
| 32 |
+
# Function to optimize process memory
|
| 33 |
+
optimize_process() {
|
| 34 |
+
local service=$1
|
| 35 |
+
local pid_file="$LOG_DIR/${service}.pid"
|
| 36 |
+
|
| 37 |
+
if [ -f "$pid_file" ]; then
|
| 38 |
+
pid=$(cat "$pid_file")
|
| 39 |
+
if kill -0 "$pid" 2>/dev/null; then
|
| 40 |
+
echo "Optimizing $service (PID: $pid)..."
|
| 41 |
+
# Send SIGQUIT to trigger Python garbage collection
|
| 42 |
+
kill -SIGQUIT "$pid" 2>/dev/null || true
|
| 43 |
+
else
|
| 44 |
+
echo "Warning: $service is not running"
|
| 45 |
+
fi
|
| 46 |
+
else
|
| 47 |
+
echo "Warning: PID file not found for $service"
|
| 48 |
+
fi
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
# Function to cleanup memory data
|
| 52 |
+
cleanup_memory() {
|
| 53 |
+
echo "Cleaning up memory data..."
|
| 54 |
+
|
| 55 |
+
# Stop memory service
|
| 56 |
+
"$SCRIPT_DIR/local_service_manager.sh" stop
|
| 57 |
+
|
| 58 |
+
# Clear memory data
|
| 59 |
+
if [ "$AGGRESSIVE" = true ]; then
|
| 60 |
+
echo "Performing aggressive cleanup..."
|
| 61 |
+
rm -rf "$DATA_DIR/aethero_mem"/*
|
| 62 |
+
rm -rf "$LOG_DIR"/*.log
|
| 63 |
+
else
|
| 64 |
+
echo "Performing standard cleanup..."
|
| 65 |
+
find "$DATA_DIR/aethero_mem" -type f -mtime +7 -delete
|
| 66 |
+
find "$LOG_DIR" -name "*.log" -mtime +7 -delete
|
| 67 |
+
fi
|
| 68 |
+
|
| 69 |
+
# Restart memory service
|
| 70 |
+
"$SCRIPT_DIR/local_service_manager.sh" start
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
# Main optimization process
|
| 74 |
+
echo "Starting memory optimization..."
|
| 75 |
+
|
| 76 |
+
# List of services to optimize
|
| 77 |
+
SERVICES=("aethero_mem" "reflection_agent" "planner_agent" "scout_agent" "analyst_agent" "langgraph")
|
| 78 |
+
|
| 79 |
+
for service in "${SERVICES[@]}"; do
|
| 80 |
+
optimize_process "$service"
|
| 81 |
+
done
|
| 82 |
+
|
| 83 |
+
# Perform cleanup if requested
|
| 84 |
+
if [ "$CLEANUP" = true ]; then
|
| 85 |
+
cleanup_memory
|
| 86 |
+
fi
|
| 87 |
+
|
| 88 |
+
# Verify optimization
|
| 89 |
+
echo "Verifying optimization results..."
|
| 90 |
+
|
| 91 |
+
# Check memory usage after optimization
|
| 92 |
+
for service in "${SERVICES[@]}"; do
|
| 93 |
+
pid_file="$LOG_DIR/${service}.pid"
|
| 94 |
+
if [ -f "$pid_file" ]; then
|
| 95 |
+
pid=$(cat "$pid_file")
|
| 96 |
+
if kill -0 "$pid" 2>/dev/null; then
|
| 97 |
+
mem_usage=$(ps -o %mem -p "$pid" | tail -n 1)
|
| 98 |
+
echo "$service memory usage: $mem_usage%"
|
| 99 |
+
|
| 100 |
+
if (( $(echo "$mem_usage > 80" | bc -l) )); then
|
| 101 |
+
echo "Warning: High memory usage in $service"
|
| 102 |
+
fi
|
| 103 |
+
fi
|
| 104 |
+
fi
|
| 105 |
+
done
|
| 106 |
+
|
| 107 |
+
echo "Memory optimization complete!"
|
| 108 |
+
|
| 109 |
+
# Return status
|
| 110 |
+
if [ "$CLEANUP" = true ]; then
|
| 111 |
+
echo "Cleanup completed successfully"
|
| 112 |
+
fi
|
| 113 |
+
|
| 114 |
+
if [ "$AGGRESSIVE" = true ]; then
|
| 115 |
+
echo "Aggressive optimization completed"
|
| 116 |
+
fi
|
| 117 |
+
|
| 118 |
+
exit 0
|