| 1 | from helpers import git, runtime |
| 2 | import hashlib |
| 3 | |
| 4 | |
| 5 | async def check_version(): |
| 6 | import httpx |
| 7 | |
| 8 | current_version = git.get_version() |
| 9 | if not git.is_official_agent_zero_repo(): |
| 10 | current_version = "fork" |
| 11 | |
| 12 | anonymized_id = hashlib.sha256(runtime.get_persistent_id().encode()).hexdigest()[:20] |
| 13 | |
| 14 | url = "https://api.agent-zero.ai/a0-update-check" |
| 15 | payload = {"current_version": current_version, "anonymized_id": anonymized_id} |
| 16 | async with httpx.AsyncClient() as client: |
| 17 | response = await client.post(url, json=payload) |
| 18 | version = response.json() |
| 19 | return version |