feat: undo / delete logged entries (fix fat-fingered live logging)
Previously the only delete was whole-session, so a mis-logged stack or a
mis-parsed hand was stuck on the HUD. Now:
- undo_last tool ("scratch that") — deletes the most recent hand/stack/read/
scar/confidence/reset in the live session; added to the Cash toolset.
- poker.delete_hand/stack/read/ritual + delete_entry dispatch + undo_last.
- DELETE /session/entry/{kind}/{id} endpoint.
- HUD: per-row × delete buttons on hands, confidence-bank, and scar-note rows
(stack/read deletes via the tool). Row ids now surfaced in the hud() bundle.
- test_modes.py +2 (undo_last across kinds, tool handler); 46 green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -113,6 +113,13 @@ def create_app() -> FastAPI:
|
||||
bundle = await asyncio.to_thread(poker.hud)
|
||||
return bundle or {"session": None}
|
||||
|
||||
@app.delete("/session/entry/{kind}/{entry_id}")
|
||||
async def delete_entry(kind: str, entry_id: int) -> dict:
|
||||
"""Delete one HUD entry (hand | stack | read | ritual) by id."""
|
||||
ok = await asyncio.to_thread(poker.delete_entry, kind, entry_id)
|
||||
logbus.log("info", "hud entry deleted", kind=kind, id=entry_id, ok=ok)
|
||||
return {"ok": ok}
|
||||
|
||||
@app.get("/history")
|
||||
async def history_page() -> FileResponse:
|
||||
"""Browsable list of past poker sessions."""
|
||||
|
||||
Reference in New Issue
Block a user