mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3840] [Issue]: Improve Peek Prompt modal #2073
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#2073
Loading…
Add table
Add a link
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?
Originally created by @BobEckman0348 on GitHub (Jul 19, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3840
Originally assigned to: @SpicyMarinara on GitHub.
Feature: Surface lorebook activation provenance in Peek Prompt modal and unify Roleplay active context view
Summary
The backend already tracks per-entry activation provenance (activation sources, matched keys, vector scores, budget-skipped reasons) but two key UI surfaces don't expose it:
PeekPromptModal.tsx) has no lorebook awareness at all — lorebook content appears as opaque text in the assembled prompt with no mapping to entries or activation reasons.This data is critical for users fine-tuning lorebook entries, keyword selection, vector settings, and budget allocation.
Current state
Data pipeline — ✅ Already exists
The backend
/lorebooks/scan/:chatIdendpoint returnsActiveLorebookScanwith full provenance per entry:Conversation/Game mode active context — ✅ Rich provenance
ActiveLorebookEntriesButton(packages/client/src/components/chat/ActiveLorebookEntriesButton.tsx) lazy-loadsActiveLorebookEntriesPanelfromChatRoleplayPanels.tsx, which renders per entry:Used in:
ConversationView.tsx:450GameSurface.tsx:10867, 11125Roleplay mode active context — ❌ Simplified, no provenance
ChatRoleplaySurface.tsx(lines 578–674) renders its own inline active context popover. Per entry (lines 622–645):title={entry.content || entry.name}— native browser tooltip on hoverMissing: activation sources, matched keys, vector scores, click-to-expand.
The data is available —
triggeredEntries(line 524) contains fullActiveLorebookEntry[]— but the render code ignores the provenance fields.Peek Prompt modal — ❌ No lorebook awareness
PeekPromptData(packages/client/src/components/chat/chat-area.types.ts:45-69):No
lorebookScanor equivalent. The modal parses the assembled prompt into sections by XML tags and estimates tokens per section, but cannot map lorebook text chunks back to individual entries or show why each entry was injected.Proposed changes
1. Unify Roleplay active context with the existing rich panel
Quick win. Replace the inline active context render in
ChatRoleplaySurface.tsx(lines 620–646) with the existingActiveLorebookEntriesPanelcomponent fromChatRoleplayPanels.tsx, or at minimum render the same provenance fields (activation sources subtitle, matched keys, vector score badges) in the existing row layout.The data is already in scope (
triggeredEntriesat line 524). No backend changes needed.2. Wire lorebook scan into Peek Prompt modal
Larger but high-value. Two parts:
a) Pass scan data to the peek endpoint response:
LorebookScanSnapshot. Include the scan snapshot (or a lightweight version with entry IDs, names, activation sources, matched keys, semantic scores, token counts) in thePeekPromptDataresponse.lorebookScan?: ActiveLorebookScanfield toPeekPromptData.b) Render provenance in
PeekPromptModal:3. (Bonus) Surface recursion depth
The scan tracks
"recursive"as an activation source but doesn't surface how deep the recursion went or which entry triggered the recursive scan. Adding arecursionDepthfield and the parent entry ID would help debug recursive lorebook chains.Why this matters
Without per-entry activation provenance in the prompt inspector, users tuning lorebooks are flying blind:
The data pipeline is already built. This is a presentation-layer gap, not an engine gap.
File references
packages/client/src/hooks/use-lorebooks.tsActiveLorebookEntrytype,useActiveLorebookEntrieshookpackages/client/src/components/chat/ChatRoleplayPanels.tsxActiveLorebookEntryRow+ActiveLorebookEntriesPanel(Conversation/Game)packages/client/src/components/chat/ActiveLorebookEntriesButton.tsxpackages/client/src/components/chat/ChatRoleplaySurface.tsxpackages/client/src/components/chat/chat-area.types.tsPeekPromptDatatype (no lorebook scan field)packages/client/src/components/chat/ChatArea.tsxpackages/client/src/components/chat/ConversationView.tsxpackages/client/src/components/game/GameSurface.tsxThanks to Mari for creating this for me!
@SpicyMarinara commented on GitHub (Jul 19, 2026):
@SpicyMarinara commented on GitHub (Jul 19, 2026):
I am taking the focused Roleplay Active Context parity slice. This will reuse the existing rich lorebook activation panel so Roleplay displays activation sources, matched keys, semantic scores, budget-skipped reasons, and expandable content. Peek Prompt provenance, scan payload changes, and recursion metadata are explicitly out of scope for this PR.