- SensorNode: 5s tick loop with delta-only emissions (clock, idle, memo changes) - Input reframed as perceiver (describes what it heard, not commands) - Output reframed as voice (acts on perception, never echoes it) - Per-node token budgets: Input 2K, Output 4K, Memorizer 3K - fit_context() trims oldest messages to stay within budget - History sliding window: 40 messages max - Facts capped at 20, trace file rotates at 500KB - /api/send + /api/clear endpoints for programmatic testing - test_cog.py test suite - Listener context: physical/social/security awareness Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
"""Test script for cog runtime API. Run with: .venv/Scripts/python.exe test_cog.py"""
|
|
import httpx, sys, time
|
|
|
|
API = "https://cog.loop42.de/api"
|
|
TOKEN = "7Oorb9S3OpwFyWgm4zi_Tq7GeamefbjjTgooPVPWAwPDOf6B4TvgvQlLbhmT4DjsqBS_D1g"
|
|
HEADERS = {"Authorization": f"Bearer {TOKEN}", "Content-Type": "application/json"}
|
|
|
|
def send(text):
|
|
r = httpx.post(f"{API}/send", json={"text": text}, headers=HEADERS, timeout=30)
|
|
d = r.json()
|
|
return d.get("response", "").strip(), d.get("memorizer", {})
|
|
|
|
def clear():
|
|
httpx.post(f"{API}/clear", headers=HEADERS, timeout=10)
|
|
|
|
tests = [
|
|
("hello!", None),
|
|
("hey tina hier!", None),
|
|
("wir gehen gleich in den pub", None),
|
|
("nico back - schreib mir ein haiku", None),
|
|
("auf deutsch, mit unseren namen und deinem, dark future tech theme", None),
|
|
("wie spaet ist es?", None),
|
|
]
|
|
|
|
clear()
|
|
print("=== COG TEST RUN ===\n")
|
|
|
|
for i, (msg, _) in enumerate(tests, 1):
|
|
print(f"--- {i}. USER: {msg}")
|
|
resp, memo = send(msg)
|
|
print(f" COG: {resp}")
|
|
print(f" MEMO: name={memo.get('user_name')} mood={memo.get('user_mood')} topic={memo.get('topic')}")
|
|
print()
|
|
time.sleep(0.5)
|
|
|
|
print("=== DONE ===")
|