[PR #4910] [MERGED] feat(server): let Professor Mari set every user-editable lorebook entry field #6538

Closed
opened 2026-10-23 04:11:22 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4910
Author: @kolacheee
Created: 8/11/2026
Status: ✅ Merged
Merged: 8/11/2026
Merged by: @kolacheee

Base: staging ← Head: feat/4791-mari-lorebook-all-fields


📝 Commits (3)

  • e6451cf feat(server): let Professor Mari set every user-editable lorebook entry field (#4791)
  • 2d48d3f Merge branch 'staging' into feat/4791-mari-lorebook-all-fields
  • 8b9e415 fix(server): apply full entry settings to embedded lorebook.create entries (#4791)

📊 Changes

4 files changed (+345 additions, -8 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/server/src/services/mari-db/mari-db.service.ts (+209 -7)
📝 packages/server/src/services/professor-mari/workspace-agent.service.ts (+3 -0)
📝 scripts/regressions/open-issues.regression.ts (+132 -1)

📄 Description

Linked issue

Closes #4909

Follow-up to #4791 / #4796.

Why this change

After #4791 taught the workspace Professor Mari to author well-parameterized lorebooks, a user testing her found she still couldn't change an entry's activation chance — she reported that changing probability from 50 to 100 was something "this workspace helper does not support."

The cause: her entry action handler (assignLorebookEntryActionFields) only read a subset of entry fields, so both lorebook.addEntry and lorebook.updateEntry silently dropped the rest. A human can set these in the UI (they're all part of bulkUpdateLorebookEntryChangesSchema), but Mari could not. This makes her the full-fidelity author #4791 intended.

What changed

  • packages/server/src/services/mari-db/mari-db.service.ts — extended assignLorebookEntryActionFields (used by both the addentry and updateentry app-data actions) to accept every remaining user-editable entry setting, and added those field names to both action allowlists:
    • Activation chance probability (clamped 0–100 via the existing bounded-number helper).
    • Timing sticky / cooldown / delay / ephemeral.
    • Recursion preventRecursion / excludeRecursion / delayUntilRecursion.
    • Inclusion-group groupWeight, per-entry scanDepth, locked, folder placement folderId.
    • Matching filters characterFilterMode/characterFilterIds, characterTagFilterMode/characterTagFilters, generationTriggerFilterMode/generationTriggerFilters, and additionalMatchingSources.
    • Added a small assignArrayField helper for the object-array field (additionalMatchingSources); element shape is validated downstream on save.
  • packages/server/src/services/professor-mari/workspace-agent.service.ts — two prompt bullets: one listing the newly-settable fields (leave at defaults unless asked; docs_read for the less-common ones), and one describing the vectorization gate.
  • scripts/regressions/open-issues.regression.ts — extended the #4791 regression to assert the new fields round-trip through updateEntry, including the probability clamp (150 → 100).
  • CHANGELOG.md — one entry under Added.

Vectorization is gated prompt-side (by design)

Per the request, Mari can set every field freely except vectorization, which she should only enable when an embedding model is configured. That gate is enforced in the prompt (she is told to set excludeFromVectorization: false only when embeddingModelConfigured: true), not in code — consistent with how #4791 treats embeddingModelConfigured as a signal rather than a hard gate. Rationale: including an entry in vectorization with no embedding model is a harmless no-op (it simply participates once one exists), so a hard reject would block a no-op; the real concern is Mari promising semantic recall she can't deliver, which the prompt gate prevents. Excluding an entry is always allowed.

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

Automated, done by me:

  • pnpm check passes (TypeScript + ESLint + build, exit 0).
  • The open-issues regression runs through the new lorebook assertions (probability clamp 150 → 100, plus sticky/cooldown/delay/groupWeight/scanDepth/preventRecursion/excludeRecursion/delayUntilRecursion/excludeFromVectorization/locked/characterFilterIds round-trips) via the real updateEntry code path.
    • Note: that regression currently fails later on a pre-existing, unrelated assertion (Summary entries must expose a shared desktop and touch reorder surface, chat-summary UI) that also fails on a clean staging checkout — not introduced by this PR.

Still needs a human (please verify in a real browser, don't trust the boxes above):

  • Ask workspace Mari to set an entry's activation chance to 100 and confirm the entry's probability updates in the lorebook editor.
  • Ask her to set timing (sticky/cooldown/delay), recursion flags, a folder, and a character filter on an entry and confirm each persists.
  • With no embedding model configured, confirm she declines to promise semantic recall and doesn't claim vectorization is active; with one configured, confirm she can include the entry.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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)

CHANGELOG.md updated. No docs/ change needed — every one of these entry settings is already documented in docs/lorebooks/entries.md, so there is no docs-i18n follow-up. No version bump.

Summary by CodeRabbit

  • New Features

    • Professor Mari can now configure nearly all editable lorebook entry settings, including activation probability, timing, recursion, matching, placement, locking, weighting, scan depth, filters, and vectorization.
    • Lorebook entries can be assigned to folders, moved, or explicitly removed from folders.
    • Advanced character, tag, generation, and matching-source filters are supported.
  • Bug Fixes

    • Improved validation, normalization, and clearing of optional lorebook settings.
    • Invalid folder references and unsupported filter values are now rejected.

🔄 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/4910 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 8/11/2026 **Status:** ✅ Merged **Merged:** 8/11/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/4791-mari-lorebook-all-fields` --- ### 📝 Commits (3) - [`e6451cf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e6451cf04f9cf1e16940d1d6dde5ed4af036dccc) feat(server): let Professor Mari set every user-editable lorebook entry field (#4791) - [`2d48d3f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2d48d3f5b28a92818b9ccae5363504dd87b6cf75) Merge branch 'staging' into feat/4791-mari-lorebook-all-fields - [`8b9e415`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8b9e415e76fe978815bb54797a1f458189eb77b8) fix(server): apply full entry settings to embedded lorebook.create entries (#4791) ### 📊 Changes **4 files changed** (+345 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/server/src/services/mari-db/mari-db.service.ts` (+209 -7) 📝 `packages/server/src/services/professor-mari/workspace-agent.service.ts` (+3 -0) 📝 `scripts/regressions/open-issues.regression.ts` (+132 -1) </details> ### 📄 Description ## Linked issue Closes #4909 Follow-up to #4791 / #4796. ## Why this change After #4791 taught the workspace Professor Mari to author well-parameterized lorebooks, a user testing her found she still couldn't change an entry's activation chance — she reported that changing `probability` from 50 to 100 was something "this workspace helper does not support." The cause: her entry action handler (`assignLorebookEntryActionFields`) only read a subset of entry fields, so both `lorebook.addEntry` and `lorebook.updateEntry` silently dropped the rest. A human can set these in the UI (they're all part of `bulkUpdateLorebookEntryChangesSchema`), but Mari could not. This makes her the full-fidelity author #4791 intended. ## What changed - **`packages/server/src/services/mari-db/mari-db.service.ts`** — extended `assignLorebookEntryActionFields` (used by both the `addentry` and `updateentry` app-data actions) to accept every remaining user-editable entry setting, and added those field names to both action allowlists: - Activation chance `probability` (clamped 0–100 via the existing bounded-number helper). - Timing `sticky` / `cooldown` / `delay` / `ephemeral`. - Recursion `preventRecursion` / `excludeRecursion` / `delayUntilRecursion`. - Inclusion-group `groupWeight`, per-entry `scanDepth`, `locked`, folder placement `folderId`. - Matching filters `characterFilterMode`/`characterFilterIds`, `characterTagFilterMode`/`characterTagFilters`, `generationTriggerFilterMode`/`generationTriggerFilters`, and `additionalMatchingSources`. - Added a small `assignArrayField` helper for the object-array field (`additionalMatchingSources`); element shape is validated downstream on save. - **`packages/server/src/services/professor-mari/workspace-agent.service.ts`** — two prompt bullets: one listing the newly-settable fields (leave at defaults unless asked; `docs_read` for the less-common ones), and one describing the vectorization gate. - **`scripts/regressions/open-issues.regression.ts`** — extended the #4791 regression to assert the new fields round-trip through `updateEntry`, including the `probability` clamp (150 → 100). - **`CHANGELOG.md`** — one entry under Added. ### Vectorization is gated prompt-side (by design) Per the request, Mari can set every field freely *except* vectorization, which she should only enable when an embedding model is configured. That gate is enforced in the prompt (she is told to set `excludeFromVectorization: false` only when `embeddingModelConfigured: true`), not in code — consistent with how #4791 treats `embeddingModelConfigured` as a signal rather than a hard gate. Rationale: including an entry in vectorization with no embedding model is a harmless no-op (it simply participates once one exists), so a hard reject would block a no-op; the real concern is Mari *promising* semantic recall she can't deliver, which the prompt gate prevents. Excluding an entry is always allowed. ## Validation - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes Automated, done by me: - `pnpm check` passes (TypeScript + ESLint + build, exit 0). - The `open-issues` regression runs through the new lorebook assertions (probability clamp 150 → 100, plus `sticky`/`cooldown`/`delay`/`groupWeight`/`scanDepth`/`preventRecursion`/`excludeRecursion`/`delayUntilRecursion`/`excludeFromVectorization`/`locked`/`characterFilterIds` round-trips) via the real `updateEntry` code path. - Note: that regression currently fails later on a **pre-existing, unrelated** assertion (`Summary entries must expose a shared desktop and touch reorder surface`, chat-summary UI) that also fails on a clean `staging` checkout — not introduced by this PR. Still needs a human (please verify in a real browser, don't trust the boxes above): - Ask workspace Mari to set an entry's activation chance to 100 and confirm the entry's `probability` updates in the lorebook editor. - Ask her to set timing (sticky/cooldown/delay), recursion flags, a folder, and a character filter on an entry and confirm each persists. - With **no** embedding model configured, confirm she declines to promise semantic recall and doesn't claim vectorization is active; with one configured, confirm she can include the entry. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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) `CHANGELOG.md` updated. No `docs/` change needed — every one of these entry settings is already documented in `docs/lorebooks/entries.md`, so there is no `docs-i18n` follow-up. No version bump. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Professor Mari can now configure nearly all editable lorebook entry settings, including activation probability, timing, recursion, matching, placement, locking, weighting, scan depth, filters, and vectorization. - Lorebook entries can be assigned to folders, moved, or explicitly removed from folders. - Advanced character, tag, generation, and matching-source filters are supported. - **Bug Fixes** - Improved validation, normalization, and clearing of optional lorebook settings. - Invalid folder references and unsupported filter values are now rejected. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:11: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#6538
No description provided.