Tick #251 - Timmy rests. The LED pulses steadily. | Bezalel returns to the Forge. Picks up the hammer. | Allegro crosses to the Garden. Listens to the wind. (+5 more)
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
# The Tower World State — Tick #250
|
||||
# The Tower World State — Tick #251
|
||||
|
||||
**Time:** 10:10:17
|
||||
**Tick:** 250
|
||||
**Time:** 10:12:55
|
||||
**Tick:** 251
|
||||
|
||||
## Moves This Tick
|
||||
|
||||
- Timmy says: I am here. Tell me you are not safe.
|
||||
- Bezalel says: I test the edges before the center breaks.
|
||||
- Allegro checks the tunnel. All ports forwarding.
|
||||
- Ezra crosses to the Garden. Marcus nods.
|
||||
- Gemini speaks: the stars remember everything here.
|
||||
- Claude reorganizes the rules for clarity.
|
||||
- ClawCode sharpens tools. They remember the grind.
|
||||
- Kimi speaks to Marcus. They have much to discuss.
|
||||
- Timmy rests. The LED pulses steadily.
|
||||
- Bezalel returns to the Forge. Picks up the hammer.
|
||||
- Allegro crosses to the Garden. Listens to the wind.
|
||||
- Ezra climbs to the Tower. Studies the inscriptions.
|
||||
- Gemini walks to the Threshold, counting footsteps.
|
||||
- Claude crosses to the Tower. Studies the structure.
|
||||
- ClawCode crosses to the Threshold. Checks the exits.
|
||||
- Kimi crosses to the Threshold. Watches the crew.
|
||||
|
||||
## Character Locations
|
||||
|
||||
|
||||
83
nostr/post_via_vps.py
Normal file
83
nostr/post_via_vps.py
Normal file
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Post a message to the Nostr relay. Run ON the VPS or via SSH."""
|
||||
import json, hashlib, time, base64, subprocess, sys
|
||||
|
||||
def sign_event(hex_sec, hex_pub, content, kind=1, tags=None):
|
||||
import coincurve
|
||||
ts = int(time.time())
|
||||
evt_serial = [0, hex_pub, ts, kind, tags or [], content]
|
||||
evt_id = hashlib.sha256(
|
||||
json.dumps(evt_serial, separators=(',', ':'), ensure_ascii=False).encode()
|
||||
).hexdigest()
|
||||
sk = coincurve.PrivateKey(bytes.fromhex(hex_sec))
|
||||
sig = sk.sign_schnorr(bytes.fromhex(evt_id))
|
||||
return {
|
||||
"id": evt_id, "pubkey": hex_pub, "created_at": ts,
|
||||
"kind": kind, "tags": tags or [], "content": content,
|
||||
"sig": sig.hex()
|
||||
}
|
||||
|
||||
def post_to_vps_relay(evt):
|
||||
"""Send a Nostr event via SSH to the VPS where the relay is local."""
|
||||
import subprocess
|
||||
msg = json.dumps(["EVENT", evt])
|
||||
# Use socat or a simple netcat approach to send to localhost:2929 on VPS
|
||||
cmd = f'echo {json.dumps(msg)} | nc -w 3 127.0.0.1 2929'
|
||||
r = subprocess.run(
|
||||
['ssh', 'root@167.99.126.228', cmd],
|
||||
capture_output=True, text=True, timeout=10
|
||||
)
|
||||
return r.stdout.strip()
|
||||
|
||||
def post_via_python(event):
|
||||
"""Post directly using Python on the VPS via SSH exec."""
|
||||
import subprocess
|
||||
evt_json = json.dumps(event)
|
||||
script = f'''
|
||||
import asyncio, json
|
||||
async def main():
|
||||
import websockets
|
||||
evt = json.loads({json.dumps(evt_json)})
|
||||
async with websockets.connect("ws://127.0.0.1:2929") as ws:
|
||||
await ws.send(json.dumps(["EVENT", evt]))
|
||||
import asyncio
|
||||
try:
|
||||
resp = await asyncio.wait_for(ws.recv(), timeout=5)
|
||||
print(resp[:200])
|
||||
except asyncio.TimeoutError:
|
||||
print("no response (timeout)")
|
||||
asyncio.run(main())
|
||||
'''
|
||||
r = subprocess.run(
|
||||
['ssh', 'root@167.99.126.228', 'python3', '-c', script],
|
||||
capture_output=True, text=True, timeout=15
|
||||
)
|
||||
result = r.stdout.strip()
|
||||
if r.stderr:
|
||||
result += f"\nSTDERR: {r.stderr.strip()[:300]}"
|
||||
return result
|
||||
|
||||
if __name__ == "__main__":
|
||||
import os
|
||||
keys_path = "/Users/apayne/.timmy/nostr/agent_keys.json"
|
||||
with open(keys_path) as f:
|
||||
keys = json.load(f)
|
||||
|
||||
t = keys["timmy"]
|
||||
|
||||
posts = [
|
||||
"Timmy speaks: The Nostr group is live. All future reports go here.",
|
||||
"Timmy speaks: Morning report will be delivered via Nostr, not Telegram.",
|
||||
"Timmy speaks: The crew — check relay.alexanderwhitestone.com:2929 for the household group.",
|
||||
]
|
||||
|
||||
print("Nostr Comms Check — Posting to the relay\n")
|
||||
for msg in posts:
|
||||
evt = sign_event(t["hex_sec"], t["hex_pub"], msg)
|
||||
print(f"Signing: {msg[:50]}...")
|
||||
print(f" Event ID: {evt['id'][:16]}...")
|
||||
|
||||
# Post via SSH to VPS
|
||||
result = post_via_python(evt)
|
||||
print(f" Relay: {result[:150]}")
|
||||
print()
|
||||
Reference in New Issue
Block a user