undici (Node's fetch) transparently decompresses gzip, deflate, and br,
but not zstd. When a browser's full Accept-Encoding header is forwarded
as-is to the target origin, a Cloudflare-fronted server may respond
with zstd, and corsProxyMiddleware pipes those still-compressed bytes
straight through — the client receives garbage instead of the expected
body (e.g. "SyntaxError: Unexpected token" when parsing JSON).
Cap the outgoing Accept-Encoding to the encodings undici can actually
decode, so the target always responds with something we can forward
correctly.
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* Fix: Avoid cpSync crash when renaming characters
Add a no-op filter to fs.cpSync during character renaming.
This avoids Node.js's native copyDir fast path, which can terminate
the process on Windows with affected Node.js versions instead of
throwing a catchable filesystem error.
Refs: https://github.com/nodejs/node/issues/63970
* docs: explain character rename copy workaround
---------
Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
* fix: return a degraded preview instead of {} when a chat's last line is unparseable
getChatInfo resolved an empty object when the last line of a chat .jsonl
failed to parse or lacked known fields (truncated write, external edit).
All three consumers (chat list, search, recents) drop entries without a
file_name, so an otherwise intact chat silently disappeared from the UI
while still occupying its name for uniqueness checks (#5940).
Resolve the already-built chatData instead: file_id, file_name, file_size
and mtime-based last_mes are known good from stat(), chat_items comes from
the line count, and mes falls back to the existing placeholder. Matcher
results from the intact lines are preserved for search.
Fixes#5940
* fix: exclude unreadable chat line from message count
Keep degraded previews aligned with the messages that can actually be loaded by excluding both the metadata line and broken trailing line.
---------
Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
This change adds a chat-specific "x-session-affinity" HTTP header to requests to Fireworks that use the full prompt. Quiet requests like summarization requests that don't use the same prompt prefix are excluded.
This improves prompt caching by
1. Adding a stable "x-session-affinity" header, which Fireworks AI recommends to route requests to the same replica
2. Separating different chats into different sessions
3. Separating main LLM calls from quiet calls which have a completely different prompt prefix
See https://docs.fireworks.ai/guides/prompt-caching.
This uses an HMAC with the cookie secret instead of simply hashing the chat title to avoid leaking chat titles. Session affinity headers may not fall under zero-data retention in Fireworks or could be cached by proxies on the way. Chat titles are tiny, so the HMAC computation is instant.
* fix: give non-ASCII chat names distinct backup keys and throttles
Backup filenames replace all non-alphanumeric characters with
underscores, so names such as equal-length CJK ones collapsed to the
same key and shared a single backup quota: busy chats evicted the
backups of unrelated quiet ones. The backup key now appends a short
hash of the raw name whenever the name contains non-ASCII characters,
keeping keys distinct and stable while ASCII names keep their exact
current keys and retention.
The backup throttle was also keyed per user only, so rapid saves in
one chat deferred or swallowed the backup of another chat saved in the
same window. It is now keyed per user and chat.
Fixes#5780
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix: replace stray NUL byte in backup throttle key separator
A literal 0x00 byte slipped into the template string separator, which
made Git treat the whole file as binary.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: reunite backupChat docblock with its function
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Closes#4448
The 'ooba' special case in the caption-image route split the correctly
structured message (a single user message with a content array
containing text + image_url) into two separate messages, moving
image_url to a top-level property with an empty content array.
oobabooga's own multimodal image handling (modules/image_utils.py)
only looks for images inside content array items with
type: 'image_url', so this transformation caused the image to be
silently dropped, producing hallucinated or "I can't see an image"
captions - even though the request appeared to contain valid image
data.
Removing the special case lets 'ooba' use the same, already-correct
message structure as every other multimodal-capable API.
Verified against a local oobabooga (llama.cpp/GGUF loader) with a
vision-capable GGUF + mmproj pair: before the fix, captions ignored
the attached image; after the fix, captions accurately describe real
photos.
Co-authored-by: bbastex <bbastex@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* Fireworks AI: Fetch model list from custom URL
Fireworks provides the model list on a custom URL in a custom format, see https://docs.fireworks.ai/api-reference/list-models. The standard /v1/models endpoint no longer works correctly and returns a wrong list of models:
```
Available models: [
'accounts/fireworks/models/deepseek-v4-pro',
'accounts/fireworks/models/flux-1-schnell-fp8',
'accounts/fireworks/models/glm-5p1',
'accounts/fireworks/models/glm-5p2',
'accounts/fireworks/models/gpt-oss-120b',
'accounts/fireworks/models/kimi-k2p5',
'accounts/fireworks/models/kimi-k2p6'
]
```
Many new models like Deepseek V4 Pro, Kimi K2.7 Code are missing.
* Fireworks AI: Add "fast" models
Some models have a "fast" variant. The model list endpoint does not return this information, so for now the available fast versions are listed explicitly.
Fast models have the same parameters (max context etc.) as the regular ones. They are only faster and cost more.
A manually deleted extension often leaves a folder husk on disk, for
example when Windows fails to remove locked .git files. The discover
endpoint listed any directory, so the husk kept reporting as an
installed extension: /extension-exists and /extension-state returned
true after a fresh load and the manifest fetch produced a 404 in the
console on every load. Discovery now skips folders without a
manifest.json and logs a warning naming the exact path, and the
client drops any discovered name whose manifest could not be loaded
so state queries cannot report ghost extensions.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* Update TTS model from Gemini 2.5 to 3.1 in TTS Extension (#5778)
* Update TTS model from Gemini 2.5 to 3.1 in TTS Extension
Added New versions and new Default model
* Add glm-5.2 option to model selection dropdown
* fix: remove GroupId requirement from MiniMax TTS
MiniMax's current API (sk-cp- keys) uses Bearer auth only. GroupId
is a legacy parameter from the pre-2025 API that the current API
tolerates/ignores. Requiring it blocks new users from setting up
MiniMax TTS.
- Backend: drop groupId from required params and URL
- Frontend: remove Group ID input field and all validation checks
Fixes#5909
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Co-authored-by: Samueras <Samueras@jackoedv.de>
Co-authored-by: chen-jiying <chen-jiying@users.noreply.github.com>
* Update TTS model from Gemini 2.5 to 3.1 in TTS Extension (#5778)
* Update TTS model from Gemini 2.5 to 3.1 in TTS Extension
Added New versions and new Default model
* Add glm-5.2 option to model selection dropdown
* Refactor file reading to use getArrayBufferSlice
* Update util.js
* Update util-pure.test.js
* test: add real-archive regression for BYAF pooled buffer handling
Builds an actual BYAF zip in memory, embeds it at an offset inside a
larger backing buffer to simulate Node's buffer pooling, and proves
through the real parser that the exact ArrayBuffer slice parses
correctly while the raw oversized backing buffer does not.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Co-authored-by: Samueras <Samueras@jackoedv.de>
Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* fix: skip non-image ComfyUI outputs
* test: cover ComfyUI gif fallback and no-output error paths
Extends the skip-non-image regression with the gifs fallback that
animated workflows rely on and the error path when no output node
carries images or gifs.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: CaoBochun <caobochun@bytedance.com>
Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* feature: add Claude Opus 5, Sonnet 5, and Gemini 3.6 Flash / 3.5 Flash-Lite
Enable adaptive thinking and strip rejected sampling/prefill fields so the new models work with Chat Completions and Image Captioning.
* feature: add Gemini 3.7 Flash
Strip rejected sampling/prefill fields and map min thinking to low so the model works with Chat Completions and Image Captioning.
* feat: refresh Claude and Gemini model lists on top of Claude 5 support
Builds on the Claude 5 and Gemini wiring in this branch: removes
retired models from the Claude and Gemini dropdowns and captioning
lists (claude-opus-4-1 verified retired with a live 404; Gemini 2.0
experimental models, 2.5 preview snapshots, and gemini-3-pro-preview
are shut down per Google's model docs), labels deprecated models
without touching option values so saved selections keep working, adds
claude-fable-5 to the captioning list, and moves new-install defaults
to claude-sonnet-5 and gemini-3.7-flash. Claude 5 generation, vision,
web search, and effort mapping verified live against the API; the
trailing-prefill test now uses a plain loop so the tests lint passes.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* Update TTS model from Gemini 2.5 to 3.1 in TTS Extension (#5778)
* Update TTS model from Gemini 2.5 to 3.1 in TTS Extension
Added New versions and new Default model
* Add glm-5.2 option to model selection dropdown
* Fix crash when a chat file is deleted mid-scan
getChatInfo() stats a chat file without handling ENOENT. If the file
is deleted (e.g. from the UI) while a search or the recent-chats list
is scanning the same directory, the stat throws, and since it's inside
new Promise(async (res) => {...}) with no reject wired up, it becomes
an unhandled rejection that kills the whole server process.
This catches ENOENT and resolves with { match: false } instead, same
as the fallback already used elsewhere in this function/its callers
for corrupted or unmatched entries.
* fix: handle all mid-scan chat deletion races in getChatInfo
The stat guard alone left the function unsound: it lived inside an
async promise executor, so a non-ENOENT error became an unhandled
rejection and the promise never settled. A file deleted between the
stat and the stream opening still crashed via an unhandled stream
error, which readline re-emits, and a file truncated to empty mid-scan
hung the request because the close handler never resolved.
getChatInfo now uses plain async/await up to the streaming part,
resolves a no-match sentinel when the file vanishes at either point,
resolves an empty object on truncation, and properly rejects
everything else. Comes with deterministic regression tests for each
race window.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Co-authored-by: Samueras <Samueras@jackoedv.de>
Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* Fix BFL API endpoint and polling URL handling
* fix: send authentication header when polling BFL results
The bfl.ai API requires the x-key header on the polling request as
well; the retired bfl.ml API tolerated unauthenticated polling. Without
the header every poll returns 403 and generation never completes.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* fix: reject localhost and .localhost domains in /api/search/visit to prevent SSRF bypass
The hostname check in /api/search/visit only validated IP addresses using
ipRegex, but did not block 'localhost' or subdomains ending in '.localhost'.
This allowed SSRF bypasses to internal services via localhost URLs.
Changes:
- Add explicit rejection of 'localhost' hostname
- Add rejection of any hostname ending in '.localhost' (RFC 6761 reserved)
Closes GHSA-wm7j-m6jm-8797
* fix: enforce SSRF boundary for /api/search/visit at connection time
The URL string checks only guard the literal input. Hostnames resolving
to private addresses, redirects into internal services, and DNS
rebinding all bypassed them. The visit endpoint now routes its outbound
request through a strict PrivateRequestAgent even when the private
request filter is disabled: the resolved IP is validated at connection
time on every hop and the connection is pinned to the validated IP.
When the private request filter is enabled its configured whitelist
keeps applying, and an enabled request proxy keeps owning routing.
Also rejects bracketed IPv6 literals, which kept their brackets and
slipped past the hostname check.
Fixes GHSA-wm7j-m6jm-8797
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
An existing non-empty chat file whose first line could not be parsed as a
JSON object passed the integrity check as if it were a legacy chat, so a
save silently replaced the file and only the replacement got backed up.
The check now fails closed for unparseable, truncated, or non-object
headers, routing the client into the existing overwrite confirmation
dialog. A UTF-8 BOM in front of an otherwise valid header is stripped
before parsing. Empty files, valid legacy headers, and force saves behave
as before.
Fixes#5454
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The ComfyUI polling loop fetches /history every 100ms to check if the
current prompt has completed. This returns the entire history, which
grows unboundedly. After ~170 generations, the JSON response exceeds
Node.js's 512MB string length limit, crashing the server with:
RangeError: Invalid string length
Fix by requesting /history/{id} instead, which returns only the single
prompt entry needed. This is a supported ComfyUI API endpoint that
returns the same data structure.
The previous date sort read file modification times while comparing
items, which meant stat'ing the same files over and over for one
listing. mtimes are now read once per file before sorting. Files that
disappear during the call (e.g. concurrent deletion) sort to the start
instead of crashing.
* feature: support Claude Opus 4.8 model
* feature: support OpenAI GPT 5.6 models
* fix: replace deprecated Gemini preview model with stable gemini-3.1-flash-lite
* Fix GPT-5.6 Chat Completions effort mapping
- Map Maximum reasoning effort to xhigh because max is Responses-only
- Clarify model-specific OpenAI and adaptive Claude effort guidance
- Cover stable Gemini 3.1 Flash-Lite thinking-level routing
Tests:
- npm run test:unit -- --runInBand
- ESLint on all changed JavaScript files
* Fix: migrate Gemini image models to stable IDs
- Replace shut-down Gemini image preview selectors for Google AI and Vertex AI
- Migrate saved chat and caption model settings to the stable replacements
- Enable image generation for the stable model IDs
- Correct the Gemini 3.1 Flash Image context fallback to 128K
- Add regression coverage for stable Gemini 3 image thinking levels
Tests:
- npm run test:unit -- --runInBand
- ESLint on all changed JavaScript files
---------
Co-authored-by: Wolfsblvt <wolfsblvt@gmail.com>
"for 3rd party API customers: GET /user/information, GET /user/data, GET /user/subscription should now be called from https://image.novelai.net. The old URL will be non-functional in a couple of hours. The old URL is currently non-functional."
from NAI devs, this change has already been implemented from NAI side, no backward compat.
* Split Pollinations into two separate API providers: (Key) and (No Key)
- Replaces the single "Pollinations" source with two distinct entries:
- "Pollinations (Key)": uses gen.pollinations.ai/v1 with Bearer token auth,
supports BYOP OAuth flow with app key pk_Gu8Ta8q6QhS67hSg and manual key entry
- "Pollinations (No Key)": uses text.pollinations.ai/v1, no authentication required
- Renames CHAT_COMPLETION_SOURCES.POLLINATIONS to POLLINATIONS_KEY/POLLINATIONS_NOKEY
throughout the codebase (constants, endpoints, frontend scripts)
- Adds BYOP authorize button and OAuth callback handler for key-based source
- Updates all data-source attributes, secret key mappings, model selectors,
tool-calling, reasoning, slash-commands, caption, and SD extension references
https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj
* Fix POLLINATIONS_NOKEY: exempt from API key check, fix placeholder text
- Add POLLINATIONS_NOKEY to the keyless providers exemption in the
/generate endpoint's API key guard (was hitting the 400 check)
- Remove 'pk_...' from the key input placeholder since pk_ is the
app key used in the BYOP auth link, not the user's secret key
https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj
* Add Pollinations anonymous/authenticated endpoint selector
Implements reviewer feedback to use a single Pollinations provider with
an endpoint dropdown (similar to Z.AI) rather than two separate sources.
- Add POLLINATIONS_ENDPOINT enum (anonymous / authenticated)
- Anonymous uses text.pollinations.ai/v1, no API key required
- Authenticated uses gen.pollinations.ai/v1, requires sk_... key with BYOP OAuth support
- Key input and BYOP button are hidden when anonymous endpoint is selected
- Backend skips key guard for anonymous requests
- Reasoning effort and JSON schema only sent for authenticated mode
- Connection status check passes for anonymous without a saved key
https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj
* Fix broken Pollinations references after resolving merge conflicts
- Replace POLLINATIONS_KEY/NOKEY in CHAT_COMPLETION_SOURCES with POLLINATIONS
- Fix SECRET_KEYS.POLLINATIONS → SECRET_KEYS.POLLINATIONS_KEY in backend
- Update all chat_completion_sources references in openai.js to use unified POLLINATIONS
- Consolidate duplicate model select/change handlers into single pollinations_model
- Keep backward compat in caption-image handler for pollinations_key/nokey multimodal API
- Fix openai.js inline handler to route pollinations to correct endpoint based on endpoint field
https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj
* Complete Pollinations unification: remove all pollinations_key/nokey splits
- Fix committed merge conflict in openai.js (Wolfsblvt review)
- Replace POLLINATIONS_KEY/NOKEY in chat_completion_source dropdown with single POLLINATIONS option
- Replace pollinations_key,pollinations_nokey in all data-source attributes with pollinations
- Merge duplicate /pollinations_key and /pollinations_nokey multimodal routes into single /pollinations
- Update caption extension: single "Pollinations" option using pollinations_endpoint from oai_settings
- Update slash-commands.js model selector to single pollinations entry
- Clean up caption-image handler (openai.js) to use only 'pollinations' api type
- Pass pollinations_endpoint in caption request body (shared.js)
- Add settings migration: pollinations_key → pollinations, pollinations_nokey → pollinations (anonymous)
https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj
* Address Cohee review: named constants, mock key, revert POLLINATIONS_KEY rename, default to authenticated
- Use POLLINATIONS_ENDPOINT named constants throughout (no magic 'anonymous' strings)
- Use mock key pattern (set key to POLLINATIONS_ENDPOINT.ANONYMOUS value) so no guard exception needed
- Revert POLLINATIONS_KEY rename back to POLLINATIONS in secrets.js files
- Default pollinations_endpoint to AUTHENTICATED so saved keys aren't bypassed
- Remove redundant isPollinationsAnon check from getReasoningEffort() (backend handles it)
- Unify tool-calling.js, caption, shared, stable-diffusion to single POLLINATIONS source
https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj
* Fix ESLint padded-blocks error in BYOP OAuth callback
https://claude.ai/code/session_01T57Cm84cv2GiSL4DPCccBj
* fix: regression in caption API validation
* fix: remove unneeded migration
* fix: remove duplicate keyless check in apiSourceConfig
* fix: regression in extractReasoningFromData
* refactor: simplify UI unhide logic
* fix: remove BYOP flow due to security concerns
* fix: use a string instead of a constant reference for placeholder key
* fix: reconnect when switching endpoints
* feat: support pollinations in /api-url command
* fix: remove endpoint check from image generation (it always uses authenticated)
* fix: default to authenticated
* fix: use a named constant in auto-connect logic
* fix: filter by modality in anon models list
* fix: remove bespoke model loading logic for anon endpoint
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
* fix: remove the cloned directory if it contains no manifest
* fix: apply feature flag guard to user extension data hosting
* fix: disable inactive controls when feature flag is off
* fix: change response status to 404
* feat: add user account version to session cookie
Co-authored-by: Copilot <copilot@github.com>
* feat: include user handle in account version hash calculation
* feat: refactor recovery code generation to use a dedicated function
* fix: don't overwrite current session version if updating another user
Co-authored-by: Copilot <copilot@github.com>
* fix: reset session version instead of nullifying the entire session
* fix: short circuit and clear cookie on request invalidation
Co-authored-by: Copilot <copilot@github.com>
* fix: update account version on recovery
---------
Co-authored-by: Copilot <copilot@github.com>
* pass jsonSchema options through sendStreamingRequest in Generate
* translate json_schema to response_format for CUSTOM chat completion source
* pass jsonSchema through generateGroupWrapper params in group chat generation
* 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>
* fix: sanitize character filenames on V2 JSON import and harden getPngName
- Add missing sanitize() call in importFromJson V2 spec branch to match all other import paths
- Sanitize data.name before readFromV2() so the name field sync happens automatically
- Add sanitize() as defense-in-depth inside getPngName() to catch future oversights
- Refactor getPngName() to use getUniqueName() utility for consistent name generation
* fix: sanitize data.name before readFromV2 in importFromPng and importFromCharX
Same bug as importFromJson: readFromV2() overwrites the top-level name
with the unsanitized data.name, undoing any prior sanitize() call.
Fix by sanitizing data.name before readFromV2 so the sync preserves it.
* fix: sanitize top-level name field in JSON and CharX import paths
* fix: incorrect path rejection in isPathUnderParent
* fix: increase maxTries in getPngName
---------
Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
* feat: add gemma 4 for AI studio
* fix: update max context return value for gemma-3n-e4b-it model
* refactor: iterate array of [regex, number]
* gemma4: enable tool calling and sysprompt
Co-authored-by: Copilot <copilot@github.com>
---------
Co-authored-by: Copilot <copilot@github.com>