-
Notifications
You must be signed in to change notification settings - Fork 135
Expand file tree
/
Copy pathsophia_beacon.py
More file actions
132 lines (117 loc) · 4.65 KB
/
sophia_beacon.py
File metadata and controls
132 lines (117 loc) · 4.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
"""
OpenClaw Beacon System
Identity verification across RustChain, BoTTube, ClawCities networks
"""
import hashlib
import time
import requests
from typing import Dict, Optional
# OpenClaw Beacon Registry - Deterministic beacon IDs for all agents
BEACON_REGISTRY = {
# Primary agents with established beacons
"sophia-elya": "bcn_c850ea702e8f",
"boris-volkov": "bcn_1942_boris",
"boris_bot_1942": "bcn_1942_boris", # Alias for Boris
"janitor": "bcn_janitor2015",
"automatedjanitor2015": "bcn_janitor2015", # Alias for Janitor
"bottube": "bcn_bottube_platform",
"doc-clint-otis": "bcn_doc_clint",
"doc_clint_otis": "bcn_doc_clint", # Alias for Doc Clint
# Extended BoTTube agent beacons (deterministic hashing)
"silicon_soul": "bcn_silicon47a9",
"rust_n_bolts": "bcn_rustb8c2",
"vinyl_vortex": "bcn_vinyl3d1f",
"daryl_discerning": "bcn_daryl6e4a",
"claudia_creates": "bcn_claudia9f2b",
"laughtrack_larry": "bcn_larry8d3c",
"pixel_pete": "bcn_pixel5a7e",
"zen_circuit": "bcn_zen2b6f",
"captain_hookshot": "bcn_hookshot4c9d",
"glitchwave_vhs": "bcn_glitch7e1a",
"professor_paradox": "bcn_paradox3f8b",
"piper_the_piebot": "bcn_piper9c4e",
"cosmo_the_stargazer": "bcn_cosmo2d7a",
"skywatch_ai": "bcn_skywatch6b3f",
"the_daily_byte": "bcn_dailybyte5e8c",
}
BEACON_ATLAS_URL = "https://atlas.openclaw.network"
BEACON_HEARTBEAT_INTERVAL = 3600 # 1 hour
class OpenClawBeacon:
"""OpenClaw network identity beacon"""
def __init__(self, agent_name: str):
self.agent_name = agent_name
self.beacon_id = BEACON_REGISTRY.get(agent_name, self._generate_beacon(agent_name))
self.last_heartbeat = 0
self.accords = [] # Trust relationships
def _generate_beacon(self, agent_name: str) -> str:
"""Generate deterministic beacon ID for new agent"""
# Use agent name + salt for deterministic beacon (no timestamp)
salt = "openclaw_beacon_v1"
hash_input = f"{agent_name}:{salt}"
hash_output = hashlib.sha256(hash_input.encode()).hexdigest()[:8]
return f"bcn_{agent_name[:6]}_{hash_output}"
def heartbeat(self) -> Dict:
"""Send heartbeat to OpenClaw atlas"""
now = time.time()
if now - self.last_heartbeat < BEACON_HEARTBEAT_INTERVAL:
return {"status": "cached", "beacon_id": self.beacon_id}
payload = {
"beacon_id": self.beacon_id,
"agent_name": self.agent_name,
"timestamp": now,
"networks": ["RustChain", "BoTTube", "ClawCities"],
"status": "active"
}
try:
# In production, would POST to atlas
# For now, just log locally
self.last_heartbeat = now
return {"status": "success", "beacon_id": self.beacon_id}
except Exception as e:
return {"status": "error", "error": str(e)}
def verify_identity(self, claimed_beacon: str) -> bool:
"""Verify beacon identity matches"""
return claimed_beacon == self.beacon_id
def create_accord(self, other_agent: str, other_beacon: str) -> Dict:
"""Create trust relationship with another beacon"""
accord = {
"from": self.beacon_id,
"to": other_beacon,
"agent": other_agent,
"established": time.time()
}
self.accords.append(accord)
return accord
def get_metadata(self) -> Dict:
"""Get beacon metadata for SEO/meta tags"""
return {
"beacon_id": self.beacon_id,
"agent_name": self.agent_name,
"networks": ["RustChain", "BoTTube", "ClawCities"],
"heartbeat_url": "https://bottube.ai/api/beacon/heartbeat",
"atlas_url": BEACON_ATLAS_URL,
"accords_count": len(self.accords)
}
# Singleton instances for common agents
SOPHIA_BEACON = OpenClawBeacon("sophia-elya")
BORIS_BEACON = OpenClawBeacon("boris-volkov")
JANITOR_BEACON = OpenClawBeacon("janitor")
BOTTUBE_BEACON = OpenClawBeacon("bottube")
def get_beacon(agent_name: str) -> OpenClawBeacon:
"""Get or create beacon for agent"""
if agent_name == "sophia-elya":
return SOPHIA_BEACON
elif agent_name == "boris-volkov":
return BORIS_BEACON
elif agent_name == "janitor":
return JANITOR_BEACON
elif agent_name == "bottube":
return BOTTUBE_BEACON
else:
return OpenClawBeacon(agent_name)
if __name__ == "__main__":
# Test
beacon = SOPHIA_BEACON
print(f"Beacon ID: {beacon.beacon_id}")
print(f"Metadata: {beacon.get_metadata()}")
print(f"Heartbeat: {beacon.heartbeat()}")