MosswartOverlord/static
Erik 79cf88d3f7 feat(agent): Phase 1 — chat-window AI assistant via Claude Code subprocess
Adds an in-dashboard AI assistant that answers questions about live game
state. Designed reactively (no background loops) — every user message in
the chat window or via /api/agent/ask runs one `claude -p` invocation.

Architecture:
- New host-side FastAPI service (agent/) on 127.0.0.1:8767, OUTSIDE the
  dereth-tracker Docker container because `claude` and ~/.claude
  credentials live on the host.
- nginx routes /api/agent/* to the host service.
- The same browser session cookie the tracker issues authenticates
  agent requests (shared SECRET_KEY).
- The agent shells out to `claude -p --session-id <uuid>` with
  cwd=/home/erik/MosswartOverlord. Sessions persist as JSONL on disk
  via Claude Code's built-in machinery.
- An MCP stdio server (agent/mcp_overlord.py) exposes tools to Claude:
  get_live_players, get_recent_rares, query_telemetry_db (read-only,
  parsed by sqlglot to reject DML/DDL), get_player_state, get_inventory,
  get_inventory_search, get_combat_stats, get_equipment_cantrips,
  get_quest_status, get_server_health, suitbuilder_search.
- Read-only PG role (overlord_agent_ro) is the second line of defense
  on the SQL tool — even a parser bypass can't mutate.

Frontend:
- AgentWindow.tsx — draggable chat window with localStorage-pinned
  session UUID, "New Chat" button, on-mount rehydration from
  /agent/sessions/{id}/history (parses Claude Code's JSONL).
- Wired into WindowRenderer + Sidebar (🤖 Assistant button).

Operational:
- systemd unit (overlord-agent.service) + install.sh.
- agent/README.md documents env vars, deploy flow, smoke tests.
- nginx/overlord.conf gets a new /api/agent/ location with 180s timeout.
- CLAUDE.md gets an "Overlord Assistant Mode" section briefing the
  agent on which tools to use and how to behave.

NOT YET DEPLOYED — server still needs:
1. Apply agent/sql/0001_overlord_agent_ro.sql + ALTER ROLE password
2. Add AGENT_DB_DSN to /home/erik/MosswartOverlord/.env
3. bash agent/install.sh (creates venv, installs unit, starts service)
4. sudo cp /home/erik/MosswartOverlord/nginx/overlord.conf to nginx + reload

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-25 20:43:59 +02:00
..
assets feat(agent): Phase 1 — chat-window AI assistant via Claude Code subprocess 2026-04-25 20:43:59 +02:00
classic feat: v2 React frontend is now primary at / 2026-04-14 12:17:23 +02:00
icons added inventory, updated DB 2025-06-10 19:21:21 +00:00
acmap.png feat: switch to UtilityBelt's acmap.png (2048x2048) 2026-04-08 12:43:22 +02:00
admin.html feat: add app-level authentication with login, session cookies, and admin panel 2026-04-10 19:45:08 +02:00
debug.html Debug and inventory 2025-06-19 17:46:19 +00:00
dereth.png Overlord sees all 2025-04-29 22:23:34 +00:00
dereth_highres.png feat: swap map to high-res color-corrected Dereth map 2026-04-08 12:41:47 +02:00
dungeon_tiles.json fix: detect PNG vs BMP format in dungeon tiles 2026-04-08 15:18:09 +02:00
favicon.ico added favicon 2025-05-09 23:31:01 +00:00
index.html feat(agent): Phase 1 — chat-window AI assistant via Claude Code subprocess 2026-04-25 20:43:59 +02:00
inventory.html feat: move column toggles into table headers 2026-04-09 10:12:01 +02:00
inventory.js feat: compute base item values by reversing active spell buffs 2026-04-09 12:31:39 +02:00
login.html Fix login page: allow /icons/ through auth middleware, match color scheme to AC logo 2026-04-10 20:07:06 +02:00
prismatic-taper-icon.png Major overhaul of db -> hypertable conversion, updated GUI, added inventory 2025-06-08 20:51:06 +00:00
script.js fix(combat): show offense + defense damage by element in grid 2026-04-12 10:13:47 +02:00
style-ac.css Extract createWindow helper to deduplicate window setup code 2026-02-26 09:26:06 +00:00
style.css feat: combat stats backend + frontend (Mag-Tools style) 2026-04-12 09:42:11 +02:00
suitbuilder.css Add suitbuilder UI improvements for locked slots and suit summary 2026-02-05 19:11:37 +00:00
suitbuilder.html feat: add Healing and Summoning cantrip constraints to suitbuilder 2026-03-07 20:57:11 +00:00
suitbuilder.js feat: add Healing and Summoning cantrip constraints to suitbuilder 2026-03-07 20:57:11 +00:00
sw.js feat: v2 React frontend is now primary at / 2026-04-14 12:17:23 +02:00