WebSocket System Rework & General Improvements
- WebSocket architecture rewrite — New
WsHandlerbase class,WsManagerfor connection tracking, event routing, and buffering; reduces WebSocket init from ~170 lines to ~10. Frontend adapter updated with exponential backoff, envelope validation, 50 MB cap, and improved handler registration. - WebSocket security fix —
dispatch_to_all_sidssnapshot now taken inside the lock to prevent security check bypass during concurrent disconnects. - WebSocket memory leak fixes — Resolved SID retention after disconnection and cleaned up unreferenced broadcast tasks.
- API/WebSocket caching — WebSocket and API caching parameters are now enabled.
a0_smallprompt set — New compact prompt set for small models, reducing initial token usage from ~10k to ~2.5k tokens. Includes stricter tool-call guardrails, canonical JSON examples, exact tool-name matching, and memory usage hints.- Fix: non-ASCII filename uploads — Resolved a 500 error when uploading images with non-ASCII filenames via
/api/image_get; adds graceful fallback for path handling in both development and Docker environments. - Fix: agents self-correct tool call format — Agents now attempt to fix their own malformed tool calls instead of immediately erroring.
- UI: chat navigation buttons — Repositioned as a floating overlay in the bottom-right of the chat area.
- Log sanitization — Printed output and HTML logs are now sanitized to handle invalid Unicode (including lone surrogates); log files opened with
utf-8anderrors='replace'. - Plugin installer — Centralized popularity checking with a configurable
POPULAR_PLUGIN_MIN_STARSthreshold. - Onboarding plugin — Added generated thumbnail.