[PR #195] [MERGED] Comprehensive update to UI Extensions documentation — lifecycle hooks, tool calling, action loader, popups, macros, and more #197

Closed
opened 2026-10-15 18:02:31 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/SillyTavern/SillyTavern-Docs/pull/195
Author: @Wolfsblvt
Created: 3/24/2026
Status: ✅ Merged
Merged: 5/3/2026
Merged by: @Cohee1207

Base: main ← Head: doc/writing-extensions-extensions


📝 Commits (4)

  • 84a5b0f Document lifecycle hooks, HTML templates, function tool calling, action loader, and expand macro/event/library documentation
  • 9d456d2 Improve function calling documentation: add canPerformToolCalls, clarify examples, and expand tips
  • 0fbf0f1 Merge branch 'main' into doc/writing-extensions-extensions
  • ed1ca0c Add 'clean' hook

📊 Changes

1 file changed (+12 additions, -1 deletions)

View changed files

📝 For_Contributors/Writing-Extensions.md (+12 -1)

📄 Description

Summary

Major overhaul of the Writing Extensions guide to reflect the current state of SillyTavern's extension API. The document was significantly behind the actual codebase — missing entire feature categories like lifecycle hooks, function tool calling, and the action loader system. This update brings it up to date so extension authors have a single, reliable reference.

What Changed

  • New: Lifecycle Hooks — Documents the hooks manifest field (install, update, delete, enable, disable, activate) with implementation examples and timeout behavior
  • New: Function Tool Calling — Full documentation for registerFunctionTool, including the parameter schema, all registration fields, unregistering, and checking tool calling support
  • New: Action Loader — Documents the loader API that replaces the deprecated showLoader/hideLoader, covering blocking/non-blocking modes and stacking
  • New: Popups and User Feedback — Comprehensive section on Popup.show helpers, custom popup construction with buttons/inputs, popup types, and toastr
  • New: HTML Templates — Documents renderExtensionTemplateAsync() with template file examples using the inline-drawer pattern
  • New: Data Bank Scrapers — Documents registerDataBankScraper() for custom data sources
  • New: Debug Functions — Documents registerDebugFunction() for the Debug Menu
  • Updated: Custom Macros — Documents the new macros.register() system with categories, arguments, and handler context; marks the legacy registerMacro()/unregisterMacro() as deprecated
  • Updated: Shared Libraries — Expanded from 7 to 25+ entries to match all exports from lib.js
  • Updated: Events — Reorganized into logical categories (app lifecycle, messages, generation, chat, characters, settings, world info, tool calling) with many newly listed event types
  • Updated: Best Practices — Streamlined to reference the new dedicated sections instead of duplicating popup/library examples

Why These Changes

The Writing Extensions doc is meant to be the primary reference for anyone building a SillyTavern extension. It had fallen behind — entire systems like tool calling and lifecycle hooks weren't mentioned at all, the macro section described a now-deprecated API, the shared library list was missing 18 entries, and the event list was a small subset of what's available. Extension authors were left reading source code for features that should be front and center in the docs.

Impact

Extension authors now have documented guidance for all major extension APIs in one place, with working code examples and clear deprecation notices for legacy APIs. The document grew from ~920 to ~1380 lines, covering the full breadth of what getContext() offers for the most commonly needed features.


🔄 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/SillyTavern/SillyTavern-Docs/pull/195 **Author:** [@Wolfsblvt](https://github.com/Wolfsblvt) **Created:** 3/24/2026 **Status:** ✅ Merged **Merged:** 5/3/2026 **Merged by:** [@Cohee1207](https://github.com/Cohee1207) **Base:** `main` ← **Head:** `doc/writing-extensions-extensions` --- ### 📝 Commits (4) - [`84a5b0f`](https://github.com/SillyTavern/SillyTavern-Docs/commit/84a5b0f88e3ed626aa863065339b5b342dac1614) Document lifecycle hooks, HTML templates, function tool calling, action loader, and expand macro/event/library documentation - [`9d456d2`](https://github.com/SillyTavern/SillyTavern-Docs/commit/9d456d2a41edc6cc5ae8fe8b2e4f151acc21bdbc) Improve function calling documentation: add canPerformToolCalls, clarify examples, and expand tips - [`0fbf0f1`](https://github.com/SillyTavern/SillyTavern-Docs/commit/0fbf0f157af1b57c060bd58ce3a4ac5edcb0a000) Merge branch 'main' into doc/writing-extensions-extensions - [`ed1ca0c`](https://github.com/SillyTavern/SillyTavern-Docs/commit/ed1ca0c4e9a2cd2a27431672aef54c557c5f0ba6) Add 'clean' hook ### 📊 Changes **1 file changed** (+12 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `For_Contributors/Writing-Extensions.md` (+12 -1) </details> ### 📄 Description ### Summary Major overhaul of the Writing Extensions guide to reflect the current state of SillyTavern's extension API. The document was significantly behind the actual codebase — missing entire feature categories like lifecycle hooks, function tool calling, and the action loader system. This update brings it up to date so extension authors have a single, reliable reference. ### What Changed - **New: Lifecycle Hooks** — Documents the `hooks` manifest field (install, update, delete, enable, disable, activate) with implementation examples and timeout behavior - **New: Function Tool Calling** — Full documentation for [registerFunctionTool](cci:1://file:///d:/code/SillyTavern/public/scripts/tool-calling.js:263:4-289:5), including the parameter schema, all registration fields, unregistering, and checking tool calling support - **New: Action Loader** — Documents the `loader` API that replaces the deprecated `showLoader`/`hideLoader`, covering blocking/non-blocking modes and stacking - **New: Popups and User Feedback** — Comprehensive section on [Popup.show](cci:1://file:///d:/code/SillyTavern/public/scripts/popup.js:595:4-625:5) helpers, custom popup construction with buttons/inputs, popup types, and toastr - **New: HTML Templates** — Documents `renderExtensionTemplateAsync()` with template file examples using the inline-drawer pattern - **New: Data Bank Scrapers** — Documents [registerDataBankScraper()](cci:1://file:///d:/code/SillyTavern/public/scripts/scrapers.js:35:4-50:5) for custom data sources - **New: Debug Functions** — Documents `registerDebugFunction()` for the Debug Menu - **Updated: Custom Macros** — Documents the new `macros.register()` system with categories, arguments, and handler context; marks the legacy [registerMacro()](cci:1://file:///d:/code/SillyTavern/public/scripts/macros/engine/MacroRegistry.js:189:4-227:5)/[unregisterMacro()](cci:1://file:///d:/code/SillyTavern/public/scripts/macros/engine/MacroRegistry.js:320:4-330:5) as deprecated - **Updated: Shared Libraries** — Expanded from 7 to 25+ entries to match all exports from [lib.js](cci:7://file:///d:/code/SillyTavern/public/lib.js:0:0-0:0) - **Updated: Events** — Reorganized into logical categories (app lifecycle, messages, generation, chat, characters, settings, world info, tool calling) with many newly listed event types - **Updated: Best Practices** — Streamlined to reference the new dedicated sections instead of duplicating popup/library examples ### Why These Changes The Writing Extensions doc is meant to be the primary reference for anyone building a SillyTavern extension. It had fallen behind — entire systems like tool calling and lifecycle hooks weren't mentioned at all, the macro section described a now-deprecated API, the shared library list was missing 18 entries, and the event list was a small subset of what's available. Extension authors were left reading source code for features that should be front and center in the docs. ### Impact Extension authors now have documented guidance for all major extension APIs in one place, with working code examples and clear deprecation notices for legacy APIs. The document grew from ~920 to ~1380 lines, covering the full breadth of what [getContext()](cci:1://file:///d:/code/SillyTavern/public/scripts/st-context.js:110:0-297:1) offers for the most commonly needed features. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-15 18:02:31 +00:00
Sign in to join this conversation.
No labels
pull-request
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
SillyTavern/SillyTavern-Docs#197
No description provided.