Commit Graph

134 Commits

Author SHA1 Message Date
Cohee 5512473b29 Extension management improvements (#5552)
* feat: enhance asset management with extension categories

Co-authored-by: Copilot <copilot@github.com>

* fix: enhance extension name validation in server endpoints

* feat: display extension author in the extensions list

* fix: unify server error response format

Co-authored-by: Copilot <copilot@github.com>

* feat: add splash on installing third-party for the first time

* fix: add URL format validation, unify validation error messages

Co-authored-by: Copilot <copilot@github.com>

* fix: apply object freeze to EMPTY_AUTHOR value

Co-authored-by: Copilot <copilot@github.com>

* fix: typecheck extensionName in API requests

Co-authored-by: Copilot <copilot@github.com>

* feat: add feature flag guard to extensions endpoints

Co-authored-by: Copilot <copilot@github.com>

* fix: parse URL before checking

Co-authored-by: Copilot <copilot@github.com>

* fix: use case insensitive regex check

* fix: make debug log more useful

Co-authored-by: Copilot <copilot@github.com>

* fix: add pre-validation of URL format and protocol

Co-authored-by: Copilot <copilot@github.com>

* fix: leaner installation success toast

* fix: settings data loss when extensions are disabled

* fix: don't try to auto-focus elements that don't exist

Co-authored-by: Copilot <copilot@github.com>

* fix: set Popup.defaultResult to negative

Co-authored-by: Copilot <copilot@github.com>

* revert: restore undefined default result

---------

Co-authored-by: Copilot <copilot@github.com>
2026-04-30 23:31:50 +03:00
Wolfsblvt d720605be8 Bulk extension field updates via merge-attributes with UNSET_VALUE sentinel (#5471)
* feat: add bulk extension field updates with UNSET_VALUE sentinel for key deletion

- Add `UNSET_VALUE` sentinel constant to signal complete field removal from character cards
- Add `writeExtensionFieldBulk()` function to update extension fields across multiple characters in a single API call
- Add `deleteValueByPath()` utility function to remove nested object keys by dot-path
- Update `writeExtensionField()` to support `UNSET_VALUE` for deleting extension keys
- Extend `/api/characters/merge-attributes

* Revert package-lock.json changes

* Allow null values in merge-attributes filter path validation

Change filter.path existence check to only skip on undefined, not null. This allows merging attributes when the existing value is explicitly null, treating null as a valid value rather than absence of a value.

* fix: share forbiddenRegExp between modules

* feat: add writeExtensionFieldBulk and UNSET_VALUE constant to getContext

* Update src/endpoints/characters.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: validate for .png extension

* Update public/scripts/extensions.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* refactor: extract shouldSkip logic as a function param to avoid double parsing

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-20 00:06:28 +03:00
Wolfsblvt 737cb95adb Add clean extension lifecycle hook for optional data cleanup (#5449)
* Add 'clean' extension hook support with optional cleanup on delete

- Add hasExtensionHook() helper to check if an extension defines a specific manifest hook
- Add 'clean' hook type to callExtensionHook() JSDoc
- Add clean button to extension UI when 'clean' hook is present
- Add onCleanClick() handler to run clean hook with confirmation
- Add cleanExtension() function to execute clean hook and reload page
- Modify deleteExtension() to optionally run clean hook before deletion
- Show cleanup checkbox on extension delete popup

* fix lint

Remove unused `callGenericPopup` import from extensions.js

* Force save settings before page reload in extension clean and delete operations

Add explicit saveSettings() calls in cleanExtension() and deleteExtension() to prevent race conditions where clean/delete hooks might update settings that get lost during the subsequent page reload.

* Remove admin permission check from extension clean operation

The clean hook is extension-defined and may not require admin privileges. Permission checks should be handled by the extension's clean hook implementation if needed, rather than enforcing a blanket restriction at the UI level.

* fix: show clean button for built-ins

* Update hasExtensionHook to support built-in extensions

* Revert "Update hasExtensionHook to support built-in extensions"

This reverts commit 31be55ea66430ffe6a8d149d519b3d6d149da9ea.

* Revert "fix: show clean button for built-ins"

This reverts commit 5f86fec70c2b7d5cd99e4dee7f14af5a3372d58f.

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-04-14 00:18:43 +03:00
Wolfsblvt a7f144f28b feat: add getExtensionManifest() to extensions.js and expose via getContext() (#5442)
Returns a structuredClone of the loaded manifest for the given extension name.
Accepts either the short name or full internal key (third-party/...).
Returns null if the extension is not registered.
2026-04-13 19:27:56 +03:00
Wolfsblvt 45009cd0e4 Deprecate legacy loader and migrate all callsites to action-loader system with informative toasts (#5326)
* Refactor loader.js to use action-loader system and move overlay management into action-loader module

- Deprecate showLoader() and hideLoader() in favor of action-loader API
- Implement legacy functions as thin wrappers around ActionLoaderHandle
- Move overlay management (showOverlay, hideOverlay, isOverlayDisplayed) into action-loader.js
- Move Popup-based loader implementation and preloader cleanup to action-loader
- Add loader.isBlocking() method to check for active blocking overlays

* Migrate from legacy loader functions to action-loader API throughout codebase

- Replace showLoader()/hideLoader() imports with loader from action-loader.js
- Update firstLoadInit() to use loader.show() with title, message, and ToastMode.STATIC
- Pass initLoaderHandle to getSettings() for early hide during onboarding flow
- Refactor renameGroupOrCharacterChat() to use loader.show() instead of boolean flag
- Wrap handleDeleteChat() with loader.show() and proper error handling
- Update BulkEditOver...

* Update loader titles and remove redundant reload notification

- Change bookmark loader title from "Bookmark" to "Chat History" for clarity
- Remove loader notification before extensions reload (redundant with browser reload)

* lint fix

* Add splash screen support to action loader with custom overlay content

- Add `overlayContent` option to ActionLoaderOptions for custom HTML in overlay
- Implement splash screen styles with centered logo, spinner, and message
- Update firstLoadInit() to use custom splash screen instead of static toast
- Pass custom content through showOverlay() to replace default spinner
- Adjust non-blocking loader warning to account for custom overlay content

* Refactor loader overlay to use DOM elements instead of HTML strings

- Add createDefaultLoaderOverlay() function to generate fresh loader overlay elements
- Export createOverlay() method on loader utility API for external use
- Change overlayContent parameter type from string-only to string|HTMLElement|null
- Add getOverlayContent() helper to normalize custom content for Popup
- Update firstLoadInit() to build splash screen using DOM manipulation instead of template literals
- Add splash-logo class and

* Use a true ellipsis

* Adjust sizing for desktop

* Even truer ellipsis

* Add transition to splash screen and fix blur animation on hideOverlay (#5338)

* Initial plan

* Blur entire splash screen on hideOverlay, not just spinner

Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>
Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/eee6c06d-7c9d-4363-bc8f-2647ed390368

* Add transition to splash-screen and fix transition detection

Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>
Agent-Logs-Url: https://github.com/SillyTavern/SillyTavern/sessions/9368bc36-31a0-4a58-aebd-7b569696ff2e

---------

Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>

* Add translations to supported locales

* Localize logo alt on welcome screen

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Co-authored-by: Claude <242468646+Claude@users.noreply.github.com>
2026-03-22 03:30:23 +02:00
Copilot 3ad9b05e27 Implement extension manifest hooks for lifecycle events (#5261)
* Initial plan

* Implement extension manifest hooks for install, delete, enable, disable

Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>

* Revert unrelated package-lock.json changes

Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>

* Address review: use Object.hasOwn, add activate hook, simplify await, return folderName from backend

Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>

* Add 'update' hook that triggers on extension update

Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>

* Revert package-lock

* Add 5-second timeout for extension hook calls using delay and Promise.race

Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>

* Revert unintended package-lock.json changes

Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>

* Add timeout warning log when extension hook exceeds 5 seconds

Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>

* Refactor extension hook call to handle synchronous results

* Refactor callExtensionHook to use constants for timeout results

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Cohee1207 <18619528+Cohee1207@users.noreply.github.com>
2026-03-08 13:10:28 +02:00
Cohee 4dbdd06d6d Add reload prompt to extension branch switch success message 2026-02-25 00:41:54 +02:00
Cohee 4d1619ba47 Chore: enable brace-style eslint check (#5159)
* eslint: enable brace-style check

* Fix jsdoc and color

* fix: correct CSS color syntax in CreateZenSliders function
2026-02-15 01:46:32 +02:00
Leandro Jofré 992fd8f01d Feat/Allow to bulk toggle all third-party extensions from Manage Extensions (#5094)
* Feat - Allow to bulk toggle all third-party extensions from popup manager

* Fix - Prevent reloading the page if the final state is the same

* Fix - Handle bulk toggle with no extensions installed

* Update - Delete leftover debug logs

* Fix - Simplify extension toggle logic and improve readability

* Update - State that bulk toggle only affects external extensions

* Feat - Allow to restore bulk toggled extensions

* Update - Move bulk toggle to the third-party extensions header

* Uncenter section headers

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2026-02-05 22:24:44 +02:00
Wolfsblvt cd0627bfec Macros 2.0 [Macros] - Add {{hasExtension}} macro, and refactor extension lookup logic (#4948)
* Add {{hasExtension}} macro and refactor extension lookup logic

- Move findExtension() from extensions-slashcommands.js to extensions.js and export it
- Update findExtension() to return object with name and enabled properties instead of just name string
- Add {{hasExtension}} macro to check if an extension is enabled
- Update /extension-state and /extension-exists commands to use refactored findExtension()
- Remove duplicate findExtension() implementation from extensions-slashcommands.js

* Refactor extension action callbacks to use extension object instead of separate name and enabled properties

* fix eslint
2026-01-04 20:37:27 +02:00
Cohee 60a8b51951 Unblock textarea send during edit (#4714) 2025-10-30 19:43:53 +02:00
Cohee df7f046912 Preset Regex: add preset type for script regexes (#4642)
* feat: preset regex

* refactor: unify `saveScriptsByType`

* fix: default branch for `saveScriptsByType`

* refactor: resolve some reviews

* fix: lint

* refactor: getPresetName -> getCurrentPresetName

* refactor: unify regex allow operation

* feat: notify whether to reload current chat when preset is changed

* refacotr: set timeout for reload current chat notification

* fix: _ -> lodash

* i18n

* Refactor API ID access

* refactor: replace UNKNOWN type with a separate constant

* refactor: consolidate CSS rules for scoped and preset script blocks

* Extend toast timeout

* Fix bug with moving, refactor

* Refactor bulk toggle operations

* Use for..of for preset application

* refactor: enhance parameter documentation for scriptType in regex functions

* fix: await loadRegexScripts in event handlers

* fix: correct script type in saveScriptsByType for preset handling

* fix: add null checks for preset manager and API ID in regex functions

* feat: implement expandable regex script options in UI

* Always show edit/delete buttons

* Add title attribute to regex script name

* fix: correct class name for regex script display

* Remove extra paddings from script blocks

* fix: ensure preset scripts are only disallowed if currently allowed during rename

* fix: reload on bulk script toggle

* feat: add PRESET_RENAMED_BEFORE event type and emit it during preset renaming

* fix: always preserve preset extensions on rename

* Handle horde in getPresetManager

---------

Co-authored-by: ZoinkCN <zoinkcn@outlook.com>
Co-authored-by: StageDog <aksanajw845@gmail.com>
2025-10-11 22:10:06 +03:00
Tosd 57e363cae6 feat: Regex Presets (#4468)
* Work in progress

* feat: save confirmation

* Fix eslint, add typedef

* Add slash command and compatibility with profiles

* Move UI label up

* Null safety

* Fix duplicate block title

* i18n: zh-CN translation

* Adjust debugger styles

* Move presets block down

* Do not generate id twice for new entries

* Add missing translations

* Simplify settings migration logic

* Fix type comment

* Add missing keys

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-09-08 12:35:14 +03:00
qvink 5865a1a85b Allow extensions to specify minimum ST client version (#4350)
* allow extensions to specify minimum client version

* using existing version compare function

* Move versionCompare to utils module

---------

Co-authored-by: qvink <qvink@users.noreply.github.com>
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-08-05 00:31:05 +03:00
Cohee 4376d66b33 Add timeout to extensions auto-update 2025-06-22 16:28:29 +03:00
Cohee 9efd40980f Add prompt type selection for LLM expressions in settings 2025-06-14 20:01:59 +03:00
Dmitry fece612f09 Merge pull request #4135 from D1m7asis/release
feat: Added AI/ML API Provider Support
2025-06-13 20:59:18 +03:00
Cohee a6928289b3 Clear extension load errors before activating extensions 2025-05-26 11:10:47 +00:00
RossAscends 57882c80e5 add ability for exts to req other exts (#4023)
* add ability for exts to req other exts

* Get rid of toasts. Collect errors on load, display in manager

* Remove unused variable

* Only show missing modules/dependencies

* Prefer display names in validation messages

* Prefer internal name for console warn

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2025-05-26 01:38:32 +03:00
Cohee 9438b5c4aa Cancel debounced metadata save before clearing chat 2025-05-17 15:44:51 +03:00
Cohee ef59afcec1 Specify tag support in messaging 2025-04-30 22:56:35 +03:00
Cohee 3340009a29 Add branch management functionality for extensions 2025-04-29 02:00:25 +03:00
Cohee 310b0f30cd Add branch selection on extension installer
Closes #3865
2025-04-28 22:53:22 +03:00
Cohee 02df7d78e2 Move extension buttons to a separate toolbar 2025-03-27 21:51:35 +02:00
Gness Erquint 976d4f39e6 No updates for disabled extensions, unless you insist. 2025-03-27 17:27:17 +03:00
Cohee 1cb9287684 Vectors WebLLM (#3631)
* Add WebLLM support for vectorization

* Load models when WebLLM extension installed

* Consistency updated

* Move checkWebLlm to initEngine

* Refactor vector request handling to use getAdditionalArgs

* Add error handling for unsupported WebLLM extension

* Add prefix to error causes
2025-03-09 00:51:44 +02:00
Cohee 8d608bcd72 Add gallery folder and sort order controls (#3605)
* Add gallery folder and sort order controls
Closes #3601

* Refactor sort constants to use Object.freeze for immutability

* Add comment

* Remove excessive null propagation

* Update type hint for gallery.folders

* Use defaultSettings.sort as a fallback

* Throw in groups

* Handle rename/deletion events

* Merge init functions

* Fix multiple gallery file uplods

* Add min-height for gallery element

* Fix gallery endpoint not parsing body

* translatable toasts

* Pass folder path in request body

* Change restore pictogram

* Add title to gallery thumbnail images

* Allow optional folder parameter in image list endpoint and handle deprecated usage warning

* Add validation for folder parameter in image list endpoint

* Add border to gallery sort selection

* Remove override if default folder is set to input

* Use server-side path sanitation

* Sanitize gallery folder input before updating

---------

Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
2025-03-04 23:16:56 +02:00
Cohee d3006cc720 Load extension i18n before script 2025-02-27 17:41:59 +00:00
Cohee e312ae6b3b Add locale data loading for extensions 2025-02-27 16:18:10 +00:00
Wolfsblvt c12f26441e Merge branch 'staging' into support-multiple-expressions 2025-02-19 20:22:02 +01:00
Yokayo 890d10d811 Work on tl 2025-02-16 18:43:57 +07:00
Cohee d5bdf1cb90 Add settings.json-backed KV string storage
Fixes #3461, #3443
2025-02-11 20:17:48 +02:00
Wolfsblvt 5c34c93a84 Merge branch 'staging' into support-multiple-expressions 2025-01-26 23:11:37 +01:00
Wolfsblvt 239c3f1db7 Add settings for multiple expressions 2025-01-26 23:11:22 +01:00
Cohee f98d27f187 Add sorting order for extensions manager 2025-01-15 22:59:41 +02:00
Yokayo 1d5cf8d25c Work on translation 2025-01-12 00:42:58 +07:00
Cohee f869b26664 Ensure unique selectors for loaded extension files 2025-01-09 22:32:15 +02:00
Cohee 2f5f9a437d Allow running generate interceptors on quiet prompts 2025-01-03 01:10:14 +02:00
Cohee 94de9411b6 UI performance fixes (#3207)
* Optimize visibility checks for burger and wand menus

* Optimize message actions visibility toggle

* Run drawer toggle in animation frame

* Replace jQuery slideToggle with a 3rd-party lib

* Refactor export button functionality to manage popup state with a boolean flag

* Do not close the pinned drawer on unpin

* Revert "Do not close the pinned drawer on unpin"

This reverts commit e3b34e9a586db853dd84809f4187d5b29cb9ac36.

* Refactor slideToggle options

* ease-in-out

* Don't skip frame on drawer toggle
2024-12-20 22:20:46 +02:00
Cohee d9e0df0884 Extensions: stable manifests sorting if conflicts in loading order 2024-12-11 23:00:57 +02:00
Cohee 62be0939d0 Refactor manifests sorting 2024-12-11 18:20:29 +02:00
Cohee bc94ff7800 Preserve scrollTop on popup reopen 2024-12-11 18:09:30 +02:00
Cohee 0e81fb6a4a Async logic fixes 2024-12-11 17:49:03 +02:00
ceruleandeep 58ac746442 Show error popup if extension update fails 2024-12-11 19:37:21 +11:00
Cohee df8e0ba923 Don't insert non-HTTP links to extension origin 2024-12-10 00:01:54 +02:00
Cohee 5a01eb8eb1 Ok, the manifest version can stay 2024-12-09 23:55:08 +02:00
Cohee f5088b398f Improve styles of extension blocks 2024-12-09 22:37:43 +02:00
Cohee 3c82d961bd Batch extension version checks 2024-12-09 22:24:02 +02:00
Cohee 126616d539 Refactor and JSDoc extensions.js 2024-12-07 20:31:16 +02:00
Cohee 83965fb611 Implement move extensions 2024-12-07 18:42:37 +02:00