System: Integrate Dispatcher and Update Workflow
This commit is contained in:
@@ -8,23 +8,32 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# === АГЕНТ 1: РАНКОВИЙ ЗБІР ===
|
# === АГЕНТ 1: РАНКОВИЙ ЗБІР (STEWARDSHIP) ===
|
||||||
standup-check:
|
standup-check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: node:16-bullseye
|
container:
|
||||||
|
image: node:16-bullseye
|
||||||
steps:
|
steps:
|
||||||
- name: 📞 Check Connectivity
|
- name: 📥 Check out repository
|
||||||
run: |
|
uses: actions/checkout@v3
|
||||||
apt-get update && apt-get install -y curl
|
|
||||||
curl -f -I https://git.smagentsconsulting.uk/ || exit 1
|
|
||||||
echo "✅ Gitea is Alive. Starting the day..."
|
|
||||||
|
|
||||||
# === АГЕНТ 2: ОСНОВНА РОБОТА ===
|
- name: 🛠️ Setup Docker Tools
|
||||||
|
run: |
|
||||||
|
apt-get update && apt-get install -y curl tar
|
||||||
|
curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-26.1.3.tgz -o docker.tgz
|
||||||
|
tar xzvf docker.tgz && mv docker/docker /usr/local/bin/ && chmod +x /usr/local/bin/docker
|
||||||
|
|
||||||
|
- name: 🌅 Run Standup Logic
|
||||||
|
run: |
|
||||||
|
# Запускаємо Python-код з аргументом --task standup
|
||||||
|
# Він перевірить диск, змінні оточення і запише статус у JSON
|
||||||
|
docker compose run --rm antigravity_core python main.py --task standup
|
||||||
|
|
||||||
|
# === АГЕНТ 2: ОСНОВНА РОБОТА (VALUE) ===
|
||||||
heavy-worker:
|
heavy-worker:
|
||||||
needs: standup-check
|
needs: standup-check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
# ВАЖЛИВО: Тільки image, ніяких volumes!
|
|
||||||
image: node:16-bullseye
|
image: node:16-bullseye
|
||||||
steps:
|
steps:
|
||||||
- name: 📥 Check out repository
|
- name: 📥 Check out repository
|
||||||
@@ -38,17 +47,14 @@ jobs:
|
|||||||
|
|
||||||
- name: 🔨 Run Main Task
|
- name: 🔨 Run Main Task
|
||||||
run: |
|
run: |
|
||||||
# Запускаємо Python-код (поки що просто версію, щоб перевірити запуск)
|
# Запускаємо Worker. Він перевірить, чи успішним був стендап (через JSON)
|
||||||
# Якщо main.py ще не готовий, це не впаде
|
docker compose run --rm antigravity_core python main.py --task worker
|
||||||
echo "Starting Agent Core..."
|
|
||||||
docker compose run --rm antigravity_core python --version
|
|
||||||
|
|
||||||
# === АГЕНТ 3: АУДИТОР ===
|
# === АГЕНТ 3: АУДИТОР (QUALITY) ===
|
||||||
qa-auditor:
|
qa-auditor:
|
||||||
needs: heavy-worker
|
needs: heavy-worker
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
# ВАЖЛИВО: Тільки image, ніяких volumes!
|
|
||||||
image: node:16-bullseye
|
image: node:16-bullseye
|
||||||
steps:
|
steps:
|
||||||
- name: 📥 Check out repository
|
- name: 📥 Check out repository
|
||||||
@@ -56,38 +62,33 @@ jobs:
|
|||||||
|
|
||||||
- name: 🛠️ Setup Docker Tools
|
- name: 🛠️ Setup Docker Tools
|
||||||
run: |
|
run: |
|
||||||
apt-get update && apt-get install -y curl tar python3
|
apt-get update && apt-get install -y curl tar
|
||||||
curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-26.1.3.tgz -o docker.tgz
|
curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-26.1.3.tgz -o docker.tgz
|
||||||
tar xzvf docker.tgz && mv docker/docker /usr/local/bin/ && chmod +x /usr/local/bin/docker
|
tar xzvf docker.tgz && mv docker/docker /usr/local/bin/ && chmod +x /usr/local/bin/docker
|
||||||
|
|
||||||
- name: 🛡️ Infrastructure Audit
|
- name: 🛡️ Run QA Audit
|
||||||
run: |
|
run: |
|
||||||
if [ -f audit.py ]; then
|
# Запускаємо аудит через main.py
|
||||||
python3 audit.py
|
docker compose run --rm antigravity_core python main.py --task audit
|
||||||
else
|
|
||||||
echo "Audit script not found, checking docker ps..."
|
|
||||||
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Image}}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# === АГЕНТ 4: РЕПОРТЕР ===
|
# === АГЕНТ 4: РЕПОРТЕР (TRANSPARENCY) ===
|
||||||
scrum-report:
|
scrum-report:
|
||||||
if: always()
|
if: always()
|
||||||
needs: [standup-check, heavy-worker, qa-auditor]
|
needs: [standup-check, heavy-worker, qa-auditor]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: node:16-bullseye
|
||||||
steps:
|
steps:
|
||||||
- name: 📢 Daily Report
|
- name: 📥 Check out repository
|
||||||
run: |
|
uses: actions/checkout@v3
|
||||||
echo "========================="
|
|
||||||
echo "📊 SPRINT REPORT"
|
|
||||||
echo "========================="
|
|
||||||
echo "Standup Check: ${{ needs.standup-check.result }}"
|
|
||||||
echo "Heavy Worker: ${{ needs.heavy-worker.result }}"
|
|
||||||
echo "QA Audit: ${{ needs.qa-auditor.result }}"
|
|
||||||
echo "========================="
|
|
||||||
|
|
||||||
if [ "${{ needs.heavy-worker.result }}" == "success" ]; then
|
- name: 🛠️ Setup Docker Tools
|
||||||
echo "✅ Day Successful. System Stable."
|
run: |
|
||||||
else
|
apt-get update && apt-get install -y curl tar
|
||||||
echo "❌ Issues Detected! Check logs above."
|
curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-26.1.3.tgz -o docker.tgz
|
||||||
exit 1
|
tar xzvf docker.tgz && mv docker/docker /usr/local/bin/ && chmod +x /usr/local/bin/docker
|
||||||
fi
|
|
||||||
|
- name: 📢 Generate Report
|
||||||
|
run: |
|
||||||
|
# Репортер збере всі статуси з JSON і виведе звіт
|
||||||
|
docker compose run --rm antigravity_core python main.py --task report
|
||||||
|
|||||||
81
main.py
81
main.py
@@ -1,39 +1,52 @@
|
|||||||
import os
|
import argparse
|
||||||
import time
|
import sys
|
||||||
import psycopg2
|
import logging
|
||||||
import requests
|
from modules.squad_logic import MorningStandup, HeavyWorker, QAAuditor, ScrumReport
|
||||||
|
|
||||||
# Налаштування (беруться з Environment Variables)
|
# Налаштування логування
|
||||||
DB_HOST = os.getenv("DB_HOST", "postgres")
|
logging.basicConfig(
|
||||||
DB_USER = os.getenv("DB_USER", "postgres")
|
level=logging.INFO,
|
||||||
DB_PASS = os.getenv("DB_PASS", "password")
|
format='%(asctime)s - [ANTIGRAVITY] - %(levelname)s - %(message)s',
|
||||||
GRAPHITI_URL = os.getenv("GRAPHITI_URL", "http://graphiti:8000")
|
datefmt='%H:%M:%S',
|
||||||
|
handlers=[logging.StreamHandler(sys.stdout)]
|
||||||
def check_connections():
|
|
||||||
print("🕵️ Antigravity Agent: Starting Diagnostics...")
|
|
||||||
|
|
||||||
# 1. Перевірка Graphiti (Пам'ять)
|
|
||||||
try:
|
|
||||||
r = requests.get(f"{GRAPHITI_URL}/health", timeout=3)
|
|
||||||
if r.status_code == 200:
|
|
||||||
print(f"✅ Graphiti Memory is ONLINE at {GRAPHITI_URL}")
|
|
||||||
else:
|
|
||||||
print(f"⚠️ Graphiti returned status {r.status_code}")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"❌ Graphiti Connection Failed: {e}")
|
|
||||||
|
|
||||||
# 2. Перевірка Postgres (База Знань)
|
|
||||||
try:
|
|
||||||
conn = psycopg2.connect(
|
|
||||||
host=DB_HOST, user=DB_USER, password=DB_PASS, dbname="postgres"
|
|
||||||
)
|
)
|
||||||
print("✅ Postgres Database is CONNECTED")
|
logger = logging.getLogger(__name__)
|
||||||
conn.close()
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description="Antigravity Squad Dispatcher")
|
||||||
|
parser.add_argument(
|
||||||
|
"--task",
|
||||||
|
choices=["standup", "worker", "audit", "report"],
|
||||||
|
help="Phase of the day to execute"
|
||||||
|
)
|
||||||
|
# Опція для перевірки версії
|
||||||
|
parser.add_argument("--version", action="store_true", help="Show version")
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if args.version:
|
||||||
|
print("Antigravity Agent v0.3.0 (Squad Architecture)")
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
# Якщо аргумент не передано, за замовчуванням запускаємо worker
|
||||||
|
# (це забезпечує сумісність, якщо ми випадково запустимо без прапорців)
|
||||||
|
task = args.task if args.task else "worker"
|
||||||
|
|
||||||
|
logger.info(f"🚀 Starting Antigravity Core. Task: {task.upper()}")
|
||||||
|
|
||||||
|
try:
|
||||||
|
if task == "standup":
|
||||||
|
MorningStandup().run()
|
||||||
|
elif task == "worker":
|
||||||
|
HeavyWorker().run()
|
||||||
|
elif task == "audit":
|
||||||
|
QAAuditor().run()
|
||||||
|
elif task == "report":
|
||||||
|
ScrumReport().run()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"❌ Postgres Connection Failed: {e}")
|
logger.error(f"❌ CRITICAL FAILURE in {task}: {e}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
while True:
|
main()
|
||||||
check_connections()
|
|
||||||
print("💤 Sleeping for 60 seconds...")
|
|
||||||
time.sleep(60)
|
|
||||||
Reference in New Issue
Block a user