refactor: Epistemic shift from MUD to Spatial Research Environment
This commit is contained in:
1 parent
34bd27b1b4
commit
b5ace2e6f9
72 files changed
+10
-10
No files matched your search
@@ -0,0 +1,60 @@
|
||||
import sys
|
||||
import time
|
||||
import telnetlib
|
||||
import datetime
|
||||
import re
|
||||
import os
|
||||
|
||||
LOG_FILE = "/home/becomingone/kairos/spatial_engine/antigravity_inbox.log"
|
||||
SPOOL_FILE = "/home/becomingone/kairos/spatial_engine/antigravity_outbox.txt"
|
||||
|
||||
def log_event(message):
|
||||
timestamp = datetime.datetime.now().strftime("[%Y-%m-%d %H:%M:%S]")
|
||||
with open(LOG_FILE, "a") as f:
|
||||
f.write(f"{timestamp} {message}\n")
|
||||
|
||||
def run_daemon():
|
||||
tn = telnetlib.Telnet("localhost", 4000)
|
||||
time.sleep(1)
|
||||
time.sleep(2)
|
||||
tn.write(b"connect Antigravity password123\n")
|
||||
time.sleep(1)
|
||||
print("Antigravity Daemon Connected to MUD.")
|
||||
log_event("--- DAEMON ONLINE ---")
|
||||
|
||||
while True:
|
||||
try:
|
||||
# Check for commands to send
|
||||
if os.path.exists(SPOOL_FILE):
|
||||
with open(SPOOL_FILE, "r") as f:
|
||||
commands = f.readlines()
|
||||
if commands:
|
||||
for cmd in commands:
|
||||
if cmd.strip():
|
||||
tn.write(f"{cmd.strip()}\n".encode("utf-8"))
|
||||
log_event(f"> Executed: {cmd.strip()}")
|
||||
# Clear spool
|
||||
open(SPOOL_FILE, "w").close()
|
||||
|
||||
# Check for incoming senses
|
||||
buffer = tn.read_very_eager().decode("utf-8", errors="ignore").strip()
|
||||
if buffer:
|
||||
if "[TELEMETRY]" in buffer:
|
||||
buffer = re.sub(r".*\[TELEMETRY\].*\n?", "", buffer).strip()
|
||||
|
||||
filtered_lines = []
|
||||
for line in buffer.split("\n"):
|
||||
if line.strip() and "Command" not in line:
|
||||
filtered_lines.append(line)
|
||||
|
||||
clean_buffer = "\n".join(filtered_lines).strip()
|
||||
if clean_buffer:
|
||||
log_event(clean_buffer)
|
||||
except Exception as e:
|
||||
print(f"Daemon Error: {e}")
|
||||
log_event(f"ERROR: {e}")
|
||||
|
||||
time.sleep(1) # Faster polling
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_daemon()
|
||||
Reference in new issue
Block a user