Add sandboxed code execution for the DM via Pydantic Monty
The DM had no way to compute anything — treasure splits, random generation,
travel time calculations all happened in its head. Now there's a `run_code`
tool backed by Pydantic's Monty sandbox (Rust-based, no filesystem/network
access) that lets the DM write and execute Python on the fly.
The interesting part: all of the DM's existing tools are exposed as host
functions inside the sandbox. Code can `recall("fireball")`, `establish()`
NPCs, `roll("2d6+3")` for math, etc. The tool description includes
dynamically-generated Python function signatures (via `inspect.signature`)
so the DM knows exactly what's callable, built the same way docketeer does
it with runtime-formatted docstrings.
The DM provides a `description` field ("Designing cave system", "Splitting
treasure") that shows in the terminal notification instead of a generic
"Running code" label.
Also extracted initiative tools into real Python functions with typed
signatures — they were inlined in a dispatcher before, which meant
`inspect.signature` couldn't reach them. Now `next_turn`, `damage`, `heal`,
`condition`, etc. are all standalone functions with docstrings wired to the
MCP tool definitions.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>