From 6fd8a3762e60d979494d1ebf5c64a4ebd0257cf2 Mon Sep 17 00:00:00 2001 From: quanturbo <168349709+quanturbo@users.noreply.github.com> Date: Mon, 20 Jul 2026 13:29:30 -0300 Subject: [PATCH] fix(compression): enable OmniGlyph for Claude Fable 5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rebuilt clean on release/v3.8.49 (branch forked from an old main and carried ~68 files of base drift). Reconciled with #7237 on the tip: supportsVision keeps the authoritative getResolvedModelCapabilities() resolution (the PR's isVisionModelId heuristic predates that fix); the PR's real change lands — OAuth 'claude' now counts as a direct Anthropic transport for OmniGlyph, and claude-fable-5 joins the vision model ids. Plumbing test now pins the '|| provider === "claude"' invariant instead of exact formatting. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> --- open-sse/handlers/chatCore.ts | 9 ++++++--- src/shared/constants/visionModels.ts | 1 + .../compression/omniglyph-chatcore-plumbing.test.ts | 12 ++++++++++++ tests/unit/vision-detection-consistency.test.ts | 5 ++--- 4 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 tests/unit/compression/omniglyph-chatcore-plumbing.test.ts diff --git a/open-sse/handlers/chatCore.ts b/open-sse/handlers/chatCore.ts index 871b27d0bcfc..a21a406bba11 100644 --- a/open-sse/handlers/chatCore.ts +++ b/open-sse/handlers/chatCore.ts @@ -1395,10 +1395,13 @@ export async function handleChatCore({ // models, which is intentionally NOT `false` so the gate still preserves images. supportsVision: getResolvedModelCapabilities({ provider, model: effectiveModel }) .supportsVision, - // Rota direta oficial ('anthropic') vs agregadores: o engine omniglyph - // exige 'direct' — agregadores redimensionam imagens (medido 2026-07-06). + // Rotas diretas oficiais ('anthropic' API key e 'claude' OAuth) vs agregadores: + // o engine omniglyph exige 'direct' — agregadores redimensionam imagens + // (medido 2026-07-06). OAuth 'claude' é rota direta oficial (#7863). providerTransport: - provider === "anthropic" ? ("direct" as const) : ("aggregator" as const), + provider === "anthropic" || provider === "claude" + ? ("direct" as const) + : ("aggregator" as const), config: compressionConfig, cachingContext: cacheCtx, principalId: compressionPrincipalId, diff --git a/src/shared/constants/visionModels.ts b/src/shared/constants/visionModels.ts index c6dda3a8e846..d546b670bd43 100644 --- a/src/shared/constants/visionModels.ts +++ b/src/shared/constants/visionModels.ts @@ -47,6 +47,7 @@ export const VISION_MODEL_ID_FRAGMENTS = [ "gemini-3", "gemini-exp", "claude-3", + "claude-fable", "claude-opus-4", "claude-sonnet-4", "claude-haiku-4", diff --git a/tests/unit/compression/omniglyph-chatcore-plumbing.test.ts b/tests/unit/compression/omniglyph-chatcore-plumbing.test.ts new file mode 100644 index 000000000000..a21a3af9ff55 --- /dev/null +++ b/tests/unit/compression/omniglyph-chatcore-plumbing.test.ts @@ -0,0 +1,12 @@ +import { readFileSync } from "node:fs"; +import assert from "node:assert/strict"; +import { test } from "node:test"; + +test("chatCore treats both Anthropic providers as direct OmniGlyph transports", () => { + const chatCore = readFileSync("open-sse/handlers/chatCore.ts", "utf8"); + + assert.match( + chatCore, + /providerTransport:\s*provider === "anthropic" \|\| provider === "claude"[\s\S]{0,80}?"direct"/ + ); +}); diff --git a/tests/unit/vision-detection-consistency.test.ts b/tests/unit/vision-detection-consistency.test.ts index 066274be213d..e1e7af2c5bbd 100644 --- a/tests/unit/vision-detection-consistency.test.ts +++ b/tests/unit/vision-detection-consistency.test.ts @@ -27,6 +27,7 @@ const VISION = [ "llava-1.5-7b", "qwen-vl-max", "gpt-4o", + "claude-fable-5", "glm-4v", "kimi-vl-a3b", "mistral-medium-3", @@ -38,9 +39,7 @@ function imageBody() { messages: [ { role: "user", - content: [ - { type: "image_url", image_url: { url: "data:image/png;base64,iVBOR" } }, - ], + content: [{ type: "image_url", image_url: { url: "data:image/png;base64,iVBOR" } }], }, ], };