Compare commits
1 Commits
mimo/creat
...
mimo/code/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
229edf16e2 |
@@ -98,15 +98,6 @@ optional_rooms:
|
|||||||
purpose: Catch-all for artefacts not yet assigned to a named room
|
purpose: Catch-all for artefacts not yet assigned to a named room
|
||||||
wizards: ["*"]
|
wizards: ["*"]
|
||||||
|
|
||||||
- key: sovereign
|
|
||||||
label: Sovereign
|
|
||||||
purpose: Artifacts of Alexander Whitestone's requests, directives, and conversation history
|
|
||||||
wizards: ["*"]
|
|
||||||
conventions:
|
|
||||||
naming: "YYYY-MM-DD_HHMMSS_<topic>.md"
|
|
||||||
index: "INDEX.md"
|
|
||||||
description: "Each artifact is a dated record of a request from Alexander and the wizard's response. The running INDEX.md provides a chronological catalog."
|
|
||||||
|
|
||||||
# Tunnel routing table
|
# Tunnel routing table
|
||||||
# Defines which room pairs are connected across wizard wings.
|
# Defines which room pairs are connected across wizard wings.
|
||||||
# A tunnel lets `recall <query> --fleet` search both wings at once.
|
# A tunnel lets `recall <query> --fleet` search both wings at once.
|
||||||
@@ -121,5 +112,3 @@ tunnels:
|
|||||||
description: Fleet-wide issue and PR knowledge
|
description: Fleet-wide issue and PR knowledge
|
||||||
- rooms: [experiments, experiments]
|
- rooms: [experiments, experiments]
|
||||||
description: Cross-wizard spike and prototype results
|
description: Cross-wizard spike and prototype results
|
||||||
- rooms: [sovereign, sovereign]
|
|
||||||
description: Alexander's requests and responses shared across all wizards
|
|
||||||
|
|||||||
@@ -243,24 +243,108 @@ async def playback(log_path: Path, ws_url: str):
|
|||||||
await ws.send(json.dumps(event))
|
await ws.send(json.dumps(event))
|
||||||
|
|
||||||
|
|
||||||
|
async def inject_event(event_type: str, ws_url: str, **kwargs):
|
||||||
|
"""Inject a single Evennia event into the Nexus WS gateway. Dev/test use."""
|
||||||
|
from nexus.evennia_event_adapter import (
|
||||||
|
actor_located, command_issued, command_result,
|
||||||
|
room_snapshot, session_bound,
|
||||||
|
)
|
||||||
|
|
||||||
|
builders = {
|
||||||
|
"room_snapshot": lambda: room_snapshot(
|
||||||
|
kwargs.get("room_key", "Gate"),
|
||||||
|
kwargs.get("title", "Gate"),
|
||||||
|
kwargs.get("desc", "The entrance gate."),
|
||||||
|
exits=kwargs.get("exits"),
|
||||||
|
objects=kwargs.get("objects"),
|
||||||
|
),
|
||||||
|
"actor_located": lambda: actor_located(
|
||||||
|
kwargs.get("actor_id", "Timmy"),
|
||||||
|
kwargs.get("room_key", "Gate"),
|
||||||
|
kwargs.get("room_name"),
|
||||||
|
),
|
||||||
|
"command_result": lambda: command_result(
|
||||||
|
kwargs.get("session_id", "dev-inject"),
|
||||||
|
kwargs.get("actor_id", "Timmy"),
|
||||||
|
kwargs.get("command_text", "look"),
|
||||||
|
kwargs.get("output_text", "You see the Gate."),
|
||||||
|
success=kwargs.get("success", True),
|
||||||
|
),
|
||||||
|
"command_issued": lambda: command_issued(
|
||||||
|
kwargs.get("session_id", "dev-inject"),
|
||||||
|
kwargs.get("actor_id", "Timmy"),
|
||||||
|
kwargs.get("command_text", "look"),
|
||||||
|
),
|
||||||
|
"session_bound": lambda: session_bound(
|
||||||
|
kwargs.get("session_id", "dev-inject"),
|
||||||
|
kwargs.get("account", "Timmy"),
|
||||||
|
kwargs.get("character", "Timmy"),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
if event_type not in builders:
|
||||||
|
print(f"[inject] Unknown event type: {event_type}", flush=True)
|
||||||
|
print(f"[inject] Available: {', '.join(builders)}", flush=True)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
event = builders[event_type]()
|
||||||
|
payload = json.dumps(event)
|
||||||
|
|
||||||
|
if websockets is None:
|
||||||
|
print(f"[inject] websockets not installed, printing event:\n{payload}", flush=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
async with websockets.connect(ws_url, open_timeout=5) as ws:
|
||||||
|
await ws.send(payload)
|
||||||
|
print(f"[inject] Sent {event_type} -> {ws_url}", flush=True)
|
||||||
|
print(f"[inject] Payload: {payload}", flush=True)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[inject] Failed to send to {ws_url}: {e}", flush=True)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="Evennia -> Nexus WebSocket Bridge")
|
parser = argparse.ArgumentParser(description="Evennia -> Nexus WebSocket Bridge")
|
||||||
sub = parser.add_subparsers(dest="mode")
|
sub = parser.add_subparsers(dest="mode")
|
||||||
|
|
||||||
live = sub.add_parser("live", help="Live tail Evennia logs and stream to Nexus")
|
live = sub.add_parser("live", help="Live tail Evennia logs and stream to Nexus")
|
||||||
live.add_argument("--log-dir", default="/root/workspace/timmy-academy/server/logs", help="Evennia logs directory")
|
live.add_argument("--log-dir", default="/root/workspace/timmy-academy/server/logs", help="Evennia logs directory")
|
||||||
live.add_argument("--ws", default="ws://127.0.0.1:8765", help="Nexus WebSocket URL")
|
live.add_argument("--ws", default="ws://127.0.0.1:8765", help="Nexus WebSocket URL")
|
||||||
|
|
||||||
replay = sub.add_parser("playback", help="Replay a telemetry JSONL file")
|
replay = sub.add_parser("playback", help="Replay a telemetry JSONL file")
|
||||||
replay.add_argument("log_path", help="Path to Evennia telemetry JSONL")
|
replay.add_argument("log_path", help="Path to Evennia telemetry JSONL")
|
||||||
replay.add_argument("--ws", default="ws://127.0.0.1:8765", help="Nexus WebSocket URL")
|
replay.add_argument("--ws", default="ws://127.0.0.1:8765", help="Nexus WebSocket URL")
|
||||||
|
|
||||||
|
inject = sub.add_parser("inject", help="Inject a single Evennia event (dev/test)")
|
||||||
|
inject.add_argument("event_type", choices=["room_snapshot", "actor_located", "command_result", "command_issued", "session_bound"])
|
||||||
|
inject.add_argument("--ws", default="ws://127.0.0.1:8765", help="Nexus WebSocket URL")
|
||||||
|
inject.add_argument("--room-key", default="Gate", help="Room key (room_snapshot, actor_located)")
|
||||||
|
inject.add_argument("--title", default="Gate", help="Room title (room_snapshot)")
|
||||||
|
inject.add_argument("--desc", default="The entrance gate.", help="Room description (room_snapshot)")
|
||||||
|
inject.add_argument("--actor-id", default="Timmy", help="Actor ID")
|
||||||
|
inject.add_argument("--command-text", default="look", help="Command text (command_result, command_issued)")
|
||||||
|
inject.add_argument("--output-text", default="You see the Gate.", help="Command output (command_result)")
|
||||||
|
inject.add_argument("--session-id", default="dev-inject", help="Hermes session ID")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.mode == "live":
|
if args.mode == "live":
|
||||||
asyncio.run(live_bridge(args.log_dir, args.ws))
|
asyncio.run(live_bridge(args.log_dir, args.ws))
|
||||||
elif args.mode == "playback":
|
elif args.mode == "playback":
|
||||||
asyncio.run(playback(Path(args.log_path).expanduser(), args.ws))
|
asyncio.run(playback(Path(args.log_path).expanduser(), args.ws))
|
||||||
|
elif args.mode == "inject":
|
||||||
|
asyncio.run(inject_event(
|
||||||
|
args.event_type,
|
||||||
|
args.ws,
|
||||||
|
room_key=args.room_key,
|
||||||
|
title=args.title,
|
||||||
|
desc=args.desc,
|
||||||
|
actor_id=args.actor_id,
|
||||||
|
command_text=args.command_text,
|
||||||
|
output_text=args.output_text,
|
||||||
|
session_id=args.session_id,
|
||||||
|
))
|
||||||
else:
|
else:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user