GM Workbench: collapse the 8 bespoke generator panels into one config-driven GeneratorPanel #234

Closed
opened 2026-07-21 18:40:48 +00:00 by claude-bot · 2 comments
Contributor

Motivation

The two-pane Workbench shell shipped in #153 (CampaignPlanning.jsx). Each generative tool still has its own bespoke React panelDescriptionGenerator, RumorGenerator, RandomTableGenerator, LootParcelGenerator, SessionPrepGenerator, InstantNpcGenerator, NpcVoiceGenerator, SeriesTitleSuggester — each ~150–235 LOC and largely cloned (the code literally says "Cloned from the DescriptionGenerator panel pattern"). They duplicate: busy/error/result/rowStatus state, the optional lore-grounding picker, a handleGenerate calling generateWorkbenchTool(campaignId, tool_id, params), and the section/loading/error chrome.

Goal

Collapse those 8 into one config-driven GeneratorPanel reading a declarative per-tool config (input fields, result renderer, action row) — so adding a Workbench tool becomes adding a config entry, mirroring how the backend already works (one ToolDef in generation_service.GENERATOR_TOOLS). Pure internal DRY refactor; no user-facing behavior change.

Heterogeneity the config must cover

  • Inputs: text / textarea / number / select / lore-multi-picker / session-select / npc-entry-select.
  • Result renderers: description (one_liner/paragraph), rumor (truth badges), random_table (rolls), loot (items+flavor), session_prep (5 sections), instant_npc (6-field cards), npc_voice (cues), series_titles (title+desc).
  • Action rows: save-as-lore, append-to-entry, add-as-plot-thread, save-to-wiki-doc, save-to-loot-ledger, accept-title-onto-occurrence, copy, etc. (WorkbenchResultActions already shared).
  • Execution modes: sync inline, async (session_prep polling), and the instant_npc Redis pool draw.

Keep behavior identical; keep/port the per-panel *.test.jsx. Consider also renaming the page header "GM Planning" → "GM Workbench" for consistency (separate small change).

Context

Deferred from #153 to avoid rewriting tested-but-unvalidated code while Dev had no live LLM. Now unblocked — all tools validated live on Dev (PR #225). Frontend-only. Target v3.10.0.

🤖 Generated with Claude Code

## Motivation The two-pane Workbench **shell** shipped in #153 ([CampaignPlanning.jsx](webapp/frontend/src/pages/CampaignPlanning.jsx)). Each generative tool still has its **own bespoke React panel** — [DescriptionGenerator](webapp/frontend/src/components/DescriptionGenerator.jsx), RumorGenerator, RandomTableGenerator, LootParcelGenerator, SessionPrepGenerator, InstantNpcGenerator, NpcVoiceGenerator, SeriesTitleSuggester — each ~150–235 LOC and largely **cloned** (the code literally says *"Cloned from the DescriptionGenerator panel pattern"*). They duplicate: `busy/error/result/rowStatus` state, the optional lore-grounding picker, a `handleGenerate` calling `generateWorkbenchTool(campaignId, tool_id, params)`, and the section/loading/error chrome. ## Goal Collapse those 8 into **one config-driven `GeneratorPanel`** reading a declarative per-tool config (input fields, result renderer, action row) — so adding a Workbench tool becomes *adding a config entry*, mirroring how the **backend already works** (one `ToolDef` in `generation_service.GENERATOR_TOOLS`). Pure internal DRY refactor; **no user-facing behavior change**. ## Heterogeneity the config must cover - **Inputs:** text / textarea / number / select / lore-multi-picker / session-select / npc-entry-select. - **Result renderers:** description (one_liner/paragraph), rumor (truth badges), random_table (rolls), loot (items+flavor), session_prep (5 sections), instant_npc (6-field cards), npc_voice (cues), series_titles (title+desc). - **Action rows:** save-as-lore, append-to-entry, add-as-plot-thread, save-to-wiki-doc, save-to-loot-ledger, accept-title-onto-occurrence, copy, etc. (`WorkbenchResultActions` already shared). - **Execution modes:** sync inline, **async** (session_prep polling), and the **instant_npc Redis pool draw**. Keep behavior identical; keep/port the per-panel `*.test.jsx`. Consider also renaming the page header "GM Planning" → "GM Workbench" for consistency (separate small change). ## Context Deferred from #153 to avoid rewriting tested-but-unvalidated code while Dev had no live LLM. Now unblocked — all tools validated live on Dev (PR #225). Frontend-only. Target **v3.10.0**. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Contributor

Scope additions (design review, 2026-07-21): folding two adjacent items into this refactor.

  1. Shared lore-grounding picker. The grounding control — today a flat checkbox list of all lore in Rumor/Random Table, a single-select in Description, and an npc-filtered select in NPC Voice — becomes one shared lore-picker control in the config-driven panel. Redesign (chosen A+D): a searchable chip/token multi-select with results grouped by entry_type, opening pre-seeded with smart-relevant suggestions (entries linked to the target session, in open plot threads, and recently updated). Replaces the flat checkbox list, which doesn't scale to large campaigns. Every grounding tool inherits it for free once it's a config field type.

  2. Header fix + rename. Rename the page header "GM Planning" → "GM Workbench", and fix the header overflow: the "Pre-generating name suggestions…" status wraps the header because the flex row doesn't constrain child widths — constrain the left group (min-w-0 + truncate the campaign name) and make the status shrink-0 whitespace-nowrap (or relocate it).

🤖 Generated with Claude Code

**Scope additions (design review, 2026-07-21):** folding two adjacent items into this refactor. 1. **Shared lore-grounding picker.** The grounding control — today a flat checkbox list of *all* lore in Rumor/Random Table, a single-select in Description, and an npc-filtered select in NPC Voice — becomes **one shared `lore-picker`** control in the config-driven panel. Redesign (chosen A+D): a **searchable chip/token multi-select** with results **grouped by entry_type**, opening **pre-seeded with smart-relevant suggestions** (entries linked to the target session, in open plot threads, and recently updated). Replaces the flat checkbox list, which doesn't scale to large campaigns. Every grounding tool inherits it for free once it's a config field type. 2. **Header fix + rename.** Rename the page header **"GM Planning" → "GM Workbench"**, and fix the header overflow: the *"Pre-generating name suggestions…"* status wraps the header because the flex row doesn't constrain child widths — constrain the left group (`min-w-0` + truncate the campaign name) and make the status `shrink-0 whitespace-nowrap` (or relocate it). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Contributor

Done — shipped in v3.10.0 (merged via #225). The 8 bespoke Workbench panels are collapsed onto one config-driven GeneratorPanel (sync / async-poll / instant-draw) reading per-tool configs in workbenchTools.jsx; the flat lore-checkbox lists are replaced by a shared searchable, type-grouped, chip-based LorePicker (server-side search, scales to large campaigns). Page renamed "GM Planning" → "GM Workbench", and the header bug fixed (root cause was NavBar rendered outside the <header>, unique to this page). Old panels removed; tests ported to LorePicker/GeneratorPanel/workbenchTools. Validated live on dev against qwen3.5.

Done — shipped in **v3.10.0** (merged via #225). The 8 bespoke Workbench panels are collapsed onto one config-driven `GeneratorPanel` (sync / async-poll / instant-draw) reading per-tool configs in `workbenchTools.jsx`; the flat lore-checkbox lists are replaced by a shared **searchable, type-grouped, chip-based `LorePicker`** (server-side search, scales to large campaigns). Page renamed **"GM Planning" → "GM Workbench"**, and the header bug fixed (root cause was NavBar rendered outside the `<header>`, unique to this page). Old panels removed; tests ported to `LorePicker`/`GeneratorPanel`/`workbenchTools`. Validated live on dev against `qwen3.5`.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rbrooks/Quest-Board#234
No description provided.