[PR #7007] [MERGED] feat(presets): let a prompt block opt out of the preset wrap format #7428

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7007
Author: @JurijPietrowicz
Created: 10/3/2026
Status: ✅ Merged
Merged: 10/3/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/section-wrap-override


📝 Commits (3)

  • db4b403 feat(presets): let a prompt block opt out of the preset wrap format
  • b1949f0 docs(changelog): link the prompt-block wrap opt-out issue
  • 7f9a641 Merge branch 'staging' into feat/section-wrap-override

📊 Changes

16 files changed (+122 additions, -3 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 docs/prompts/presets.md (+2 -0)
📝 packages/client/src/components/presets/PresetEditor.tsx (+20 -1)
📝 packages/client/src/localization/locales/en.json (+2 -0)
📝 packages/server/src/db/schema/prompts.ts (+2 -0)
📝 packages/server/src/db/seed.ts (+3 -0)
📝 packages/server/src/routes/backup.routes.ts (+1 -0)
📝 packages/server/src/services/conversation/character-commands.ts (+2 -0)
📝 packages/server/src/services/generation/professor-mari-command-runtime.ts (+2 -0)
📝 packages/server/src/services/import/marinara.importer.ts (+1 -0)
📝 packages/server/src/services/mari-db/mari-db.service.ts (+2 -0)
📝 packages/server/src/services/prompt/assembler.ts (+5 -2)
📝 packages/server/src/services/storage/prompts.storage.ts (+3 -0)
📝 packages/shared/src/schemas/prompt.schema.ts (+1 -0)
📝 packages/shared/src/types/prompt.ts (+2 -0)
📝 scripts/regressions/prompt.regression.ts (+73 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7006

Why this change

  • A preset's Wrap Format applies to every section. With XML or MARKDOWN selected, there is no way to send a single prompt block without its tag or heading. The only workaround is to switch the whole preset to NONE and hand-write the tags for every other block.

What changed

  • Send without wrapper switch on each Prompt Block in the Preset Editor's Sections tab. When it is on, the block is sent exactly as written, and the rest of the preset keeps its wrap format.
  • A block inside a group is still wrapped by the group. Group wrapping is unchanged.
  • Markers always keep their wrapper. The switch is not rendered for markers, and the assembler ignores the flag when isMarker is true, so a marker imported with the flag set cannot lose its wrapper.
  • The switch is hidden when the preset's wrap format is NONE.
  • New section field skipWrap (shared type, zod schema, skip_wrap column with default "false"). Existing rows read the column default, so no migration or STORAGE_VERSION bump is needed.
  • skipWrap is carried through preset duplicate, section duplicate, export (raw rows), backup restore, Marinara import, bundled-preset reseed and Professor Mari's preset commands.
  • The bundled-preset snapshot includes skipWrap only when it is true. Otherwise every install's stored snapshot hash would stop matching and the stock preset would look user-edited.
  • Prompt regression covering XML and Markdown, an ungrouped bare block, a grouped bare block, and a marker that keeps its wrapper.
  • docs/prompts/presets.md paragraph under "Wrap formats", English UI strings, and a CHANGELOG.md entry.

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

Automated runs at db4b403f962e1830a0ab5a22637914c080fa62ca (the code commit; the later b1949f05f changes only the changelog line), on top of staging 031c372e9:

  • pnpm check: passed.
  • pnpm localization:check: passed.
  • pnpm version:check: passed.
  • pnpm regression: 494/494 passed, including the new prompt regression. With the marker guard or the skipWrap handling removed from assembler.ts, the new regression fails.
  • pnpm smoke:ui: 7/7 passed (desktop Chromium).
  • pnpm regression:ui e2e/core-flows.e2e.ts --project=desktop-chromium --project=mobile-chromium --grep "preset token counters|quick preset editor" --workers=1: 4 passed, 2 skipped (viewport-specific tests that skip on the other project).
  • Not run: mobile WebKit, and the full browser matrix.
  • API check against the built server with a throwaway DATA_DIR: on a duplicated preset, PATCH with {"skipWrap": true} was stored and read back, and kept through preset duplicate and export. Existing sections read "false".

Claim boundary (prompt assembly / storage / import-export):

  • Core claim: a prompt block with skipWrap is sent unwrapped. Everything else assembles exactly as before.
  • Tested: XML and Markdown presets, an ungrouped block, a grouped block, a marker with the flag set, existing rows without the column, and the duplicate and export round trip.
  • Not tested: backup restore, Marinara import, and Mari's preset commands. These paths just copy the field, and the code was reviewed but not exercised.

Manual verification notes

  • Manually verify in the browser: in a duplicated preset, expand a Prompt Block, turn on Send without wrapper, and confirm in the prompt preview that the block arrives without its tag while other blocks stay wrapped.
  • Manually verify the switch is absent on markers (e.g. Character Info, Lorebook) and on every block when the preset uses NONE.
  • Manually verify that a grouped block with the switch on is still wrapped by its group tag.
  • Manually verify the switch in light and dark mode and in the compact mobile preset editor.
  • Manually verify that exporting and re-importing a preset keeps the switch state.

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)

docs/prompts/presets.md changed. The [docs-i18n] docs/prompts/presets.md follow-up issue will be opened and linked here.

UI evidence (if applicable)

after-editor-dark after-editor-light

Prompt with switch disabled:
before-preview-light

Prompt with switch enabled:
after-preview-light

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Prompt blocks can be sent without their individual XML-tag or Markdown-heading wrapper. Their group wrapper remains, and markers always retain their wrappers.
    • The preset editor offers a “Send without wrapper” option for non-marker blocks when a wrap format is selected. The setting is preserved when duplicating blocks and supported when importing presets.

🔄 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/7007 **Author:** [@JurijPietrowicz](https://github.com/JurijPietrowicz) **Created:** 10/3/2026 **Status:** ✅ Merged **Merged:** 10/3/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/section-wrap-override` --- ### 📝 Commits (3) - [`db4b403`](https://github.com/Pasta-Devs/Marinara-Engine/commit/db4b403f962e1830a0ab5a22637914c080fa62ca) feat(presets): let a prompt block opt out of the preset wrap format - [`b1949f0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b1949f05fb656ed1ca70385dc8e3fccbe64f9577) docs(changelog): link the prompt-block wrap opt-out issue - [`7f9a641`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7f9a641639bbd57718db0e06c298fce36c0adae0) Merge branch 'staging' into feat/section-wrap-override ### 📊 Changes **16 files changed** (+122 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `docs/prompts/presets.md` (+2 -0) 📝 `packages/client/src/components/presets/PresetEditor.tsx` (+20 -1) 📝 `packages/client/src/localization/locales/en.json` (+2 -0) 📝 `packages/server/src/db/schema/prompts.ts` (+2 -0) 📝 `packages/server/src/db/seed.ts` (+3 -0) 📝 `packages/server/src/routes/backup.routes.ts` (+1 -0) 📝 `packages/server/src/services/conversation/character-commands.ts` (+2 -0) 📝 `packages/server/src/services/generation/professor-mari-command-runtime.ts` (+2 -0) 📝 `packages/server/src/services/import/marinara.importer.ts` (+1 -0) 📝 `packages/server/src/services/mari-db/mari-db.service.ts` (+2 -0) 📝 `packages/server/src/services/prompt/assembler.ts` (+5 -2) 📝 `packages/server/src/services/storage/prompts.storage.ts` (+3 -0) 📝 `packages/shared/src/schemas/prompt.schema.ts` (+1 -0) 📝 `packages/shared/src/types/prompt.ts` (+2 -0) 📝 `scripts/regressions/prompt.regression.ts` (+73 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #7006 ## Why this change - A preset's **Wrap Format** applies to every section. With **XML** or **MARKDOWN** selected, there is no way to send a single prompt block without its tag or heading. The only workaround is to switch the whole preset to **NONE** and hand-write the tags for every other block. ## What changed - **Send without wrapper** switch on each **Prompt Block** in the Preset Editor's **Sections** tab. When it is on, the block is sent exactly as written, and the rest of the preset keeps its wrap format. - A block inside a group is still wrapped by the group. Group wrapping is unchanged. - Markers always keep their wrapper. The switch is not rendered for markers, and the assembler ignores the flag when `isMarker` is true, so a marker imported with the flag set cannot lose its wrapper. - The switch is hidden when the preset's wrap format is **NONE**. - New section field `skipWrap` (shared type, zod schema, `skip_wrap` column with default `"false"`). Existing rows read the column default, so no migration or `STORAGE_VERSION` bump is needed. - `skipWrap` is carried through preset duplicate, section duplicate, export (raw rows), backup restore, Marinara import, bundled-preset reseed and Professor Mari's preset commands. - The bundled-preset snapshot includes `skipWrap` only when it is true. Otherwise every install's stored snapshot hash would stop matching and the stock preset would look user-edited. - Prompt regression covering XML and Markdown, an ungrouped bare block, a grouped bare block, and a marker that keeps its wrapper. - `docs/prompts/presets.md` paragraph under "Wrap formats", English UI strings, and a `CHANGELOG.md` entry. ## Validation - [x] `pnpm check` passes locally - [ ] 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) - [ ] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` Automated runs at `db4b403f962e1830a0ab5a22637914c080fa62ca` (the code commit; the later `b1949f05f` changes only the changelog line), on top of `staging` `031c372e9`: - `pnpm check`: passed. - `pnpm localization:check`: passed. - `pnpm version:check`: passed. - `pnpm regression`: 494/494 passed, including the new prompt regression. With the marker guard or the `skipWrap` handling removed from `assembler.ts`, the new regression fails. - `pnpm smoke:ui`: 7/7 passed (desktop Chromium). - `pnpm regression:ui e2e/core-flows.e2e.ts --project=desktop-chromium --project=mobile-chromium --grep "preset token counters|quick preset editor" --workers=1`: 4 passed, 2 skipped (viewport-specific tests that skip on the other project). - Not run: mobile WebKit, and the full browser matrix. - API check against the built server with a throwaway `DATA_DIR`: on a duplicated preset, `PATCH` with `{"skipWrap": true}` was stored and read back, and kept through preset duplicate and export. Existing sections read `"false"`. **Claim boundary (prompt assembly / storage / import-export):** - Core claim: a prompt block with `skipWrap` is sent unwrapped. Everything else assembles exactly as before. - Tested: XML and Markdown presets, an ungrouped block, a grouped block, a marker with the flag set, existing rows without the column, and the duplicate and export round trip. - Not tested: backup restore, Marinara import, and Mari's preset commands. These paths just copy the field, and the code was reviewed but not exercised. ### Manual verification notes - [x] Manually verify in the browser: in a duplicated preset, expand a **Prompt Block**, turn on **Send without wrapper**, and confirm in the prompt preview that the block arrives without its tag while other blocks stay wrapped. - [x] Manually verify the switch is absent on markers (e.g. **Character Info**, **Lorebook**) and on every block when the preset uses **NONE**. - [x] Manually verify that a grouped block with the switch on is still wrapped by its group tag. - [x] Manually verify the switch in light and dark mode and in the compact mobile preset editor. - [x] Manually verify that exporting and re-importing a preset keeps the switch state. ## 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) `docs/prompts/presets.md` changed. The `[docs-i18n] docs/prompts/presets.md` follow-up issue will be opened and linked here. ## UI evidence (if applicable) <img width="1440" height="900" alt="after-editor-dark" src="https://github.com/user-attachments/assets/c2e8dd88-2710-401c-b394-9584667781b4" /> <img width="1440" height="900" alt="after-editor-light" src="https://github.com/user-attachments/assets/bd58cfd1-8026-4a54-b22c-a3222bc33dfc" /> Prompt with switch disabled: <img width="1440" height="1250" alt="before-preview-light" src="https://github.com/user-attachments/assets/deff02cb-4bd9-4d9a-ae00-46bcc2af1bfa" /> Prompt with switch enabled: <img width="1440" height="1250" alt="after-preview-light" src="https://github.com/user-attachments/assets/96f65ecd-554e-4f47-8b80-a6d4cb2215bf" /> 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Prompt blocks can be sent without their individual XML-tag or Markdown-heading wrapper. Their group wrapper remains, and markers always retain their wrappers. * The preset editor offers a “Send without wrapper” option for non-marker blocks when a wrap format is selected. The setting is preserved when duplicating blocks and supported when importing presets. <!-- 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:19:41 +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#7428
No description provided.