Skip to content

feat: add JSONL event streaming, Textual replay UI, and Ollama support for Kahn simulations#1

Open
UnbornAztecKing wants to merge 2 commits intomainfrom
unbornaztecking/ollama
Open

feat: add JSONL event streaming, Textual replay UI, and Ollama support for Kahn simulations#1
UnbornAztecKing wants to merge 2 commits intomainfrom
unbornaztecking/ollama

Conversation

@UnbornAztecKing
Copy link
Owner

Summary

  • Add a new sim.py execution path that emits structured JSONL events alongside CSV output.
  • Introduce a wargame_tui terminal UI for replaying runs, inspecting turns/events, and live-following simulations.
  • Add a typed event pipeline (GameEvent, writer, store, tailer) to separate simulation output from presentation.
  • Extend legacy runners with ollama: model support and minor response-parsing hardening.
  • Add packaging, CI, fixtures, docs, and test coverage for the new workflow.

Details

  • Simulation

    • Add sim.py with provider routing for OpenAI, Anthropic, Gemini, and ollama: models.
    • Emit structured events for lifecycle, phase transitions, LLM decisions, state changes, KPI updates, and reports.
    • Add --events-file to write JSONL to a file or stdout.
    • Use json-repair to tolerate malformed model JSON.
  • TUI / events

    • Add typed event models with sequence numbers, timestamps, payloads, and content hashes.
    • Add append-only writer, JSONL-backed store, and polling tailer for replay/live-tail workflows.
    • Add a Textual UI with turn navigation, event cards, KPI display, and search.
    • Add sample fixtures and demo event data.
  • Legacy runners

    • Update Kahn_game_v11.py and Kahn_game_v12.py to support ollama: model IDs via configurable OLLAMA_BASE_URL.
    • Harden parsing for empty or missing model responses.
  • Tooling

    • Add pyproject.toml, uv.lock, .python-version, CI, Make targets, and README updates.

Risk & Impact

  • Moderate risk: large additive change with a parallel sim.py path that may drift from legacy runners.
  • Performance trade-off: event writes flush/fsync on append, and the TUI polls for updates.
  • Current event storage is in-memory and better suited to smaller runs than large archives.
  • Raises the tooling/runtime baseline with Python 3.12, uv, and new dependencies.
  • Backward-compatibility risk is otherwise low; existing runner flows remain in place.

Testing

  • Add unit tests for event models, JSONL storage, writer behavior, and serialization.
  • Add Textual smoke tests for mount/render, turn selection, KPI updates, and search interactions.
  • No obvious end-to-end coverage for sim.py parity with legacy runners or live-tail behavior.

Reviewer Notes

  • Focus review on behavioral drift between sim.py and the legacy runners.
  • --compact appears to be parsed by the TUI entrypoint but not clearly wired through.
  • Manual QA:
    • Run sim.py --events-file ... and verify TUI live-follow behavior.
    • Validate event ordering, sequencing, and KPI updates during a live run.
    • Verify ollama: routing with custom OLLAMA_BASE_URL.

Co-authored-by: Cursor <cursoragent@cursor.com>

fix

uv init
- sim.py: modularized game engine with JSONL event streaming, Ollama
  support via openai-compatible prefix routing, and full CLI
- vorpal/: Textual TUI for replaying and live-monitoring event streams;
  turn sidebar with phase navigation, type-colored event cards,
  responsive A/B split view with aligned field grid, KPI bar with
  history panel, inline and modal search, 100ms live tail, dynamic
  ASCII banner centering, double-newline and wrap-indent text formatting
- Makefile: sim, view, pull-model, and tournament targets for frontier
  and Ollama model combinations
- pyproject.toml / uv.lock: added textual, pydantic, click, watchfiles;
  registered vorpal entry point
- README.md: updated with sim module reference, Vorpal section, and
  Ollama usage guide; vorpal/README.md with full interface and
  architecture documentation
- .github/workflows/ci.yml: mypy and pytest on push/PR
- tests/: Textual pilot smoke tests, model validation, store, and
  event writer tests
@UnbornAztecKing UnbornAztecKing force-pushed the unbornaztecking/ollama branch from b96e5e2 to 9bf98dd Compare March 2, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant