[GH-ISSUE #5954] Let a player turn individual lorebook entries off for one chat (the storage already supports it) #3295

Closed
opened 2026-10-21 06:01:45 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @kolacheee on GitHub (Sep 8, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5954

Originally assigned to: @SpicyMarinara on GitHub.

A player should be able to turn individual lorebook entries on and off for one Game Mode chat, without that choice leaking into every other chat that uses the same book.

Most of this already exists — what's missing is a way for a person to trigger it.

The storage shape is already there and already honored:

// packages/shared/src/types/chat.ts:429-431
/** Per-chat ephemeral / enabled overrides for lorebook entries (entryId → state).
 *  Tracked per-chat so ephemeral countdown in one chat doesn't affect others. */
entryStateOverrides?: Record<string, { ephemeral?: number | null; enabled?: boolean }>;

and processLorebooks already filters on it (services/lorebook/index.ts:1113-1130): an entry whose override says enabled === false is dropped for that chat and left untouched everywhere else. It lives on the chat's metadata JSON blob, so no new table and no migration.

But nothing in the client ever writes it. entryStateOverrides appears nowhere under packages/client/src — the only writer in the codebase is the automatic ephemeral countdown, which sets enabled: false after an entry's activations run out (services/lorebook/index.ts:1290, :1302).

What a player can reach today is the wrong switch. Settings → Lorebooks → Edit opens InlineLorebookEntriesEditor, whose rows carry an enabled toggle (LorebookEntryRow.tsx:618-628). Because the editor passes no onUpdateEntry, that toggle falls through to the global PATCH /lorebooks/{id}/entries/{entryId} (lorebooks.storage.ts:923) — it edits the entry row itself, so flipping it off in a game chat turns it off in every chat using that book, with nothing in the UI saying so. That's arguably a bug on its own.

Every per-chat control that does exist is whole-book: excludedLorebookIds, lorebook.scope, activeLorebookIds.

What's needed: a route that accepts something like {chatId, entryId, enabled} and merges into entryStateOverrides the same way the ephemeral system already does, plus a control that reads clearly as this chat only — most naturally beside (or instead of) the global switch already in the entry row, reached from the chat's Lorebooks section, which already renders for game chats. Worth care in the UI: a global switch and a per-chat switch sitting next to each other will get mixed up unless they're unmistakable.

Not the same thing as the Pixelforge picker. Pixelforge 0.16.2 ships a per-entry picker, but it selects entries for one world-generation call and then steps back — it writes nothing to chat metadata by design. This ask is standing chat scope: which entries stay live turn after turn. Same "book → entries" UI shape, different subsystem and different lifetime.

Originally created by @kolacheee on GitHub (Sep 8, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5954 Originally assigned to: @SpicyMarinara on GitHub. A player should be able to turn individual lorebook entries on and off for one Game Mode chat, without that choice leaking into every other chat that uses the same book. **Most of this already exists — what's missing is a way for a person to trigger it.** The storage shape is already there and already honored: ```ts // packages/shared/src/types/chat.ts:429-431 /** Per-chat ephemeral / enabled overrides for lorebook entries (entryId → state). * Tracked per-chat so ephemeral countdown in one chat doesn't affect others. */ entryStateOverrides?: Record<string, { ephemeral?: number | null; enabled?: boolean }>; ``` and `processLorebooks` already filters on it (`services/lorebook/index.ts:1113-1130`): an entry whose override says `enabled === false` is dropped for that chat and left untouched everywhere else. It lives on the chat's `metadata` JSON blob, so no new table and no migration. **But nothing in the client ever writes it.** `entryStateOverrides` appears nowhere under `packages/client/src` — the only writer in the codebase is the automatic ephemeral countdown, which sets `enabled: false` after an entry's activations run out (`services/lorebook/index.ts:1290, :1302`). **What a player can reach today is the wrong switch.** Settings → Lorebooks → Edit opens `InlineLorebookEntriesEditor`, whose rows carry an enabled toggle (`LorebookEntryRow.tsx:618-628`). Because the editor passes no `onUpdateEntry`, that toggle falls through to the global `PATCH /lorebooks/{id}/entries/{entryId}` (`lorebooks.storage.ts:923`) — it edits the entry row itself, so flipping it off in a game chat turns it off in **every** chat using that book, with nothing in the UI saying so. That's arguably a bug on its own. Every per-chat control that does exist is whole-book: `excludedLorebookIds`, `lorebook.scope`, `activeLorebookIds`. **What's needed:** a route that accepts something like `{chatId, entryId, enabled}` and merges into `entryStateOverrides` the same way the ephemeral system already does, plus a control that reads clearly as *this chat only* — most naturally beside (or instead of) the global switch already in the entry row, reached from the chat's Lorebooks section, which already renders for game chats. Worth care in the UI: a global switch and a per-chat switch sitting next to each other will get mixed up unless they're unmistakable. **Not the same thing as the Pixelforge picker.** Pixelforge 0.16.2 ships a per-entry picker, but it selects entries for *one* world-generation call and then steps back — it writes nothing to chat metadata by design. This ask is standing chat scope: which entries stay live turn after turn. Same "book → entries" UI shape, different subsystem and different lifetime.
bsakaguchi 2026-10-21 06:01:45 +07:00
  • closed this issue
  • added the
    in-pr
    label
Author
Owner

@SpicyMarinara commented on GitHub (Sep 9, 2026):

Owned by @SpicyMarinara with Codex. Draft PR #5981 tracks the fix: reuse the chat entry overrides, with explicit per-chat labeling and no global entry mutation from the chat toggle.

<!-- gh-comment-id:5593741189 --> @SpicyMarinara commented on GitHub (Sep 9, 2026): Owned by @SpicyMarinara with Codex. Draft PR #5981 tracks the fix: reuse the chat entry overrides, with explicit per-chat labeling and no global entry mutation from the chat toggle.
Sign in to join this conversation.
No milestone
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
Pasta-Devs/Marinara-Engine#3295
No description provided.