feat: GM Workbench improv NPC tools + generalized prefetch (#155) #222
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/155-improv-npc"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two at-the-table improv tools (C1 + C2), plus the prefetch generalization deferred from #136.
Generalized prefetch (the reusable infra)
ToolDef.pool_field— names the output list a prefetchable tool draws from.workbench_pool_service— a per-campaign+tool Redis list: atomicLPOPdraw,RPUSHfill (capped at 15, 2h TTL). The generalized counterpart of the name cache; Redis access lives here so tests patch the service seam, not the raw client.prefetch_workbench_poolCelery task — lock + TTL, mirroringprefetch_name_options.POST /workbench/{tool_id}/draw(pop one; queue a refill when the pool runs low; cold-pool inline fallback that buffers the rest) andPOST /workbench/{tool_id}/prefetch(warm in the background). Both GM-only; 404 for non-prefetchable tools.C1 —
instant_npc(prefetchable,pool_field="npcs")A fully-formed NPC — name, pronouns, occupation, want, secret, voice cue — drawn with zero visible LLM wait. Frontend
InstantNpcGeneratorwarms the pool on mount, "Conjure an NPC" draws off it, and "Save as lore entry" creates annpcLoreEntry.C2 —
npc_voicePerformable voice/mannerism cues for an existing npc entry — scoped strictly to cues (backstory/statblocks stay owned by #130). Frontend
NpcVoiceGeneratorreuses the sharedWorkbenchResultActionsbar, so cues land as a new lore entry, as a review draft appended to the npc entry, or copied.Notes
Verification (Docker)
test_workbench_npc.py— warm-pool draw, low-pool refill trigger, cold-pool inline fallback, prefetch trigger, non-prefetchable/GM-only 404/403,npc_voicegenerate + persistence + 422, parser tolerance)ruff check+ruff format --checkclean; eslint 0 errorsCloses #155.