From ee4208ec516fb38f77880f8747ba0b82131b2bbe Mon Sep 17 00:00:00 2001 From: mARTin-B78 Date: Fri, 4 Sep 2026 13:38:40 +0200 Subject: [PATCH] refactor: scope cast compatibility modules --- CHANGELOG.md | 4 ++++ VERSION | 2 +- docs/ARCHITECTURE.md | 2 ++ static/index.html | 16 ++++++++-------- static/js/audiobook-cast.js | 10 ++++++++++ static/js/sillytavern.js | 13 +++++++++++++ 6 files changed, 38 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 583a06c..82405f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ Follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · versioned wi ## [Unreleased] ### Changed +- **Audiobook-cast namespace migration.** Cast serialization, page stamping, and speaker normalization now use a private + scope with compatibility exports and the existing `window.TTVC.audiobook.cast` API. +- **SillyTavern namespace migration.** Character-card parsing, import, and export helpers now use a private scope with + compatibility exports and a `window.TTVC.sillyTavern` API. - **Seed-finder namespace migration.** Seed sample generation, caching, and batch controls now use a private scope with compatibility exports and a `window.TTVC.seedFinder` API. - **Character-column namespace migration.** Character-table metadata, persisted column visibility, and completeness diff --git a/VERSION b/VERSION index 41edee9..773d679 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.24.94 +1.24.95 diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 4db78bb..8caf280 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -81,6 +81,8 @@ Done incrementally as global-scope ordered files (no ES-module change needed) - ✅ Shared utility helpers use a private scope with explicit compatibility exports and a `window.TTVC.utils` API. - ✅ Character-table metadata and column/completeness helpers use a private scope with a namespace API. - ✅ Seed-finder generation and caching helpers use a private scope with compatibility exports and a namespace API. +- ✅ Audiobook cast serialization and speaker normalization use a private scope with the existing cast namespace API. +- ✅ SillyTavern character-card import/export helpers use a private scope with a namespace API. - ✅ `static/css/resource-diagnostics.css` — isolated Performance/resource diagnostic panel styles. - ✅ `static/css/background-jobs.css` — isolated background-job history and retry-panel styles. - ✅ `static/css/voice-design.css` — isolated Voice Design form, samples, and preview-match styles. diff --git a/static/index.html b/static/index.html index 2c514e4..9f9a853 100644 --- a/static/index.html +++ b/static/index.html @@ -10,7 +10,7 @@ - + @@ -27,12 +27,12 @@ - - - - - - + + + + + + @@ -397,7 +397,7 @@ window.toggleNavTree = function(treeId, chevronId) { - + diff --git a/static/js/audiobook-cast.js b/static/js/audiobook-cast.js index 70a62f7..b6c14af 100644 --- a/static/js/audiobook-cast.js +++ b/static/js/audiobook-cast.js @@ -2,6 +2,8 @@ // Live casting remains in audiobook.js; these deterministic export/migration // helpers have no casting-state side effects and can be loaded independently. +(function (root) { + function _abCastMarkdown(data) { const payload = data || {}; const segments = Array.isArray(payload.segments) ? payload.segments : []; @@ -3495,3 +3497,11 @@ window.TTVC.audiobook.cast = { dropPhantomSpeakers: _audiobookDropPhantomSpeakers, consolidateSpeakerAliases: _audiobookConsolidateSpeakerAliases, }; + +Object.assign(root, { + _abCastMarkdown, _abStampSegmentPages, audiobookCastView, + _audiobookMergeAdjacentSameSpeaker, _audiobookMergeAdjacentDialogue, + _audiobookMergeSplitSentences, _audiobookDedupNearbyDuplicates, + _audiobookDropPhantomSpeakers, _audiobookConsolidateSpeakerAliases, +}); +})(window); diff --git a/static/js/sillytavern.js b/static/js/sillytavern.js index 33e9a0e..ad953f7 100644 --- a/static/js/sillytavern.js +++ b/static/js/sillytavern.js @@ -1,4 +1,5 @@ // ── SillyTavern character-card compatibility ────────────────────────────────── +(function (root) { // // Import and export characters in SillyTavern / TavernAI "Character Card" format // so a cast built here can be moved to/from SillyTavern (and the wider ecosystem @@ -188,3 +189,15 @@ window.stFromRecord = stFromRecord; window.stImportCards = stImportCards; window.stImportDialog = stImportDialog; window.stExportRecord = stExportRecord; + +root.TTVC = root.TTVC || {}; +root.TTVC.sillyTavern = root.TTVC.sillyTavern || {}; +Object.assign(root.TTVC.sillyTavern, { + parseFile: stParseFile, + toSheet: stToSheet, + fromRecord: stFromRecord, + importCards: stImportCards, + importDialog: stImportDialog, + exportRecord: stExportRecord, +}); +})(window);