[GM Workbench] Session prep sheet generator (B4) #158
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Motivation / Context
The report ranks the session prep sheet as the single highest-differentiation Workbench tool (§6): "reads your actual campaign state" — beat notes, recent session summaries, open threads, and arcs — to produce a structured prep draft no generic generator site can replicate, because none of them have access to this campaign's history. This is deliberately the last Phase 1/2 tool: it's the most complex (multi-source context assembly, prose-heavy output, review-before-save) and benefits from every other piece of the foundation already existing.
Per §3, Group B: generates a strong start, 3-5 potential scenes, secrets & clues, and NPCs likely to appear (linked to their lore entries), plus loose ends from the last session.
Approach
session_preptool inGENERATOR_TOOLS(generation_service.py, #136), flagged for Celery execution (sync_allowed=False) — this is exactly the "prose-heavy tool" case the report calls out for async handling (§5.1): multi-source context assembly plus a long structured output will exceed the "must be async" latency threshold on a local Ollama box.Session.beat_notesfor the upcoming session (existing GM free-text notes).recent_sessions_context(db, campaign_id, n)— last 1-2 session summaries, following the pattern already used in issue #23's design andupdate_campaign_storyline.threads_context(db, campaign_id)— openPlotThreads and arc statuses.generate_lore_entry_draft→run_lore_entry_draft_generation(webapp/backend/app/tasks/reminder_tasks.py:2018, 2051-2124) with apending → ready/failedlifecycle written intoGenerationResult(#138). Output structure: strong start (1-2 sentences), 3-5 potential scenes, secrets & clues, NPCs likely to appear (each cross-referenced to an existingLoreEntryvialore_contextmatching where possible), loose ends carried from the last session.WikiDraftReview.jsx-style old-vs-new comparison, edit, iterate) adapted forSession.beat_notesas the target field rather than aLoreEntry.body. On approval, the GM explicitly chooses append or replace.WikiDraftReview.jsxalready uses for draft generation) and presents the review UI onceready.Dependencies
recent_sessions_context), #138 (scratchpad + async status lifecycle) — Phase 0 foundation, required in full since this tool exercises every builder and the async path.GeneratorPanellater, same as issues 4/6/7.Out of scope
beat_noteswithout GM review — never allowed; always append-or-replace-with-confirmation.Acceptance criteria
session_preptool registered,POST /api/campaigns/{campaign_id}/workbench/session_prep/generateruns async via Celery, GM-only.beat_notes, recent session summaries, and open threads/arcs, and produces strong start / 3-5 scenes / secrets & clues / linked NPCs / loose ends.pending → ready/failedare visible via theGenerationResulthistory/status endpoint from #138.Session.beat_notes.LoreEntryrows where a match exists in campaign lore.Done — merged to
feat/v3.10-gm-workbenchvia PR #221.The first async Workbench tool.
session_prep(sync_allowed=False) runs on the #136 Celery path, assembling context from the upcoming session's beat notes +recent_sessions_context+threads_context+lore_context, and producing{strong_start, scenes[], secrets_and_clues[], npcs[{name,note}], loose_ends[]}(tolerant parser).session_idis a str/UUID param so it round-trips throughrow.paramsto the worker.GET /workbench/history/{result_id}(GM-only).SessionPrepGenerator: pick an upcoming session → generate (pending) → poll until ready/failed → render the sheet with NPCs linked to matching wiki entries → append or replace intobeat_notes(existing PATCH) after explicit GM review. Never auto-writes.fetchWorkbenchResultusescache: falseso the client's 15s GET dedup cache doesn't hide thepending → readytransition from the poller.All acceptance criteria met (async lifecycle visible via history/status; reads beat_notes + recent summaries + threads; explicit append-or-replace review; NPCs link to existing lore). No new models/migrations.
Verified: backend 719 passed (incl. new
test_workbench_session_prep.py), frontend 379 passed, ruff + eslint clean, build OK. Not yet exercised against a live LLM on dev — that's pending your dev testing.