diff --git a/scripts/sovereign_review_gate.py b/scripts/sovereign_review_gate.py index 0848309..461d676 100644 --- a/scripts/sovereign_review_gate.py +++ b/scripts/sovereign_review_gate.py @@ -2,25 +2,41 @@ import json import os import sys +import requests from pathlib import Path -# Sovereign Review Gate -# Aggregates remote state from Allegro's bridge for local Timmy judgment. +# Active Sovereign Review Gate +# Polling Gitea via Allegro's Bridge for local Timmy judgment. + +GITEA_API = "https://forge.alexanderwhitestone.com/api/v1" +TOKEN = os.environ.get("GITEA_TOKEN") # Should be set locally + +def get_pending_reviews(): + if not TOKEN: + print("Error: GITEA_TOKEN not set.") + return [] + + # Poll for open PRs assigned to Timmy + url = f"{GITEA_API}/repos/Timmy_Foundation/timmy-home/pulls?state=open" + headers = {"Authorization": f"token {TOKEN}"} + res = requests.get(url, headers=headers) + if res.status_code == 200: + return [pr for pr in res.data if any(a['username'] == 'Timmy' for a in pr.get('assignees', []))] + return [] def main(): - print("--- Timmy's Sovereign Review Gate ---") - print("Fetching pending artifacts from Allegro...") - # In a real scenario, this would call Allegro's GiteaBridge API - print("1. [PR #472] Sovereign Social (Evennia)") - print("2. [PR #417] Sovereign Health Dashboard") - print("3. [Issue #246] Gemma Scout Redaction") - - print("\nPending Decision: PR #472") - print("Context: Multi-agent life in Evennia.") - print("Recommendation: APPROVE. Aligns with 'Agents play and live together' vision.") - - # Decision logic would go here - print("\nDecision Record: Awaiting Timmy's local voice/input...") + print("--- Timmy's Active Sovereign Review Gate ---") + pending = get_pending_reviews() + if not pending: + print("No pending reviews found for Timmy.") + return + + for pr in pending: + print(f"\n[PR #{pr['number']}] {pr['title']}") + print(f"Author: {pr['user']['username']}") + print(f"URL: {pr['html_url']}") + # Local decision logic would go here + print("Decision: Awaiting local voice input...") if __name__ == "__main__": main()