[PR #8552] [MERGED] feat(mari): Prof. Mari in the Lorebook editor and its entries #8667

Closed
opened 2026-11-07 16:46:22 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8552
Author: @Gunterlie
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @Gunterlie

Base: feat/mari-editors ← Head: feat/mari-lorebook-editor


📝 Commits (1)

  • 2420087 feat(mari): Prof. Mari in the Lorebook editor and its entries

📊 Changes

11 files changed (+1814 additions, -1308 deletions)

View changed files

📝 packages/client/src/components/characters/MariFieldReview.tsx (+15 -4)
📝 packages/client/src/components/chat/HomeProfessorMariChat.tsx (+3 -3)
📝 packages/client/src/components/chat/MariEditEasyViewer.tsx (+4 -2)
📝 packages/client/src/components/lorebooks/LorebookEditor.tsx (+1466 -1231)
📝 packages/client/src/components/lorebooks/LorebookEntryRow.tsx (+83 -25)
📝 packages/client/src/components/lorebooks/LorebookFormFields.tsx (+4 -1)
📝 packages/client/src/hooks/use-mari-editor-fields.ts (+72 -18)
📝 packages/client/src/lib/mari-editor-fields.ts (+67 -18)
📝 packages/server/src/services/professor-mari/workspace-agent.service.ts (+1 -1)
📝 scripts/regressions/mari-editor-fields.regression.ts (+95 -5)
📝 scripts/regressions/mari/review-cards.regression.ts (+4 -0)

📄 Description

Linked issue

No issue: planned work, slice 7b of the Professor Mari companion (#8418); PRed into the integration branch feat/mari-editors.

Why this change

The Character and Persona editors already let Prof. Mari work beside the form: she shows her changes in the field, the user keeps or declines them there, and "Open at this field" jumps to the right place. The Lorebook editor had none of this, and lorebooks are where her edits are most useful (long entry content). Entries are their own records inside a lorebook, so they need their own field ids, save handling and reveal logic.

What changed

  • Two new editor kinds in MARI_EDITOR_KINDS: lorebook (the book) and lorebookEntry (each entry). Entry field ids are entries.<entryId>.<key>, so anchors stay unique next to the book's own name/description.
  • Matches the server shapes: lorebook.update and lorebook.updateentry (plus the lorebook.entry.update / lorebook.entries.update aliases); an entry call is read by entryId first. Kept entry fields come from the review's diffPreview, because the action result names only the lorebook.
  • Lorebook editor: companion, field draft, in-field review for the book description and entry content, pre-save on Keep (book save + entry save queue flush), takeover restore, and a "Prof. Mari is here" chip when her field is off screen.
  • Collapsed entries: Next / "Open at this field" expands the entry; a review for an entry that is not rendered stays on her card.
  • The form rebases on refetch, and saves send only the changed keys (book lorebookSavePatch and the entry save payload), so a save no longer overwrites her change with stale values.
  • Keep waits for an in-flight entry autosave and for the background save of an entry that just closed (Next).
  • Review labels, the decline prompt and the active field name the entry ("Smugglers · Content").
  • Server: HELD_ID_ARGS now reads entryId before lorebookId, so a held entry edit names the entry (open-at-field works, no "+1 other record").
  • Regressions: new slice 7b cases in mari-editor-fields.regression.ts; a held-entry id case in mari/review-cards.regression.ts.

LorebookEditor.tsx shows a large diff because the return block is now wrapped in the review provider and re-indented. Review it with whitespace hidden (?w=1): about 350 changed lines.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

Agent-run checks (not a substitute for the steps below):

  • Client and server tsc --noEmit clean; eslint on the changed client files clean except one existing serverRun deps warning in HomeProfessorMariChat.tsx; prettier clean; localization:check passed (no new keys).
  • Regressions mari-editor-fields and mari/review-cards pass.
  • Playwright on a throwaway server with an empty data dir and seeded held changes, lorebook editor, 35/35 checks: book + collapsed entry review, Next expands, Keep all, kept line, Undo; Open at this field; Edit takeover; Save after her change; entry autosave race; field draft with the entry field id; Keep during an in-flight entry autosave; Keep on entry Y after editing X then Next; 390 px sheet + Open at this field, no horizontal scroll. Quick Persona and Character pass: 16/16.
  • Opus review: 0 blocker/high, 3 medium + 3 low, all fixed (Keep during in-flight autosave, closed-entry save race, held entry id on the server, takeover rebase, takeover text for a closed entry, entry name in labels).
  • No dedicated test: the takeover rebase (L4), the takeover save for a closed entry (L5), and lorebookSavePatch (covered only by the live Playwright run).

To verify manually:

  • Ask Prof. Mari to rewrite an entry's content in Manual mode while the entry is collapsed; press Next on her review and confirm the entry expands and shows her change in the Content field.
  • Type in an entry's description, then press Keep on her review right away; confirm both your text and her change are saved after a reload.
  • Use Edit on her entry review, change the text, then Keep; confirm your text stays and the other entry fields show the current saved values.
  • On a phone-width window (390 px), open her card and use "Open at this field" for an entry; confirm the editor scrolls to that entry's field.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Screenshots were taken during the agent run and kept local; none attached.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8552 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `feat/mari-editors` ← **Head:** `feat/mari-lorebook-editor` --- ### 📝 Commits (1) - [`2420087`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2420087b31a9275ea06e53884c239b3f7998f3c7) feat(mari): Prof. Mari in the Lorebook editor and its entries ### 📊 Changes **11 files changed** (+1814 additions, -1308 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/characters/MariFieldReview.tsx` (+15 -4) 📝 `packages/client/src/components/chat/HomeProfessorMariChat.tsx` (+3 -3) 📝 `packages/client/src/components/chat/MariEditEasyViewer.tsx` (+4 -2) 📝 `packages/client/src/components/lorebooks/LorebookEditor.tsx` (+1466 -1231) 📝 `packages/client/src/components/lorebooks/LorebookEntryRow.tsx` (+83 -25) 📝 `packages/client/src/components/lorebooks/LorebookFormFields.tsx` (+4 -1) 📝 `packages/client/src/hooks/use-mari-editor-fields.ts` (+72 -18) 📝 `packages/client/src/lib/mari-editor-fields.ts` (+67 -18) 📝 `packages/server/src/services/professor-mari/workspace-agent.service.ts` (+1 -1) 📝 `scripts/regressions/mari-editor-fields.regression.ts` (+95 -5) 📝 `scripts/regressions/mari/review-cards.regression.ts` (+4 -0) </details> ### 📄 Description ## Linked issue No issue: planned work, slice 7b of the Professor Mari companion (#8418); PRed into the integration branch `feat/mari-editors`. ## Why this change The Character and Persona editors already let Prof. Mari work beside the form: she shows her changes in the field, the user keeps or declines them there, and "Open at this field" jumps to the right place. The Lorebook editor had none of this, and lorebooks are where her edits are most useful (long entry content). Entries are their own records inside a lorebook, so they need their own field ids, save handling and reveal logic. ## What changed - Two new editor kinds in `MARI_EDITOR_KINDS`: `lorebook` (the book) and `lorebookEntry` (each entry). Entry field ids are `entries.<entryId>.<key>`, so anchors stay unique next to the book's own `name`/`description`. - Matches the server shapes: `lorebook.update` and `lorebook.updateentry` (plus the `lorebook.entry.update` / `lorebook.entries.update` aliases); an entry call is read by `entryId` first. Kept entry fields come from the review's `diffPreview`, because the action result names only the lorebook. - Lorebook editor: companion, field draft, in-field review for the book description and entry content, pre-save on Keep (book save + entry save queue flush), takeover restore, and a "Prof. Mari is here" chip when her field is off screen. - Collapsed entries: Next / "Open at this field" expands the entry; a review for an entry that is not rendered stays on her card. - The form rebases on refetch, and saves send only the changed keys (book `lorebookSavePatch` and the entry save payload), so a save no longer overwrites her change with stale values. - Keep waits for an in-flight entry autosave and for the background save of an entry that just closed (Next). - Review labels, the decline prompt and the active field name the entry ("Smugglers · Content"). - Server: `HELD_ID_ARGS` now reads `entryId` before `lorebookId`, so a held entry edit names the entry (open-at-field works, no "+1 other record"). - Regressions: new slice 7b cases in `mari-editor-fields.regression.ts`; a held-entry id case in `mari/review-cards.regression.ts`. `LorebookEditor.tsx` shows a large diff because the return block is now wrapped in the review provider and re-indented. Review it with whitespace hidden (`?w=1`): about 350 changed lines. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes Agent-run checks (not a substitute for the steps below): - Client and server `tsc --noEmit` clean; eslint on the changed client files clean except one existing `serverRun` deps warning in `HomeProfessorMariChat.tsx`; prettier clean; `localization:check` passed (no new keys). - Regressions `mari-editor-fields` and `mari/review-cards` pass. - Playwright on a throwaway server with an empty data dir and seeded held changes, lorebook editor, 35/35 checks: book + collapsed entry review, Next expands, Keep all, kept line, Undo; Open at this field; Edit takeover; Save after her change; entry autosave race; field draft with the entry field id; Keep during an in-flight entry autosave; Keep on entry Y after editing X then Next; 390 px sheet + Open at this field, no horizontal scroll. Quick Persona and Character pass: 16/16. - Opus review: 0 blocker/high, 3 medium + 3 low, all fixed (Keep during in-flight autosave, closed-entry save race, held entry id on the server, takeover rebase, takeover text for a closed entry, entry name in labels). - No dedicated test: the takeover rebase (L4), the takeover save for a closed entry (L5), and `lorebookSavePatch` (covered only by the live Playwright run). To verify manually: - [ ] Ask Prof. Mari to rewrite an entry's content in Manual mode while the entry is collapsed; press Next on her review and confirm the entry expands and shows her change in the Content field. - [ ] Type in an entry's description, then press Keep on her review right away; confirm both your text and her change are saved after a reload. - [ ] Use Edit on her entry review, change the text, then Keep; confirm your text stays and the other entry fields show the current saved values. - [ ] On a phone-width window (390 px), open her card and use "Open at this field" for an entry; confirm the editor scrolls to that entry's field. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) Screenshots were taken during the agent run and kept local; none attached. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:46:22 +07:00
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#8667
No description provided.