[GH-ISSUE #4986] Preset import: standalone ST transformer emitting the native marinara_preset envelope #2765

Closed
opened 2026-10-21 05:54:48 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @ktello on GitHub (Aug 13, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4986

Problem

The SillyTavern preset importer (packages/server/src/services/import/st-prompt.importer.ts) writes directly to storage and discards structure the Marinara data model already supports:

  • Duplicate marker types are skipped, so marker placement is lost (e.g. charDescription and charPersonality at different positions collapse into one character marker)
  • Distinct world_info_before / world_info_after markers and per-marker enabled state are not preserved
  • Nested prompt groups are collapsed to one level
  • Detected variable patterns become legacy variable groups instead of real ChoiceBlocks
  • File timestamps are dropped; separately, /api/import/marinara writes client timestampOverrides to data.metadata.timestamps while importPreset reads them from data.preset — the override is silently dead
  • The native envelope importer validates nothing (string-boolean coercions, unguarded Number() casts, role as any)
  • Because the importer is coupled to the DB layer, none of the mapping logic is unit-testable

Proposal

Add a standalone, pure transformer library (st-preset-import/ at the project root, @marinara-engine/st-preset-import) that maps ST preset JSON to the native marinara_preset v1 envelope, and converge every preset import path (ST single-file, ST bulk, native) on the schema-validated importPreset pipeline. The legacy direct-to-storage importer is removed behind a fixture parity gate.

Full design: OpenSpec change add-st-preset-transformer (proposal, design decisions, spec deltas, task plan).

Ownership

Implementation by Claude (agent) coordinated by @ktello, on branch agent/st-preset-transformer targeting staging. Draft PR to follow immediately per repo coordination rules.

Originally created by @ktello on GitHub (Aug 13, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4986 ## Problem The SillyTavern preset importer (`packages/server/src/services/import/st-prompt.importer.ts`) writes directly to storage and discards structure the Marinara data model already supports: - Duplicate marker types are skipped, so marker **placement** is lost (e.g. `charDescription` and `charPersonality` at different positions collapse into one `character` marker) - Distinct `world_info_before` / `world_info_after` markers and per-marker enabled state are not preserved - Nested prompt groups are collapsed to one level - Detected variable patterns become legacy variable groups instead of real ChoiceBlocks - File timestamps are dropped; separately, `/api/import/marinara` writes client `timestampOverrides` to `data.metadata.timestamps` while `importPreset` reads them from `data.preset` — the override is silently dead - The native envelope importer validates nothing (string-boolean coercions, unguarded `Number()` casts, `role as any`) - Because the importer is coupled to the DB layer, none of the mapping logic is unit-testable ## Proposal Add a standalone, pure transformer library (`st-preset-import/` at the project root, `@marinara-engine/st-preset-import`) that maps ST preset JSON to the native `marinara_preset` v1 envelope, and converge every preset import path (ST single-file, ST bulk, native) on the schema-validated `importPreset` pipeline. The legacy direct-to-storage importer is removed behind a fixture parity gate. Full design: OpenSpec change `add-st-preset-transformer` (proposal, design decisions, spec deltas, task plan). ## Ownership Implementation by Claude (agent) coordinated by @ktello, on branch `agent/st-preset-transformer` targeting `staging`. Draft PR to follow immediately per repo coordination rules.
Author
Owner

@SpicyMarinara commented on GitHub (Aug 13, 2026):

The imports drop these because ME doesn't make use of those.

<!-- gh-comment-id:5287474798 --> @SpicyMarinara commented on GitHub (Aug 13, 2026): The imports drop these because ME doesn't make use of those.
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#2765
No description provided.