Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
Release v3.8.37 (#5053)
Diego Rodrigues de Sa e Souza555b21d296d9
diff --git a/.env.example b/.env.exampleindex c2b069c2da..3099694ed8 100644--- a/.env.example+++ b/.env.example@@ -378,6 +378,12 @@ NEXT_PUBLIC_CLOUD_URL=#OMNIROUTE_KIE_CALLBACK_URL=#OMNIROUTE_PUBLIC_URL=+# Headroom token-saver proxy URL. The dashboard lifecycle (api/headroom/*) spawns+# a local headroom-ai CLI on loopback by default; override only to point at an+# external Docker sidecar proxy. Defaults to http://localhost:8787 when unset.+# Used by: src/lib/headroom/detect.ts.+#HEADROOM_URL=http://localhost:8787+# Upstream quota endpoints used by the Usage page. Override only for# debugging or when routing through a corporate mirror. Used by:# open-sse/services/usage.ts.diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 5181ebc246..06dcd7f9e5 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -140,7 +140,15 @@ jobs:name: Quality Ratchetruns-on: ubuntu-latestneeds: test-coverage- if: ${{ !cancelled() && needs.test-coverage.result == 'success' }}+ # Run even when test-coverage was SKIPPED/FAILED (e.g. a single flaky Coverage+ # Shard breaks the shard→coverage→ratchet chain). The DETERMINISTIC ratchets+ # (eslint / complexity / cognitive-complexity / duplication / codeql) do NOT need+ # the coverage artifact and MUST still run so cycle drift is measured on the+ # release PR — otherwise a flake silently skips the whole gate (incident: v3.8.36+ # release PR #4854, where the drift cascade only surfaced post-merge in #5029).+ # The coverage.* metrics degrade gracefully: the download is continue-on-error and+ # the ratchet runs with --allow-missing, so absent coverage is skipped, not failed.+ if: ${{ !cancelled() }}# security-events: read lets the CodeQL ratchet read open code-scanning alerts# via `gh api .../code-scanning/alerts`. contents: read keeps checkout working.permissions:@@ -156,7 +164,12 @@ jobs:cache: npm- uses: ./.github/actions/npm-ci-retry# Coverage mergeada (coverage-summary.json) p/ o ratchet de cobertura.+ # continue-on-error: o artifact pode não existir se a job test-coverage foi+ # SKIPPED (shard flaky). Nesse caso collect-metrics pula coverage.* (ausente sem+ # erro) e o ratchet roda com --allow-missing — as métricas determinísticas+ # (eslint/complexity/cognitive) seguem BLOQUEANTES.- uses: actions/download-artifact@v8+ continue-on-error: truewith:name: coverage-reportpath: coverage/@@ -164,8 +177,10 @@ jobs:# Catraca: falha se qualquer métrica regredir vs quality-baseline.json (commitado).# Hoje: contagem de warnings do ESLint. Fase 4 estende com cobertura (lida do# coverage mergeado). Tamanho de arquivo e duplicação têm gates dedicados.+ # --allow-missing: pula métricas do baseline ausentes do collect (coverage.* quando+ # o artifact não veio) em vez de falhar — mantém os gates determinísticos ativos.- name: Ratchet check- run: node scripts/quality/check-quality-ratchet.mjs --summary .artifacts/quality-ratchet.md+ run: node scripts/quality/check-quality-ratchet.mjs --allow-missing --summary .artifacts/quality-ratchet.md# Fase 6A.5: require-tighten — BLOQUEANTE (promovido de advisory no fim do ciclo# v3.8.27). Falha quando uma métrica MELHOROU sem o baseline ter sido apertado no# mesmo PR (força capturar ganhos permanentes). As métricas coverage.* carregam@@ -174,7 +189,7 @@ jobs:# mergeada == baseline (ver a nota _require_tighten_flip_blocking em# config/quality/quality-baseline.json).- name: Require-tighten (blocking)- run: node scripts/quality/check-quality-ratchet.mjs --require-tighten+ run: node scripts/quality/check-quality-ratchet.mjs --allow-missing --require-tighten# Catraca de duplicação (jscpd@4 sobre src+open-sse). Roda neste job (paralelo)# para não pesar no caminho crítico do lint.- name: Duplication ratchetdiff --git a/.github/workflows/quality.yml b/.github/workflows/quality.ymlindex 1c3fdc5e36..4242fb6648 100644--- a/.github/workflows/quality.yml+++ b/.github/workflows/quality.yml@@ -53,6 +53,18 @@ jobs:- run: npm run check:test-discovery- run: npm run check:test-runner-api- run: npm run check:any-budget:t11+ # Build-scope guard: fails if worktrees/cruft leak into the tsconfig include+ # scope (would OOM `next build`). Instant. See incident 2026-06-25 / #5031.+ - run: npm run check:build-scope+ # Pack-policy (unexpected-files allowlist) WITHOUT a build — catches a stray file+ # leaking into the npm tarball (v3.8.36: 6 ops bin/*.sh) per-PR instead of only on+ # the release PR's heavy Package Artifact job.+ - run: npm run check:pack-policy+ # Complexity + cognitive-complexity ratchets on the fast-path (PR→release) so+ # cycle drift is rebaselined PER-PR instead of cascading onto the release PR's+ # Quality Ratchet (v3.8.36: +30 complexity / +15 cognitive surfaced only post-merge).+ - run: npm run check:complexity+ - run: npm run check:cognitive-complexity- name: Typecheck (core)run: npm run typecheck:core# TIA: build the impact map at runtime (gitignored, ~21MB) and run only thediff --git a/.gitignore b/.gitignoreindex 4810f236f2..efdd25c7e5 100644--- a/.gitignore+++ b/.gitignore@@ -161,6 +161,8 @@ typescript# Superpowers plans/specs (internal tooling, not project code)docs/superpowers/+# Superpowers visual-companion brainstorm mockups (ephemeral)+.superpowers/# TIA test-impact map — generated at runtime in CI (build-test-impact-map.mjs), never committed (~21MB)config/quality/test-impact-map.jsondiff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2a67ba8279..9fc6858653 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,6 +4,162 @@---+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/CLAUDE.md b/CLAUDE.mdindex efc6980f6f..29dfab1eda 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -72,7 +72,7 @@ Client → /v1/chat/completions (Next.js route)API routes follow a consistent pattern: `Route → CORS preflight → Zod body validation → Optional auth (extractApiKey/isValidApiKey) → API key policy enforcement → Handler delegation (open-sse)`. No global Next.js middleware — interception is route-specific.-**Combo routing** (`open-sse/services/combo.ts`): 15 strategies (priority, weighted, fill-first, round-robin, P2C, random, least-used, cost-optimized, reset-aware, reset-window, strict-random, auto, lkgp, context-optimized, context-relay). Each target calls `handleSingleModel()` which wraps `handleChatCore()` with per-target error handling and circuit breaker checks. See `docs/routing/AUTO-COMBO.md` for the 9-factor Auto-Combo scoring and `docs/architecture/RESILIENCE_GUIDE.md` for the 3 resilience layers.+**Combo routing** (`open-sse/services/combo.ts`): 17 strategies (priority, weighted, fill-first, round-robin, P2C, random, least-used, cost-optimized, reset-aware, reset-window, headroom, strict-random, auto, lkgp, context-optimized, context-relay, fusion). Each target calls `handleSingleModel()` which wraps `handleChatCore()` with per-target error handling and circuit breaker checks. The `fusion` strategy is the exception: it fans out to a panel of models in parallel, then a judge model synthesizes one final answer (`open-sse/services/fusion.ts`). See `docs/routing/AUTO-COMBO.md` for the 9-factor Auto-Combo scoring + the full strategy table and `docs/architecture/RESILIENCE_GUIDE.md` for the 3 resilience layers.---@@ -332,7 +332,7 @@ For any non-trivial change, read the matching deep-dive first:| Repo navigation | `docs/architecture/REPOSITORY_MAP.md` || Architecture | `docs/architecture/ARCHITECTURE.md` || Engineering reference | `docs/architecture/CODEBASE_DOCUMENTATION.md` |-| Auto-Combo (9-factor scoring, 15 strategies) | `docs/routing/AUTO-COMBO.md` |+| Auto-Combo (9-factor scoring, 17 strategies) | `docs/routing/AUTO-COMBO.md` || Resilience (3 mechanisms) | `docs/architecture/RESILIENCE_GUIDE.md` || Reasoning replay | `docs/routing/REASONING_REPLAY.md` || Skills framework | `docs/frameworks/SKILLS.md` |diff --git a/README.md b/README.mdindex 37bde4d92e..58458f6e07 100644--- a/README.md+++ b/README.md@@ -23,7 +23,7 @@[](#-231-ai-providers--50-free)[](docs/reference/FREE_TIERS.md)[](#%EF%B8%8F-save-1595-tokens--automatically)-[](#-combos--the-flagship)+[](#-combos--the-flagship)[](#-quick-start)<br/>@@ -182,7 +182,7 @@▼┌──────────────────────────────────────────────────────────┐│ OmniRoute — Smart Router │-│ RTK + Caveman compression · 15 routing strategies │+│ RTK + Caveman compression · 17 routing strategies ││ Circuit breakers · TLS stealth · MCP · A2A · Guardrails │└─────────────────────────┬──────────────────────────────────┘┌─────────────┬────┴────────┬─────────────┐@@ -220,7 +220,7 @@ No combo to create. Set your model to `auto` (or a variant) and OmniRoute builds##-### 🔀 Or build your own — 15 routing strategies+### 🔀 Or build your own — 17 routing strategies| Goal | Strategy / combo || --------------------------------------- | -------------------------------------------------- |@@ -229,6 +229,8 @@ No combo to create. Set your model to `auto` (or a variant) and OmniRoute builds| 💸 Always cheapest viable model | `cost-optimized` · `auto/cheap` || 🧠 Hand off long context between models | `context-relay` · `context-optimized` || 🎲 Randomized / privacy routing | `random` · `strict-random` |+| 🧬 Fan out to a panel + judge synthesis | `fusion` |+| 📊 Route by remaining quota headroom | `reset-window` · `headroom` || 🤖 Just make it smart | `auto` (9-factor scoring) · `lkgp` · `reset-aware` |<sub>The Auto-Combo engine scores every candidate on **9 factors** (health, quota, cost, latency, success rate, freshness…) — see [`docs/routing/AUTO-COMBO.md`](docs/routing/AUTO-COMBO.md).</sub>@@ -262,20 +264,20 @@ Result: 4 layers of fallback = zero downtime</div>-| Feature | OmniRoute | Other routers |-| -------------------------------------- | ----------------------------------------------------------- | ------------- |-| 🌐 Providers | **231** | 20–100 |-| 🆓 Free providers | **50+ (11 free forever)** | 1–5 |-| 🔀 Routing strategies | **15** (priority, weighted, cost-optimized, context-relay…) | 1–3 |-| 🗜️ Token compression | **RTK + Caveman stacked (15–95%)** | None / 20–40% |-| 🧰 Built-in MCP server | **87 tools, 3 transports, 30 scopes** | Rare |-| 🤝 A2A agent protocol | **6 skills, JSON-RPC 2.0** | None |-| 🧠 Memory (FTS5 + vector) | **Yes** | Rare |-| 🛡️ Guardrails (PII, injection, vision) | **Yes** | Rare |-| ☁️ Cloud agents | **Codex, Devin, Jules** | None |-| 🥷 TLS fingerprint stealth | **JA3/JA4 via wreq-js** | None |-| 🖥️ Multi-platform | **Web · Desktop · Termux · PWA** | Web only |-| 🌍 i18n | **42 locales** | 0–4 |+| Feature | OmniRoute | Other routers |+| -------------------------------------- | ------------------------------------------------------------------- | ------------- |+| 🌐 Providers | **231** | 20–100 |+| 🆓 Free providers | **50+ (11 free forever)** | 1–5 |+| 🔀 Routing strategies | **17** (priority, weighted, cost-optimized, context-relay, fusion…) | 1–3 |+| 🗜️ Token compression | **RTK + Caveman stacked (15–95%)** | None / 20–40% |+| 🧰 Built-in MCP server | **87 tools, 3 transports, 30 scopes** | Rare |+| 🤝 A2A agent protocol | **6 skills, JSON-RPC 2.0** | None |+| 🧠 Memory (FTS5 + vector) | **Yes** | Rare |+| 🛡️ Guardrails (PII, injection, vision) | **Yes** | Rare |+| ☁️ Cloud agents | **Codex, Devin, Jules** | None |+| 🥷 TLS fingerprint stealth | **JA3/JA4 via wreq-js** | None |+| 🖥️ Multi-platform | **Web · Desktop · Termux · PWA** | Web only |+| 🌍 i18n | **42 locales** | 0–4 |<sub>📊 Detailed comparison vs LiteLLM, OpenRouter & Portkey → [`docs/comparison/OMNIROUTE_VS_ALTERNATIVES.md`](docs/comparison/OMNIROUTE_VS_ALTERNATIVES.md)</sub>@@ -287,18 +289,18 @@ Result: 4 layers of fallback = zero downtime</div>-> Recent highlights from **v3.8.20 → v3.8.36**. Full history in [`CHANGELOG.md`](CHANGELOG.md).+> Recent highlights from **v3.8.20 → v3.8.37**. Full history in [`CHANGELOG.md`](CHANGELOG.md).- **⚖️ Quota-Share routing** — a dedicated combo strategy that spreads load across accounts by _available quota_: Deficit-Round-Robin scheduling, per-connection `max_concurrent` with cooldown-wait queueing, multi-window usage buckets (5h / 7d / per-model), per-(key,model) caps, session stickiness for prompt-cache integrity, and proactive saturation from upstream token-usage headers. → [Resilience Guide](docs/architecture/RESILIENCE_GUIDE.md)- **🤖 One-command CLI/agent setup** — a dedicated `setup-*` command configures each coding tool to route through OmniRoute (Claude Code, Codex, Cline, Continue, Cursor, Roo Code, Kilo Code, Crush, Goose, Qwen Code, Aider, OpenCode, Gemini CLI); `omniroute launch` / `omniroute launch-codex` are zero-config launchers. → [CLI Integrations](docs/guides/CLI-INTEGRATIONS.md)- **🛰️ Remote mode** — drive a remote OmniRoute from any machine with scoped access tokens (`omniroute connect` / `omniroute contexts` / `omniroute tokens`). → [Remote Mode](docs/guides/REMOTE-MODE.md)- **🧭 Smarter auto-routing** — OpenRouter-style `auto/<category>:<tier>` combos (e.g. `auto/coding:fast`, `auto/reasoning:pro`), a **Fusion** strategy (16th — fan out to a panel of models in parallel, then synthesize via a judge), **task-aware routing** (best-fit connection per task type), per-request `X-Route-Model` override, live Arena-ELO + models.dev model intelligence, per-step account allowlists, provider-wildcard combo steps, nested combo-ref execution, sticky weighted selection, and `web_search`-aware routing. → [Auto-Combo](docs/routing/AUTO-COMBO.md)-- **🗜️ Pluggable compression** — an async pipeline of **9 composable engines** with Compression Studios, an LLMLingua-2 ONNX engine and a heuristic/SLM two-tier **Ultra**, RTK, delegated Anthropic Context Editing, **Output Styles** (output-axis steering: terse-prose / less-code / terse-CJK), an **adaptive context-budget dial** (escalate only as far as needed to fit the context window), per-request `x-omniroute-compression` control, an opt-in offline eval harness, and a unified panel with named profiles + an active-profile selector. → [Compression](docs/compression/COMPRESSION_ENGINES.md)+- **🗜️ Pluggable compression** — an async pipeline of **9 composable engines** with Compression Studios, an LLMLingua-2 ONNX engine and a heuristic/SLM two-tier **Ultra**, RTK, delegated Anthropic Context Editing, **Output Styles** (output-axis steering: terse-prose / less-code / terse-CJK), an **adaptive context-budget dial** (escalate only as far as needed to fit the context window), per-request `x-omniroute-compression` control, an opt-in offline eval harness, one-click **Headroom** proxy lifecycle management from the dashboard (Docker sidecar supported), and a unified panel with named profiles + an active-profile selector. → [Compression](docs/compression/COMPRESSION_ENGINES.md)- **🕵️ Transparent MITM decrypt (TPROXY)** — capture & translate traffic from CLIs that ignore proxy env vars, with a per-SNI certificate authority and a trust-store installer. → [MITM/TPROXY](docs/security/MITM-TPROXY-DECRYPT.md)- **💸 Cost telemetry everywhere** — `X-OmniRoute-*` cost/usage headers on every endpoint (including media), a non-token cost engine, a cache-HIT `X-OmniRoute-Cost-Saved` header, and per-key USD spend quotas. → [API Reference](docs/reference/API_REFERENCE.md)- **🧠 Memory you control** — opt-in int8 vector quantization (Qdrant + sqlite-vec), memory off by default, and a per-request `x-omniroute-no-memory` header. → [Memory](docs/frameworks/MEMORY.md)- **🛡️ Security** — a prompt-injection guard across every LLM route (backed by a red-team suite), plus a free DuckDuckGo last-resort web search. → [Guardrails](docs/security/GUARDRAILS.md)-- **🤝 More providers & agents** — Cursor Cloud Agent (a 4th cloud agent), CodeBuddy CN (`copilot.tencent.com`), a Google Flow video-generation provider, a refreshed 231-provider catalog (OrcaRouter, Wafer AI, OpenAdapter, dit.ai, TokenRouter, …), Vertex AI media generation (speech / transcription / music / video), and one-click account import from CLIProxyAPI (`~/.cli-proxy-api/`). → [Providers](docs/reference/PROVIDER_REFERENCE.md)+- **🤝 More providers & agents** — Cursor Cloud Agent (a 4th cloud agent), CodeBuddy CN (`copilot.tencent.com`), a Google Flow video-generation provider, new gateways **DGrid** and **Pioneer AI** (Fastino Labs), inbound **xAI Grok** translators, GPT-4 / GPT-4o-mini on the GitHub Copilot provider, multi-model **Factory Droid**, a refreshed 231-provider catalog (OrcaRouter, Wafer AI, OpenAdapter, dit.ai, TokenRouter, …), Vertex AI media generation (speech / transcription / music / video), and one-click account import from CLIProxyAPI (`~/.cli-proxy-api/`). → [Providers](docs/reference/PROVIDER_REFERENCE.md)- **⚡ Local performance & infra** — a one-click local Redis launcher (`omniroute redis up`, plus a dashboard Redis panel), one-click **Cloudflare Workers** and **Deno Deploy** relay deployers wired into the proxy pool, and an optional Bifrost Go sidecar that offloads the hottest relay path (`BIFROST_BASE_URL`, with automatic fallback to the TypeScript path on timeout). → [Environment](docs/reference/ENVIRONMENT.md)<br/>diff --git a/bin/cli/runtime/nativeDeps.mjs b/bin/cli/runtime/nativeDeps.mjsindex 852cff76b7..2a0787bd04 100644--- a/bin/cli/runtime/nativeDeps.mjs+++ b/bin/cli/runtime/nativeDeps.mjs@@ -79,7 +79,18 @@ export function isBetterSqliteBinaryValid() {export function npmInstallRuntime(pkgs, opts = {}) {const cwd = ensureRuntimeDir();- const npmArgs = ["install", ...pkgs, "--no-audit", "--no-fund", "--prefer-online", "--no-save"];+ // Persist to the runtime package.json (exact version) instead of --no-save so a later+ // install of a sibling runtime dep (e.g. systray2 from trayRuntime.ts, which writes to the+ // same runtime dir) does not prune this package as "extraneous" — that pruning otherwise+ // reproduces "No SQLite driver available" after a tray install removes better-sqlite3.+ const npmArgs = [+ "install",+ ...pkgs,+ "--no-audit",+ "--no-fund",+ "--prefer-online",+ "--save-exact",+ ];// On Windows .cmd files cannot be executed without a shell; use cmd.exe /c explicitly// so we never set shell:true (which would propagate env and enable injection).const isWin = platform() === "win32";diff --git a/bin/cli/runtime/trayRuntime.ts b/bin/cli/runtime/trayRuntime.tsindex cc734b6f80..712bc720dc 100644--- a/bin/cli/runtime/trayRuntime.ts+++ b/bin/cli/runtime/trayRuntime.ts@@ -83,8 +83,12 @@ function isInstalled(): boolean {}function installSystray(): void {+ // --save-exact persists systray2 to the runtime package.json so installing it does not+ // prune a sibling runtime dep (e.g. better-sqlite3 from nativeDeps.mjs, which writes to the+ // same runtime dir) as "extraneous", and so the tray dep survives a later sibling install.+ // Without it, a sibling install reproduces "No SQLite driver available".execSync(- `npm install --prefix "${RUNTIME_DIR}" ${SYSTRAY_SPEC} --no-audit --no-fund --silent`,+ `npm install --prefix "${RUNTIME_DIR}" ${SYSTRAY_SPEC} --no-audit --no-fund --save-exact --silent`,{ stdio: ["ignore", "ignore", "pipe"], timeout: 120_000 });}diff --git a/bin/cli/tray/autostart.mjs b/bin/cli/tray/autostart.mjsindex 742bf99c20..605161c2a1 100644--- a/bin/cli/tray/autostart.mjs+++ b/bin/cli/tray/autostart.mjs@@ -204,6 +204,64 @@ export function isAutostartEnabled() {return false;}+/**+ * Pure parse of `launchctl list <label>` output: true only when the agent's+ * "PID" line matches the given process id. launchctl prints the running PID for+ * a managed Aqua agent; a loaded-but-not-running agent omits the key entirely.+ *+ * Exported for unit testing — the darwin branch can't execute on the Linux CI.+ */+export function parseAgentSelfFromLaunchctl(output, pid) {+ if (!output) return false;+ const match = output.match(/"PID"\s*=\s*(\d+)/);+ return !!(match && parseInt(match[1], 10) === pid);+}++/**+ * True when `runList()` (which should run `launchctl list <label>`) succeeds,+ * i.e. launchd actually recognizes the agent. A plist sitting on disk that+ * launchd never loaded must NOT count as enabled — checking file existence+ * alone makes the tray menu lie ("✓ Enabled" while launchd has the agent in a+ * failed state or never loaded it).+ *+ * `runList` is injectable so the parse/branch logic is testable without a real+ * launchctl on the (Linux) CI runner.+ */+export function isLaunchdAgentLoaded(runList) {+ try {+ runList();+ return true;+ } catch {+ return false;+ }+}++/**+ * Returns true when the current Node process IS the running instance launchd is+ * managing under our agent label.+ *+ * `launchctl unload`/`load -w` for a user-domain agent sends SIGTERM to the+ * running process. When the running OmniRoute cli was itself spawned by the+ * autostart launchd agent (autostart was enabled, then the machine rebooted,+ * then the user clicked the tray "Disable Autostart" item), an unload would+ * kill the very process executing the click handler — the tray icon would+ * silently disappear instead of the menu label flipping. Enable/disable skip+ * launchctl in that case; the on-disk plist change is what matters for the next+ * login, and launchd already has us loaded under our own PID.+ */+function isAgentSelfMac() {+ try {+ const output = execFileSync("launchctl", ["list", APP_LABEL], {+ encoding: "utf8",+ stdio: ["ignore", "pipe", "ignore"],+ timeout: 3000,+ });+ return parseAgentSelfFromLaunchctl(output, process.pid);+ } catch {+ return false;+ }+}+function enableMac() {const plistDir = join(homedir(), "Library", "LaunchAgents");mkdirSync(plistDir, { recursive: true });@@ -225,6 +283,10 @@ function enableMac() {<key>KeepAlive</key><false/></dict></plist>`;writeFileSync(plistPath, plist, { mode: 0o644 });+ // If we're already the running agent, launchctl load/unload would SIGTERM us.+ // The plist is updated on disk and launchd already has us loaded under our own+ // PID — nothing more to do for the current session.+ if (isAgentSelfMac()) return existsSync(plistPath);try {execSync("launchctl load -w " + JSON.stringify(plistPath), { stdio: "ignore" });} catch {}@@ -233,9 +295,15 @@ function enableMac() {function disableMac() {const plistPath = join(homedir(), "Library", "LaunchAgents", `${APP_LABEL}.plist`);- try {- execSync("launchctl unload -w " + JSON.stringify(plistPath), { stdio: "ignore" });- } catch {}+ // Don't kill ourselves: when the current process is the running agent,+ // `launchctl unload` sends SIGTERM and a user clicking "Disable Autostart"+ // from the tray would lose the tray icon instead of just flipping the label.+ // Removing the plist file is enough to stop the agent at the next login.+ if (!isAgentSelfMac()) {+ try {+ execSync("launchctl unload -w " + JSON.stringify(plistPath), { stdio: "ignore" });+ } catch {}+ }try {unlinkSync(plistPath);} catch {}@@ -243,7 +311,16 @@ function disableMac() {}function isEnabledMac() {- return existsSync(join(homedir(), "Library", "LaunchAgents", `${APP_LABEL}.plist`));+ const plistPath = join(homedir(), "Library", "LaunchAgents", `${APP_LABEL}.plist`);+ if (!existsSync(plistPath)) return false;+ // The plist file existing is not enough — launchd must actually recognize the+ // agent, otherwise the tray menu reports "Enabled" for an inert/failed agent.+ return isLaunchdAgentLoaded(() =>+ execFileSync("launchctl", ["list", APP_LABEL], {+ stdio: ["ignore", "ignore", "ignore"],+ timeout: 3000,+ })+ );}function enableWin() {diff --git a/config/quality/complexity-baseline.json b/config/quality/complexity-baseline.jsonindex 419b80a5b2..cdff5b6401 100644--- a/config/quality/complexity-baseline.json+++ b/config/quality/complexity-baseline.json@@ -1,6 +1,6 @@{"_comment": "Catraca de complexidade (check-complexity.mjs, ESLint core rules complexity>=15 e max-lines-per-function>80 sobre src+open-sse+electron+bin via eslint.complexity.config.mjs). Conta total de violacoes; so pode cair. --update ratcheta.",- "count": 1950,+ "count": 1963,"_rebaseline_2026_06_25_v3836_release": "Reconciliacao release-volatil 1920->1950 (+30) no fechamento do ciclo v3.8.36, surfada pelo CI da fix-PR #5029 (a catraca de complexidade NAO roda no fast-path PR->release nem foi medida no release PR #4854 — Quality Ratchet foi SKIPPED la — so PR->main, entao o ramo acumulou os 137 commits sem rebaselinar). O +30 e drift de condicionais NOVOS das features legitimas do ciclo: Quota-Share Fase 2/3 (estrategia dedicada DRR+P2C, multi-window buckets, concurrency control, headroom, saturacao proativa — #4885/#4907/#4908/#4927/#4928/#4929/#4939/#4965/#4967/#4970), task-aware + Fusion combo (#4945/#4652), e ramos de provider/translator de contribuidores. A god-file decomposition #3501 e PURA (move codigo p/ leaves, complexity-neutra). Verificado que esta fix-PR (#5029) toca SO scripts/build/pack-artifact-policy.ts (array de strings), tests/integration/resilience-http-e2e.test.ts (2 keys) e os 2 baselines json — contribui 0 ao gate que varre src+open-sse+electron+bin. Mesma familia dos rebaselines anteriores — crescimento de feature legitimo recem-TDD'd, nao regressao; reducao estrutural fica como debt (#3501).","_rebaseline_2026_06_23_v3835_release": "Reconciliacao release-volatil 1916->1920 (+4) no fechamento do ciclo v3.8.35, surfada pelo pre-flight check:release-green (a catraca de complexidade NAO roda no fast-path PR->release, so release->main, entao o ramo acumula sem rebaselinar). O +4 e drift de condicionais NOVOS dos merges de contribuidor/feature deste ciclo (Compression Phase 4 #4694/#4707/#4716/#4720, combos auto-promote #4774, tier no-auth #4753, deepseek-web tool-fold #4756, dedupe provider nodes #4768). Verificado que o trabalho de release-finalize desta sessao toca SO docs/*.md (THREAT_MODEL), CHANGELOG.md, baselines e 1 linha de string em scripts/check/check-fabricated-docs.mjs (fora do escopo src+open-sse+electron+bin que o gate varre) — contribui 0. Mesma familia dos rebaselines anteriores — crescimento de feature legitimo recem-TDD'd, nao regressao; reducao estrutural fica como debt (#3501).","_rebaseline_2026_06_23_v3834_release": "Reconciliacao release-volatil 1915->1916 (+1) no fechamento do ciclo v3.8.34. check:complexity NAO roda no fast-path PR->release (so release->main), entao o ramo acumula sem rebaselinar; surfou no full CI do release PR (run em c98e7ff6d). O +1 e drift de condicional NOVO de merge de contribuidor do ciclo (features quota/usage/opencode-go/M365). Verificado que o commit de release-finalize NAO adiciona complexity: toca CHANGELOG/baseline/mirrors/3 testes + 1 linha de regex em opencodeOllamaUsage.ts (sem novo ramo) + reorder de dados no reka registry — local mede 1916 com ou sem essa mudanca. Mesma familia dos rebaselines anteriores — crescimento de feature legitimo, nao regressao; reducao estrutural fica como debt (#3501).",@@ -20,5 +20,6 @@"_rebaseline_2026_06_19_v3830": "Re-baseline consciente: drift 1800->1885 (+85) do ciclo v3.8.25->v3.8.29 (round-9, ~130 PRs: combo split D7/D8, chatCore split, novos providers/modelos, cost-telemetry, MITM decrypt, remote-mode CLI). Medido no tip release/v3.8.30 (3e6be4701). Mesma familia dos re-baselines anteriores — crescimento de feature legitima, nao regressao. Reducao fica como debt de refactor dedicado.","_rebaseline_2026_06_13_v3825": "Re-baseline consciente: drift 1794->1800 (+6) do ciclo v3.8.24->v3.8.25 (features #3799-#3806). Mesma familia dos re-baselines anteriores — crescimento de feature legitima, nao regressao. Reducao fica como debt de refactor dedicado.","_rebaseline_2026_06_10": "Re-baseline consciente: 1739 foi medido na branch das Fases 0-6 (base ~v3.8.17); a v3.8.18 publicada ja carrega 1746 (provado: o commit-base 5f2722bd6, anterior a qualquer commit do ciclo v3.8.19, mede 1746 — funcoes complexas dos reworks RequestLoggerV2/stream/combo). Mesma familia dos re-baselines de eslintWarnings/file-size. Reducao = Fase 6A (2026-06-16).",- "_rebaseline_2026_06_13_6a11": "Re-baseline consciente Task 6A.11: escopo ampliado para src+open-sse+electron+bin (electron/bin contribuem 0 violacoes novas — todos os 4 arquivos .ts em bin/ estao abaixo dos thresholds). Drift 1746→1794 pre-existente de features mergeadas nos ciclos v3.8.22/v3.8.23 (nao causado por esta task). Congelado no valor real medido para destrancar o gate."+ "_rebaseline_2026_06_13_6a11": "Re-baseline consciente Task 6A.11: escopo ampliado para src+open-sse+electron+bin (electron/bin contribuem 0 violacoes novas — todos os 4 arquivos .ts em bin/ estao abaixo dos thresholds). Drift 1746→1794 pre-existente de features mergeadas nos ciclos v3.8.22/v3.8.23 (nao causado por esta task). Congelado no valor real medido para destrancar o gate.",+ "_rebaseline_2026_06_26_v3837_release": "1950->1963 (+13). v3.8.37 cycle drift surfaced by the release-green pre-flight (the Quality Ratchet does NOT run on PR->release fast-gates, so warnings/complexity accrued unmeasured across this cycle's 76 commits — provider adds DGrid/Pioneer/xAI, headroom proxy lifecycle #4649, ~50 SSE/translator fixes, Engine Combos #5062). Trust-but-verify: this release-finalize working tree touches ONLY CHANGELOG.md, docs/i18n/*/CHANGELOG.md mirrors, and these baselines — 0 production-code change, so all drift is inherited cycle drift (`any` warn-allowed in open-sse/ + tests/). Tighten via --require-tighten next cycle."}diff --git a/config/quality/file-size-baseline.json b/config/quality/file-size-baseline.jsonindex 9fc2e6d628..1c59b8f75e 100644--- a/config/quality/file-size-baseline.json+++ b/config/quality/file-size-baseline.json@@ -1,5 +1,7 @@{"_comment": "Catraca de tamanho (check-file-size.mjs). frozen so pode encolher; arquivos novos <= cap. --update ratcheta.",+ "_rebaseline_2026_06_26_rc17b_leva4": "Leva 4 (22 PRs): drift dos commits definidores. route.ts (#4931 DGrid), settings.ts (#4852/#4856), chat.ts (#4852/#4858/#4870), antigravity.ts (#4941 retry), codex.ts (#4849), request/openai-responses.ts (#4859/#4862), response/openai-responses.ts (#4862/#4906 dense+custom-tool), kiro.ts NOVO>800 (#4855), openai-to-claude.ts NOVO>800 (#4853); testes: executor-codex (#4849), translator-openai-responses-req (#4859).",+ "_rebaseline_2026_06_25_rc17b_leva3": "Leva 3 (24 PRs port do dono): drift de tamanho dos commits definidores mergeados. chat.ts/auth.ts (#4825 bare-model resolve), base.ts (#4820 strip X-Stainless), cursor.ts (#4842 Composer sentinel), default.ts (#4823 anthropic-version case-insensitive), tokenRefresh.ts (#4818 refreshLeadMs), openai-to-gemini.ts (#4821 strip builtin tools), openai-to-kiro.ts (#4816 reject [1m]), response/openai-responses.ts (#4848 close reasoning), request/openai-responses.ts NOVO @808 (#4789 filter nameless tools); testes: executor-default-base (#4823), provider-validation-specialty (#4819 HF whoami), translator-openai-to-kiro (#4816).","_rebaseline_2026_06_25_4976_ratelimit_400_failover": "Bug fix #4976: a 400 carrying rate-limit text (e.g. MiMoCode 'Detected high-frequency non-compliant requests') was classified as a non-fallbackable generic 400, so MiMo-auto never failed over -> 502 in Cline. open-sse/services/accountFallback.ts 1762->1773 (+11 = a bounded ReDoS-safe RATE_LIMIT_TEXT_PATTERNS array + a single check in the 400 branch returning buildRetryableFallback(RATE_LIMIT_EXCEEDED) at connection-cooldown scope, placed AFTER malformed/overflow detection so a malformed 400 keeps its #2101 MODEL_CAPACITY guard). Irreducible classification wiring at the existing 400 branch; the pattern array is the minimal addition. Covered by tests/unit/accountfallback-ratelimit-400-4976.test.ts (EN+zh rate-limit text -> fallback; generic 400 stays non-fallback; malformed 400 stays MODEL_CAPACITY).","_rebaseline_2026_06_24_4945_task_aware_router_precedence": "Base-red fix: the #4945 task-aware reordering (reorderByTaskWeight) runs for strategy \"auto\" and was applied AFTER the auto router (selectWithStrategy: lkgp/cost/etc) had already pinned orderedTargets[0], silently defeating the operator's explicit LKGP/cost choice (proven: tests/unit/combo-routing-engine.test.ts 'honors LKGP after filtering to tool-capable models' + 'falls back to the full pool when tool filtering empties candidates' selected gpt-oss-120b — the 1st target — instead of the LKGP/cost winner; instrumentation showed orderedTargets[0]=claude post-filter then gpt-oss post-task-reorder). open-sse/services/combo.ts 3306->3321 (+15 = a one-line `autoUsedExplicitRouter` flag set when the explicit router succeeds, and at the task-aware step: when that flag is set, pin orderedTargets[0] and let task-aware refine only the fallback tail — reorderByTaskWeight returns the same objects so identity filtering is safe). gpt-oss-120b correctly REMAINS tool-capable (model-capabilities-registry.test.ts asserts true), so this is NOT a tool-capability change. Irreducible chokepoint wiring at the existing auto-route boundary; not extractable. Covered by the two combo-routing-engine.test.ts cases above + combo-task-aware.test.ts (task-aware still active for non-router strategies).","_rebaseline_2026_06_24_per_connection_max_concurrent": "Feature (per-connection max_concurrent enforcement, issue #9 follow-up) own growth: open-sse/services/combo.ts 3225->3238 (+13 net). Provider connections already carry a maxConcurrent ceiling (provider_connections.max_concurrent, migration 029, set in the UI/API/DB) but routing ignored it, so low-concurrency subscription accounts (GLM/MiniMax ~1) got flooded -> 429 + cooldown, worse under quota-share where keys share one account. The new wiring lives at the two combo dispatch chokepoints: (1) the strategy===\"quota-share\" branch resolves each target connection's cap and passes it into selectQuotaShareTarget so an at-cap connection is deprioritized (fail-open, never hard-blocked); (2) handleRoundRobinCombo resolves the target connection's cap and uses it as the semaphore maxConcurrency (fallback = combo-level concurrency). ALL extractable logic was moved into the new pure leaf open-sse/services/combo/concurrencyCaps.ts (resolveMaxConcurrentByConnection + makeConnectionConcurrencyResolver, DB reads deduped per connectionId, fail-open) and the pure effectiveMaxConcurrency resolver into combo/comboPredicates.ts; combo.ts keeps only the irreducible chokepoint wiring (a 5-line import + the two call-site bindings). Cohesive at the existing dispatch boundaries, not further extractable. Structural shrink of combo.ts tracked in #3501. Covered by tests/unit/quota-share-strategy.test.ts (per-connection maxConcurrent gating cases) + tests/unit/combo/effective-max-concurrency.test.ts.",@@ -117,12 +119,12 @@"frozen": {"_rebaseline_pr1043_minimax_tts": "Upstream port decolua/9router#1043 (toanalien) own growth: audioSpeech.ts 965->1061 (+96). Adds MiniMax T2A v2 TTS dispatch (handleMinimaxSpeech + hexToBytes helper) — provider entry was already in audioRegistry (format: minimax-tts) but no handler existed, falling through to the OpenAI-compatible default that fails (T2A has custom shape + hex-encoded audio + base_resp envelope). New branch sits next to the other inline provider branches (xiaomi-mimo, coqui, tortoise, aws-polly) — extracting would just create indirection. Covered by tests/unit/minimax-tts-1043.test.ts (3 tests, GREEN: success, base_resp error, invalid-hex).","open-sse/config/providerRegistry.ts": 4731,- "open-sse/executors/antigravity.ts": 1735,- "open-sse/executors/base.ts": 1416,+ "open-sse/executors/antigravity.ts": 1806,+ "open-sse/executors/base.ts": 1470,"open-sse/executors/chatgpt-web.ts": 2870,"open-sse/executors/claude-web.ts": 1057,- "open-sse/executors/codex.ts": 1528,- "open-sse/executors/cursor.ts": 1453,+ "open-sse/executors/codex.ts": 1541,+ "open-sse/executors/cursor.ts": 1474,"open-sse/executors/deepseek-web.ts": 1148,"_rebaseline_2026_06_22_4644_deepseek_web_tools": "PR #4644 (BugsBag/robust deepseek-web tool-call parsing): open-sse/executors/deepseek-web.ts 1117->1125 (+8). The new agentic tool-call path emits surrounding text + reasoning before tool_calls and swaps to the dedicated deepseekWebTools.ts parser; the +8 lines are cohesive wiring at the existing transformSSE chokepoint (the parser itself lives in the new deepseekWebTools.ts file, already under cap). The PR's own fast-gate (PR->release) does not run check:file-size, so this surfaced only at release reconcile. Covered by tests/unit/deepseek-web-tools-variants.test.ts + deepseek-web-tools-execute.test.ts.","_rebaseline_2026_06_23_4712_deepseek_web_tool_results": "PR for #4712 (deepseek-web drops role:tool): open-sse/executors/deepseek-web.ts 1125->1148 (+23). messagesToPrompt() now folds role:\"tool\" results into the single-prompt transcript (recovering the tool name from the preceding assistant tool_calls by tool_call_id) instead of silently dropping them; the lines are cohesive wiring inside the existing function. Covered by tests/unit/deepseek-web-tool-result-prompt-4712.test.ts.",@@ -133,7 +135,7 @@"open-sse/handlers/audioSpeech.ts": 1061,"open-sse/handlers/chatCore.ts": 5125,"open-sse/handlers/imageGeneration.ts": 3777,- "open-sse/handlers/responseSanitizer.ts": 1103,+ "open-sse/handlers/responseSanitizer.ts": 1122,"open-sse/handlers/search.ts": 1546,"open-sse/handlers/sseParser.ts": 830,"open-sse/handlers/videoGeneration.ts": 1083,@@ -151,11 +153,11 @@"open-sse/services/combo.ts": 3368,"open-sse/services/compression/strategySelector.ts": 848,"open-sse/services/rateLimitManager.ts": 1035,- "open-sse/services/tokenRefresh.ts": 2070,+ "open-sse/services/tokenRefresh.ts": 2103,"open-sse/services/usage.ts": 3454,- "open-sse/translator/request/openai-to-gemini.ts": 870,- "open-sse/translator/request/openai-to-kiro.ts": 807,- "open-sse/translator/response/openai-responses.ts": 923,+ "open-sse/translator/request/openai-to-gemini.ts": 906,+ "open-sse/translator/request/openai-to-kiro.ts": 842,+ "open-sse/translator/response/openai-responses.ts": 1035,"open-sse/utils/cursorAgentProtobuf.ts": 1521,"open-sse/utils/stream.ts": 2710,"src/app/(dashboard)/dashboard/HomePageClient.tsx": 1385,@@ -195,7 +197,7 @@"src/app/(dashboard)/dashboard/usage/components/EvalsTab.tsx": 2148,"src/app/(dashboard)/dashboard/usage/components/ProviderLimits/index.tsx": 1121,"src/app/api/oauth/[provider]/[action]/route.ts": 924,- "src/app/api/providers/[id]/models/route.ts": 2590,+ "src/app/api/providers/[id]/models/route.ts": 2593,"src/app/api/providers/[id]/test/route.ts": 924,"src/app/api/usage/analytics/route.ts": 941,"src/app/api/v1/models/catalog.ts": 1615,@@ -206,7 +208,7 @@"src/lib/db/models.ts": 1259,"src/lib/db/providers.ts": 1063,"src/lib/db/proxies.ts": 1060,- "src/lib/db/settings.ts": 1151,+ "src/lib/db/settings.ts": 1155,"src/lib/db/usageAnalytics.ts": 925,"src/lib/evals/evalRunner.ts": 961,"src/lib/memory/retrieval.ts": 1171,@@ -215,7 +217,7 @@"src/lib/resilience/settings.ts": 841,"src/lib/tailscaleTunnel.ts": 1202,"src/lib/usage/callLogs.ts": 975,- "src/lib/usage/providerLimits.ts": 950,+ "src/lib/usage/providerLimits.ts": 955,"src/lib/usage/usageHistory.ts": 934,"src/shared/components/OAuthModal.tsx": 960,"src/shared/components/RequestLoggerV2.tsx": 1316,@@ -226,8 +228,12 @@"src/shared/constants/sidebarVisibility.ts": 1100,"src/shared/services/cliRuntime.ts": 1090,"src/shared/validation/schemas.ts": 2523,- "src/sse/handlers/chat.ts": 1525,- "src/sse/services/auth.ts": 2328+ "src/sse/handlers/chat.ts": 1552,+ "src/sse/services/auth.ts": 2336,+ "open-sse/executors/default.ts": 835,+ "open-sse/translator/request/openai-responses.ts": 902,+ "open-sse/executors/kiro.ts": 814,+ "open-sse/translator/request/openai-to-claude.ts": 805},"testCap": 800,"testFrozen": {@@ -248,8 +254,8 @@"tests/unit/db-settings-crud.test.ts": 941,"tests/unit/deepseek-web.test.ts": 1081,"tests/unit/executor-antigravity.test.ts": 942,- "tests/unit/executor-codex.test.ts": 1339,- "tests/unit/executor-default-base.test.ts": 1339,+ "tests/unit/executor-codex.test.ts": 1340,+ "tests/unit/executor-default-base.test.ts": 1477,"tests/unit/grok-web.test.ts": 2437,"tests/unit/image-generation-handler.test.ts": 2019,"tests/unit/model-sync-route.test.ts": 1016,@@ -259,7 +265,7 @@"tests/unit/oauth-providers-config.test.ts": 870,"tests/unit/perplexity-web.test.ts": 959,"tests/unit/provider-models-route.test.ts": 1618,- "tests/unit/provider-validation-specialty.test.ts": 2752,+ "tests/unit/provider-validation-specialty.test.ts": 2801,"_rebaseline_pr4613_compatible_provider_groups": "Reconcile #4613 already-merged growth: providers-page-utils.test.ts 1004->1052 (+48, buildCompatibleProviderGroups partition unit test). Fast-gate PR->release does not run check:file-size, so this surfaced post-merge.","tests/unit/providers-page-utils.test.ts": 1052,"tests/unit/reasoning-cache.test.ts": 980,@@ -267,12 +273,12 @@"tests/unit/search-handler-extended.test.ts": 1124,"tests/unit/sse-auth.test.ts": 1553,"tests/unit/stream-utils.test.ts": 2435,- "tests/unit/token-refresh-service.test.ts": 1322,+ "tests/unit/token-refresh-service.test.ts": 1353,"tests/unit/translator-friendly-test-bench.test.tsx": 848,"tests/unit/translator-helper-branches.test.ts": 870,- "tests/unit/translator-openai-responses-req.test.ts": 1047,+ "tests/unit/translator-openai-responses-req.test.ts": 1097,"tests/unit/translator-openai-to-gemini.test.ts": 1579,- "tests/unit/translator-openai-to-kiro.test.ts": 918,+ "tests/unit/translator-openai-to-kiro.test.ts": 999,"tests/unit/translator-resp-gemini-to-openai.test.ts": 1234,"tests/unit/usage-service-hardening.test.ts": 1633,"tests/unit/vscode-token-routes.test.ts": 1212@@ -320,5 +326,7 @@"_rebaseline_2026_06_20_4447_openai_gpt41mini_o_mini_pricing": "PR #4447 own growth: pricing.ts 1592->1620 (+28 = pure-data pricing rows closing the null/$0 gap for registry-exposed OpenAI ids gpt-4.1-mini, gpt-4.1-nano, o3-mini, o4-mini that tripped the catalog pricing gate; getPricingForModel does an exact lookup, so a missing key resolves to null. Official OpenAI per-1M prices + the table's derived-field convention (reasoning=output*1.5, cache_creation=input, cached=official). Restore-green for a pre-existing release/v3.8.32 red surfaced by #4432's __RUN_ALL__ run. Cohesive data; not extractable.","_rebaseline_2026_06_20_web_cookie_validator_shadow_fix": "validation.ts 4518->4522 (+4 = move the generic web-cookie validateWebCookieProvider dispatch from the TOP of validateProviderApiKey to a FALLBACK after SPECIALTY_VALIDATORS, plus a comment, so #4023's generic AUTH_007 ping no longer shadows the rich per-provider validators (grok-web #3474 IP-reputation/Cloudflare, chatgpt-web cf-mitigated, claude/gemini/copilot/qwen/t3-web). Restores provider-validation-specialty.test.ts (112/112) while keeping web-cookie-auth007 (5/5). Behavior fix at an existing dispatch boundary; not extractable.","_rebaseline_2026_06_22_phase4b_slm_tier_ultra": "Compression Phase 4 (B) SLM tier own growth: open-sse/services/compression/strategySelector.ts 783->818 (+35 at the existing applyUltraAsync chokepoint). The no-modelPath ultra branch (previously a one-line passthrough to the sync applyCompression) now runs the two-tier resolver: it adapts the body, builds the ultraConfig (threading config.ultraEngine + preserveSystemPrompt), awaits the now-async ultraCompress (SLM Tier-B when ultraEngine===slm and the worker backend is available, else fail-open to the Tier-A heuristic), and threads result.stats.ultraTier into the returned CompressionStats so the resolved tier reaches the D0 telemetry persister. The sync applyCompression ultra branch is also re-pointed to the new pure ultraCompressHeuristic. The two-tier resolver + the pure heuristic live in open-sse/services/compression/ultra.ts and the thin SLM entry in engines/llmlingua/ultraEntry.ts (both <cap, fully unit-tested); strategySelector.ts is cohesive dispatch wiring at the existing ultra chokepoint, not extractable without hiding the dispatch boundary. Covered by tests/unit/compression/ultra-slm-tier.test.ts (applyCompressionAsync ultraTier:slm) + ultra.test.ts (39 regression) + the integration suites. Structural shrink of this file tracked in #3501.",- "_rebaseline_2026_06_22_phase4c_adaptive_context_budget": "Compression Phase 4 (C) adaptive context-budget wiring own growth: open-sse/services/compression/strategySelector.ts 818->848 (+30 at the existing selectCompressionPlan dispatch chokepoint). selectCompressionPlan gains an 8th optional `adaptiveOptions` param (modelContextLimit/requestMaxTokens/onAdaptive sink) and, after resolveBasePlan and before the caching-aware pass, runs the PURE resolveAdaptivePlan when config.contextBudget.mode is floor|replace-autotrigger; the new adaptiveEnabled(config) helper also gates the legacy shouldAutoTrigger branch inside resolveBasePlan off when adaptive owns automatic-by-size escalation (D-C4). The escalation ladder, target computation, and the resolver itself live in open-sse/services/compression/adaptiveCompression/{computeTarget,ladder,resolveAdaptivePlan,types}.ts (all <cap, fully unit-tested by Tasks 1-4). strategySelector.ts is cohesive dispatch wiring at the existing compression chokepoint, not extractable without hiding the dispatch boundary, mirroring the prior compression rebaselines (#4217/#4210/phase4b). Covered by tests/unit/compression/adaptive-select-plan-wiring.test.ts (4 tests) + adaptive-chatcore-source-guard.test.ts (2). chatCore.ts also grows ~30 lines at the same call site (threads getTokenLimit(provider,effectiveModel) + request max_tokens into adaptiveOptions and records the adaptive telemetry block onto compression.completed) but stays under its frozen cap. Structural shrink of this file tracked in #3501."+ "_rebaseline_2026_06_22_phase4c_adaptive_context_budget": "Compression Phase 4 (C) adaptive context-budget wiring own growth: open-sse/services/compression/strategySelector.ts 818->848 (+30 at the existing selectCompressionPlan dispatch chokepoint). selectCompressionPlan gains an 8th optional `adaptiveOptions` param (modelContextLimit/requestMaxTokens/onAdaptive sink) and, after resolveBasePlan and before the caching-aware pass, runs the PURE resolveAdaptivePlan when config.contextBudget.mode is floor|replace-autotrigger; the new adaptiveEnabled(config) helper also gates the legacy shouldAutoTrigger branch inside resolveBasePlan off when adaptive owns automatic-by-size escalation (D-C4). The escalation ladder, target computation, and the resolver itself live in open-sse/services/compression/adaptiveCompression/{computeTarget,ladder,resolveAdaptivePlan,types}.ts (all <cap, fully unit-tested by Tasks 1-4). strategySelector.ts is cohesive dispatch wiring at the existing compression chokepoint, not extractable without hiding the dispatch boundary, mirroring the prior compression rebaselines (#4217/#4210/phase4b). Covered by tests/unit/compression/adaptive-select-plan-wiring.test.ts (4 tests) + adaptive-chatcore-source-guard.test.ts (2). chatCore.ts also grows ~30 lines at the same call site (threads getTokenLimit(provider,effectiveModel) + request max_tokens into adaptiveOptions and records the adaptive telemetry block onto compression.completed) but stays under its frozen cap. Structural shrink of this file tracked in #3501.",+ "_rebaseline_2026_06_25_rc17_pr_batch": "rc17 PR batch own growth (cohesive, not extractable): responseSanitizer.ts 1103->1122 (+19 = SanitizeOpenAIResponseOptions interface + stripReasoning option, #4678); tokenRefresh.ts 2070->2090 (+20 = codex 401 defense-in-depth unrecoverable-refresh guard, #4686); token-refresh-service.test.ts 1322->1353 (+31 = 401-unfamiliar-payload regression case, #4686); translator-openai-responses-req.test.ts 1047->1050 (+3 = reasoning_effort non-Copilot assertion update, #4688). All are the merged PRs own surgical additions at existing chokepoints.",+ "_rebaseline_2026_06_25_rc17b_leva2": "rc17 leva2 PR batch own growth (cohesive, not extractable): providerLimits.ts 950->955 (#4786 generalized accesstoken fallback); default.ts NEW frozen entry at 828 (#4729 anthropic-compatible Bearer + #4766 json_schema fallback + #4787 cline workos headers — three provider-specific header branches); openai-to-kiro.ts 807->814 (#4763 Claude-capability image gate); openai-responses.ts 923->937 (#4764 computeFinishReason guard); executor-default-base.test.ts 1339->1440 (#4766 json_schema fallback tests); translator-openai-to-kiro.test.ts 918->980 (#4763 non-Claude image gate tests)."}diff --git a/config/quality/quality-baseline.json b/config/quality/quality-baseline.jsonindex 19c0643a18..40ee0e1194 100644--- a/config/quality/quality-baseline.json+++ b/config/quality/quality-baseline.json@@ -2,12 +2,13 @@"_comment": "Catraca de qualidade. 'down' = nao pode aumentar; 'up' = nao pode cair. Atualize via 'npm run quality:ratchet -- --update' (somente quando melhora). Cada valor e um numero REAL medido, nunca um chute. Cobertura entra na Fase 4 a partir de um run de cobertura mergeada no CI.","metrics": {"eslintWarnings": {- "value": 3970,+ "value": 3987,"direction": "down","_rebaseline_2026_06_25_v3836_release": "v3.8.36 cycle drift surfaced by the post-merge fix PR #5029 (the Quality Ratchet was SKIPPED on the release PR #4854 itself, and does NOT run on the PR→release fast-gates, so warnings accrued unmeasured across this cycle's 137 commits — Quota-Share Fase 2/3 features, god-file decomposition #3501/#4811-#4956, 14 external contributor PRs). 3912→3970 (+58), the exact value measured by the CI Quality Ratchet on #5029. Trust-but-verify: this fix PR touches ONLY scripts/build/pack-artifact-policy.ts (a string-literal allowlist array, scripts/ is eslint-light) and tests/integration/resilience-http-e2e.test.ts (2 string keys, no `any`) — 0 new warnings, so all +58 is inherited cycle drift (`any` warn-allowed in open-sse/ + tests/). Same precedent as _rebaseline_2026_06_23_v3835_release. Tighten via --require-tighten next cycle.","_rebaseline_2026_06_23_v3835_release": "v3.8.35 cycle drift surfaced by the release-green pre-flight (the Quality Ratchet does NOT run on PR→release fast-gates, so warnings accrued across this cycle's parallel-session merges — Compression Phase 4 #4694/#4707/#4716/#4720, chatCore #3501 leaf extractions, contributor PRs #4726/#4753/#4774/#4781/#4783/#4793, etc.). 3907→3912 (+5). Verified my release-finalize working tree touches ONLY docs/*.md (THREAT_MODEL), CHANGELOG.md, baselines, and 1 string line in scripts/check/check-fabricated-docs.mjs — 0 production-code change, so all +5 is inherited contributor drift. No coverage/openapi/i18n regressions.","_rebaseline_2026_06_22_v3834_release": "v3.8.34 cycle drift surfaced by the release-green pre-flight (the Quality Ratchet does NOT run on PR→release fast-gates, so warnings accrued across this cycle's parallel-session merges — #4583-4586/#4588-4593/#4606-4621/#4644/#4647/#4696/etc.). 3900→3907 (+7). Verified my release-finalize working tree touches ONLY CHANGELOG.md (git status: 0 code changes), so all +7 is inherited contributor drift. No coverage/openapi/i18n regressions.",- "_rebaseline_2026_06_22_v3833_release": "Cumulative cycle drift surfaced by the release PR full CI. 3867→3900 (+33)."+ "_rebaseline_2026_06_22_v3833_release": "Cumulative cycle drift surfaced by the release PR full CI. 3867→3900 (+33).",+ "_rebaseline_2026_06_26_v3837_release": "3970->3987. v3.8.37 cycle drift surfaced by the release-green pre-flight (the Quality Ratchet does NOT run on PR->release fast-gates, so warnings/complexity accrued unmeasured across this cycle's 76 commits — provider adds DGrid/Pioneer/xAI, headroom proxy lifecycle #4649, ~50 SSE/translator fixes, Engine Combos #5062). Trust-but-verify: this release-finalize working tree touches ONLY CHANGELOG.md, docs/i18n/*/CHANGELOG.md mirrors, and these baselines — 0 production-code change, so all drift is inherited cycle drift (`any` warn-allowed in open-sse/ + tests/). Tighten via --require-tighten next cycle."},"eslintErrors": {"value": 0,@@ -95,17 +96,19 @@"eps": 0.5},"deadExports": {- "value": 343,+ "value": 345,"direction": "down",- "dedicatedGate": true+ "dedicatedGate": true,+ "_rebaseline_2026_06_26_v3837_release": "343->345. v3.8.37 cycle drift surfaced by the release-green pre-flight (the Quality Ratchet does NOT run on PR->release fast-gates, so warnings/complexity accrued unmeasured across this cycle's 76 commits — provider adds DGrid/Pioneer/xAI, headroom proxy lifecycle #4649, ~50 SSE/translator fixes, Engine Combos #5062). Trust-but-verify: this release-finalize working tree touches ONLY CHANGELOG.md, docs/i18n/*/CHANGELOG.md mirrors, and these baselines — 0 production-code change, so all drift is inherited cycle drift (`any` warn-allowed in open-sse/ + tests/). Tighten via --require-tighten next cycle."},"cognitiveComplexity": {- "value": 816,+ "value": 826,"direction": "down","dedicatedGate": true,"_rebaseline_2026_06_25_v3836_release": "801→816 (+15) — v3.8.36 cycle drift surfaced by the fix-PR #5029 CI (cognitive-complexity does NOT run on PR→release fast-gates, and the Quality Ratchet job was SKIPPED on the release PR #4854 itself, so the +15 from this cycle's 137 commits accrued unmeasured). Measured locally = 816 (identical to the CI Cognitive complexity ratchet). Drift from legit cycle features (Quota-Share Fase 2/3, task-aware/Fusion combo, contributor provider/translator branches); god-file decomposition #3501 is complexity-neutral. This fix-PR touches only pack-artifact-policy.ts + a test + the 2 baseline JSONs — contributes 0. Structural shrink tracked in #3501.","_rebaseline_2026_06_22_v3834_release": "797→801 (+4) — v3.8.34 cycle drift surfaced by the release-green pre-flight (cognitive-complexity does NOT run on PR→release fast-gates). Verified my release-finalize working tree touches ONLY CHANGELOG.md (git status: 0 code changes), so all +4 is inherited contributor drift from this cycle's parallel-session merges. Structural shrink tracked in #3501.",- "_rebaseline_2026_06_22_v3833_release": "793→797 (+4) — pre-existing cycle drift on origin/release/v3.8.33."+ "_rebaseline_2026_06_22_v3833_release": "793→797 (+4) — pre-existing cycle drift on origin/release/v3.8.33.",+ "_rebaseline_2026_06_26_v3837_release": "816->826. v3.8.37 cycle drift surfaced by the release-green pre-flight (the Quality Ratchet does NOT run on PR->release fast-gates, so warnings/complexity accrued unmeasured across this cycle's 76 commits — provider adds DGrid/Pioneer/xAI, headroom proxy lifecycle #4649, ~50 SSE/translator fixes, Engine Combos #5062). Trust-but-verify: this release-finalize working tree touches ONLY CHANGELOG.md, docs/i18n/*/CHANGELOG.md mirrors, and these baselines — 0 production-code change, so all drift is inherited cycle drift (`any` warn-allowed in open-sse/ + tests/). Tighten via --require-tighten next cycle."},"typeCoveragePct": {"value": 92.17,diff --git a/docs/README.md b/docs/README.mdindex 4ca2ffbefe..c56c8f8923 100644--- a/docs/README.md+++ b/docs/README.md@@ -78,7 +78,7 @@ Pluggable subsystems exposed to clients, agents, and operators.Combo routing, scoring, and replay.-- [AUTO-COMBO.md](routing/AUTO-COMBO.md) — Auto-Combo (9-factor scoring, 15 strategies).+- [AUTO-COMBO.md](routing/AUTO-COMBO.md) — Auto-Combo (9-factor scoring, 17 strategies).- [REASONING_REPLAY.md](routing/REASONING_REPLAY.md) — reasoning replay flow.## security/diff --git a/docs/architecture/ARCHITECTURE.md b/docs/architecture/ARCHITECTURE.mdindex 9d5f00735c..938c52e9f6 100644--- a/docs/architecture/ARCHITECTURE.md+++ b/docs/architecture/ARCHITECTURE.md@@ -365,9 +365,11 @@ relying on a static combo definition. It powers the `auto/*` model prefix familyKey capabilities:-- **14 routing strategies** (priority, weighted, fill-first, round-robin, P2C, random,- least-used, cost-optimized, strict-random, **auto**, lkgp, context-optimized,- context-relay, plus a fallback path) — auto is the headline addition in v3.8.0.+- **17 routing strategies** (priority, weighted, fill-first, round-robin, P2C, random,+ least-used, cost-optimized, reset-aware, reset-window, headroom, strict-random,+ **auto**, lkgp, context-optimized, context-relay, **fusion**, plus a fallback path) —+ auto is the headline addition in v3.8.0; `fusion` (panel fan-out + judge synthesis,+ `open-sse/services/fusion.ts`) is new in v3.8.36.- **9-factor scoring**: cost, latency p95, success rate, quota headroom, lockoutproximity, breaker state, recent failures, model availability, and tag affinity.- **Virtual factory** materializes ephemeral combos when no matching named combodiff --git a/docs/architecture/RESILIENCE_GUIDE.md b/docs/architecture/RESILIENCE_GUIDE.mdindex 9c5187b92d..0c94cab8f6 100644--- a/docs/architecture/RESILIENCE_GUIDE.md+++ b/docs/architecture/RESILIENCE_GUIDE.md@@ -201,7 +201,7 @@ Bounded by `comboCooldownWait` (`enabled`, `maxWaitMs` 5s, `maxAttempts` 2,## Other Resilience Features-- **14 routing strategies** (priority, weighted, round-robin, context-relay, fill-first, p2c, random, least-used, cost-optimized, reset-aware, strict-random, auto, lkgp, context-optimized) — see [AUTO-COMBO.md](../routing/AUTO-COMBO.md).+- **17 routing strategies** (priority, weighted, round-robin, context-relay, fill-first, p2c, random, least-used, cost-optimized, reset-aware, reset-window, headroom, strict-random, auto, lkgp, context-optimized, fusion) — see [AUTO-COMBO.md](../routing/AUTO-COMBO.md).- **Reset-aware routing** (v3.8.0) — prioritizes connections by quota reset time.- **Background mode degradation** — Responses API `background: true` degraded to sync with warning.- **Dynamic tool limit detection** — backs off providers when tool count limits hit.diff --git a/docs/comparison/OMNIROUTE_VS_ALTERNATIVES.md b/docs/comparison/OMNIROUTE_VS_ALTERNATIVES.mdindex b7d7af4b1e..a62c4ccef0 100644--- a/docs/comparison/OMNIROUTE_VS_ALTERNATIVES.md+++ b/docs/comparison/OMNIROUTE_VS_ALTERNATIVES.md@@ -16,7 +16,7 @@ Objective feature comparison vs popular open-source AI routers.| **Providers** | **207+** | ~100 | ~50 | ~30 || **Self-hostable** | ✅ | ✅ | ❌ | ⚠ paid || **OAuth providers (Claude, Codex, Copilot, etc.)** | **15+** | partial | ❌ | ❌ |-| **Auto-fallback combos** | **15 strategies** | priority-based | tier-based | weighted |+| **Auto-fallback combos** | **17 strategies** | priority-based | tier-based | weighted || **Tier 1/2/3 fallback (subscription→cheap→free)** | ✅ + UI | manual | n/a | manual || **Token compression** | RTK (47 filters) + Caveman | none | none | none || **Built-in MCP server** | ✅ 87 tools, 30 scopes | ❌ | ❌ | ❌ |diff --git a/docs/diagrams/request-pipeline.mmd b/docs/diagrams/request-pipeline.mmdindex d0883aa76c..88261da1b5 100644--- a/docs/diagrams/request-pipeline.mmd+++ b/docs/diagrams/request-pipeline.mmd@@ -13,7 +13,7 @@ flowchart LRCache -->|yes| Return["Return cached"]Cache -->|no| Rate["Rate limit<br/>(per-key, per-IP)"]Rate --> Combo{"Combo<br/>target?"}- Combo -->|combo| Resolve["resolveComboTargets<br/>(14 strategies)"]+ Combo -->|combo| Resolve["resolveComboTargets<br/>(17 strategies)"]Resolve --> Single["handleSingleModel<br/>(per target)"]Combo -->|single| SingleSingle --> Translate["translateRequest<br/>(OpenAI↔Claude↔Gemini)"]diff --git a/docs/frameworks/OPEN_SSE_ARCHITECTURE.md b/docs/frameworks/OPEN_SSE_ARCHITECTURE.mdindex 821a0588cc..efdc823e75 100644--- a/docs/frameworks/OPEN_SSE_ARCHITECTURE.md+++ b/docs/frameworks/OPEN_SSE_ARCHITECTURE.md@@ -226,7 +226,7 @@ export async function handleComboChat(body, comboId): Promise<ChatResult> {}```-Supports **15 routing strategies** (see `src/shared/constants/routingStrategies.ts`):+Supports **17 routing strategies** (see `src/shared/constants/routingStrategies.ts`):| Strategy | Behavior ||----------|----------|@@ -241,10 +241,12 @@ Supports **15 routing strategies** (see `src/shared/constants/routingStrategies.| `cost-optimized` | Cheapest healthy target first || `reset-aware` | Aware of provider reset windows || `reset-window` | Reset window-based routing |+| `headroom` | Most remaining quota headroom first || `strict-random` | Truly uniform (no quality weighting) || `auto` | Use 9-factor scoring (`autoCombo/`) || `lkgp` | Last known good provider first || `context-optimized` | Best for long-context requests |+| `fusion` | Fan out to a panel in parallel, then synthesize via a judge (`fusion.ts`) |### base.ts (1170 LOC)diff --git a/docs/guides/FEATURES.md b/docs/guides/FEATURES.mdindex 39b7877f5f..b240ba9037 100644--- a/docs/guides/FEATURES.md+++ b/docs/guides/FEATURES.md@@ -61,7 +61,7 @@ OpenRouter connections can store a per-connection `preset` in Advanced Settings.## 🎨 Combos-Create model routing combos with 14 strategies: priority, weighted, fill-first, round-robin, p2c (power-of-two-choices), random, least-used, cost-optimized, reset-aware, strict-random, auto, lkgp (last-known-good-provider), context-optimized, and **context-relay**. Each combo chains multiple models with automatic fallback and includes quick templates and readiness checks.+Create model routing combos with 17 strategies: priority, weighted, fill-first, round-robin, p2c (power-of-two-choices), random, least-used, cost-optimized, reset-aware, reset-window, headroom, strict-random, auto, lkgp (last-known-good-provider), context-optimized, context-relay, and **fusion** (fan out to a panel of models in parallel, then synthesize one answer via a judge). Each combo chains multiple models with automatic fallback and includes quick templates and readiness checks.Recent combo improvements:diff --git a/docs/i18n/ar/CHANGELOG.md b/docs/i18n/ar/CHANGELOG.mdindex 89afe8ca7d..29b2f7b4a8 100644--- a/docs/i18n/ar/CHANGELOG.md+++ b/docs/i18n/ar/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/az/CHANGELOG.md b/docs/i18n/az/CHANGELOG.mdindex cf2d935f24..16907c9875 100644--- a/docs/i18n/az/CHANGELOG.md+++ b/docs/i18n/az/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/bg/CHANGELOG.md b/docs/i18n/bg/CHANGELOG.mdindex cf2d935f24..16907c9875 100644--- a/docs/i18n/bg/CHANGELOG.md+++ b/docs/i18n/bg/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/bn/CHANGELOG.md b/docs/i18n/bn/CHANGELOG.mdindex 9b58d0487d..a290218473 100644--- a/docs/i18n/bn/CHANGELOG.md+++ b/docs/i18n/bn/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/cs/CHANGELOG.md b/docs/i18n/cs/CHANGELOG.mdindex f8b3eca0c9..ab66a42906 100644--- a/docs/i18n/cs/CHANGELOG.md+++ b/docs/i18n/cs/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/da/CHANGELOG.md b/docs/i18n/da/CHANGELOG.mdindex 51948487a1..7224e25c46 100644--- a/docs/i18n/da/CHANGELOG.md+++ b/docs/i18n/da/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/de/CHANGELOG.md b/docs/i18n/de/CHANGELOG.mdindex 97f29ab9e4..b0936c06cd 100644--- a/docs/i18n/de/CHANGELOG.md+++ b/docs/i18n/de/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/es/CHANGELOG.md b/docs/i18n/es/CHANGELOG.mdindex 863cd1e9b1..6e4d87c5eb 100644--- a/docs/i18n/es/CHANGELOG.md+++ b/docs/i18n/es/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/fa/CHANGELOG.md b/docs/i18n/fa/CHANGELOG.mdindex f5d31c7a06..2ee6881a4e 100644--- a/docs/i18n/fa/CHANGELOG.md+++ b/docs/i18n/fa/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/fi/CHANGELOG.md b/docs/i18n/fi/CHANGELOG.mdindex 99a417809b..f91ca4bbfc 100644--- a/docs/i18n/fi/CHANGELOG.md+++ b/docs/i18n/fi/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/fr/CHANGELOG.md b/docs/i18n/fr/CHANGELOG.mdindex bfd7145007..a94afc017f 100644--- a/docs/i18n/fr/CHANGELOG.md+++ b/docs/i18n/fr/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/gu/CHANGELOG.md b/docs/i18n/gu/CHANGELOG.mdindex de18b7c00c..7c24e33244 100644--- a/docs/i18n/gu/CHANGELOG.md+++ b/docs/i18n/gu/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/he/CHANGELOG.md b/docs/i18n/he/CHANGELOG.mdindex 80a9cb71ca..336debb7fc 100644--- a/docs/i18n/he/CHANGELOG.md+++ b/docs/i18n/he/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/hi/CHANGELOG.md b/docs/i18n/hi/CHANGELOG.mdindex 7c9f3b6775..0e1821a90a 100644--- a/docs/i18n/hi/CHANGELOG.md+++ b/docs/i18n/hi/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/hu/CHANGELOG.md b/docs/i18n/hu/CHANGELOG.mdindex cfa2904521..8d4f23d490 100644--- a/docs/i18n/hu/CHANGELOG.md+++ b/docs/i18n/hu/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/id/CHANGELOG.md b/docs/i18n/id/CHANGELOG.mdindex c2b0948921..208f8983e6 100644--- a/docs/i18n/id/CHANGELOG.md+++ b/docs/i18n/id/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/in/CHANGELOG.md b/docs/i18n/in/CHANGELOG.mdindex 6e6652edec..33ab8b744f 100644--- a/docs/i18n/in/CHANGELOG.md+++ b/docs/i18n/in/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/it/CHANGELOG.md b/docs/i18n/it/CHANGELOG.mdindex ddd1c6c2c7..f18d7baad7 100644--- a/docs/i18n/it/CHANGELOG.md+++ b/docs/i18n/it/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/ja/CHANGELOG.md b/docs/i18n/ja/CHANGELOG.mdindex 6f06951f86..3d621f9b94 100644--- a/docs/i18n/ja/CHANGELOG.md+++ b/docs/i18n/ja/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/ko/CHANGELOG.md b/docs/i18n/ko/CHANGELOG.mdindex b914a8a7b9..857c13825a 100644--- a/docs/i18n/ko/CHANGELOG.md+++ b/docs/i18n/ko/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/mr/CHANGELOG.md b/docs/i18n/mr/CHANGELOG.mdindex 161ac93e23..ff090cacbd 100644--- a/docs/i18n/mr/CHANGELOG.md+++ b/docs/i18n/mr/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/ms/CHANGELOG.md b/docs/i18n/ms/CHANGELOG.mdindex cea2a3444c..dcb29dd631 100644--- a/docs/i18n/ms/CHANGELOG.md+++ b/docs/i18n/ms/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/nl/CHANGELOG.md b/docs/i18n/nl/CHANGELOG.mdindex edd232ab2d..a3daac861b 100644--- a/docs/i18n/nl/CHANGELOG.md+++ b/docs/i18n/nl/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/no/CHANGELOG.md b/docs/i18n/no/CHANGELOG.mdindex b5389638a0..db6f40b4a5 100644--- a/docs/i18n/no/CHANGELOG.md+++ b/docs/i18n/no/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/phi/CHANGELOG.md b/docs/i18n/phi/CHANGELOG.mdindex 6e2e331cfa..673bba6927 100644--- a/docs/i18n/phi/CHANGELOG.md+++ b/docs/i18n/phi/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/pl/CHANGELOG.md b/docs/i18n/pl/CHANGELOG.mdindex bbe5cc859b..95439e9401 100644--- a/docs/i18n/pl/CHANGELOG.md+++ b/docs/i18n/pl/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/pt-BR/CHANGELOG.md b/docs/i18n/pt-BR/CHANGELOG.mdindex b3676533c1..988df79449 100644--- a/docs/i18n/pt-BR/CHANGELOG.md+++ b/docs/i18n/pt-BR/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/pt/CHANGELOG.md b/docs/i18n/pt/CHANGELOG.mdindex 685fed1c2e..a696d04e63 100644--- a/docs/i18n/pt/CHANGELOG.md+++ b/docs/i18n/pt/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/ro/CHANGELOG.md b/docs/i18n/ro/CHANGELOG.mdindex 293cc84ad0..7f2f882c99 100644--- a/docs/i18n/ro/CHANGELOG.md+++ b/docs/i18n/ro/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/ru/CHANGELOG.md b/docs/i18n/ru/CHANGELOG.mdindex ea2ed3f8d4..e87ce53eb8 100644--- a/docs/i18n/ru/CHANGELOG.md+++ b/docs/i18n/ru/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/sk/CHANGELOG.md b/docs/i18n/sk/CHANGELOG.mdindex a8bbe4ecfc..96c9003f29 100644--- a/docs/i18n/sk/CHANGELOG.md+++ b/docs/i18n/sk/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/sv/CHANGELOG.md b/docs/i18n/sv/CHANGELOG.mdindex 5be49ed849..8af7823f12 100644--- a/docs/i18n/sv/CHANGELOG.md+++ b/docs/i18n/sv/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/sw/CHANGELOG.md b/docs/i18n/sw/CHANGELOG.mdindex 3371ce8419..b5900960f7 100644--- a/docs/i18n/sw/CHANGELOG.md+++ b/docs/i18n/sw/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/ta/CHANGELOG.md b/docs/i18n/ta/CHANGELOG.mdindex 8a038bf8f8..5dbddc7f1c 100644--- a/docs/i18n/ta/CHANGELOG.md+++ b/docs/i18n/ta/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/te/CHANGELOG.md b/docs/i18n/te/CHANGELOG.mdindex 840fbb9a3f..8a8a1f3d5c 100644--- a/docs/i18n/te/CHANGELOG.md+++ b/docs/i18n/te/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/th/CHANGELOG.md b/docs/i18n/th/CHANGELOG.mdindex c29add6041..85a2479c70 100644--- a/docs/i18n/th/CHANGELOG.md+++ b/docs/i18n/th/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/tr/CHANGELOG.md b/docs/i18n/tr/CHANGELOG.mdindex 243c717932..eabb512eb8 100644--- a/docs/i18n/tr/CHANGELOG.md+++ b/docs/i18n/tr/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/uk-UA/CHANGELOG.md b/docs/i18n/uk-UA/CHANGELOG.mdindex af94f3ff56..b3192c2bf3 100644--- a/docs/i18n/uk-UA/CHANGELOG.md+++ b/docs/i18n/uk-UA/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/ur/CHANGELOG.md b/docs/i18n/ur/CHANGELOG.mdindex 0817f3ab1b..71b76d76f3 100644--- a/docs/i18n/ur/CHANGELOG.md+++ b/docs/i18n/ur/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/vi/CHANGELOG.md b/docs/i18n/vi/CHANGELOG.mdindex e15d11cd74..5b4cac11d1 100644--- a/docs/i18n/vi/CHANGELOG.md+++ b/docs/i18n/vi/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/i18n/zh-CN/CHANGELOG.md b/docs/i18n/zh-CN/CHANGELOG.mdindex f102ef23d6..337bb1b3ae 100644--- a/docs/i18n/zh-CN/CHANGELOG.md+++ b/docs/i18n/zh-CN/CHANGELOG.md@@ -6,6 +6,162 @@## [3.8.31] — 2026-06-20+## [3.8.37] — 2026-06-26++### ✨ New Features++- **feat(providers):** add DGrid AI gateway provider — OpenAI-compatible gateway at `api.dgrid.ai/v1` (alias `dgrid`, API-key auth, passthrough models). Free router tier (10 RPM / 100 RPD); a $5 lifetime top-up raises limits to 20 RPM / 1,000 RPD. ([#4931](https://github.com/diegosouzapw/OmniRoute/pull/4931) — thanks @dgridOP)++- **feat(providers):** add Pioneer AI (Fastino Labs) provider — OpenAI-compatible chat completions at `api.pioneer.ai/v1`. Registered with alias `pn`, `X-API-Key` auth, and a catalog of 10 open-tier serverless models (Qwen3, Llama 3.1/3.2, Gemma 3, SmolLM3). Free $75 credits, no credit card required. Gated enterprise models (Claude/GPT/Gemini) require prior fine-tuning on the Pioneer platform and are intentionally excluded from the catalog. ([#4909](https://github.com/diegosouzapw/OmniRoute/pull/4909) — thanks @HikiNarou)++- **feat(providers):** add xAI Grok inbound translators and a thinking patcher — Grok requests are now translated on the inbound path and reasoning is normalized so Grok modes behave consistently across clients. ([#4910](https://github.com/diegosouzapw/OmniRoute/pull/4910) — thanks @mugnimaestra)++- **feat(oauth):** Codex bulk-import endpoint — `POST /api/oauth/codex/import` accepts multiple Codex OAuth credentials in one call for fast multi-account onboarding. ([#4914](https://github.com/diegosouzapw/OmniRoute/pull/4914) — thanks @beaaan)++- **feat(embeddings):** add a `dimensions` override field to embedding combos so an embedding combo can pin the output vector size per target. ([#4913](https://github.com/diegosouzapw/OmniRoute/pull/4913) — thanks @wenzetan)++- **feat(sse):** auto-promote successful combo model — a new opt-in `comboAutoPromoteEnabled` setting reorders a combo's persisted model list so that, when a combo model responds successfully, it is moved to position #1 for future requests. ([#4852](https://github.com/diegosouzapw/OmniRoute/pull/4852) — thanks @arssnndr)++- **feat(sse):** add toggleable tool-source diagnostics — an opt-in switch surfaces where each tool definition originated when debugging tool-routing issues. ([#4856](https://github.com/diegosouzapw/OmniRoute/pull/4856) — thanks @DuyPrX)++- **feat(headroom):** proxy lifecycle management + dashboard UI — start/stop/monitor a Headroom compression proxy from the dashboard, with Docker sidecar support. ([#4649](https://github.com/diegosouzapw/OmniRoute/pull/4649) — thanks @diegosouzapw / @carmelogunsroses)++- **feat(sse):** `x-omniroute-strip-reasoning` request header to drop `reasoning_content` from upstream responses (opt-in, preserving reasoning-aware clients). ([#4678](https://github.com/diegosouzapw/OmniRoute/pull/4678) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(cli):** multi-model support for the Factory Droid CLI integration. ([#4682](https://github.com/diegosouzapw/OmniRoute/pull/4682) — thanks @anuragg-saxenaa / @diegosouzapw)++- **feat(sse):** parse Gemini CLI 429 `retryDelay` from the structured `RetryInfo` payload so cooldowns honor the upstream-provided backoff. ([#4738](https://github.com/diegosouzapw/OmniRoute/pull/4738) — thanks @NoxzRCW)++- **feat(sse):** add GPT-4 and GPT-4o mini to the GitHub Copilot provider catalog. ([#4798](https://github.com/diegosouzapw/OmniRoute/pull/4798), [#4797](https://github.com/diegosouzapw/OmniRoute/pull/4797) — thanks @decolua)++- **feat(api):** add the `MiniMax-M3` pricing row (canonical + lowercase alias) so the new MiniMax default model gets accurate per-request cost accounting instead of falling back to a zero/default rate. ([#4814](https://github.com/diegosouzapw/OmniRoute/pull/4814) — thanks @octo-patch)++### 🔧 Bug Fixes++- **fix(sse):** dense, deterministic `response.output` ordering in `response.completed` — items are now sorted by their actual `output_index` (via a recorded-as-emitted accumulator + stable sort) instead of being rebuilt from unordered state dicts; `normalizeOutputIndex` replaces fragile `parseInt` calls for robust index coercion; superseded tool calls (replaced at the same index mid-stream) are excluded from the final output array. ([#4906](https://github.com/diegosouzapw/OmniRoute/pull/4906) — thanks @Marco9113)++- **fix(sse):** normalize Codex custom/freeform tools (`apply_patch`, `type:"custom"` with no `parameters`) to a `{ input: string }` function schema instead of an empty schema — the empty schema made models invoke `apply_patch` with `{}`, breaking the Codex runtime which expects `{ input: string }`. Also maps `custom_tool_call` / `custom_tool_call_output` input items and streams `apply_patch` tool calls via `custom_tool_call_input.delta`/`.done` events. ([#4862](https://github.com/diegosouzapw/OmniRoute/pull/4862) — thanks @nstung463)++- **fix(sse):** preserve the `required` array when translating Draft 2020-12 antigravity tool schemas (e.g. from OpenCode), stripping unsupported JSON Schema meta keywords while keeping mandatory arguments required so the model no longer calls tools without them. ([#4843](https://github.com/diegosouzapw/OmniRoute/pull/4843) — thanks @anuragg-saxenaa)++- **fix(sse):** Kiro tool-schema sanitizer — strip unsupported JSON-Schema keywords (`anyOf`/`$ref`/`if`-`then`, etc.) and hash-truncate tool names >64 chars before dispatch, mapping the streamed tool-call name back for the client, so Kiro no longer rejects tool calls with `400 "Improperly formed request"`. ([#4847](https://github.com/diegosouzapw/OmniRoute/pull/4847) — thanks @smarthomeblack)++- **fix(sse):** make the `anthropic-version` default-guard case-insensitive for `anthropic-compatible-*` providers, so a caller/operator-supplied `Anthropic-Version` (any casing) is no longer clobbered by a second lowercase `anthropic-version: 2023-06-01` header. ([#4823](https://github.com/diegosouzapw/OmniRoute/pull/4823) — thanks @zakirkun)++- **fix(db):** validate HuggingFace API tokens via the `whoami-v2` endpoint as a pure auth probe so fine-grained Inference-Provider tokens (valid even when model/task endpoints reject them) are no longer falsely marked invalid; only 401/403 means an invalid key, other non-OK statuses surface as transient upstream errors. ([#4819](https://github.com/diegosouzapw/OmniRoute/pull/4819) — thanks @Delcado19)++- **fix(sse):** reject the Anthropic-only `[1m]` context-1m suffix in `buildKiroPayload` before it reaches AWS Bedrock — Kiro is Bedrock-backed and cannot honor the beta, so a forwarded `kr/*[1m]` model id was malformed upstream; callers now get a clear error pointing them at a direct-Anthropic provider for 1M-context routing. ([#4816](https://github.com/diegosouzapw/OmniRoute/pull/4816) — thanks @Delcado19)++- **fix(dashboard):** align the Engine Combos editor engines with the API schema — the named-combos pipeline dropdown offered four engines (`headroom`, `session-dedup`, `ccr`, `llmlingua`) that `PUT /api/context/combos/[id]` rejects, so selecting one made the save return 400 while the UI swallowed the error. The dropdown is now sourced from a single canonical engine map shared with `stackedPipelineStepSchema` (parity guarded by a unit test), and the editor surfaces save errors plus empty-name/empty-pipeline validation instead of failing quietly. ([#5062](https://github.com/diegosouzapw/OmniRoute/pull/5062) — closes #4955)++- **fix(sse):** surface malformed HTTP-200 upstream responses instead of treating them as success, so combo fallback can trigger. ([#4942](https://github.com/diegosouzapw/OmniRoute/pull/4942) — thanks @haipham22)++- **fix(antigravity):** retry transient upstream failures rather than failing the request outright. ([#4941](https://github.com/diegosouzapw/OmniRoute/pull/4941) — thanks @Jordannst)++- **fix(sse):** exclude WS-bridge controller-closed errors from the provider circuit breaker so a client disconnect no longer trips the whole provider. ([#4870](https://github.com/diegosouzapw/OmniRoute/pull/4870) — closes #4602, thanks @huohua-dev)++- **fix(sse):** resolve custom combos by id and case-insensitive name. ([#4869](https://github.com/diegosouzapw/OmniRoute/pull/4869) — closes #4446, thanks @herjarsa)++- **fix(sse):** forward AI SDK image parts in the Responses translator. ([#4859](https://github.com/diegosouzapw/OmniRoute/pull/4859) — thanks @mugnimaestra)++- **fix(sse):** emit valid concatenable Kiro `tool_calls.arguments` deltas. ([#4855](https://github.com/diegosouzapw/OmniRoute/pull/4855) — thanks @wahyuzero)++- **fix(sse):** strip `temperature` for Claude models with extended thinking enabled (the upstream rejects it). ([#4853](https://github.com/diegosouzapw/OmniRoute/pull/4853) — thanks @noestelar)++- **fix(sse):** unwrap the Qoder HTTP-200 SSE error envelope so combo fallback can trigger. ([#4850](https://github.com/diegosouzapw/OmniRoute/pull/4850) — thanks @vianlearns)++- **fix(sse):** strip reasoning blobs from agentic context to prevent O(n²) token growth across multi-turn agent loops. ([#4849](https://github.com/diegosouzapw/OmniRoute/pull/4849) — thanks @GodrezJr2)++- **fix(sse):** close the reasoning block before message content in the Responses stream so clients render reasoning and answer in the right order. ([#4848](https://github.com/diegosouzapw/OmniRoute/pull/4848) — thanks @kwanLeeFrmVi)++- **fix(config):** sync the full SiliconFlow model list into the registry. ([#4844](https://github.com/diegosouzapw/OmniRoute/pull/4844) — thanks @letanphuc)++- **fix(sse):** strip Composer `<|final|>` sentinel markers that leaked after Composer reasoning. ([#4842](https://github.com/diegosouzapw/OmniRoute/pull/4842) — thanks @noestelar)++- **fix(build):** trace-include `sql.js`'s `sql-wasm.wasm` in the standalone bundle so SQLite-WASM works in the packaged build. ([#4839](https://github.com/diegosouzapw/OmniRoute/pull/4839) — thanks @Delcado19)++- **fix(cli):** persist lazily-installed native runtime deps (`better-sqlite3`, `systray2`) to the shared runtime `package.json` with `--save-exact` instead of `--no-save`, so installing one no longer prunes the other as "extraneous" — fixing a "No SQLite driver available" failure after a `--tray` install. ([#4841](https://github.com/diegosouzapw/OmniRoute/pull/4841) — thanks @omartuhintvs)++- **fix(sse):** resolve bare model names to a connection's `defaultModel` before upstream calls. ([#4825](https://github.com/diegosouzapw/OmniRoute/pull/4825) — thanks @anuragg-saxenaa)++- **fix(api):** surface a Docker-localhost hint on provider-node validation connection errors. ([#4822](https://github.com/diegosouzapw/OmniRoute/pull/4822) — thanks @anuragg-saxenaa)++- **fix(sse):** strip Gemini built-in tools when `functionDeclarations` are present in the Antigravity envelope (the two are mutually exclusive upstream). ([#4821](https://github.com/diegosouzapw/OmniRoute/pull/4821) — thanks @vanszs)++- **fix(sse):** strip `X-Stainless-*` headers and normalize the SDK `User-Agent` for OpenAI-compatible endpoints. ([#4820](https://github.com/diegosouzapw/OmniRoute/pull/4820) — thanks @anuragg-saxenaa)++- **fix(oauth):** allow a per-connection refresh lead-time override via `providerSpecificData.refreshLeadMs`. ([#4818](https://github.com/diegosouzapw/OmniRoute/pull/4818) — thanks @anuragg-saxenaa)++- **fix(dashboard):** resolve passthrough model aliases by `providerId` in `ModelSelectModal`. ([#4815](https://github.com/diegosouzapw/OmniRoute/pull/4815) — thanks @anuragg-saxenaa)++- **fix(sse):** strip `enumDescriptions` from Antigravity tool schemas. ([#4813](https://github.com/diegosouzapw/OmniRoute/pull/4813), [#4740](https://github.com/diegosouzapw/OmniRoute/pull/4740) — thanks @anuragg-saxenaa)++- **fix(dashboard):** keep the desktop sidebar visible via an explicit CSS class. ([#4812](https://github.com/diegosouzapw/OmniRoute/pull/4812) — thanks @Delcado19)++- **fix(sse):** filter nameless hosted tools when converting Responses API to Chat format. ([#4789](https://github.com/diegosouzapw/OmniRoute/pull/4789) — upstream, thanks Владимир Акимов)++- **fix(sse):** stream-writer mock `abort()` now returns a Promise (test-stability fix). ([#4788](https://github.com/diegosouzapw/OmniRoute/pull/4788) — thanks @decolua)++- **fix(sse):** use the WorkOS auth-token shape for Cline. ([#4787](https://github.com/diegosouzapw/OmniRoute/pull/4787) — thanks @apeltekci)++- **fix(api):** fall back to the existing access token for any OAuth provider when a refresh fails. ([#4786](https://github.com/diegosouzapw/OmniRoute/pull/4786) — thanks @decolua)++- **fix(sse):** read Antigravity usage from the `response.usageMetadata` envelope. ([#4785](https://github.com/diegosouzapw/OmniRoute/pull/4785) — thanks @decolua)++- **fix(oauth):** verify Cursor installation on Linux before auto-import. ([#4770](https://github.com/diegosouzapw/OmniRoute/pull/4770) — upstream, thanks Ibrahim Ryan)++- **fix(cli):** fall back to the default data dir when `DATA_DIR` is not writable. ([#4767](https://github.com/diegosouzapw/OmniRoute/pull/4767) — upstream, thanks Thiên Toán)++- **fix(sse):** `json_schema` fallback for OpenAI-compatible providers that don't support structured outputs. ([#4766](https://github.com/diegosouzapw/OmniRoute/pull/4766) — thanks @mustafabozkaya)++- **fix(cli):** verify launchd registration and skip self-SIGTERM in macOS autostart. ([#4765](https://github.com/diegosouzapw/OmniRoute/pull/4765) — thanks @ntdung6868)++- **fix(sse):** finalize the `tool_calls` `finish_reason` on early stream end in the OpenAI Responses translator. ([#4764](https://github.com/diegosouzapw/OmniRoute/pull/4764) — thanks @decolua)++- **fix(sse):** gate Kiro image attachments behind a Claude-capability check. ([#4763](https://github.com/diegosouzapw/OmniRoute/pull/4763) — thanks @decolua)++- **fix(sse):** track Ollama streaming usage from raw NDJSON chunks. ([#4754](https://github.com/diegosouzapw/OmniRoute/pull/4754) — thanks @fresent)++- **fix(sse):** include low-level cause details in `formatProviderError`. ([#4741](https://github.com/diegosouzapw/OmniRoute/pull/4741) — thanks @decolua)++- **fix(executors):** `anthropic-compatible-*` gateways now get a `Bearer` token alongside `x-api-key`. ([#4729](https://github.com/diegosouzapw/OmniRoute/pull/4729) — thanks @hodtien)++- **fix(translator):** strip the `x-anthropic-billing-header` in the claude-to-openai path. ([#4728](https://github.com/diegosouzapw/OmniRoute/pull/4728) — thanks @weimaozhen)++- **fix(translator):** preserve `reasoning_effort` for non-Copilot Responses clients. ([#4688](https://github.com/diegosouzapw/OmniRoute/pull/4688) — thanks @ryanngit / @diegosouzapw)++- **fix(codex):** treat an OAuth 401 as an unrecoverable refresh failure (stop retrying a dead token). ([#4686](https://github.com/diegosouzapw/OmniRoute/pull/4686) — thanks @sacwooky / @diegosouzapw)++- **fix(translator):** coerce tool descriptions to strings in OpenAI normalization. ([#4675](https://github.com/diegosouzapw/OmniRoute/pull/4675) — thanks @East-rayyy / @diegosouzapw)++- **fix(dashboard):** stop double-masking an already-masked API key in the list view (E2E 3/9 regression). ([#4671](https://github.com/diegosouzapw/OmniRoute/pull/4671) — thanks @diegosouzapw)++- **fix(combo):** flatten Anthropic tool messages + tool history to prevent an upstream 503. ([#4648](https://github.com/diegosouzapw/OmniRoute/pull/4648) — thanks @warelik / @diegosouzapw)++- **fix(providers):** require a Default Model in the compatible-provider API-key setup flow. ([#4641](https://github.com/diegosouzapw/OmniRoute/pull/4641) — thanks @arden1601)++### 🔒 Security++- **fix(auth):** only trust forwarding headers (`X-Forwarded-For` / `X-Real-IP`) from loopback TCP peers, so a non-loopback client can't spoof its origin to bypass local-only route guards. ([#4689](https://github.com/diegosouzapw/OmniRoute/pull/4689) — thanks @Jordannst / @diegosouzapw)++- **fix(sse):** redact the API key from the AUTH debug log in the chat handler. ([#4858](https://github.com/diegosouzapw/OmniRoute/pull/4858) — thanks @sacwooky)++- **fix(oauth):** classify `/api/oauth/cursor/auto-import` as a local-only route in the route guard, so the loopback-enforced process-spawning endpoint can't be reached through a tunneled/leaked JWT (Hard Rule #17). ([#5070](https://github.com/diegosouzapw/OmniRoute/pull/5070) — thanks @diegosouzapw)++### 📝 Maintenance++- **chore(ci):** harden the release flow — decouple the Quality Ratchet from coverage-shard flakes (`if: !cancelled()` + `--allow-missing`), add fast-path drift gates (`check:complexity`, `check:cognitive-complexity`, `check:pack-policy`, `check:build-scope`), and raise the default build heap to 8 GB. ([#5054](https://github.com/diegosouzapw/OmniRoute/pull/5054) — thanks @diegosouzapw)++- **docs(routing):** sync the combo strategy docs for Fusion (17 strategies). ([#5067](https://github.com/diegosouzapw/OmniRoute/pull/5067) — thanks @diegosouzapw)++- **test(sse):** golden-lock the `provider.ts` translate-path across all providers. ([#4734](https://github.com/diegosouzapw/OmniRoute/pull/4734) — thanks @diegosouzapw / @decolua)++- **docs(env):** document `HEADROOM_URL` in `.env.example` + `ENVIRONMENT.md`. (thanks @diegosouzapw)++- **chore(quality):** rebaseline the file-size ratchet across the rc17 PR-batch levas (leva2/leva3/leva4) to absorb cycle drift. (thanks @diegosouzapw)++---+## [3.8.36] — 2026-06-25### ✨ New Featuresdiff --git a/docs/openapi.yaml b/docs/openapi.yamlindex 94c3865437..e9fa9c2949 100644--- a/docs/openapi.yaml+++ b/docs/openapi.yaml@@ -1,7 +1,7 @@openapi: 3.1.0info:title: OmniRoute API- version: 3.8.36+ version: 3.8.37description: |OmniRoute is a local-first AI API proxy router. It provides an OpenAI-compatibleendpoint that routes requests to multiple AI providers with load balancing,@@ -6672,10 +6672,13 @@ components:- least-used- cost-optimized- reset-aware+ - reset-window+ - headroom- strict-random- auto- lkgp- context-optimized+ - fusiondefault: prioritynodes:type: arraydiff --git a/docs/reference/ENVIRONMENT.md b/docs/reference/ENVIRONMENT.mdindex 9828821bed..5fef70fbac 100644--- a/docs/reference/ENVIRONMENT.md+++ b/docs/reference/ENVIRONMENT.md@@ -793,6 +793,7 @@ Anthropic-compatible provider instead.| `HEALTHCHECK_STAGGER_MS` | `3000` | `src/lib/tokenHealthCheck.ts` | Stagger interval (ms) between provider token healthchecks at startup. || `REQUEST_RETRY` | `2` | `src/sse/services/cooldownAwareRetry.ts` | Number of automatic retries on model-scoped cooldown responses before returning error to client. || `MAX_RETRY_INTERVAL_SEC` | `30` | `src/sse/services/cooldownAwareRetry.ts` | Max backoff interval (seconds) between cooldown retries. Capped by this value regardless of upstream `Retry-After`. |+| `HEADROOM_URL` | `http://localhost:8787` | `src/lib/headroom/detect.ts` | Headroom token-saver proxy URL. The dashboard lifecycle (`api/headroom/*`) spawns a local `headroom-ai` CLI on loopback by default; override only to point at an external Docker sidecar proxy. |### Stream-recovery tuning constants (not env vars)diff --git a/docs/routing/AUTO-COMBO.md b/docs/routing/AUTO-COMBO.mdindex ac5b6fe124..5006fe4516 100644--- a/docs/routing/AUTO-COMBO.md+++ b/docs/routing/AUTO-COMBO.md@@ -147,7 +147,7 @@ Notes:## All Routing Strategies-OmniRoute's combo engine supports **14 routing strategies** (declared in `src/shared/constants/routingStrategies.ts` → `ROUTING_STRATEGY_VALUES`). The Auto Combo engine itself is exposed under the `auto` strategy; the others are available for persisted combos.+OmniRoute's combo engine supports **17 routing strategies** (declared in `src/shared/constants/routingStrategies.ts` → `ROUTING_STRATEGY_VALUES`). The Auto Combo engine itself is exposed under the `auto` strategy; the others are available for persisted combos.| Strategy | Description || :------------------ | :----------------------------------------------------------------- |@@ -161,12 +161,74 @@ OmniRoute's combo engine supports **14 routing strategies** (declared in `src/sh| `least-used` | Pick target with lowest current load || `cost-optimized` | Minimize $ per request given catalog pricing || `reset-aware` ⭐ | Prioritize by quota reset time — short reset windows ranked higher |+| `reset-window` | Prefer targets whose quota window resets soonest |+| `headroom` | Pick the target with the most remaining quota headroom || `strict-random` | Random without deduplication of repeats || `auto` | Use Auto Combo scoring (9-factor) — **recommended** || `lkgp` | Last-Known-Good Path (sticky route to last successful target) || `context-optimized` | Pick target with best fit for current context size |+| `fusion` 🧬 | Fan out to a panel of models in parallel, then synthesize one answer via a judge (see below) |-⭐ = New in v3.8.0+⭐ = New in v3.8.0 · 🧬 = New in v3.8.36++## Fusion Strategy++`fusion` is the one strategy that does **not** pick a single target. It fans the prompt+out to **every panel model in parallel**, then a configurable **judge model** synthesizes+a single final answer from all panel responses. Ported from upstream `decolua/9router`+(OpenRouter's Fusion design); implementation in `open-sse/services/fusion.ts`.++How it works:++1. **Fan-out** — the prompt is sent to every panel model at once, forced non-streaming+ with tools stripped (the judge needs complete prose to synthesize).+2. **Quorum-grace collection** — as soon as `minPanel` answers arrive, a short grace+ timer starts for the stragglers, then fusion proceeds with whatever was collected.+ This caps the slowest model's penalty on wall time, bounded by a hard timeout.+3. **Judge synthesis** — panel answers are anonymized (`Source 1`, `Source 2`, … — so+ the judge weighs substance, not model brand) and handed to the judge, which analyzes+ consensus / contradictions / partial coverage / unique insights / blind spots, then+ writes **one** authoritative answer. The judge call keeps the client's original+ `stream` flag + tools, so streaming and downstream tool use still work.+4. **Graceful degradation** — 0 panel answers → `503`; exactly 1 survivor → that answer+ is returned directly (nothing to fuse); a single-model panel answers directly.++### Configuration++Configured on the combo's `config` blob (no schema migration — it reuses the existing+`combos` table):++| Field | Type | Default | Purpose |+| :--------------------------------- | :------- | :-------- | :----------------------------------------------------------- |+| `config.judgeModel` | `string` | first panel model | Model that synthesizes the final answer |+| `config.fusionTuning.minPanel` | `number` | `2` | Successful answers required before the grace timer starts (clamped to `[2, panelSize]`) |+| `config.fusionTuning.stragglerGraceMs` | `number` | `8000` | How long to wait for laggards once quorum is reached |+| `config.fusionTuning.panelHardTimeoutMs` | `number` | `90000` | Absolute cap so one hung model can't stall the request |++Defaults live in `FUSION_DEFAULTS` (`open-sse/services/fusion.ts`).++### Example++```bash+curl -X POST http://localhost:20128/api/combos \+ -H "Authorization: Bearer <key>" \+ -H "Content-Type: application/json" \+ -d '{+ "name": "fusion-panel",+ "strategy": "fusion",+ "targets": [+ { "model": "cc/claude-opus-4-7" },+ { "model": "cx/gpt-5.5" },+ { "model": "glm/glm-5.1" }+ ],+ "config": {+ "judgeModel": "cc/claude-opus-4-7",+ "fusionTuning": { "minPanel": 2, "stragglerGraceMs": 8000, "panelHardTimeoutMs": 90000 }+ }+ }'+```++Then call it like any combo: `{"model":"fusion-panel","messages":[...]}`.## Virtual Auto-Combo Factory@@ -519,5 +581,5 @@ See `docs/marketing/TIERS.md` for tier definitions and provider classification.| `open-sse/services/autoCombo/autoPrefix.ts` | `auto/` prefix parser + 6 variants || `open-sse/services/autoCombo/virtualFactory.ts` | Builds in-memory `AutoComboConfig` from live connections || `open-sse/services/autoCombo/providerRegistryAccessor.ts` | Test hook for mocking provider registry |-| `src/shared/constants/routingStrategies.ts` | `ROUTING_STRATEGY_VALUES` (14 strategies) |+| `src/shared/constants/routingStrategies.ts` | `ROUTING_STRATEGY_VALUES` (17 strategies) || `src/sse/handlers/chat.ts` | Integration: auto-prefix short-circuit |diff --git a/electron/package-lock.json b/electron/package-lock.jsonindex 54c681a2c2..14cb8260cc 100644--- a/electron/package-lock.json+++ b/electron/package-lock.json@@ -1,12 +1,12 @@{"name": "omniroute-desktop",- "version": "3.8.36",+ "version": "3.8.37","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "omniroute-desktop",- "version": "3.8.36",+ "version": "3.8.37","license": "MIT","dependencies": {"electron-updater": "^6.8.9"diff --git a/electron/package.json b/electron/package.jsonindex f7eaf45c7e..ec964eea18 100644--- a/electron/package.json+++ b/electron/package.json@@ -1,6 +1,6 @@{"name": "omniroute-desktop",- "version": "3.8.36",+ "version": "3.8.37","description": "OmniRoute Desktop Application","main": "main.js","author": {diff --git a/next.config.mjs b/next.config.mjsindex 2f06962ee2..aefe08fadd 100644--- a/next.config.mjs+++ b/next.config.mjs@@ -146,6 +146,10 @@ const nextConfig = {"./open-sse/services/compression/rules/**/*.json","./open-sse/lib/sha3_wasm_bg.wasm","./open-sse/lib/deepseek-pow-solver.cjs",+ // sql.js WASM is loaded at runtime by the sqljsAdapter fallback tier+ // (better-sqlite3 → node:sqlite → sql.js). Next traces sql-wasm.js but can+ // omit the runtime sql-wasm.wasm asset from the standalone bundle.+ "./node_modules/sql.js/dist/sql-wasm.wasm",],},outputFileTracingExcludes: {diff --git a/open-sse/config/providers/index.ts b/open-sse/config/providers/index.tsindex ef02d0697f..d02172990f 100644--- a/open-sse/config/providers/index.ts+++ b/open-sse/config/providers/index.ts@@ -40,6 +40,7 @@ import { baichuanProvider } from "./registry/baichuan/index.ts";import { yiProvider } from "./registry/yi/index.ts";import { deepseekProvider } from "./registry/deepseek/index.ts";import { deepseek_webProvider } from "./registry/deepseek/web/index.ts";+import { dgridProvider } from "./registry/dgrid/index.ts";import { kimi_coding_apikeyProvider } from "./registry/kimi/coding-apikey/index.ts";import { kimi_codingProvider } from "./registry/kimi/coding/index.ts";import { kimiProvider } from "./registry/kimi/index.ts";@@ -167,6 +168,7 @@ import { openadapterProvider } from "./registry/openadapter/index.ts";import { ditProvider } from "./registry/dit/index.ts";import { tokenrouterProvider } from "./registry/tokenrouter/index.ts";import { codebuddy_cnProvider } from "./registry/codebuddy-cn/index.ts";+import { pioneerProvider } from "./registry/pioneer/index.ts";export const REGISTRY: Record<string, RegistryEntry> = {aimlapi: aimlapiProvider,@@ -207,6 +209,7 @@ export const REGISTRY: Record<string, RegistryEntry> = {yi: yiProvider,deepseek: deepseekProvider,"deepseek-web": deepseek_webProvider,+ dgrid: dgridProvider,"kimi-coding-apikey": kimi_coding_apikeyProvider,"kimi-coding": kimi_codingProvider,kimi: kimiProvider,@@ -336,4 +339,5 @@ export const REGISTRY: Record<string, RegistryEntry> = {dit: ditProvider,tokenrouter: tokenrouterProvider,"codebuddy-cn": codebuddy_cnProvider,+ pioneer: pioneerProvider,};diff --git a/open-sse/config/providers/registry/dgrid/index.ts b/open-sse/config/providers/registry/dgrid/index.tsnew file mode 100644index 0000000000..e759bc1356--- /dev/null+++ b/open-sse/config/providers/registry/dgrid/index.ts@@ -0,0 +1,15 @@+import type { RegistryEntry } from "../../shared.ts";++export const dgridProvider: RegistryEntry = {+ id: "dgrid",+ alias: "dgrid",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.dgrid.ai/v1/chat/completions",+ authType: "apikey",+ authHeader: "bearer",+ modelsUrl: "https://api.dgrid.ai/v1/models",+ defaultContextLength: 128000,+ models: [{ id: "dgridai/free", name: "DGrid Free Models Router" }],+ passthroughModels: true,+};diff --git a/open-sse/config/providers/registry/github/index.ts b/open-sse/config/providers/registry/github/index.tsindex d5ab6458c8..f8c25d05a1 100644--- a/open-sse/config/providers/registry/github/index.ts+++ b/open-sse/config/providers/registry/github/index.ts@@ -25,9 +25,16 @@ export const githubProvider: RegistryEntry = {defaultContextLength: 128000,headers: getGitHubCopilotChatHeaders(),models: [+ // Copilot still serves the original GPT-4 via chat/completions; keep it+ // alongside GPT-4o and the GPT-5.x family so apps that hard-code `gpt-4` resolve here.+ { id: "gpt-4", name: "GPT-4", contextLength: 128000 },// 9router#98 — Copilot still serves GPT-4o via chat/completions; keep it// alongside the GPT-5.x family so apps that hard-code `gpt-4o` resolve here.{ id: "gpt-4o", name: "GPT-4o", contextLength: 128000 },+ // Copilot also serves the cheaper GPT-4o mini via chat/completions; keep it+ // alongside gpt-4o so apps that hard-code `gpt-4o-mini` resolve to the Copilot+ // (`gh`) provider rather than only the github-models (`ghm`) marketplace entry.+ { id: "gpt-4o-mini", name: "GPT-4o mini", contextLength: 128000 },{ id: "gpt-5-mini", name: "GPT-5 Mini", targetFormat: "openai-responses" },{ id: "gpt-5.3-codex", name: "GPT-5.3 Codex", targetFormat: "openai-responses" },{ id: "gpt-5.4-mini", name: "GPT-5.4 Mini", targetFormat: "openai-responses" },diff --git a/open-sse/config/providers/registry/pioneer/index.ts b/open-sse/config/providers/registry/pioneer/index.tsnew file mode 100644index 0000000000..c577ff3ff5--- /dev/null+++ b/open-sse/config/providers/registry/pioneer/index.ts@@ -0,0 +1,41 @@+import type { RegistryEntry } from "../../shared.ts";++/**+ * Pioneer AI by Fastino Labs — OpenAI-compatible chat completions.+ *+ * Endpoint: https://api.pioneer.ai/v1/chat/completions+ * Auth: X-API-Key header with a pio_sk_... key (Bearer also accepted upstream).+ *+ * Only models with supports_on_demand_inference=true work directly with a bare+ * pio_sk_ key. Gated/enterprise models (Claude/GPT/Gemini etc.) require a prior+ * fine-tuning job and are called via the resulting job id, not the base model id.+ *+ * Source of truth for models: GET https://api.pioneer.ai/base-models+ * ?supports_inference=true&task_type=decoder+ * filter: supports_on_demand_inference=true+ */+export const pioneerProvider: RegistryEntry = {+ id: "pioneer",+ alias: "pn",+ format: "openai",+ executor: "default",+ baseUrl: "https://api.pioneer.ai/v1/chat/completions",+ authType: "apikey",+ // Pioneer standardises on X-API-Key (preferred over Bearer).+ // The default executor resolves "x-api-key" to the X-API-Key header.+ authHeader: "x-api-key",+ models: [+ // === Open-tier serverless inference ===+ // These models support on-demand inference with any pio_sk_ key.+ { id: "Qwen/Qwen3-32B", name: "Qwen3 32B" },+ { id: "Qwen/Qwen3.6-27B", name: "Qwen3.6 27B" },+ { id: "Qwen/Qwen3.5-9B", name: "Qwen3.5 9B" },+ { id: "Qwen/Qwen3-8B", name: "Qwen3 8B" },+ { id: "Qwen/Qwen3-4B-Base", name: "Qwen3 4B Base" },+ { id: "Qwen/Qwen3-1.7B-Base", name: "Qwen3 1.7B Base" },+ { id: "meta-llama/Llama-3.1-8B-Instruct", name: "Llama 3.1 8B Instruct" },+ { id: "meta-llama/Llama-3.2-1B-Instruct", name: "Llama 3.2 1B Instruct" },+ { id: "google/gemma-3-4b-pt", name: "Gemma 3 4B (Pretrained)" },+ { id: "HuggingFaceTB/SmolLM3-3B-Base", name: "SmolLM3 3B Base" },+ ],+};diff --git a/open-sse/config/providers/registry/siliconflow/index.ts b/open-sse/config/providers/registry/siliconflow/index.tsindex a869c969e3..46dd572b2d 100644--- a/open-sse/config/providers/registry/siliconflow/index.ts+++ b/open-sse/config/providers/registry/siliconflow/index.ts@@ -9,15 +9,79 @@ export const siliconflowProvider: RegistryEntry = {authType: "apikey",authHeader: "bearer",models: [+ // DeepSeek{ id: "deepseek-ai/DeepSeek-V3.2", name: "DeepSeek V3.2" },+ { id: "deepseek-ai/DeepSeek-V3.2-Exp", name: "DeepSeek V3.2 Exp" },{ id: "deepseek-ai/DeepSeek-V3.1", name: "DeepSeek V3.1" },+ { id: "deepseek-ai/DeepSeek-V3.1-Terminus", name: "DeepSeek V3.1 Terminus" },+ { id: "deepseek-ai/DeepSeek-V3", name: "DeepSeek V3" },{ id: "deepseek-ai/DeepSeek-R1", name: "DeepSeek R1" },- { id: "Qwen/Qwen3-235B-A22B-Instruct-2507", name: "Qwen3 235B" },- { id: "Qwen/Qwen3-Coder-480B-A35B-Instruct", name: "Qwen3 Coder 480B" },+ { id: "deepseek-ai/deepseek-vl2", name: "DeepSeek VL2" },+ { id: "nex-agi/DeepSeek-V3.1-Nex-N1", name: "DeepSeek V3.1 Nex N1" },+ // Qwen+ { id: "Qwen/Qwen3.6-35B-A3B", name: "Qwen 3.6 35B A3B" },+ { id: "Qwen/Qwen3.6-27B", name: "Qwen 3.6 27B" },+ { id: "Qwen/Qwen3.5-397B-A17B", name: "Qwen 3.5 397B A17B" },+ { id: "Qwen/Qwen3.5-122B-A10B", name: "Qwen 3.5 122B A10B" },+ { id: "Qwen/Qwen3.5-35B-A3B", name: "Qwen 3.5 35B A3B" },+ { id: "Qwen/Qwen3.5-27B", name: "Qwen 3.5 27B" },+ { id: "Qwen/Qwen3.5-9B", name: "Qwen 3.5 9B" },+ { id: "Qwen/Qwen3-Next-80B-A3B-Instruct", name: "Qwen3 Next 80B Instruct" },+ { id: "Qwen/Qwen3-Next-80B-A3B-Thinking", name: "Qwen3 Next 80B Thinking" },+ { id: "Qwen/Qwen3-235B-A22B", name: "Qwen3 235B A22B" },+ { id: "Qwen/Qwen3-235B-A22B-Instruct-2507", name: "Qwen3 235B A22B Instruct" },+ { id: "Qwen/Qwen3-235B-A22B-Thinking-2507", name: "Qwen3 235B A22B Thinking" },{ id: "Qwen/Qwen3-32B", name: "Qwen3 32B" },- { id: "moonshotai/Kimi-K2.5", name: "Kimi K2.5" },+ { id: "Qwen/Qwen3-30B-A3B-Instruct-2507", name: "Qwen3 30B A3B Instruct" },+ { id: "Qwen/Qwen3-30B-A3B-Thinking-2507", name: "Qwen3 30B A3B Thinking" },+ { id: "Qwen/Qwen3-14B", name: "Qwen3 14B" },+ { id: "Qwen/Qwen3-8B", name: "Qwen3 8B" },+ { id: "Qwen/Qwen3-Coder-480B-A35B-Instruct", name: "Qwen3 Coder 480B" },+ { id: "Qwen/Qwen3-Coder-30B-A3B-Instruct", name: "Qwen3 Coder 30B" },+ { id: "Qwen/Qwen3-Omni-30B-A3B-Instruct", name: "Qwen3 Omni 30B Instruct" },+ { id: "Qwen/Qwen3-Omni-30B-A3B-Thinking", name: "Qwen3 Omni 30B Thinking" },+ { id: "Qwen/Qwen3-Omni-30B-A3B-Captioner", name: "Qwen3 Omni 30B Captioner" },+ { id: "Qwen/Qwen2.5-72B-Instruct", name: "Qwen 2.5 72B" },+ { id: "Qwen/Qwen2.5-72B-Instruct-128K", name: "Qwen 2.5 72B 128K" },+ { id: "Qwen/Qwen2.5-32B-Instruct", name: "Qwen 2.5 32B" },+ { id: "Qwen/Qwen2.5-14B-Instruct", name: "Qwen 2.5 14B" },+ { id: "Qwen/Qwen2.5-7B-Instruct", name: "Qwen 2.5 7B" },+ { id: "Qwen/Qwen2.5-VL-7B-Instruct", name: "Qwen 2.5 VL 7B" },+ // GLM+ { id: "zai-org/GLM-5.1", name: "GLM 5.1" },+ { id: "zai-org/GLM-5", name: "GLM 5" },+ { id: "zai-org/GLM-5V-Turbo", name: "GLM 5V Turbo" },{ id: "zai-org/GLM-4.7", name: "GLM 4.7" },+ { id: "zai-org/GLM-4.6", name: "GLM 4.6" },+ { id: "zai-org/GLM-4.6V", name: "GLM 4.6V" },+ { id: "zai-org/GLM-4.5", name: "GLM 4.5" },+ { id: "zai-org/GLM-4.5-Air", name: "GLM 4.5 Air" },+ { id: "zai-org/GLM-4.5V", name: "GLM 4.5V" },+ { id: "THUDM/GLM-4-32B-0414", name: "GLM 4 32B" },+ { id: "THUDM/GLM-4-9B-0414", name: "GLM 4 9B" },+ { id: "THUDM/GLM-Z1-32B-0414", name: "GLM Z1 32B" },+ { id: "THUDM/GLM-Z1-9B-0414", name: "GLM Z1 9B" },+ // Kimi+ { id: "moonshotai/Kimi-K2.6", name: "Kimi K2.6" },+ { id: "moonshotai/Kimi-K2.5", name: "Kimi K2.5" },+ { id: "moonshotai/Kimi-K2-Instruct", name: "Kimi K2 Instruct" },+ { id: "moonshotai/Kimi-K2-Instruct-0905", name: "Kimi K2 Instruct 0905" },+ { id: "moonshotai/Kimi-K2-Thinking", name: "Kimi K2 Thinking" },+ // Other{ id: "openai/gpt-oss-120b", name: "GPT OSS 120B" },+ { id: "openai/gpt-oss-20b", name: "GPT OSS 20B" },{ id: "baidu/ERNIE-4.5-300B-A47B", name: "ERNIE 4.5 300B" },+ { id: "tencent/Hunyuan-A13B-Instruct", name: "Hunyuan A13B" },+ { id: "tencent/Hunyuan-MT-7B", name: "Hunyuan MT 7B" },+ { id: "tencent/Hy3-preview", name: "Hunyuan Hy3 Preview" },+ { id: "meta-llama/Meta-Llama-3.1-8B-Instruct", name: "Llama 3.1 8B" },+ { id: "MiniMaxAI/MiniMax-M2.5", name: "MiniMax M2.5" },+ { id: "MiniMaxAI/MiniMax-M2.1", name: "MiniMax M2.1" },+ { id: "inclusionAI/Ling-flash-2.0", name: "Ling Flash 2.0" },+ { id: "inclusionAI/Ling-mini-2.0", name: "Ling Mini 2.0" },+ { id: "inclusionAI/Ring-flash-2.0", name: "Ring Flash 2.0" },+ { id: "google/gemma-4-31B-it", name: "Gemma 4 31B" },+ { id: "google/gemma-4-26B-A4B-it", name: "Gemma 4 26B" },+ { id: "ByteDance-Seed/Seed-OSS-36B-Instruct", name: "Seed OSS 36B" },],};diff --git a/open-sse/config/toolCloaking.ts b/open-sse/config/toolCloaking.tsindex 429a6ca28b..22f648eabb 100644--- a/open-sse/config/toolCloaking.ts+++ b/open-sse/config/toolCloaking.ts@@ -52,6 +52,40 @@ function toToolName(value: unknown): string {return typeof value === "string" ? value.trim() : "";}+/**+ * Recursively strip `enumDescriptions` from a JSON schema.+ *+ * VSCode Copilot emits `enumDescriptions` inside tool parameter schemas, but the+ * Antigravity API rejects any request carrying that field with HTTP 400. Walk the+ * schema's `properties` and `items` so the field is removed at every nesting level+ * before the declaration is sent upstream.+ */+export function stripEnumDescriptions(schema: unknown): unknown {+ if (!schema || typeof schema !== "object") return schema;++ if (Array.isArray(schema)) {+ return schema.map((entry) => stripEnumDescriptions(entry));+ }++ const result: JsonRecord = { ...(schema as JsonRecord) };+ delete result.enumDescriptions;++ const properties = asRecord(result.properties);+ if (properties) {+ const nextProperties: JsonRecord = {};+ for (const key of Object.keys(properties)) {+ nextProperties[key] = stripEnumDescriptions(properties[key]);+ }+ result.properties = nextProperties;+ }++ if (result.items !== undefined) {+ result.items = stripEnumDescriptions(result.items);+ }++ return result;+}+export function shouldCloakAntigravityTool(toolName: string): boolean {return (toolName.length > 0 && !AG_DEFAULT_TOOLS.has(toolName) && !toolName.endsWith(AG_TOOL_SUFFIX)@@ -99,9 +133,20 @@ export function cloakAntigravityToolPayload<T extends JsonRecord>(const declaration = asRecord(declarationValue);if (!declaration) continue;- const rawName = toToolName(declaration.name);+ // VSCode Copilot sends `enumDescriptions` in tool parameter schemas, but the+ // Antigravity API rejects requests carrying that field with HTTP 400. Strip it+ // recursively before the declaration is forwarded upstream.+ const stripped: JsonRecord =+ declaration.parameters !== undefined+ ? { ...declaration, parameters: stripEnumDescriptions(declaration.parameters) }+ : declaration;+ if (stripped !== declaration) {+ changed = true;+ }++ const rawName = toToolName(stripped.name);if (!rawName) {- cloakedDeclarations.push({ ...declaration });+ cloakedDeclarations.push({ ...stripped });continue;}@@ -112,7 +157,7 @@ export function cloakAntigravityToolPayload<T extends JsonRecord>(}cloakedDeclarations.push({- ...declaration,+ ...stripped,name: cloakedName,});}diff --git a/open-sse/executors/antigravity.ts b/open-sse/executors/antigravity.tsindex 178601dd44..acc3b6c06a 100644--- a/open-sse/executors/antigravity.ts+++ b/open-sse/executors/antigravity.ts@@ -60,6 +60,26 @@ import * as prl from "../utils/providerRequestLogging.ts";const MAX_RETRY_AFTER_MS = 60_000;const LONG_RETRY_THRESHOLD_MS = 60_000;const CREDITS_EXHAUSTED_TTL_MS = 5 * 60 * 60 * 1000; // 5 hours+// Cap for transient 5xx backoff — shorter than the 429 cap to avoid long stalls on+// infra hiccups ("Agent execution terminated", "high traffic", capacity errors).+const ANTIGRAVITY_TRANSIENT_RETRY_MAX_MS = 15_000;++const ANTIGRAVITY_TRANSIENT_ERROR_PATTERNS: RegExp[] = [+ /high\s+traffic/i,+ /agent\s+(execution\s+)?terminated\s+due\s+to\s+error/i,+ /capacity/i,+ /temporarily\s+unavailable/i,+ /timeout/i,+ /stream\s+(ended|closed|terminated|interrupted)/i,+ /empty\s+response/i,+];++const ANTIGRAVITY_TRANSIENT_STATUSES = new Set([+ HTTP_STATUS.SERVER_ERROR,+ HTTP_STATUS.BAD_GATEWAY,+ HTTP_STATUS.SERVICE_UNAVAILABLE,+ HTTP_STATUS.GATEWAY_TIMEOUT,+]);// The upstream API uses plain model IDs (no -high/-low suffix).// Tier suffixes were speculative and caused 404 for gemini-3.x models — the// bare-Pro→Low normalization was retired (the set stayed empty, making the guard@@ -957,6 +977,40 @@ export class AntigravityExecutor extends BaseExecutor {return totalMs;}+ /**+ * Flatten an Antigravity error JSON + raw body text into a single string so+ * isTransientAntigravityError can match against body patterns.+ */+ extractErrorMessage(errorJson: unknown, bodyText = ""): string {+ const candidates: string[] = [];+ if (errorJson && typeof errorJson === "object") {+ const obj = errorJson as Record<string, unknown>;+ const errField = obj.error;+ if (errField && typeof errField === "object") {+ const msg = (errField as Record<string, unknown>).message;+ if (typeof msg === "string") candidates.push(msg);+ else if (msg != null) candidates.push(JSON.stringify(msg));+ } else if (typeof errField === "string") {+ candidates.push(errField);+ }+ if (typeof obj.message === "string") candidates.push(obj.message);+ }+ if (bodyText) candidates.push(bodyText);+ return candidates.filter(Boolean).join("\n");+ }++ /**+ * Return true when a status + error message combination should be retried+ * with exponential backoff instead of immediately failing-over to the next URL.+ * 429 is always transient. Transient 5xx statuses (500/502/503/504) are also+ * retried when the body contains a known capacity/traffic/agent pattern.+ */+ isTransientAntigravityError(status: number, message: string): boolean {+ if (status === HTTP_STATUS.RATE_LIMITED) return true;+ if (ANTIGRAVITY_TRANSIENT_STATUSES.has(status)) return true;+ return ANTIGRAVITY_TRANSIENT_ERROR_PATTERNS.some((p) => p.test(message || ""));+ }+/*** Collect an SSE streaming response into a single non-streaming JSON response.* Parses Gemini-format SSE chunks and assembles text content + usage into one@@ -1469,25 +1523,42 @@ export class AntigravityExecutor extends BaseExecutor {continue;}- // Auto retry only for 429 when retryMs is 0 or undefined- if (- response.status === HTTP_STATUS.RATE_LIMITED &&- (!retryMs || retryMs === 0) &&- retryAttemptsByUrl[urlIndex] < MAX_AUTO_RETRIES- ) {- retryAttemptsByUrl[urlIndex]++;- // Exponential backoff: 2s, 4s, 8s...- const backoffMs = Math.min(- 1000 * 2 ** retryAttemptsByUrl[urlIndex],- MAX_RETRY_AFTER_MS- );- log?.debug?.(- "RETRY",- `429 auto retry ${retryAttemptsByUrl[urlIndex]}/${MAX_AUTO_RETRIES} after ${backoffMs / 1000}s`- );- await new Promise((resolve) => setTimeout(resolve, backoffMs));- urlIndex--;- continue;+ // Auto retry for 429 (no Retry-After) or transient 5xx errors.+ // For 5xx we read the body to detect known transient patterns+ // ("Agent execution terminated due to error", "high traffic", "capacity").+ if ((!retryMs || retryMs === 0) && retryAttemptsByUrl[urlIndex] < MAX_AUTO_RETRIES) {+ let shouldAutoRetry = response.status === HTTP_STATUS.RATE_LIMITED;+ if (!shouldAutoRetry && ANTIGRAVITY_TRANSIENT_STATUSES.has(response.status)) {+ try {+ const errBody = await response.clone().text();+ let errJson: unknown = null;+ try {+ errJson = errBody ? JSON.parse(errBody) : null;+ } catch {+ // non-JSON body — fall through to pattern match against raw text+ }+ const errMsg = this.extractErrorMessage(errJson, errBody);+ shouldAutoRetry = this.isTransientAntigravityError(response.status, errMsg);+ } catch {+ // ignore body read errors+ }+ }+ if (shouldAutoRetry) {+ retryAttemptsByUrl[urlIndex]++;+ // Exponential backoff: 2s, 4s, 8s… capped per-status+ const cap =+ response.status === HTTP_STATUS.RATE_LIMITED+ ? MAX_RETRY_AFTER_MS+ : ANTIGRAVITY_TRANSIENT_RETRY_MAX_MS;+ const backoffMs = Math.min(1000 * 2 ** retryAttemptsByUrl[urlIndex], cap);+ log?.debug?.(+ "RETRY",+ `${response.status} transient auto retry ${retryAttemptsByUrl[urlIndex]}/${MAX_AUTO_RETRIES} after ${backoffMs / 1000}s`+ );+ await new Promise((resolve) => setTimeout(resolve, backoffMs));+ urlIndex--;+ continue;+ }}log?.debug?.(diff --git a/open-sse/executors/base.ts b/open-sse/executors/base.tsindex 51a0e1389c..7d36eb7e1d 100644--- a/open-sse/executors/base.ts+++ b/open-sse/executors/base.ts@@ -192,6 +192,50 @@ export function applyConfiguredUserAgent(}}+/**+ * Returns true when the outbound request targets an OpenAI-compatible endpoint+ * (a `openai-compatible-*` provider, or a Chat Completions / Responses URL).+ * Used to scope the X-Stainless strip narrowly so genuine SDK-spoofing paths+ * (e.g. Claude Code compat, which legitimately ADDS X-Stainless-*) are untouched.+ */+export function isOpenAICompatibleEndpoint(provider: string, url: string): boolean {+ if (provider?.startsWith?.("openai-compatible-")) return true;+ return url.includes("/v1/chat/completions") || url.includes("/v1/responses");+}++/**+ * Strip OpenAI SDK (`X-Stainless-*`) metadata headers and normalize an SDK-derived+ * User-Agent for OpenAI-compatible passthrough requests. Some upstream gateways+ * 403 on these SDK-identifying headers. Only applied to OpenAI-compatible endpoints —+ * other providers (Claude/Claude Code compat) may legitimately send X-Stainless-*.+ *+ * Mutates `headers` in place and returns the list of stripped header keys (for logging).+ */+export function stripStainlessHeadersForOpenAICompat(+ headers: Record<string, string>,+ provider: string,+ url: string+): string[] {+ if (!isOpenAICompatibleEndpoint(provider, url)) return [];++ const strippedKeys: string[] = [];+ for (const key of Object.keys(headers)) {+ if (key.toLowerCase().startsWith("x-stainless-")) {+ delete headers[key];+ strippedKeys.push(key);+ }+ }++ // Normalize User-Agent: SDK-based clients send verbose product strings that some+ // upstreams block. Replace with a clean browser-like UA only when it looks SDK-derived.+ const ua = (headers["User-Agent"] || headers["user-agent"] || "").toLowerCase();+ if (ua.includes("openai") && (ua.includes("node") || ua.includes("axios") || ua.includes("undici"))) {+ setUserAgentHeader(headers, "Mozilla/5.0 (compatible; OpenAI Compatible)");+ }++ return strippedKeys;+}+export function mergeAbortSignals(primary: AbortSignal, secondary: AbortSignal): AbortSignal {const controller = new AbortController();@@ -817,6 +861,16 @@ export class BaseExecutor {const headers = this.buildHeaders(activeCredentials, stream, clientHeaders, model);applyConfiguredUserAgent(headers, activeCredentials?.providerSpecificData);+ // Strip OpenAI SDK (X-Stainless-*) metadata + normalize SDK-derived User-Agent+ // on OpenAI-compatible passthrough requests — some upstream gateways 403 on them.+ const strippedStainless = stripStainlessHeadersForOpenAICompat(headers, this.provider, url);+ if (strippedStainless.length > 0) {+ log?.debug?.(+ "HEADERS",+ `Stripped X-Stainless-* from OpenAI-compatible request: ${strippedStainless.join(", ")}`+ );+ }+const ccRequestDefaults = isClaudeCodeCompatible(this.provider)? getClaudeCodeCompatibleRequestDefaults(activeCredentials?.providerSpecificData): {};diff --git a/open-sse/executors/codex.ts b/open-sse/executors/codex.tsindex ffa7b0d81d..172fa1a987 100644--- a/open-sse/executors/codex.ts+++ b/open-sse/executors/codex.ts@@ -296,7 +296,7 @@ function convertSystemToDeveloperRole(body: Record<string, unknown>): void {* server-generated prefix (rs_, fc_, resp_, msg_) — so the content is* preserved but the backend won't try to look it up*/-function stripStoredItemReferences(body: Record<string, unknown>): void {+export function stripStoredItemReferences(body: Record<string, unknown>): void {if (Array.isArray(body.input) && body.input.length === 0) {body.input = [{@@ -330,6 +330,19 @@ function stripStoredItemReferences(body: Record<string, unknown>): void {return false;}+ // Reasoning blobs (encrypted_content) are unusable with store=false since+ // previous_response_id is deleted — strip them to avoid wasting context+ // tokens (O(n^2) growth across agentic turns).+ if (+ item &&+ typeof item === "object" &&+ !Array.isArray(item) &&+ (item as Record<string, unknown>).type === "reasoning"+ ) {+ strippedCount++;+ return false;+ }+// Object items with server-generated IDs: strip the id field but keep the item.// e.g. { id: "rs_...", type: "reasoning", summary: [...] } → keep content, remove id// e.g. { id: "fc_...", type: "function_call", ... } → keep content, remove iddiff --git a/open-sse/executors/cursor.ts b/open-sse/executors/cursor.tsindex a1c855a1ca..58354f2384 100644--- a/open-sse/executors/cursor.ts+++ b/open-sse/executors/cursor.ts@@ -325,11 +325,32 @@ export function isComposerModel(model: string | undefined | null): boolean {return /^composer(?:-|$)/i.test(id ?? "");}+// Composer's protobuf sometimes wraps the visible suffix in sentinel tags:+// `<|final|>` (full-width pipes) or `<|final|>` (ASCII), optionally closed+// with a matching `<|/final|>` / `<|/final|>`. These are protocol-internal+// and must never leak to OpenAI-compatible clients (decolua/9router#1316).+const COMPOSER_OPEN_MARKER = /^\s*<[||]\s*final\s*[||]>\s*/i;+const COMPOSER_CLOSE_MARKER = /\s*<[||]\s*\/\s*final\s*[||]>\s*$/i;+const COMPOSER_PARTIAL_OPEN = /^\s*<(?![||/])/;+const COMPOSER_PARTIAL_OPEN_PIPE = /^\s*<[||][^>]*$/;+export function visibleComposerContentFromThinking(thinking: string): string {if (!thinking) return "";const endIdx = thinking.lastIndexOf(COMPOSER_THINK_END);if (endIdx < 0) return "";- return thinking.slice(endIdx + COMPOSER_THINK_END.length).trimStart();+ let visible = thinking.slice(endIdx + COMPOSER_THINK_END.length).trimStart();+ if (COMPOSER_OPEN_MARKER.test(visible)) {+ visible = visible.replace(COMPOSER_OPEN_MARKER, "");+ } else if (+ COMPOSER_PARTIAL_OPEN.test(visible) ||+ COMPOSER_PARTIAL_OPEN_PIPE.test(visible)+ ) {+ // A streamed chunk delivered only a partial opening marker (e.g. `<` or+ // `<|fin`). Hold back everything until more data arrives so the marker+ // fragment never leaks as content.+ return "";+ }+ return visible.replace(COMPOSER_CLOSE_MARKER, "").trim();}export function composerReasoningRemainder(thinking: string): string {diff --git a/open-sse/executors/default.ts b/open-sse/executors/default.tsindex 0eceec4530..b6f58a3ccc 100644--- a/open-sse/executors/default.ts+++ b/open-sse/executors/default.ts@@ -33,6 +33,7 @@ import { buildMaritalkChatUrl } from "../config/maritalk.ts";import { LOCAL_PROVIDERS } from "@/shared/constants/providers";import { isForbiddenCustomHeaderName } from "@/shared/constants/upstreamHeaders";import { getClaudeCodeCompatibleRequestDefaults } from "@/lib/providers/requestDefaults";+import { buildClineHeaders } from "@/shared/utils/clineAuth";import type { PoolConfig } from "../services/sessionPool/types.ts";@@ -447,6 +448,12 @@ export class DefaultExecutor extends BaseExecutor {case "glm-coding-apikey":headers["x-api-key"] = effectiveKey || credentials.accessToken;break;+ case "cline":+ // Cline's API requires the bearer token prefixed with `workos:` plus a+ // set of Cline client-identification headers; plain `Bearer <token>`+ // is rejected upstream. buildClineHeaders() emits both.+ Object.assign(headers, buildClineHeaders(effectiveKey || credentials.accessToken));+ break;default:if (isClaudeCodeCompatible(this.provider)) {const ccRequestDefaults = getClaudeCodeCompatibleRequestDefaults(@@ -469,7 +476,29 @@ export class DefaultExecutor extends BaseExecutor {} else if (credentials.accessToken) {headers["Authorization"] = `Bearer ${credentials.accessToken}`;}- if (!headers["anthropic-version"]) {+ // Port of decolua/9router commit b977bf74:+ // Third-party Anthropic-compatible gateways frequently require+ // Authorization: Bearer ALONGSIDE x-api-key — without it they+ // return 401 missing_api_key on every forward. Only emit the+ // Bearer fallback for non-official upstreams; api.anthropic.com+ // (and the empty/default baseUrl that targets it) must keep the+ // x-api-key-only behavior to avoid regressing the official path.+ if (effectiveKey && !headers["Authorization"]) {+ const baseUrl = credentials?.providerSpecificData?.baseUrl || "";+ const isOfficialAnthropic =+ baseUrl === "" || baseUrl.includes("api.anthropic.com");+ if (!isOfficialAnthropic) {+ headers["Authorization"] = `Bearer ${effectiveKey}`;+ }+ }+ // Default the anthropic-version header only when the caller/operator+ // has not already supplied one. The lookup is case-insensitive so a+ // pre-set "Anthropic-Version" (e.g. from this.config.headers or a+ // custom header) is not clobbered with a duplicate lowercase entry.+ const hasAnthropicVersion = Object.keys(headers).some(+ (key) => key.toLowerCase() === "anthropic-version"+ );+ if (!hasAnthropicVersion) {headers["anthropic-version"] = "2023-06-01";}} else {@@ -547,6 +576,45 @@ export class DefaultExecutor extends BaseExecutor {return headers;}+ /**+ * Downgrade `response_format: { type: "json_schema" }` to `json_object` for+ * `openai-compatible-*` providers, injecting the JSON schema into the system+ * prompt instead. DeepSeek / Ollama / local OpenAI-compatible models often+ * lack native Structured Output and return empty or malformed content when a+ * `json_schema` response_format is forwarded as-is. Gated on the+ * `openai-compatible-` provider family so providers with native Structured+ * Output support keep the native `json_schema` path.+ */+ applyJsonSchemaFallback<T>(body: T): T {+ if (!this.provider?.startsWith?.("openai-compatible-")) return body;+ if (!body || typeof body !== "object" || Array.isArray(body)) return body;++ const record = body as Record<string, unknown>;+ const rf = record.response_format as+ | { type?: string; json_schema?: { schema?: unknown } }+ | undefined;+ if (rf?.type !== "json_schema" || !rf.json_schema?.schema) return body;++ const schemaJson = JSON.stringify(rf.json_schema.schema, null, 2);+ const prompt = `You must respond with valid JSON that strictly follows this JSON schema:\n\`\`\`json\n${schemaJson}\n\`\`\`\nRespond ONLY with the JSON object, no other text.`;++ const messages: Array<Record<string, unknown>> = Array.isArray(record.messages)+ ? (record.messages as Array<Record<string, unknown>>).map((m) => ({ ...m }))+ : [];+ const sys = messages.find((m) => m.role === "system");+ if (sys) {+ if (typeof sys.content === "string") {+ sys.content = `${sys.content}\n\n${prompt}`;+ } else if (Array.isArray(sys.content)) {+ sys.content.push({ type: "text", text: `\n\n${prompt}` });+ }+ } else {+ messages.unshift({ role: "system", content: prompt });+ }++ return { ...record, messages, response_format: { type: "json_object" } } as T;+ }+/*** For compatible providers, the model name is already clean by the time* it reaches the executor (chatCore sets body.model = modelInfo.model,@@ -558,6 +626,7 @@ export class DefaultExecutor extends BaseExecutor {transformRequest(model, body, stream, credentials) {const cleanedBody = super.transformRequest(model, body, stream, credentials);let withDefaults = applyProviderRequestDefaults(cleanedBody, this.config.requestDefaults);+ withDefaults = this.applyJsonSchemaFallback(withDefaults);const targetFormat = getTargetFormat(this.provider, credentials?.providerSpecificData);const requestFormat =withDefaults && typeof withDefaults === "object" && !Array.isArray(withDefaults)diff --git a/open-sse/executors/gemini-cli.ts b/open-sse/executors/gemini-cli.tsindex e8caba72ea..979d157aa1 100644--- a/open-sse/executors/gemini-cli.ts+++ b/open-sse/executors/gemini-cli.ts@@ -534,11 +534,18 @@ export class GeminiCLIExecutor extends BaseExecutor {}}- // Parse retry time from Gemini error message body- // Format: "Your quota will reset after 2h7m23s"+ // Parse retry time from Gemini error message body. Two shapes are handled:+ // 1. Structured google.rpc.RetryInfo in the 429/503 JSON body:+ // { error: { details: [{ "@type": ".../google.rpc.RetryInfo", retryDelay: "30s" }] } }+ // 2. Human-readable prose: "Your quota will reset after 2h7m23s"+ // The structured hint is authoritative (it is what the Cloud Code Assist API+ // sends), so it is checked first and falls through to the prose form on miss.parseRetryFromErrorMessage(errorMessage: unknown): number | null {if (!errorMessage || typeof errorMessage !== "string") return null;+ const structuredMs = this.parseStructuredRetryDelay(errorMessage);+ if (structuredMs !== null) return structuredMs;+const match = errorMessage.match(/reset (?:after|in) (\d+h)?(\d+m)?(\d+s)?/i);if (!match) return null;@@ -549,6 +556,32 @@ export class GeminiCLIExecutor extends BaseExecutor {return totalMs || 2_000;}++ // Read google.rpc.RetryInfo.retryDelay from a Google API error JSON body and+ // convert the protobuf Duration string ("30s", "1.5s", "0.500s") into ms.+ // Returns null when the body is not JSON or carries no RetryInfo detail.+ private parseStructuredRetryDelay(bodyText: string): number | null {+ if (!bodyText.includes("RetryInfo")) return null;+ try {+ const parsed = JSON.parse(bodyText);+ const details = parsed?.error?.details;+ if (!Array.isArray(details)) return null;+ for (const detail of details) {+ if (+ detail?.["@type"] === "type.googleapis.com/google.rpc.RetryInfo" &&+ typeof detail?.retryDelay === "string"+ ) {+ const seconds = parseFloat(detail.retryDelay.replace(/s$/i, ""));+ if (Number.isFinite(seconds) && seconds >= 0) {+ return Math.round(seconds * 1000) || 2_000;+ }+ }+ }+ } catch {+ /* not JSON — caller falls back to prose parsing */+ }+ return null;+ }}export default GeminiCLIExecutor;diff --git a/open-sse/executors/kiro.ts b/open-sse/executors/kiro.tsindex 44f7b32c99..382b11919a 100644--- a/open-sse/executors/kiro.ts+++ b/open-sse/executors/kiro.ts@@ -27,6 +27,8 @@ type KiroStreamState = {hasToolCalls: boolean;toolCallIndex: number;seenToolIds: Map<string, number>;+ toolArgsEmitted: Map<string, string>;+ toolArgsBuffered: Map<string, { toolIndex: number; canonical: string }>;totalContentLength?: number;contextUsagePercentage?: number;hasContextUsage?: boolean;@@ -125,6 +127,56 @@ function crc32(buf: Uint8Array) {return (crc ^ 0xffffffff) >>> 0;}+/**+ * Flush buffered tool arguments at finish boundaries.+ *+ * Kiro/CodeWhisperer streams toolUseEvent.input as PARTIAL OBJECTS that grow over time+ * (e.g. {command:"cat /home"} then {command:"cat /home/wxsys"}). Re-stringifying each one+ * and emitting it as an OpenAI argument delta produces overlapping prefixes that+ * concatenate into unparseable garbage downstream ("Unterminated string").+ *+ * Fix: defer object-form payloads into state.toolArgsBuffered keyed by toolCallId, keep+ * only the latest canonical, and emit ONCE here as the complete arguments string (the+ * final object is the source of truth — intermediate states are noise). String-form+ * payloads are already concatenable deltas and are emitted incrementally.+ */+export function flushBufferedToolArgs(+ state: Pick<KiroStreamState, "toolArgsBuffered" | "toolArgsEmitted">,+ controller: { enqueue: (chunk: Uint8Array) => void },+ ctx: { responseId: string; created: number; model: string }+): void {+ if (!state.toolArgsBuffered || state.toolArgsBuffered.size === 0) return;+ const { responseId, created, model } = ctx;+ for (const [toolCallId, info] of state.toolArgsBuffered) {+ const alreadyEmitted = state.toolArgsEmitted.get(toolCallId) || "";+ if (info.canonical && info.canonical !== alreadyEmitted) {+ const argsChunk: JsonRecord = {+ id: responseId,+ object: "chat.completion.chunk",+ created,+ model,+ choices: [+ {+ index: 0,+ delta: {+ tool_calls: [+ {+ index: info.toolIndex,+ function: { arguments: info.canonical },+ },+ ],+ },+ finish_reason: null,+ },+ ],+ };+ controller.enqueue(TEXT_ENCODER.encode(`data: ${JSON.stringify(argsChunk)}\n\n`));+ state.toolArgsEmitted.set(toolCallId, info.canonical);+ }+ }+ state.toolArgsBuffered.clear();+}+function buildKiroFinishChunk(state: KiroStreamState,responseId: string,@@ -310,6 +362,8 @@ export class KiroExecutor extends BaseExecutor {hasToolCalls: false,toolCallIndex: 0,seenToolIds: new Map(),+ toolArgsEmitted: new Map(),+ toolArgsBuffered: new Map(),};const transformStream = new TransformStream(@@ -469,46 +523,56 @@ export class KiroExecutor extends BaseExecutor {}if (toolInput !== undefined) {- let argumentsStr;-if (typeof toolInput === "string") {- argumentsStr = toolInput;- } else if (typeof toolInput === "object") {- argumentsStr = JSON.stringify(toolInput);- } else {- continue;- }-- const argsChunk = {- id: responseId,- object: "chat.completion.chunk",- created,- model,- choices: [- {- index: 0,- delta: {- tool_calls: [- {- index: toolIndex,- function: {- arguments: argumentsStr,+ // String-form payloads are already concatenable incremental deltas —+ // emit immediately and track what we've sent.+ state.toolArgsEmitted.set(+ toolCallId,+ (state.toolArgsEmitted.get(toolCallId) || "") + toolInput+ );++ const argsChunk = {+ id: responseId,+ object: "chat.completion.chunk",+ created,+ model,+ choices: [+ {+ index: 0,+ delta: {+ tool_calls: [+ {+ index: toolIndex,+ function: {+ arguments: toolInput,+ },},- },- ],+ ],+ },+ finish_reason: null,},- finish_reason: null,- },- ],- };- chunkIndex++;- controller.enqueue(TEXT_ENCODER.encode(`data: ${JSON.stringify(argsChunk)}\n\n`));+ ],+ };+ chunkIndex++;+ controller.enqueue(+ TEXT_ENCODER.encode(`data: ${JSON.stringify(argsChunk)}\n\n`)+ );+ } else if (typeof toolInput === "object" && toolInput !== null) {+ // Object-form payloads are PARTIAL OBJECTS that grow over time. Buffer+ // the latest canonical and flush once at a finish boundary, otherwise the+ // overlapping JSON prefixes concatenate into unparseable garbage.+ state.toolArgsBuffered.set(toolCallId, {+ toolIndex,+ canonical: JSON.stringify(toolInput),+ });+ }}}}// Handle messageStopEventif (eventType === "messageStopEvent") {+ flushBufferedToolArgs(state, controller, { responseId, created, model });state.stopSeen = true;}@@ -576,6 +640,10 @@ export class KiroExecutor extends BaseExecutor {},flush(controller) {+ // Flush any buffered tool arguments (partial-object payloads) before finishing —+ // idempotent against toolArgsEmitted if messageStopEvent already flushed them.+ flushBufferedToolArgs(state, controller, { responseId, created, model });+// Emit finish chunk if not already sentif (!state.finishEmitted) {state.finishEmitted = true;diff --git a/open-sse/executors/qoder.ts b/open-sse/executors/qoder.tsindex 8e251d94ec..f52faad70c 100644--- a/open-sse/executors/qoder.ts+++ b/open-sse/executors/qoder.ts@@ -14,6 +14,102 @@ import { sanitizeQwenThinkingToolChoice } from "../services/qwenThinking.ts";import { buildCosyHeadersForValidation, resolveQoderJobToken } from "../services/qoderCli.ts";import { sanitizeErrorMessage } from "../utils/error.ts";+function truncate(text: string, max: number): string {+ if (text.length <= max) return text;+ return `${text.slice(0, max)}…`;+}++/**+ * Peek at the first SSE event from a Qoder response to detect upstream errors+ * that Qoder wraps inside an HTTP 200 SSE envelope ({statusCodeValue, body}).+ * Returns a proper HTTP error Response when found, so downstream fallback+ * logic (combo routing, account fallback) can trigger. For success, re-creates+ * the stream with the first chunk prepended so the body passes through+ * transparently.+ */+async function unwrapQoderEnvelope(response: Response): Promise<Response> {+ if (!response.ok || !response.body) {+ return response;+ }++ const reader = response.body.getReader();+ const decoder = new TextDecoder();++ const { done, value } = await reader.read();+ if (done) {+ reader.cancel();+ return new Response(+ JSON.stringify({ error: { message: "[qoder] empty response", type: "provider_error" } }),+ { status: 502, headers: { "Content-Type": "application/json" } }+ );+ }++ const text = decoder.decode(value, { stream: true });++ let errorStatus: number | null = null;+ let errorMsg = "";+ for (const line of text.split("\n")) {+ const trimmed = line.trim();+ if (!trimmed.startsWith("data:")) continue;+ const jsonStr = trimmed.slice(5).trim();+ if (jsonStr === "[DONE]") break;+ try {+ const envelope = JSON.parse(jsonStr) as Record<string, unknown>;+ const statusVal =+ typeof envelope.statusCodeValue === "number" ? envelope.statusCodeValue : 200;+ if (statusVal !== 200) {+ errorStatus = statusVal >= 400 ? statusVal : 502;+ errorMsg =+ typeof envelope.body === "string" ? envelope.body : `upstream status ${statusVal}`;+ }+ } catch {+ // Malformed JSON — treat as non-error; downstream handling parses it.+ }+ break;+ }++ if (errorStatus) {+ reader.cancel();+ const errType =+ errorStatus === 401 || errorStatus === 403 ? "authentication_error" : "provider_error";+ return new Response(+ JSON.stringify({+ error: {+ message: `[qoder error ${errorStatus}: ${sanitizeErrorMessage(truncate(errorMsg, 200))}]`,+ type: errType,+ },+ }),+ { status: errorStatus, headers: { "Content-Type": "application/json" } }+ );+ }++ // Re-create the stream with the first chunk prepended so the success body+ // passes through unchanged.+ const restStream = new ReadableStream<Uint8Array>({+ start(controller) {+ controller.enqueue(value);+ },+ pull(controller) {+ return reader.read().then(({ done, value }) => {+ if (done) {+ controller.close();+ return;+ }+ controller.enqueue(value);+ });+ },+ cancel() {+ reader.cancel();+ },+ });++ return new Response(restStream, {+ status: response.status,+ statusText: response.statusText,+ headers: new Headers(response.headers),+ });+}+function getAuthToken(credentials: ProviderCredentials): string {if (typeof credentials.apiKey === "string" && credentials.apiKey.trim()) {return credentials.apiKey.trim();@@ -214,13 +310,12 @@ export class QoderExecutor extends BaseExecutor {};}- const newHeaders = new Headers(response.headers);+ // Qoder wraps upstream errors inside an HTTP 200 SSE envelope+ // ({statusCodeValue}). Peek at the first event to detect this and return+ // a proper HTTP error so combo/account fallback logic can trigger.+ const unwrapped = await unwrapQoderEnvelope(response);return {- response: new Response(response.body, {- status: response.status,- statusText: response.statusText,- headers: newHeaders,- }),+ response: unwrapped,url: endpointUrl,headers,transformedBody: payload,@@ -249,3 +344,8 @@ export class QoderExecutor extends BaseExecutor {}export default QoderExecutor;++export const __test__ = {+ unwrapQoderEnvelope,+ truncate,+};diff --git a/open-sse/handlers/chatCore.ts b/open-sse/handlers/chatCore.tsindex b9b1f00093..86f143b27c 100644--- a/open-sse/handlers/chatCore.ts+++ b/open-sse/handlers/chatCore.ts@@ -18,6 +18,7 @@ import {getHeaderValueCaseInsensitive,isNoMemoryRequested,resolveCompressionHeader,+ isStripReasoningRequested,} from "./chatCore/headers.ts";import { markCodexScopeRateLimited } from "./chatCore/codexFailover.ts";import { getCombosCached } from "./chatCore/comboContextCache.ts";@@ -63,6 +64,7 @@ import { resolveChatCoreTargetFormat } from "./chatCore/targetFormat.ts";import { injectSystemPrompt, injectCustomSystemPrompt } from "../services/systemPrompt.ts";import { translateRequest, needsTranslation } from "../translator/index.ts";import { FORMATS } from "../translator/formats.ts";+import { sanitizeKiroTools } from "../utils/kiroSanitizer.ts";import { splitMisplacedToolResults } from "../translator/helpers/claudeHelper.ts";import {createSSETransformStreamWithLogger,@@ -83,6 +85,7 @@ import {} from "../services/tokenRefresh.ts";import { createRequestLogger } from "../utils/requestLogger.ts";import { createPreparedRequestLogger, runWithCapture } from "../utils/providerRequestLogging.ts";+import { summarizeToolSources } from "../utils/toolSources.ts";import { applyResponsesPreviousResponseIdPolicy } from "../utils/responsesStatePolicy.ts";import { applyClaudeEffortVariant } from "./chatCore/claudeEffortVariant.ts";import { DEFAULT_THINKING_CLAUDE_SIGNATURE } from "../config/defaultThinkingSignature.ts";@@ -106,6 +109,7 @@ import {formatProviderError,sanitizeErrorMessage,} from "../utils/error.ts";+import { reportMalformed200, detectMalformedNonStream } from "../utils/diagnostics.ts";import {checkTokenLimits,recordTokenUsage,@@ -657,6 +661,12 @@ export async function handleChatCore({const noLogEnabled = apiKeyInfo?.noLog === true;// Consolidate settings reads — fetch once, reuse throughout the requestconst settings = cachedSettings ?? (await getCachedSettings());+ // Opt-in tool-source diagnostics (#1825): summarize the request's tool definitions+ // (count + MCP/hosted/client source breakdown + first names) as a single debug line.+ if (settings.logToolSources === true) {+ const toolSummary = summarizeToolSources((body as { tools?: unknown }).tools);+ if (toolSummary) log?.debug?.("TOOLS", toolSummary);+ }// #1311 (opt-in): echo the client-requested alias/combo name in the response `model`// field instead of the upstream model, so strict clients (Claude Desktop) that validate// response.model === request.model stop rejecting alias/combo requests with a 401.@@ -1769,6 +1779,30 @@ export async function handleChatCore({trace("post_translation");+ // Kiro: sanitize tool schemas before dispatch. Kiro returns 400 "Improperly+ // formed request" for unsupported JSON-Schema keywords (anyOf/$ref/if-then,+ // etc.) and tool names >64 chars. Strip those keys and hash-truncate long+ // names; merge the truncated→original nameMap into the existing+ // `_toolNameMap` so kiro-to-openai maps streamed tool-call names back (#1375).+ if (targetFormat === FORMATS.KIRO) {+ const kiroTools =+ translatedBody?.conversationState?.currentMessage?.userInputMessage+ ?.userInputMessageContext?.tools;+ if (kiroTools) {+ const { tools: sanitizedKiroTools, nameMap: kiroNameMap } = sanitizeKiroTools(kiroTools);+ translatedBody.conversationState.currentMessage.userInputMessage.userInputMessageContext.tools =+ sanitizedKiroTools;+ if (kiroNameMap.size > 0) {+ const existing =+ translatedBody._toolNameMap instanceof Map+ ? translatedBody._toolNameMap+ : new Map<string, string>();+ kiroNameMap.forEach((original, truncated) => existing.set(truncated, original));+ translatedBody._toolNameMap = existing;+ }+ }+ }+// Extract toolNameMap for response translation (Claude OAuth)const translatedToolNameMap = translatedBody._toolNameMap;const nativeClaudeToolNameMap = isClaudePassthrough@@ -3493,7 +3527,13 @@ export async function handleChatCore({if (clientResponseFormat === FORMATS.OPENAI_RESPONSES) {translatedResponse = sanitizeResponsesApiResponse(translatedResponse);} else if (clientResponseFormat === FORMATS.OPENAI) {- translatedResponse = sanitizeOpenAIResponse(translatedResponse);+ // Port of decolua/9router#517: opt-in `x-omniroute-strip-reasoning` header+ // unconditionally drops `reasoning_content` from the final non-streaming+ // JSON for clients (e.g. Firecrawl AI SDK) whose JSON parsers break on+ // that non-standard field. Reasoning replay cache is captured above this+ // sanitize step, so the cache feature is unaffected.+ const stripReasoning = isStripReasoningRequested(clientRawRequest?.headers ?? null);+ translatedResponse = sanitizeOpenAIResponse(translatedResponse, { stripReasoning });}applyClientUsageBuffer(translatedResponse, body, clientResponseFormat);@@ -3587,6 +3627,59 @@ export async function handleChatCore({return createErrorResult(HTTP_STATUS.BAD_REQUEST, guardrailMessage);}+ // Validate the *translated* response actually carries client-usable output.+ // isEmptyContentResponse (above) runs on the raw responseBody before translation;+ // this check runs after translation + sanitization + tool-call execution to catch+ // cases where a provider returns a structurally valid raw body that translates into+ // choices:[] or output:[] with no usable content (Responses API shape included).+ const malformedTranslatedReason = detectMalformedNonStream(translatedResponse);+ if (malformedTranslatedReason) {+ const totalLatency = Date.now() - startTime;+ const rawBytes = (() => {+ try {+ return JSON.stringify(responseBody || {}).length;+ } catch {+ return -1;+ }+ })();+ reportMalformed200({+ mode: "nonstream",+ provider,+ model,+ connectionId,+ reason: malformedTranslatedReason,+ recvBytes: rawBytes,+ recvLines: -1,+ emitted: -1,+ events: {},+ ttftMs: totalLatency,+ elapsedMs: totalLatency,+ });+ appendRequestLog({+ model,+ provider,+ connectionId,+ status: `FAILED ${HTTP_STATUS.BAD_GATEWAY}`,+ }).catch(() => {});+ const malformedMessage = `[${provider}/${model}] returned an empty response (no usable choices/output)`;+ persistAttemptLogs({+ status: HTTP_STATUS.BAD_GATEWAY,+ tokens: usage,+ responseBody,+ providerRequest: finalBody || translatedBody,+ providerResponse: looksLikeSSE+ ? { _streamed: true, _format: "sse-json", summary: responseBody }+ : responseBody,+ clientResponse: buildErrorBody(HTTP_STATUS.BAD_GATEWAY, malformedMessage),+ claudeCacheMeta: claudePromptCacheLogMeta,+ claudeCacheUsageMeta: cacheUsageLogMeta,+ cacheSource: "upstream",+ });+ persistFailureUsage(HTTP_STATUS.BAD_GATEWAY, "malformed_translated_response");+ trackPendingRequest(model, provider, pendingConnId, false);+ return createErrorResult(HTTP_STATUS.BAD_GATEWAY, malformedMessage);+ }+// ── Phase 9.1: Cache store (non-streaming, temp=0) ──storeSemanticCacheResponse({enabled: semanticCacheEnabled,diff --git a/open-sse/handlers/chatCore/headers.ts b/open-sse/handlers/chatCore/headers.tsindex 913898ad3b..ba6d1c2712 100644--- a/open-sse/handlers/chatCore/headers.ts+++ b/open-sse/handlers/chatCore/headers.ts@@ -44,3 +44,22 @@ export function resolveCompressionHeader(const value = (getHeaderValueCaseInsensitive(headers, "x-omniroute-compression") || "").trim();return value || null;}++/**+ * Per-request opt-in to unconditionally strip `reasoning_content` from the+ * non-streaming JSON response via the `x-omniroute-strip-reasoning` header.+ * Some clients (e.g. Firecrawl AI SDK) have JSON parsers that break on this+ * non-standard OpenAI extension even though it's syntactically valid, and even+ * on reasoning-only messages that the default sanitizer keeps. Truthy values:+ * `true` / `1` / `yes` (case-insensitive). Ported from upstream 9router#517+ * (closes upstream #509). Reasoning is still captured for the replay cache+ * before this header is consulted, so the cache feature is unaffected.+ */+export function isStripReasoningRequested(+ headers: Record<string, unknown> | Headers | null | undefined+): boolean {+ const value = (getHeaderValueCaseInsensitive(headers, "x-omniroute-strip-reasoning") || "")+ .trim()+ .toLowerCase();+ return value === "true" || value === "1" || value === "yes";+}diff --git a/open-sse/handlers/responseSanitizer.ts b/open-sse/handlers/responseSanitizer.tsindex 112673127a..f852aedac0 100644--- a/open-sse/handlers/responseSanitizer.ts+++ b/open-sse/handlers/responseSanitizer.ts@@ -269,10 +269,26 @@ export function extractThinkingFromContent(text: string): {* Sanitize a non-streaming OpenAI ChatCompletion response.* Strips non-standard fields and normalizes required fields.*/-export function sanitizeOpenAIResponse(body: unknown): unknown {+export interface SanitizeOpenAIResponseOptions {+ /**+ * When true, unconditionally remove `reasoning_content` from every choice+ * message in the final payload — including reasoning-only messages and+ * DeepSeek V4 — even though the default sanitizer keeps it in those cases.+ * Wired to the `x-omniroute-strip-reasoning` request header for clients whose+ * JSON parsers cannot tolerate the non-standard field (e.g. Firecrawl AI SDK).+ * Ported from upstream 9router#517 (closes upstream #509).+ */+ stripReasoning?: boolean;+}++export function sanitizeOpenAIResponse(+ body: unknown,+ options: SanitizeOpenAIResponseOptions = {}+): unknown {const bodyRecord = toRecord(body);if (!bodyRecord) return body;const isDeepSeekV4 = isDeepSeekV4Model(bodyRecord.model);+ const stripReasoning = options.stripReasoning === true;// Build sanitized response with only allowed top-level fieldsconst sanitized: JsonRecord = {};@@ -296,6 +312,9 @@ export function sanitizeOpenAIResponse(body: unknown): unknown {) {sanitizedChoice.finish_reason = "tool_calls";}+ if (stripReasoning && message && "reasoning_content" in message) {+ delete message.reasoning_content;+ }return sanitizedChoice;});} else {diff --git a/open-sse/package.json b/open-sse/package.jsonindex 3c06fd0eca..9329fca7a4 100644--- a/open-sse/package.json+++ b/open-sse/package.json@@ -1,6 +1,6 @@{"name": "@omniroute/open-sse",- "version": "3.8.36",+ "version": "3.8.37","description": "Express SSE sidecar for OmniRoute — handles streaming, protocol translation, and provider orchestration","type": "module","main": "index.js",diff --git a/open-sse/services/model.ts b/open-sse/services/model.tsindex 5d306d6fa7..674ddbe2ce 100644--- a/open-sse/services/model.ts+++ b/open-sse/services/model.ts@@ -148,6 +148,34 @@ export function resolveProviderAlias(aliasOrId: string | null | undefined): strireturn ALIAS_TO_PROVIDER_ID[aliasOrId] || aliasOrId;}+/**+ * #474 — Resolve a bare model name to the selected connection's `defaultModel`.+ *+ * When the client requested a bare model name (no "/", e.g. an alias that+ * resolved to "auto") and the chosen connection declares a `defaultModel`, the+ * upstream provider must receive that concrete model ID instead of the+ * placeholder. A "/"-qualified model name is an explicit provider/model choice+ * and is always returned untouched.+ *+ * Pure function — `requestedModelStr` is the raw client-facing model string+ * (used only to decide whether the name is "bare"); `resolvedModel` is the+ * already-resolved model that would otherwise be sent upstream.+ */+export function resolveBareModelToConnectionDefault(+ requestedModelStr: string | null | undefined,+ resolvedModel: string | null | undefined,+ connectionDefaultModel: string | null | undefined+): string | null {+ const fallback = typeof resolvedModel === "string" ? resolvedModel : null;+ if (typeof requestedModelStr !== "string" || requestedModelStr.includes("/")) {+ return fallback;+ }+ if (typeof connectionDefaultModel === "string" && connectionDefaultModel.length > 0) {+ return connectionDefaultModel;+ }+ return fallback;+}+function isCrossProxyModelCompatEnabled() {const raw = process.env.MODEL_ALIAS_COMPAT_ENABLED;return raw !== "false" && raw !== "0";diff --git a/open-sse/services/provider.ts b/open-sse/services/provider.tsindex e269c85863..fddf0daae8 100644--- a/open-sse/services/provider.ts+++ b/open-sse/services/provider.ts@@ -7,6 +7,7 @@ import {joinClaudeCodeCompatibleUrl,} from "./claudeCodeCompatible.ts";import { getClaudeCodeCompatibleRequestDefaults } from "@/lib/providers/requestDefaults";+import { buildClineHeaders } from "@/shared/utils/clineAuth";const OPENAI_COMPATIBLE_PREFIX = "openai-compatible-";const OPENAI_COMPATIBLE_DEFAULTS = {@@ -347,6 +348,11 @@ export function buildProviderHeaders(provider, credentials, stream = true, bodyif (!stream) {headers["Accept"] = "application/json";}+ } else if (provider === "cline") {+ // Cline's API requires the bearer token prefixed with `workos:` plus a set+ // of Cline client-identification headers; plain `Bearer <token>` is rejected+ // upstream. buildClineHeaders() emits both.+ Object.assign(headers, buildClineHeaders(credentials.apiKey || credentials.accessToken));} else if (entry) {// Registry-driven authconst authHeader = entry.authHeader || "bearer";diff --git a/open-sse/services/tokenRefresh.ts b/open-sse/services/tokenRefresh.tsindex 34eac23a74..2528c167bc 100755--- a/open-sse/services/tokenRefresh.ts+++ b/open-sse/services/tokenRefresh.ts@@ -50,9 +50,22 @@ export const REFRESH_LEAD_MS: Record<string, number> = {/*** Get the proactive refresh lead time (ms) for a given provider.- * Falls back to TOKEN_EXPIRY_BUFFER_MS (5 min) when not explicitly listed.+ *+ * Precedence:+ * 1. A per-connection override in `providerSpecificData.refreshLeadMs`+ * (must be a positive finite number), so an operator can tune the lead+ * time for a single connection without touching the provider defaults.+ * 2. The provider default from REFRESH_LEAD_MS.+ * 3. TOKEN_EXPIRY_BUFFER_MS (5 min) when nothing else applies.*/-export function getRefreshLeadMs(provider: string): number {+export function getRefreshLeadMs(+ provider: string,+ providerSpecificData?: { refreshLeadMs?: unknown } | null+): number {+ const override = providerSpecificData?.refreshLeadMs;+ if (typeof override === "number" && Number.isFinite(override) && override > 0) {+ return override;+ }return REFRESH_LEAD_MS[provider] ?? TOKEN_EXPIRY_BUFFER_MS;}@@ -1063,6 +1076,26 @@ export async function refreshCodexToken(refreshToken, log, proxyConfig: unknownreturn { error: "unrecoverable_refresh_error", code: errorCode };}+ // Defense-in-depth (port from decolua/9router#1821): any 401 from OpenAI's+ // OAuth token endpoint means the refresh credential itself was rejected+ // (e.g. rotated away, or a payload variant whose code we do not yet+ // recognize — OpenAI has shipped both `token_expired` and the bare+ // "Could not validate your token" message). Retrying with the same dead+ // refresh token will never succeed; surface re-auth instead of looping.+ // 429 / 5xx remain transient and fall through to the retryable branch.+ if (response.status === 401) {+ const code = errorCode || "unauthorized";+ log?.error?.(+ "TOKEN_REFRESH",+ "Codex OAuth token endpoint returned 401. Re-authentication required.",+ {+ status: response.status,+ errorCode: code,+ }+ );+ return { error: "unrecoverable_refresh_error", code };+ }+log?.error?.("TOKEN_REFRESH", "Failed to refresh Codex token", {status: response.status,error: errorText,diff --git a/open-sse/transformer/responsesTransformer.ts b/open-sse/transformer/responsesTransformer.tsindex 6eebf965e0..0bb9156a73 100644--- a/open-sse/transformer/responsesTransformer.ts+++ b/open-sse/transformer/responsesTransformer.ts@@ -97,6 +97,11 @@ export function createResponsesApiTransformStream(logger = null, keepaliveIntervfuncCallIds: {},funcArgsDone: {},funcItemDone: {},+ completedOutputItems: [] as Array<{+ output_index: number;+ item: Record<string, unknown>;+ seq: number;+ }>,buffer: "",completedSent: false,usage: null,@@ -106,6 +111,36 @@ export function createResponsesApiTransformStream(logger = null, keepaliveIntervconst encoder = new TextEncoder();const nextSeq = () => ++state.seq;+ // Normalize output_index to a non-negative integer (replaces fragile parseInt calls)+ const normalizeOutputIndex = (outputIndex: number | string): number => {+ const normalized = Number(outputIndex);+ return Number.isInteger(normalized) && normalized >= 0 ? normalized : 0;+ };++ // Record a finalized item as it is emitted in output_item.done so buildDenseOutput+ // can later sort by the actual output_index rather than rebuilding from state dicts.+ const recordCompletedItem = (+ outputIndex: number | string,+ item: Record<string, unknown>+ ): number => {+ const normalized = normalizeOutputIndex(outputIndex);+ state.completedOutputItems.push({ output_index: normalized, item, seq: state.seq });+ return normalized;+ };++ // Build a dense, deterministic output array sorted by output_index then by seq+ // (emission order within the same index) — mirrors upstream PR #721.+ const buildDenseOutput = (): Array<Record<string, unknown>> =>+ state.completedOutputItems+ .slice()+ .sort((left, right) => {+ if (left.output_index !== right.output_index) {+ return left.output_index - right.output_index;+ }+ return left.seq - right.seq;+ })+ .map(({ item }) => item);+const emit = (controller, eventType, data) => {data.sequence_number = nextSeq();const output = `event: ${eventType}\ndata: ${JSON.stringify(data)}\n\n`;@@ -172,15 +207,19 @@ export function createResponsesApiTransformStream(logger = null, keepaliveIntervpart: { type: "summary_text", text: state.reasoningBuf },});+ const reasoningItem = {+ id: state.reasoningId,+ type: "reasoning",+ summary: [{ type: "summary_text", text: state.reasoningBuf }],+ };+emit(controller, "response.output_item.done", {type: "response.output_item.done",output_index: state.reasoningIndex,- item: {- id: state.reasoningId,- type: "reasoning",- summary: [{ type: "summary_text", text: state.reasoningBuf }],- },+ item: reasoningItem,});++ recordCompletedItem(state.reasoningIndex, reasoningItem);}};@@ -188,12 +227,13 @@ export function createResponsesApiTransformStream(logger = null, keepaliveIntervif (state.msgItemAdded[idx] && !state.msgItemDone[idx]) {state.msgItemDone[idx] = true;const fullText = state.msgTextBuf[idx] || "";- const msgId = `msg_${state.responseId}_${idx}`;+ const normalizedIndex = normalizeOutputIndex(idx);+ const msgId = `msg_${state.responseId}_${normalizedIndex}`;emit(controller, "response.output_text.done", {type: "response.output_text.done",item_id: msgId,- output_index: parseInt(idx),+ output_index: normalizedIndex,content_index: 0,text: fullText,logprobs: [],@@ -202,27 +242,32 @@ export function createResponsesApiTransformStream(logger = null, keepaliveIntervemit(controller, "response.content_part.done", {type: "response.content_part.done",item_id: msgId,- output_index: parseInt(idx),+ output_index: normalizedIndex,content_index: 0,part: { type: "output_text", annotations: [], logprobs: [], text: fullText },});+ const msgItem = {+ id: msgId,+ type: "message",+ content: [{ type: "output_text", annotations: [], logprobs: [], text: fullText }],+ role: "assistant",+ };+emit(controller, "response.output_item.done", {type: "response.output_item.done",- output_index: parseInt(idx),- item: {- id: msgId,- type: "message",- content: [{ type: "output_text", annotations: [], logprobs: [], text: fullText }],- role: "assistant",- },+ output_index: normalizedIndex,+ item: msgItem,});++ recordCompletedItem(normalizedIndex, msgItem);}};- const closeToolCall = (controller, idx) => {+ const closeToolCall = (controller, idx, recordAsCompleted = true) => {const callId = state.funcCallIds[idx];if (callId && !state.funcItemDone[idx]) {+ const normalizedIndex = normalizeOutputIndex(idx);let args = state.funcArgsBuf[idx] || "{}";// Fix #1674 & #1852: Final cleanup of empty string and empty array placeholders@@ -248,22 +293,30 @@ export function createResponsesApiTransformStream(logger = null, keepaliveIntervemit(controller, "response.function_call_arguments.done", {type: "response.function_call_arguments.done",item_id: `fc_${callId}`,- output_index: parseInt(idx),+ output_index: normalizedIndex,arguments: args,});+ const funcItem = {+ id: `fc_${callId}`,+ type: "function_call",+ arguments: args,+ call_id: callId,+ name: state.funcNames[idx] || "",+ };+emit(controller, "response.output_item.done", {type: "response.output_item.done",- output_index: parseInt(idx),- item: {- id: `fc_${callId}`,- type: "function_call",- arguments: args,- call_id: callId,- name: state.funcNames[idx] || "",- },+ output_index: normalizedIndex,+ item: funcItem,});+ // Only record as a completed output item when this is a final close (not a+ // superseded-call eviction where a new call replaced this one at the same index).+ if (recordAsCompleted) {+ recordCompletedItem(normalizedIndex, funcItem);+ }+state.funcItemDone[idx] = true;state.funcArgsDone[idx] = true;}@@ -273,33 +326,9 @@ export function createResponsesApiTransformStream(logger = null, keepaliveIntervif (!state.completedSent) {state.completedSent = true;- // Build output from accumulated state- const output = [];- if (state.reasoningId) {- output.push({- id: state.reasoningId,- type: "reasoning",- summary: [{ type: "summary_text", text: state.reasoningBuf }],- });- }- for (const idx in state.msgItemAdded) {- output.push({- id: `msg_${state.responseId}_${idx}`,- type: "message",- role: "assistant",- content: [{ type: "output_text", annotations: [], text: state.msgTextBuf[idx] || "" }],- });- }- for (const idx in state.funcCallIds) {- const callId = state.funcCallIds[idx];- output.push({- id: `fc_${callId}`,- type: "function_call",- call_id: callId,- name: state.funcNames[idx] || "",- arguments: state.funcArgsBuf[idx] || "{}",- });- }+ // Build a dense, deterministic output array from items recorded as they were emitted.+ // Sorted by output_index then by emission sequence for stable ordering.+ const output = buildDenseOutput();const response: Record<string, unknown> = {id: state.responseId,@@ -416,6 +445,17 @@ export function createResponsesApiTransformStream(logger = null, keepaliveInterv// Handle text content (may contain <think> tags)if (delta.content) {+ // Close reasoning if it was opened via native reasoning_content+ // and is still open, before emitting message content. Without this+ // the reasoning item is never closed and the message reuses the+ // reasoning output_index, producing a protocol-invalid stream.+ // Guard on !inThinking: reasoning opened via <think> tags is closed by+ // its matching </think> below — force-closing it here would snapshot a+ // partial buffer (dense output records the item at close time). (#4848 + #4906)+ if (state.reasoningId && !state.reasoningDone && !state.inThinking) {+ closeReasoning(controller);+ }+let content = delta.content;if (content.includes("<think>")) {@@ -442,31 +482,36 @@ export function createResponsesApiTransformStream(logger = null, keepaliveInterv// Regular text contentif (content) {+ // Use a distinct output_index for the message when reasoning was+ // emitted, so the message item does not collide with the+ // reasoning item's output_index.+ const msgIdx = state.reasoningId ? state.reasoningIndex + 1 : idx;+// Fix for #1211: Strip leading double-newlines / blank spaces from the very first text chunk- if (!state.msgTextBuf[idx]) {+ if (!state.msgTextBuf[msgIdx]) {content = content.trimStart();}if (!content) continue;- if (!state.msgItemAdded[idx]) {- state.msgItemAdded[idx] = true;- const msgId = `msg_${state.responseId}_${idx}`;+ if (!state.msgItemAdded[msgIdx]) {+ state.msgItemAdded[msgIdx] = true;+ const msgId = `msg_${state.responseId}_${msgIdx}`;emit(controller, "response.output_item.added", {type: "response.output_item.added",- output_index: idx,+ output_index: msgIdx,item: { id: msgId, type: "message", content: [], role: "assistant" },});}- if (!state.msgContentAdded[idx]) {- state.msgContentAdded[idx] = true;+ if (!state.msgContentAdded[msgIdx]) {+ state.msgContentAdded[msgIdx] = true;emit(controller, "response.content_part.added", {type: "response.content_part.added",- item_id: `msg_${state.responseId}_${idx}`,- output_index: idx,+ item_id: `msg_${state.responseId}_${msgIdx}`,+ output_index: msgIdx,content_index: 0,part: { type: "output_text", annotations: [], logprobs: [], text: "" },});@@ -474,21 +519,27 @@ export function createResponsesApiTransformStream(logger = null, keepaliveIntervemit(controller, "response.output_text.delta", {type: "response.output_text.delta",- item_id: `msg_${state.responseId}_${idx}`,- output_index: idx,+ item_id: `msg_${state.responseId}_${msgIdx}`,+ output_index: msgIdx,content_index: 0,delta: content,logprobs: [],});- if (!state.msgTextBuf[idx]) state.msgTextBuf[idx] = "";- state.msgTextBuf[idx] += content;+ if (!state.msgTextBuf[msgIdx]) state.msgTextBuf[msgIdx] = "";+ state.msgTextBuf[msgIdx] += content;}}// Handle tool_callsif (delta.tool_calls) {- closeMessage(controller, idx);+ // Close reasoning first so tool calls do not collide with an+ // open reasoning item, then close the message at its real index.+ if (state.reasoningId && !state.reasoningDone) {+ closeReasoning(controller);+ }+ const msgIdx = state.reasoningId ? state.reasoningIndex + 1 : idx;+ closeMessage(controller, msgIdx);for (const tc of delta.tool_calls) {const tcIdx = tc.index ?? 0;@@ -497,7 +548,9 @@ export function createResponsesApiTransformStream(logger = null, keepaliveInterv// T37: Prevent merging if a new tool_call uses the same indexif (state.funcCallIds[tcIdx] && newCallId && state.funcCallIds[tcIdx] !== newCallId) {- closeToolCall(controller, tcIdx);+ // Superseded call: close and emit output_item.done but do NOT record as final output+ // since this call was replaced by a new one at the same index.+ closeToolCall(controller, tcIdx, false);delete state.funcCallIds[tcIdx];delete state.funcNames[tcIdx];delete state.funcArgsBuf[tcIdx];diff --git a/open-sse/translator/helpers/geminiToolsSanitizer.ts b/open-sse/translator/helpers/geminiToolsSanitizer.tsindex 4f1ae35e01..9e2979d1fe 100644--- a/open-sse/translator/helpers/geminiToolsSanitizer.ts+++ b/open-sse/translator/helpers/geminiToolsSanitizer.ts@@ -175,6 +175,10 @@ export function buildGeminiTools(}const functionDeclarations: GeminiFunctionDeclaration[] = [];+ // Track sanitized names already added to prevent Gemini rejection from duplicate+ // function declaration names (two different raw names that collapse to the same+ // sanitized form, or the same raw name repeated across tool groups).+ const seenToolNames = new Set<string>();let googleSearchTool: GeminiTool | null = null;for (const rawTool of tools) {@@ -194,8 +198,11 @@ export function buildGeminiTools(continue;}+ const sanitizedName = sanitizeGeminiToolName(fn.name, options);+ if (seenToolNames.has(sanitizedName)) continue;+ seenToolNames.add(sanitizedName);functionDeclarations.push({- name: sanitizeGeminiToolName(fn.name, options),+ name: sanitizedName,description: typeof fn.description === "string" ? fn.description : "",parameters: cleanJSONSchemaForAntigravity(toGeminiParametersSchema(fn.parameters)),});@@ -204,11 +211,15 @@ export function buildGeminiTools(}if (typeof rawTool.name === "string" && rawTool.name.trim()) {- functionDeclarations.push({- name: sanitizeGeminiToolName(rawTool.name, options),- description: typeof rawTool.description === "string" ? rawTool.description : "",- parameters: cleanJSONSchemaForAntigravity(toGeminiParametersSchema(rawTool.input_schema)),- });+ const sanitizedName = sanitizeGeminiToolName(rawTool.name, options);+ if (!seenToolNames.has(sanitizedName)) {+ seenToolNames.add(sanitizedName);+ functionDeclarations.push({+ name: sanitizedName,+ description: typeof rawTool.description === "string" ? rawTool.description : "",+ parameters: cleanJSONSchemaForAntigravity(toGeminiParametersSchema(rawTool.input_schema)),+ });+ }continue;}@@ -218,11 +229,15 @@ export function buildGeminiTools(continue;}- functionDeclarations.push({- name: sanitizeGeminiToolName(fn.name, options),- description: typeof fn.description === "string" ? fn.description : "",- parameters: cleanJSONSchemaForAntigravity(toGeminiParametersSchema(fn.parameters)),- });+ const sanitizedName = sanitizeGeminiToolName(fn.name, options);+ if (!seenToolNames.has(sanitizedName)) {+ seenToolNames.add(sanitizedName);+ functionDeclarations.push({+ name: sanitizedName,+ description: typeof fn.description === "string" ? fn.description : "",+ parameters: cleanJSONSchemaForAntigravity(toGeminiParametersSchema(fn.parameters)),+ });+ }}}diff --git a/open-sse/translator/helpers/openaiHelper.ts b/open-sse/translator/helpers/openaiHelper.tsindex 375364c725..b6a9bbfb32 100644--- a/open-sse/translator/helpers/openaiHelper.ts+++ b/open-sse/translator/helpers/openaiHelper.ts@@ -43,8 +43,15 @@ export function filterToOpenAIFormat(body) {// Keep tool messages as-is (OpenAI format)if (msg.role === "tool") return msg;- // Keep assistant messages with tool_calls as-is- if (msg.role === "assistant" && msg.tool_calls) return msg;+ // Keep assistant messages with tool_calls, but strip reasoning_content —+ // reasoning blobs inflate context on every subsequent agentic turn (O(n^2)).+ if (msg.role === "assistant" && msg.tool_calls) {+ if (msg.reasoning_content !== undefined) {+ const { reasoning_content, ...cleanMsg } = msg;+ return cleanMsg;+ }+ return msg;+ }// Handle string contentif (typeof msg.content === "string") return msg;@@ -178,7 +185,9 @@ export function filterToOpenAIFormat(body) {type: "function",function: {name: tool.name,- description: tool.description || "",+ // Coerce: strict upstream validators (NVIDIA NIM, Codex) reject+ // non-string descriptions. Ports decolua/9router#397.+ description: String(tool.description ?? ""),parameters: tool.input_schema || { type: "object", properties: {} },},};@@ -190,7 +199,7 @@ export function filterToOpenAIFormat(body) {type: "function",function: {name: fn.name,- description: fn.description || "",+ description: String(fn.description ?? ""),parameters: fn.parameters || { type: "object", properties: {} },},}));diff --git a/open-sse/translator/index.ts b/open-sse/translator/index.tsindex febb538cb1..d0f00967aa 100644--- a/open-sse/translator/index.ts+++ b/open-sse/translator/index.ts@@ -565,6 +565,7 @@ export function initState(sourceFormat) {funcCallIds: {},funcArgsDone: {},funcItemDone: {},+ completedOutputItems: [],completedSent: false,};}diff --git a/open-sse/translator/request/antigravity-to-openai.ts b/open-sse/translator/request/antigravity-to-openai.tsindex 2faac10e5c..24d25d4b11 100644--- a/open-sse/translator/request/antigravity-to-openai.ts+++ b/open-sse/translator/request/antigravity-to-openai.ts@@ -85,7 +85,7 @@ export function antigravityToOpenAIRequest(model, body, stream) {function: {name: func.name,description: func.description || "",- parameters: normalizeSchemaTypes(func.parameters) || {+ parameters: cleanSchemaPreservingRequired(func.parameters) || {type: "object",properties: {},},@@ -100,18 +100,24 @@ export function antigravityToOpenAIRequest(model, body, stream) {}// Recursively convert Antigravity schema types (OBJECT, STRING, etc.) to lowercase-function normalizeSchemaTypes(schema) {+// and strip unsupported fields like enumDescriptions.+function normalizeSchemaTypes(schema: unknown): unknown {if (!schema || typeof schema !== "object") return schema;- const result = Array.isArray(schema) ? [...schema] : { ...schema };+ const result: JsonRecord = Array.isArray(schema)+ ? ([...(schema as unknown[])] as unknown as JsonRecord)+ : { ...(schema as JsonRecord) };if (typeof result.type === "string") {result.type = result.type.toLowerCase();}- if (result.properties) {- const normalized = {};- for (const [key, val] of Object.entries(result.properties)) {+ // Strip enumDescriptions — not supported by upstream APIs+ delete result.enumDescriptions;++ if (result.properties && typeof result.properties === "object") {+ const normalized: JsonRecord = {};+ for (const [key, val] of Object.entries(result.properties as JsonRecord)) {normalized[key] = normalizeSchemaTypes(val);}result.properties = normalized;@@ -124,6 +130,83 @@ function normalizeSchemaTypes(schema) {return result;}+// Clean a JSON Schema for Antigravity while PRESERVING the `required` array at every level.+// Unlike the type-lowering pass alone, this strips JSON Schema Draft 2020-12 meta keywords+// ($schema, $defs, $ref, additionalProperties, patternProperties, title, x-*, ...) that the+// Antigravity upstream does not accept, yet keeps `required` so the model still treats+// mandatory tool arguments as mandatory. Clients such as OpenCode send full Draft 2020-12+// tool schemas; dropping `required` lets the model call tools without their required args.+function cleanSchemaPreservingRequired(schema: unknown): unknown {+ if (!schema || typeof schema !== "object") return schema;++ // Reuse the existing recursion to lowercase types + strip enumDescriptions, then+ // remove draft-meta keywords and reconcile `required` against the surviving properties.+ const normalized = normalizeSchemaTypes(structuredClone(schema));+ stripDraftMeta(normalized);+ preserveRequired(normalized);+ return normalized;+}++// Draft 2020-12 / JSON Schema meta keywords the Antigravity upstream does not accept.+const DRAFT_META_KEYS = new Set([+ "$schema",+ "$defs",+ "definitions",+ "$ref",+ "$comment",+ "const",+ "additionalProperties",+ "propertyNames",+ "patternProperties",+ "title",+]);++function stripDraftMeta(obj: unknown): void {+ if (!obj || typeof obj !== "object") return;+ if (Array.isArray(obj)) {+ for (const item of obj) stripDraftMeta(item);+ return;+ }+ const record = obj as JsonRecord;+ for (const key of Object.keys(record)) {+ if (DRAFT_META_KEYS.has(key) || key.startsWith("x-")) {+ delete record[key];+ }+ }+ for (const value of Object.values(record)) {+ if (value && typeof value === "object") stripDraftMeta(value);+ }+}++// Preserve `required` even when referenced fields were stripped from constraint blocks.+// At each node where both `required` and `properties` are present, keep only the entries+// that still exist in `properties`; drop `required` entirely if none survive. This avoids+// emitting a `required` array that references fields removed by stripDraftMeta.+function preserveRequired(obj: unknown): void {+ if (!obj || typeof obj !== "object") return;+ if (Array.isArray(obj)) {+ for (const item of obj) preserveRequired(item);+ return;+ }+ const record = obj as JsonRecord;+ if (Array.isArray(record.required) && record.properties && typeof record.properties === "object") {+ const properties = record.properties as JsonRecord;+ const valid = (record.required as unknown[]).filter(+ (field) =>+ typeof field === "string" &&+ Object.prototype.hasOwnProperty.call(properties, field)+ );+ if (valid.length === 0) {+ delete record.required;+ } else {+ record.required = valid;+ }+ }+ for (const value of Object.values(record)) {+ if (value && typeof value === "object") preserveRequired(value);+ }+}+// Convert Antigravity content to OpenAI message// Handles: text, thought, thoughtSignature, functionCall, functionResponse, inlineDatafunction convertContent(content) {diff --git a/open-sse/translator/request/claude-to-openai.ts b/open-sse/translator/request/claude-to-openai.tsindex b6ff556316..94b2a19b92 100644--- a/open-sse/translator/request/claude-to-openai.ts+++ b/open-sse/translator/request/claude-to-openai.ts@@ -5,6 +5,19 @@ import { adjustMaxTokens } from "../helpers/maxTokensHelper.ts";type JsonRecord = Record<string, unknown>;const TOOL_CHOICE_ANY = ["a", "n", "y"].join("");+/**+ * Port of decolua/9router commit 0aaa5ab3 (closes prompt-cache instability):+ * Anthropic injects a dynamic `x-anthropic-billing-header: <value>` line at+ * the top of some system prompts. When we translate Claude → OpenAI and+ * forward to a non-Anthropic upstream, that line both leaks into the+ * assistant prompt and rotates per request, destroying prompt-cache hits.+ * Strip it from each system entry before assembling the OpenAI request.+ */+function stripAnthropicBillingHeader(text: unknown): string {+ if (typeof text !== "string") return "";+ return text.replace(/^x-anthropic-billing-header:[^\n]*(?:\r?\n)?/i, "");+}+/*** Normalize tool input schema for OpenAI compatibility.* OpenAI strict mode requires `properties: {}` on object-type schemas,@@ -108,8 +121,11 @@ export function claudeToOpenAIRequest(model, body, stream, credentials: unknown// System messageif (body.system) {const systemContent = Array.isArray(body.system)- ? body.system.map((s) => s.text || "").join("\n")- : body.system;+ ? body.system+ .map((s) => stripAnthropicBillingHeader(s.text || ""))+ .filter(Boolean)+ .join("\n")+ : stripAnthropicBillingHeader(body.system);if (systemContent) {result.messages.push({diff --git a/open-sse/translator/request/openai-responses.ts b/open-sse/translator/request/openai-responses.tsindex bc2a36c8c7..979c92bfcf 100644--- a/open-sse/translator/request/openai-responses.ts+++ b/open-sse/translator/request/openai-responses.ts@@ -294,6 +294,66 @@ export function openaiResponsesToOpenAIRequest(continue;}+ if (itemType === "custom_tool_call") {+ // Codex custom tool call (e.g. apply_patch): `input` is a raw string, not JSON+ // arguments. Map it onto the assistant tool_calls list as a function call whose+ // arguments wrap the raw string as { input }, matching the { input: string }+ // schema the request-side tools normalization advertises for custom tools.+ const fnName = toString(item.name).trim();+ if (!fnName) {+ continue;+ }+ if (!currentAssistantMsg) {+ currentAssistantMsg = {+ role: "assistant",+ content: null,+ tool_calls: [],+ };+ }+ const toolCalls = Array.isArray(currentAssistantMsg.tool_calls)+ ? currentAssistantMsg.tool_calls+ : [];+ toolCalls.push({+ id: toString(item.call_id),+ type: "function",+ function: {+ name: fnName,+ arguments: JSON.stringify({ input: item.input }),+ },+ });+ currentAssistantMsg.tool_calls = toolCalls;+ continue;+ }++ if (itemType === "custom_tool_call_output") {+ // Result of a custom tool call — translate the same way as function_call_output.+ if (currentAssistantMsg) {+ messages.push(currentAssistantMsg);+ currentAssistantMsg = null;+ }+ if (pendingToolResults.length > 0) {+ for (const toolResult of pendingToolResults) {+ messages.push(toolResult);+ }+ pendingToolResults = [];+ }+ // Unwrap JSON-wrapped output {"output":"...","metadata":{...}} → plain string.+ const rawOut = typeof item.output === "string" ? item.output : JSON.stringify(item.output);+ let toolContent = rawOut;+ try {+ const parsed = JSON.parse(rawOut);+ if (parsed && typeof parsed.output === "string") toolContent = parsed.output;+ } catch {+ // Not JSON — keep the raw output as the tool content.+ }+ messages.push({+ role: "tool",+ tool_call_id: toString(item.call_id),+ content: toolContent,+ });+ continue;+ }+if (itemType === "reasoning") {// Skip reasoning items - they are display-only metadatacontinue;@@ -342,10 +402,11 @@ export function openaiResponsesToOpenAIRequest(function: {name: toString(sub.name),description: toString(sub.description),- parameters: sub.parameters ?? sub.input_schema ?? {- type: "object",- properties: {},- },+ parameters: sub.parameters ??+ sub.input_schema ?? {+ type: "object",+ properties: {},+ },},}));}@@ -381,10 +442,42 @@ export function openaiResponsesToOpenAIRequest(},};}+ // Responses API "hosted" tools (e.g. Codex's request_user_input,+ // { type: "request_user_input" }) carry no explicit `name` and cannot be+ // represented as a Chat Completions function declaration. Emitting them with+ // an empty name produces an anonymous functionDeclaration that downstream+ // providers such as Gemini reject with a 400 ("Invalid function name").+ // Skip any tool without a non-empty string name; named tools are unaffected.+ const name = tool.name;+ if (typeof name !== "string" || name.trim() === "") return [];++ // Custom/freeform tools (e.g. Codex apply_patch with type:"custom" and a grammar+ // format) carry no `parameters` field. Converting them to an empty function schema+ // makes downstream models invoke them with {}, but the Codex runtime expects+ // { input: string }. Normalize all custom tools to a well-defined { input: string }+ // schema so the model produces valid arguments. (#1007)+ if (toolType === "custom") {+ return {+ type: "function",+ function: {+ name: toString(tool.name),+ description: toString(tool.description),+ parameters: {+ type: "object",+ properties: {+ input: { type: "string" },+ },+ required: ["input"],+ additionalProperties: false,+ },+ strict: tool.strict,+ },+ };+ }return {type: "function",function: {- name: toString(tool.name),+ name,description: toString(tool.description),parameters: tool.parameters,strict: tool.strict,@@ -445,21 +538,23 @@ export function openaiResponsesToOpenAIRequest(}delete result.store;- // Copilot-only: promote Responses `reasoning.{effort,summary}` to Chat fields- // so the downstream openai-to-claude translator can enable extended thinking.- // Gated by the UA marker from translateRequest; other clients see `reasoning` dropped.- if (- credentialRecord._copilotClient === true &&- root.reasoning &&- typeof root.reasoning === "object" &&- !Array.isArray(root.reasoning)- ) {+ // Promote Responses `reasoning.effort` to the Chat-Completions-native+ // `reasoning_effort` field so OpenAI-family upstreams (and the downstream+ // openai-to-claude translator's extended-thinking path) keep the hint when a+ // Responses client is routed across formats. The Copilot-only `summary` ->+ // Claude summarized-thinking marker stays behind the UA gate from+ // translateRequest because it is Copilot-specific glue, not an OpenAI-native+ // field. Ported from upstream PR decolua/9router#1817 (ryanngit).+ if (root.reasoning && typeof root.reasoning === "object" && !Array.isArray(root.reasoning)) {const reasoningRec = toRecord(root.reasoning);const effort = toString(reasoningRec.effort);if (effort && result.reasoning_effort === undefined) {result.reasoning_effort = normalizeResponsesReasoningEffort(effort);}- if (shouldRequestClaudeSummarizedThinking(reasoningRec.summary)) {+ if (+ credentialRecord._copilotClient === true &&+ shouldRequestClaudeSummarizedThinking(reasoningRec.summary)+ ) {result[COPILOT_REASONING_SUMMARY_MARKER] = "summarized";}}@@ -539,6 +634,19 @@ export function openaiToOpenAIResponsesRequest(}return imgResult;}+ if (+ contentItem.type === "image" &&+ typeof contentItem.image === "string" &&+ /^data:([^;]+);base64,(.+)$/.test(contentItem.image)+ ) {+ // AI SDK-style image part: { type: "image", image: "data:...;base64,..." } (#1330)+ const imgResult: JsonRecord = {+ type: "input_image",+ image_url: contentItem.image,+ detail: contentItem.detail !== undefined ? contentItem.detail : "auto",+ };+ return imgResult;+ }if (contentItem.type === "file" || contentItem.type === "document") {// Accept both the OpenAI `file` shape and the Gemini-style `document` shape,// and map the bare `data`/`url` fields too, so a PDF reaches Codex/Responsesdiff --git a/open-sse/translator/request/openai-to-claude.ts b/open-sse/translator/request/openai-to-claude.tsindex 6e8d9b0058..c4cfae7a3a 100644--- a/open-sse/translator/request/openai-to-claude.ts+++ b/open-sse/translator/request/openai-to-claude.ts@@ -223,7 +223,23 @@ export function openaiToClaudeRequest(model, body, stream) {};// Temperature- if (body.temperature !== undefined) {+ //+ // Claude's Messages API rejects `temperature` when extended thinking is active.+ // Two cases where thinking is on:+ // (a) Caller passes `body.thinking` or `body.reasoning_effort` (handled later —+ // `result.thinking` becomes truthy, and we strip temperature at the end).+ // (b) The request targets Claude OAuth (claude-code), which always sends+ // `Anthropic-Beta: ...,interleaved-thinking-2025-05-14,...` in headers.+ // The model is forced into thinking server-side, but neither `body.thinking`+ // nor `result.thinking` will be set, so we detect this by model name. This+ // affects claude-opus-4.x and claude-sonnet-4.x (the families that support+ // extended thinking).+ //+ // For models that don't force thinking (haiku, older sonnets), preserve temperature.+ // Note: Opus 4.7+/Fable 5 already drop sampling params upstream of the translator via+ // the registry `unsupportedParams` strip; this covers the remaining 4.x families.+ const modelForcesThinking = /claude-(?:opus|sonnet)-4/i.test(String(model));+ if (body.temperature !== undefined && !modelForcesThinking) {result.temperature = body.temperature;}if (body.temperature === undefined && body.top_p !== undefined) {@@ -527,6 +543,15 @@ export function openaiToClaudeRequest(model, body, stream) {delete result[COPILOT_REASONING_SUMMARY_MARKER];+ // Final guard: Claude rejects `temperature` whenever extended thinking is+ // enabled. If `result.thinking` was set above from `body.thinking` or+ // `body.reasoning_effort` (manual budget or adaptive effort), drop temperature+ // defensively. The model-name strip earlier already covers Claude OAuth's+ // forced-thinking case (claude-opus-4.x / claude-sonnet-4.x).+ if (result.thinking && result.temperature !== undefined) {+ delete result.temperature;+ }+// Attach toolNameMap to result for response translationif (toolNameMap.size > 0) {result._toolNameMap = toolNameMap;diff --git a/open-sse/translator/request/openai-to-gemini.ts b/open-sse/translator/request/openai-to-gemini.tsindex 3042ce12e0..09f1001a16 100644--- a/open-sse/translator/request/openai-to-gemini.ts+++ b/open-sse/translator/request/openai-to-gemini.ts@@ -36,6 +36,16 @@ import { buildGeminiTools, sanitizeGeminiToolName } from "../helpers/geminiTools// See: https://github.com/keisksw/antigravity-output-analysisconst ANTIGRAVITY_CLAUDE_MAX_OUTPUT_TOKENS = 16_384;+// Gemini built-in tool names that Antigravity's v1internal endpoint rejects with a+// 400 when they are mixed with functionDeclarations in the same request. These must+// be stripped from the Cloud Code envelope's functionDeclarations.+const GEMINI_BUILTIN_TOOL_NAMES = new Set<string>([+ "google_search",+ "web_search",+ "search_web",+ "googleSearch",+]);+type GeminiPart = Record<string, unknown>;type GeminiContent = { role: string; parts: GeminiPart[] };@@ -753,8 +763,34 @@ function wrapInCloudCodeEnvelope(model, geminiCLI, credentials = null, isAntigraenvelope.request.systemInstruction = { role: "system", parts: [defaultPart] };}- // Add toolConfig for Antigravity- if (geminiCLI.tools?.some((tool) => Array.isArray(tool.functionDeclarations))) {+ // Strip Gemini built-in tool *names* out of functionDeclarations: Antigravity's+ // v1internal endpoint returns 400 when a built-in tool (google_search etc.) is+ // mixed with functionDeclarations in the same request. Native grounding entries+ // (e.g. `{ googleSearch: {} }`) are left intact; only the functionDeclarations+ // arrays are cleaned, and a declarations entry that becomes empty is dropped.+ if (envelope.request.tools && envelope.request.tools.length > 0) {+ const cleanedTools = envelope.request.tools+ .map((tool) => {+ if (!Array.isArray(tool.functionDeclarations)) {+ return tool;+ }+ const customDecls = tool.functionDeclarations.filter(+ (fn) => !GEMINI_BUILTIN_TOOL_NAMES.has(fn.name)+ );+ return { ...tool, functionDeclarations: customDecls };+ })+ .filter(+ (tool) =>+ !Array.isArray(tool.functionDeclarations) || tool.functionDeclarations.length > 0+ );+ envelope.request.tools = cleanedTools.length > 0 ? cleanedTools : undefined;+ }++ // Add toolConfig for Antigravity only when custom functionDeclarations remain.+ const hasCustomTools = envelope.request.tools?.some(+ (tool) => (tool.functionDeclarations?.length ?? 0) > 0+ );+ if (hasCustomTools) {envelope.request.toolConfig = {functionCallingConfig: { mode: "VALIDATED" },};diff --git a/open-sse/translator/request/openai-to-kiro.ts b/open-sse/translator/request/openai-to-kiro.tsindex 3b6052dbcb..9411b33dbd 100644--- a/open-sse/translator/request/openai-to-kiro.ts+++ b/open-sse/translator/request/openai-to-kiro.ts@@ -6,6 +6,28 @@ import { register } from "../registry.ts";import { FORMATS } from "../formats.ts";import { v4 as uuidv4, v5 as uuidv5 } from "uuid";+/**+ * Anthropic's direct-provider `[1m]` context-1m beta suffix. Kiro is AWS+ * Bedrock-backed and does not honor it, so forwarding a `kr/*` model id that+ * carries `[1m]` produces a malformed upstream model id at Bedrock.+ */+export const KIRO_UNSUPPORTED_CONTEXT_1M_SUFFIX = "[1m]";+export const KIRO_UNSUPPORTED_CONTEXT_1M_MESSAGE =+ "[kr/*] '[1m]' suffix is not supported by Kiro upstream. Kiro is AWS " ++ "Bedrock-backed and does not honor Anthropic's context-1m beta. Use a " ++ "direct-Anthropic provider for 1M-context routing.";++/**+ * Kiro is AWS Bedrock-backed, so Anthropic's direct-provider `[1m]` context+ * beta cannot be forwarded as part of a `kr/*` model id.+ */+export function hasUnsupportedKiroContextSuffix(model: unknown): boolean {+ return (+ typeof model === "string" &&+ model.toLowerCase().includes(KIRO_UNSUPPORTED_CONTEXT_1M_SUFFIX)+ );+}+function parseToolInput(value: unknown) {if (value && typeof value === "object" && !Array.isArray(value)) {return value;@@ -128,6 +150,12 @@ function convertMessages(messages, tools, model) {let currentRole = null;let toolsAttached = false;+ // Only Claude models support images in Kiro. Kiro also routes non-Claude+ // models (deepseek, minimax, glm, qwen3-coder-next, auto-kiro) that do not+ // accept image attachments — gate image extraction behind a Claude check so+ // we never attach images those models would reject.+ const supportsImages = typeof model === "string" && model.toLowerCase().includes("claude");+const flushPending = () => {if (currentRole === "user") {const content = pendingUserContent.join("\n\n").trim() || "(empty)";@@ -250,9 +278,10 @@ function convertMessages(messages, tools, model) {.map((c) => c.text || "");content = textParts.join("\n");- // Extract images (OpenAI image_url and Anthropic image formats)+ // Extract images (OpenAI image_url and Anthropic image formats).+ // Skip entirely for models that do not support images — see supportsImages.for (const block of msg.content) {- if (block.type === "image_url") {+ if (supportsImages && block.type === "image_url") {const url: string = block.image_url?.url || "";if (url.startsWith("data:")) {// data:image/jpeg;base64,<data>@@ -261,11 +290,11 @@ function convertMessages(messages, tools, model) {const format = mediaType.split("/")[1] || "jpeg";if (bytes) pendingImages.push({ format, source: { bytes } });}- } else if (block.type === "image" && block.source?.type === "base64") {+ } else if (supportsImages && block.type === "image" && block.source?.type === "base64") {const format = (block.source.media_type || "image/jpeg").split("/")[1] || "jpeg";if (block.source.data)pendingImages.push({ format, source: { bytes: block.source.data } });- } else if (block.type === "image" && typeof block.image === "string") {+ } else if (supportsImages && block.type === "image" && typeof block.image === "string") {// AI SDK-style image part: { type: "image", image: "data:...;base64,..." } (#1330)const url = block.image;if (url.startsWith("data:")) {@@ -632,6 +661,12 @@ function convertMessages(messages, tools, model) {* Build Kiro payload from OpenAI format*/export function buildKiroPayload(model, body, stream, credentials) {+ // Reject the Anthropic-only `[1m]` context beta before it reaches Bedrock —+ // Kiro cannot honor it and a forwarded `kr/*[1m]` id is malformed upstream.+ if (hasUnsupportedKiroContextSuffix(model)) {+ throw new Error(KIRO_UNSUPPORTED_CONTEXT_1M_MESSAGE);+ }+// Normalize model name: Claude Code sends dashes (claude-sonnet-4-6),// Kiro API expects dots (claude-sonnet-4.6). Convert trailing version segment.const normalizedModel = model.replace(diff --git a/open-sse/translator/response/kiro-to-openai.ts b/open-sse/translator/response/kiro-to-openai.tsindex 57b70e626b..f58a2aaeaa 100644--- a/open-sse/translator/response/kiro-to-openai.ts+++ b/open-sse/translator/response/kiro-to-openai.ts@@ -118,7 +118,12 @@ export function convertKiroToOpenAI(chunk, state) {if (eventType === "toolUseEvent" || data.toolUseEvent) {const toolUse = data.toolUseEvent || data;const toolCallId = toolUse.toolUseId || fallbackToolCallId();- const toolName = toolUse.name || "";+ // #1375: long tool names were hash-truncated for Kiro (sanitizeKiroTools).+ // Map the streamed name back to the original so the client sees the name+ // it sent. `state.toolNameMap` carries truncated → original entries.+ const rawName = toolUse.name || "";+ const toolName =+ state.toolNameMap instanceof Map ? state.toolNameMap.get(rawName) || rawName : rawName;const toolInput = toolUse.input || {};// #3980: record that this stream produced tool calls so the terminaldiff --git a/open-sse/translator/response/openai-responses.ts b/open-sse/translator/response/openai-responses.tsindex adc4680bb8..90a6b74d87 100644--- a/open-sse/translator/response/openai-responses.ts+++ b/open-sse/translator/response/openai-responses.ts@@ -125,6 +125,16 @@ export function openaiToOpenAIResponsesResponse(chunk, state) {// Handle text contentif (delta.content) {+ // Close reasoning if it was opened via native reasoning_content and is+ // still open, before emitting message content. Otherwise the reasoning+ // item is never closed and the message reuses its output_index.+ // Guard on !inThinking: reasoning opened via <think> tags is closed by its+ // matching </think> below — force-closing it here would snapshot a partial+ // buffer (dense output records the item at close time). (#4848 + #4906)+ if (state.reasoningId && !state.reasoningDone && !state.inThinking) {+ closeReasoning(state, emit);+ }+let content = delta.content;if (content.includes("<think>")) {@@ -149,13 +159,22 @@ export function openaiToOpenAIResponsesResponse(chunk, state) {}if (content) {- emitTextContent(state, emit, idx, content);+ // Use a distinct output_index for the message when reasoning was+ // emitted, so the message item does not collide with the reasoning item.+ const msgIdx = state.reasoningId ? state.reasoningIndex + 1 : idx;+ emitTextContent(state, emit, msgIdx, content);}}// Handle tool_callsif (delta.tool_calls) {- closeMessage(state, emit, idx);+ // Close reasoning first so tool calls do not collide with an open+ // reasoning item, then close the message at its real index.+ if (state.reasoningId && !state.reasoningDone) {+ closeReasoning(state, emit);+ }+ const msgIdx = state.reasoningId ? state.reasoningIndex + 1 : idx;+ closeMessage(state, emit, msgIdx);for (const tc of delta.tool_calls) {emitToolCall(state, emit, tc);}@@ -172,6 +191,36 @@ export function openaiToOpenAIResponsesResponse(chunk, state) {return events;}+// Normalize output_index to a non-negative integer (replaces fragile parseInt calls)+function normalizeOutputIndex(outputIndex) {+ const normalized = Number(outputIndex);+ return Number.isInteger(normalized) && normalized >= 0 ? normalized : 0;+}++// Record a finalized item keyed by output_index so buildDenseOutput can sort later+function recordCompletedItem(state, outputIndex, item) {+ if (!Array.isArray(state.completedOutputItems)) {+ state.completedOutputItems = [];+ }+ const normalized = normalizeOutputIndex(outputIndex);+ state.completedOutputItems.push({ output_index: normalized, item, seq: state.seq });+ return normalized;+}++// Build a dense, deterministic output array sorted by output_index then by seq+function buildDenseOutput(state) {+ const items = Array.isArray(state.completedOutputItems) ? state.completedOutputItems : [];+ return items+ .slice()+ .sort((left, right) => {+ if (left.output_index !== right.output_index) {+ return left.output_index - right.output_index;+ }+ return left.seq - right.seq;+ })+ .map(({ item }) => item);+}+// Helper functionsfunction startReasoning(state, emit, idx) {if (!state.reasoningId) {@@ -227,15 +276,19 @@ function closeReasoning(state, emit) {part: { type: "summary_text", text: state.reasoningBuf },});+ const reasoningItem = {+ id: state.reasoningId,+ type: "reasoning",+ summary: [{ type: "summary_text", text: state.reasoningBuf }],+ };+emit("response.output_item.done", {type: "response.output_item.done",output_index: state.reasoningIndex,- item: {- id: state.reasoningId,- type: "reasoning",- summary: [{ type: "summary_text", text: state.reasoningBuf }],- },+ item: reasoningItem,});++ recordCompletedItem(state, state.reasoningIndex, reasoningItem);}}@@ -280,12 +333,13 @@ function closeMessage(state, emit, idx) {if (state.msgItemAdded[idx] && !state.msgItemDone[idx]) {state.msgItemDone[idx] = true;const fullText = state.msgTextBuf[idx] || "";- const msgId = `msg_${state.responseId}_${idx}`;+ const normalizedIndex = normalizeOutputIndex(idx);+ const msgId = `msg_${state.responseId}_${normalizedIndex}`;emit("response.output_text.done", {type: "response.output_text.done",item_id: msgId,- output_index: parseInt(idx),+ output_index: normalizedIndex,content_index: 0,text: fullText,logprobs: [],@@ -294,21 +348,25 @@ function closeMessage(state, emit, idx) {emit("response.content_part.done", {type: "response.content_part.done",item_id: msgId,- output_index: parseInt(idx),+ output_index: normalizedIndex,content_index: 0,part: { type: "output_text", annotations: [], logprobs: [], text: fullText },});+ const msgItem = {+ id: msgId,+ type: "message",+ content: [{ type: "output_text", annotations: [], logprobs: [], text: fullText }],+ role: "assistant",+ };+emit("response.output_item.done", {type: "response.output_item.done",- output_index: parseInt(idx),- item: {- id: msgId,- type: "message",- content: [{ type: "output_text", annotations: [], logprobs: [], text: fullText }],- role: "assistant",- },+ output_index: normalizedIndex,+ item: msgItem,});++ recordCompletedItem(state, normalizedIndex, msgItem);}}@@ -320,7 +378,9 @@ function emitToolCall(state, emit, tc) {// T37: If we already have a tool call at this index but the ID changed,// we must close the current one and start a new one to prevent merging.if (state.funcCallIds[tcIdx] && newCallId && state.funcCallIds[tcIdx] !== newCallId) {- closeToolCall(state, emit, tcIdx);+ // Superseded call: close and emit output_item.done but do NOT record as final output+ // since this call was replaced by a new one at the same index.+ closeToolCall(state, emit, tcIdx, false);delete state.funcCallIds[tcIdx];delete state.funcNames[tcIdx];delete state.funcArgsBuf[tcIdx];@@ -330,19 +390,32 @@ function emitToolCall(state, emit, tc) {if (funcName) state.funcNames[tcIdx] = funcName;+ // Codex custom tools (apply_patch) are surfaced to the client as custom_tool_call items+ // and stream their raw patch via custom_tool_call_input.* events instead of the+ // function_call_arguments.* events used for regular function tools. (#1007)+ const isCustomTool = (state.funcNames[tcIdx] || funcName) === "apply_patch";+if (!state.funcCallIds[tcIdx] && newCallId) {state.funcCallIds[tcIdx] = newCallId;emit("response.output_item.added", {type: "response.output_item.added",output_index: tcIdx,- item: {- id: `fc_${newCallId}`,- type: "function_call",- arguments: "",- call_id: newCallId,- name: state.funcNames[tcIdx] || "",- },+ item: isCustomTool+ ? {+ id: `fc_${newCallId}`,+ type: "custom_tool_call",+ input: "",+ call_id: newCallId,+ name: state.funcNames[tcIdx] || "",+ }+ : {+ id: `fc_${newCallId}`,+ type: "function_call",+ arguments: "",+ call_id: newCallId,+ name: state.funcNames[tcIdx] || "",+ },});}@@ -356,8 +429,11 @@ function emitToolCall(state, emit, tc) {state.funcArgsBuf[tcIdx] = nextArgs;if (refCallId && emittedDelta) {- emit("response.function_call_arguments.delta", {- type: "response.function_call_arguments.delta",+ const deltaEvent = isCustomTool+ ? "response.custom_tool_call_input.delta"+ : "response.function_call_arguments.delta";+ emit(deltaEvent, {+ type: deltaEvent,item_id: `fc_${refCallId}`,output_index: tcIdx,delta: emittedDelta,@@ -366,29 +442,73 @@ function emitToolCall(state, emit, tc) {}}-function closeToolCall(state, emit, idx) {+function closeToolCall(state, emit, idx, recordAsCompleted = true) {const callId = state.funcCallIds[idx];if (callId && !state.funcItemDone[idx]) {+ const normalizedIndex = normalizeOutputIndex(idx);const args = state.funcArgsBuf[idx] || "{}";+ const isCustomTool = (state.funcNames[idx] || "") === "apply_patch";++ let funcItem;+ if (isCustomTool) {+ // The model produced JSON {"input":"..."} against the normalized custom-tool schema.+ // Unwrap it back to the raw patch string the Codex runtime expects. (#1007)+ let rawInput = args;+ try {+ const parsed = JSON.parse(args);+ if (parsed && typeof parsed.input === "string") rawInput = parsed.input;+ } catch {+ // Not JSON — fall back to the raw buffered arguments.+ }- emit("response.function_call_arguments.done", {- type: "response.function_call_arguments.done",- item_id: `fc_${callId}`,- output_index: parseInt(idx),- arguments: args,- });+ emit("response.custom_tool_call_input.done", {+ type: "response.custom_tool_call_input.done",+ item_id: `fc_${callId}`,+ output_index: normalizedIndex,+ input: rawInput,+ });- emit("response.output_item.done", {- type: "response.output_item.done",- output_index: parseInt(idx),- item: {+ funcItem = {+ id: `fc_${callId}`,+ type: "custom_tool_call",+ input: rawInput,+ call_id: callId,+ name: state.funcNames[idx] || "",+ };++ emit("response.output_item.done", {+ type: "response.output_item.done",+ output_index: normalizedIndex,+ item: funcItem,+ });+ } else {+ emit("response.function_call_arguments.done", {+ type: "response.function_call_arguments.done",+ item_id: `fc_${callId}`,+ output_index: normalizedIndex,+ arguments: args,+ });++ funcItem = {id: `fc_${callId}`,type: "function_call",arguments: args,call_id: callId,name: state.funcNames[idx] || "",- },- });+ };++ emit("response.output_item.done", {+ type: "response.output_item.done",+ output_index: normalizedIndex,+ item: funcItem,+ });+ }++ // Only record as a completed output item when this is a final close (not a+ // superseded-call eviction where a new call replaced this one at the same index).+ if (recordAsCompleted) {+ recordCompletedItem(state, normalizedIndex, funcItem);+ }state.funcItemDone[idx] = true;state.funcArgsDone[idx] = true;@@ -399,33 +519,11 @@ function sendCompleted(state, emit) {if (!state.completedSent) {state.completedSent = true;- // Build output from accumulated state- const output = [];- if (state.reasoningId) {- output.push({- id: state.reasoningId,- type: "reasoning",- summary: [{ type: "summary_text", text: state.reasoningBuf }],- });- }- for (const idx in state.msgItemAdded) {- output.push({- id: `msg_${state.responseId}_${idx}`,- type: "message",- role: "assistant",- content: [{ type: "output_text", annotations: [], text: state.msgTextBuf[idx] || "" }],- });- }- for (const idx in state.funcCallIds) {- const callId = state.funcCallIds[idx];- output.push({- id: `fc_${callId}`,- type: "function_call",- call_id: callId,- name: state.funcNames[idx] || "",- arguments: state.funcArgsBuf[idx] || "{}",- });- }+ // Build a dense, deterministic output array from items recorded as they were emitted+ // (each close*() call records its item via recordCompletedItem — including the+ // #1007 custom_tool_call shape for apply_patch). Sorted by output_index then by+ // emission sequence for stable ordering.+ const output = buildDenseOutput(state);const response: Record<string, unknown> = {id: state.responseId,@@ -531,6 +629,21 @@ function withAssistantRoleOnFirstDelta(state, result) {return result;}+/**+ * Resolve the terminal finish_reason for a Responses→Chat stream.+ *+ * `currentToolCallId` is intentionally sticky for the current turn: it is set when a+ * function_call item is announced (`response.output_item.added`) and is only cleared once+ * the matching `response.output_item.done` advances `toolCallIndex`. If the stream ends+ * (flush or `response.completed`) after a tool call was emitted but BEFORE its+ * `output_item.done` arrived, `toolCallIndex` is still 0 while `currentToolCallId` is set.+ * Guarding on it as well lets us still finalize as `tool_calls` instead of `stop`, so+ * OpenAI-compatible clients continue tool-result processing instead of stopping prematurely.+ */+function computeFinishReason(state): "tool_calls" | "stop" {+ return (state.toolCallIndex || 0) > 0 || state.currentToolCallId ? "tool_calls" : "stop";+}+/*** Translate OpenAI Responses API chunk to OpenAI Chat Completions format* This is for when Codex returns data and we need to send it to an OpenAI-compatible client@@ -544,7 +657,7 @@ function openaiResponsesToOpenAIResponseStream(chunk, state) {// Flush: send final chunk with finish_reasonif (!state.finishReasonSent && state.started) {state.finishReasonSent = true;- const hadToolCalls = (state.toolCallIndex || 0) > 0;+ const finishReason = computeFinishReason(state);return {id: state.chatId || `chatcmpl-${Date.now()}`,object: "chat.completion.chunk",@@ -554,7 +667,7 @@ function openaiResponsesToOpenAIResponseStream(chunk, state) {{index: 0,delta: {},- finish_reason: hadToolCalls ? "tool_calls" : "stop",+ finish_reason: finishReason,},],};@@ -830,8 +943,7 @@ function openaiResponsesToOpenAIResponseStream(chunk, state) {if (!state.finishReasonSent) {state.finishReasonSent = true;- const hadToolCalls = (state.toolCallIndex || 0) > 0;- const reason = hadToolCalls ? "tool_calls" : "stop";+ const reason = computeFinishReason(state);state.finishReason = reason; // Mark for usage injection in stream.jsconst finalChunk: Record<string, unknown> = {diff --git a/open-sse/utils/diagnostics.ts b/open-sse/utils/diagnostics.tsnew file mode 100644index 0000000000..8c58358c80--- /dev/null+++ b/open-sse/utils/diagnostics.ts@@ -0,0 +1,222 @@+/**+ * Diagnostics for malformed HTTP-200 upstream responses.+ *+ * Surfaces HTTP-200-but-empty upstream responses (empty SSE stream, empty+ * translated body) as structured, sanitized errors rather than silent+ * `output:[]` / `choices:[]` successes.+ *+ * Hard Rule #12: every string that reaches an HTTP/SSE response body MUST+ * route through sanitizeErrorMessage(). All helpers below enforce this.+ */++import { sanitizeErrorMessage } from "./error.ts";++// ── Types ────────────────────────────────────────────────────────────────────++export type MalformedReason =+ | "empty"+ | "stall"+ | "abort"+ | "client_closed"+ | "no_terminal"+ | "parse_fail"+ | "empty_choices"+ | "empty_stream"+ | string;++export interface ReportMalformed200Opts {+ mode: string;+ provider?: string | null;+ model?: string | null;+ connectionId?: string | null;+ reason?: MalformedReason;+ recvBytes?: number;+ recvLines?: number;+ emitted?: number;+ events?: Record<string, number>;+ ttftMs?: number;+ elapsedMs?: number;+}++// ── Internal helpers ─────────────────────────────────────────────────────────++// Human-readable reason text surfaced to the client and logs.+// These strings end up in error.message — they are passed through+// sanitizeErrorMessage before being embedded in any response body.+const REASON_MESSAGES: Record<string, string> = {+ empty: "no content produced",+ stall: "stream stalled (no data within the stall window)",+ abort: "stream aborted",+ client_closed: "client closed the connection",+ no_terminal: "stream closed without a terminal event",+ parse_fail: "failed to parse upstream stream",+ empty_choices: "response had no usable choices/output",+ empty_stream: "upstream stream carried no content",+};++function describeReason(reason?: MalformedReason): string {+ if (!reason) return "empty response";+ return REASON_MESSAGES[reason] ?? reason;+}++// ── Exports ──────────────────────────────────────────────────────────────────++/**+ * Log one structured [MALFORMED-200] line to stdout.+ * Noop-safe (any field is optional). Used by streaming + non-streaming+ * handlers to emit a single, grep-correlatable diagnostic entry.+ */+export function reportMalformed200(opts: ReportMalformed200Opts): void {+ const {+ mode,+ provider,+ model,+ connectionId,+ reason,+ recvBytes,+ recvLines,+ emitted,+ events,+ ttftMs,+ elapsedMs,+ } = opts;+ const evtStr =+ events && typeof events === "object"+ ? `[${Object.entries(events)+ .map(([k, v]) => `${k}=${v}`)+ .join(",")}]`+ : "[]";+ console.log(+ `[MALFORMED-200] mode=${mode || "?"} provider=${provider || "?"} model=${model || "?"} ` ++ `conn=${connectionId || "-"} reason=${reason || "empty"} recvBytes=${recvBytes ?? -1} ` ++ `recvLines=${recvLines ?? -1} emitted=${emitted ?? -1} events=${evtStr} ` ++ `ttft=${ttftMs ?? -1}ms dur=${elapsedMs ?? -1}ms`+ );+}++/**+ * Synthesize an OpenAI chat.completion.chunk SSE line for an empty stream.+ * Caller enqueues this before the terminal `data: [DONE]`.+ *+ * All user-visible strings are sanitized through sanitizeErrorMessage+ * (Hard Rule #12) to prevent stack-trace exposure.+ */+export function synthOpenAIErrorChunk(opts: {+ provider?: string | null;+ model?: string | null;+ reason?: MalformedReason;+}): string {+ const { provider, model, reason } = opts;+ const reasonText = sanitizeErrorMessage(describeReason(reason));+ const providerPart = sanitizeErrorMessage(provider ?? "?");+ const safeMessage = sanitizeErrorMessage(+ `[${providerPart}] returned an empty response (${reasonText}). ` ++ "Likely quota exhaustion, an overloaded upstream, or a proxy/gateway intercepting the stream."+ );+ const body = {+ id: `chatcmpl-empty-${Date.now()}`,+ object: "chat.completion.chunk",+ created: Math.floor(Date.now() / 1000),+ model: sanitizeErrorMessage(model ?? "unknown"),+ choices: [{ index: 0, delta: {}, finish_reason: "stop" }],+ error: {+ message: safeMessage,+ type: "upstream_empty_response",+ },+ };+ return `data: ${JSON.stringify(body)}\n\n`;+}++/**+ * Synthesize a response.failed SSE event for an empty/aborted Responses API+ * passthrough stream.+ *+ * Message is sanitized through sanitizeErrorMessage (Hard Rule #12).+ */+export function synthResponsesFailure(reason?: MalformedReason): string {+ const safeMessage = sanitizeErrorMessage(+ `stream closed before response.completed (${describeReason(reason)})`+ );+ const event = {+ type: "response.failed",+ response: {+ id: null,+ status: "failed",+ error: {+ type: "stream_error",+ code: "stream_disconnected",+ message: safeMessage,+ },+ },+ };+ return `event: response.failed\ndata: ${JSON.stringify(event)}\n\n`;+}++/**+ * Decide whether a *translated* non-streaming body is malformed for the client.+ *+ * Returns a reason string ("empty_choices" | "no_terminal") when the body is+ * malformed, or null when it carries usable output.+ *+ * This runs *after* response translation so it catches cases the raw-body+ * checks above miss (e.g. a provider returning a valid non-empty raw body that+ * translates into an OpenAI `choices:[]` with no content).+ *+ * Design notes:+ * - Reasoning-only responses (content="" + reasoning_content) are intentionally+ * allowed — they are valid completions, not errors.+ * - Tool-call responses (content=null + tool_calls=[…]) are also valid.+ * - Responses API function_call / other structural items count as output even+ * when they carry no user-visible text.+ */+export function detectMalformedNonStream(resp: unknown): MalformedReason | null {+ if (!resp || typeof resp !== "object") return "empty_choices";++ const body = resp as Record<string, unknown>;++ // ── Responses API shape ──+ if (body.object === "response") {+ const output = body.output;+ const hasOutput =+ Array.isArray(output) &&+ output.some((item) => {+ if (!item || typeof item !== "object") return false;+ const it = item as Record<string, unknown>;+ if (it.type === "message") {+ return (+ Array.isArray(it.content) &&+ (it.content as unknown[]).some((c) => {+ const part = c as Record<string, unknown>;+ return typeof part?.text === "string" && (part.text as string).length > 0;+ })+ );+ }+ // function_call / other structural items count+ return Boolean(it.type);+ });+ if (!hasOutput) return "empty_choices";+ const status = typeof body.status === "string" ? body.status : "";+ if (status && !["completed", "done"].includes(status)) return "no_terminal";+ return null;+ }++ // ── Chat Completions shape ──+ const choices = body.choices;+ if (!Array.isArray(choices) || choices.length === 0) return "empty_choices";++ const anyHasOutput = choices.some((choice) => {+ const c = choice as Record<string, unknown>;+ const msg = c?.message as Record<string, unknown> | undefined;+ if (typeof msg?.content === "string" && (msg.content as string).length > 0) return true;+ if (Array.isArray(msg?.tool_calls) && (msg.tool_calls as unknown[]).length > 0) return true;+ if (typeof msg?.reasoning_content === "string" && (msg.reasoning_content as string).length > 0)+ return true;+ return false;+ });++ if (!anyHasOutput) return "empty_choices";+ return null;+}++// ── Test-only export ─────────────────────────────────────────────────────────+export const __test = { describeReason };diff --git a/open-sse/utils/error.ts b/open-sse/utils/error.tsindex 980fabcd14..17bbef99d4 100644--- a/open-sse/utils/error.ts+++ b/open-sse/utils/error.ts@@ -487,7 +487,7 @@ export function normalizeCookie(raw: string): string {* @returns {string} Formatted error message*/export function formatProviderError(- error: { code?: string | number; message?: string } | Error,+ error: { code?: string | number; message?: string; cause?: unknown } | Error,provider: string,model: string,statusCode?: string | number | null@@ -495,5 +495,12 @@ export function formatProviderError(const providerCode = "code" in error ? error.code : undefined;const code = statusCode || providerCode || "FETCH_FAILED";const message = error.message || "Unknown error";- return `[${code}]: ${message}`;+ // Expose low-level cause (e.g. UND_ERR_SOCKET, ECONNRESET, ETIMEDOUT) for diagnosing fetch failures+ const cause = (error as { cause?: unknown }).cause;+ const causeObj = cause && typeof cause === "object" ? (cause as Record<string, unknown>) : undefined;+ const causeCode = typeof causeObj?.code === "string" ? causeObj.code : undefined;+ const causeMsg = typeof causeObj?.message === "string" ? causeObj.message : undefined;+ const causeStr =+ causeCode || causeMsg ? ` (cause: ${[causeCode, causeMsg].filter(Boolean).join(": ")})` : "";+ return `[${code}]: ${message}${causeStr}`;}diff --git a/open-sse/utils/flattenToolHistory.ts b/open-sse/utils/flattenToolHistory.tsnew file mode 100644index 0000000000..62b82bfa1d--- /dev/null+++ b/open-sse/utils/flattenToolHistory.ts@@ -0,0 +1,116 @@+/**+ * Flatten tool turns (OpenAI tool/function role + tool_calls, and+ * Anthropic-style tool_use / tool_result content blocks) into plain+ * assistant prose.+ *+ * Why: when a combo leg (or any prose-only fan-out) strips the tools+ * definitions but the prior history still carries structured tool turns,+ * agentic models keep emitting tool_calls — returning empty prose and+ * triggering an upstream 503. Flattening keeps the context but removes+ * the tool-loop trigger.+ *+ * Pure function. Does not mutate input.+ *+ * Ported from upstream decolua/9router PR #1910 (commits 86162eeb + 9ab14e77).+ */+import { extractTextContent } from "../translator/helpers/geminiHelper.ts";++export const TOOL_CALL_PREFIX = "[Called tools: ";+export const TOOL_RESULT_PREFIX = "[Tool result: ";++type ContentBlock = {+ type?: string;+ text?: string;+ name?: string;+ content?: unknown;+ [k: string]: unknown;+};++type ToolCall = {+ function?: { name?: string };+ name?: string;+ [k: string]: unknown;+};++type Message = {+ role?: string;+ content?: unknown;+ tool_calls?: ToolCall[];+ [k: string]: unknown;+};++function isMessage(m: unknown): m is Message {+ return m != null && typeof m === "object";+}++export function flattenToolHistory<T extends Message>(+ messages: ReadonlyArray<T | null | undefined>+): Message[] {+ const out: Message[] = [];+ for (const raw of messages) {+ if (!isMessage(raw)) continue;+ const msg = raw as Message;++ // OpenAI tool / function role -> assistant prose+ if (msg.role === "tool" || msg.role === "function") {+ const text =+ extractTextContent(msg.content) || String(msg.content ?? "");+ out.push({+ role: "assistant",+ content: `${TOOL_RESULT_PREFIX}${text}]`,+ });+ continue;+ }++ // OpenAI assistant with structured tool_calls -> flatten into prose+ if (msg.role === "assistant" && Array.isArray(msg.tool_calls)) {+ const { tool_calls, ...rest } = msg;+ const names = tool_calls+ .map((c) => c?.function?.name || c?.name || "tool")+ .join(", ");+ const base =+ extractTextContent(rest.content) ||+ (typeof rest.content === "string" ? rest.content : "");+ out.push({+ ...rest,+ content: `${base}${base ? "\n" : ""}${TOOL_CALL_PREFIX}${names}]`,+ });+ continue;+ }++ // Anthropic-style tool_use / tool_result blocks in content array+ if (Array.isArray(msg.content)) {+ const blocks = msg.content as ContentBlock[];+ const hasToolUse = blocks.some((c) => c?.type === "tool_use");+ const hasToolResult = blocks.some((c) => c?.type === "tool_result");+ if (hasToolUse || hasToolResult) {+ const textParts: string[] = [];+ const toolNames: string[] = [];+ const toolResults: string[] = [];+ for (const block of blocks) {+ if (block?.type === "text" && typeof block.text === "string") {+ textParts.push(block.text);+ } else if (block?.type === "tool_use") {+ toolNames.push(block.name || "tool");+ } else if (block?.type === "tool_result") {+ toolResults.push(+ extractTextContent(block.content) || String(block.content ?? "")+ );+ }+ }+ let newContent = textParts.join("\n");+ if (toolNames.length > 0) {+ newContent = `${newContent}${newContent ? "\n" : ""}${TOOL_CALL_PREFIX}${toolNames.join(", ")}]`;+ }+ if (toolResults.length > 0) {+ newContent = `${newContent}${newContent ? "\n" : ""}${TOOL_RESULT_PREFIX}${toolResults.join("\n")}]`;+ }+ out.push({ ...msg, content: newContent });+ continue;+ }+ }++ out.push(msg);+ }+ return out;+}diff --git a/open-sse/utils/kiroSanitizer.ts b/open-sse/utils/kiroSanitizer.tsnew file mode 100644index 0000000000..fa7a14f2de--- /dev/null+++ b/open-sse/utils/kiroSanitizer.ts@@ -0,0 +1,127 @@+/**+ * Kiro tool-schema sanitizer.+ *+ * Kiro / AWS CodeWhisperer rejects requests with HTTP 400 "Improperly formed+ * request" when a tool's `inputSchema.json` contains JSON-Schema keywords it+ * does not understand (`additionalProperties`, `anyOf`/`oneOf`/`allOf`/`not`,+ * `$ref`/`$defs`/`definitions`, `if`/`then`/`else`, etc.) or an empty+ * `required` array. It also rejects tool names longer than 64 characters.+ *+ * This pure helper strips the unsupported keys recursively, ensures a+ * top-level `required: []` is present, and hash-truncates over-long names —+ * returning a `nameMap` (truncated → original) so the streamed tool-call name+ * can be mapped back for the client. See chatCore.ts (request wiring) and+ * translator/response/kiro-to-openai.ts (response reverse-mapping).+ */+import { createHash } from "node:crypto";++/** Max tool-name length Kiro accepts before it rejects the request. */+const MAX_TOOL_NAME_LENGTH = 64;++/** JSON-Schema keywords Kiro rejects anywhere in a tool schema. */+const STRIP_KEYS = new Set<string>([+ "additionalProperties",+ "anyOf",+ "oneOf",+ "allOf",+ "not",+ "$schema",+ "$id",+ "$ref",+ "$defs",+ "definitions",+ "if",+ "then",+ "else",+ "unevaluatedProperties",+ "unevaluatedItems",+ "contentEncoding",+ "contentMediaType",+]);++/**+ * Recursively drop unsupported JSON-Schema keys and empty `required` arrays.+ * Non-object/array values are returned untouched.+ */+function stripKeys(value: unknown): unknown {+ if (!value || typeof value !== "object") return value;+ if (Array.isArray(value)) return value.map(stripKeys);++ const cleaned: Record<string, unknown> = {};+ for (const [key, val] of Object.entries(value as Record<string, unknown>)) {+ if (STRIP_KEYS.has(key)) continue;+ if (key === "required" && Array.isArray(val) && val.length === 0) continue;+ cleaned[key] = stripKeys(val);+ }+ return cleaned;+}++/** A single Kiro tool entry (loose shape — upstream payloads vary). */+type KiroTool = {+ toolSpecification?: {+ name?: string;+ inputSchema?: { json?: unknown };+ [key: string]: unknown;+ };+ [key: string]: unknown;+};++export interface SanitizeKiroToolsResult<T = unknown> {+ tools: T;+ /** Map of truncated tool name → original name, for response reverse-mapping. */+ nameMap: Map<string, string>;+}++/**+ * Sanitize a Kiro `tools` array in place-safely (returns new objects).+ *+ * - Strips JSON-Schema keys Kiro rejects from each `inputSchema.json`.+ * - Ensures the top-level schema carries `required: []` (Kiro requires the key).+ * - Hash-truncates tool names > 64 chars and records the mapping in `nameMap`.+ *+ * Inputs that are not arrays are returned untouched with an empty `nameMap`,+ * so this is safe to call unconditionally on the Kiro tools slot.+ */+export function sanitizeKiroTools<T>(tools: T): SanitizeKiroToolsResult<T> {+ const nameMap = new Map<string, string>();++ if (!tools || !Array.isArray(tools)) {+ return { tools, nameMap };+ }++ const sanitized = (tools as KiroTool[]).map((tool) => {+ const spec = tool?.toolSpecification;+ if (!spec) return tool;++ const originalName = spec.name;+ let name = originalName;+ if (typeof name === "string" && name.length > MAX_TOOL_NAME_LENGTH) {+ const hash = createHash("sha256").update(name).digest("hex").slice(0, 7);+ name = `${name.slice(0, 56)}_${hash}`;+ nameMap.set(name, originalName as string);+ }++ const schema = spec.inputSchema?.json;+ if (schema && typeof schema === "object" && !Array.isArray(schema)) {+ const cleaned = stripKeys(schema) as Record<string, unknown>;+ if (!cleaned.required) {+ cleaned.required = [];+ }+ return {+ ...tool,+ toolSpecification: {+ ...spec,+ name,+ inputSchema: { json: cleaned },+ },+ };+ }++ return {+ ...tool,+ toolSpecification: { ...spec, name },+ };+ });++ return { tools: sanitized as T, nameMap };+}diff --git a/open-sse/utils/streamHandler.ts b/open-sse/utils/streamHandler.tsindex 0de178772a..1e813a978f 100644--- a/open-sse/utils/streamHandler.ts+++ b/open-sse/utils/streamHandler.ts@@ -345,6 +345,22 @@ function buildStreamErrorChunks(return encodeSseEvent(errorEvent, { includeDone: true });}+/**+ * Minimal `writable` half used by `pipeWithDisconnect`. The real writable is+ * driven entirely by the upstream-piped readable, so the writer only needs an+ * `abort()` hook for `createDisconnectAwareStream`'s `cancel()` path.+ *+ * `abort()` returns `Promise<void>` to match the native+ * `WritableStreamDefaultWriter.abort()` contract — `cancel()` (and any caller+ * that awaits the writer) gets a real thenable instead of `undefined`, which+ * keeps abort/error handling clean. Ported from decolua/9router@6b624af4.+ */+export function createNoopAbortWritable(): {+ getWriter: () => { abort: () => Promise<void> };+} {+ return { getWriter: () => ({ abort: () => Promise.resolve() }) };+}+/*** Create transform stream with disconnect detection* Wraps existing transform stream and adds abort capability@@ -432,7 +448,7 @@ export function pipeWithDisconnect(if (!stallTimeoutMs || stallTimeoutMs <= 0) {const transformedBody = providerResponse.body.pipeThrough(transformStream);return createDisconnectAwareStream(- { readable: transformedBody, writable: { getWriter: () => ({ abort: () => {} }) } },+ { readable: transformedBody, writable: createNoopAbortWritable() },streamController);}@@ -526,7 +542,7 @@ export function pipeWithDisconnect(const transformedBody = providerResponse.body.pipeThrough(upstreamTap).pipeThrough(transformStream);return createDisconnectAwareStream(- { readable: transformedBody, writable: { getWriter: () => ({ abort: () => {} }) } },+ { readable: transformedBody, writable: createNoopAbortWritable() },wrappedController);}diff --git a/open-sse/utils/toolSources.ts b/open-sse/utils/toolSources.tsnew file mode 100644index 0000000000..62f458caf9--- /dev/null+++ b/open-sse/utils/toolSources.ts@@ -0,0 +1,69 @@+/**+ * toolSources.ts — diagnostic classification of request tool definitions.+ *+ * Pure helpers that summarize the `tools` array of a chat request into a+ * single human-readable line (tool count, per-source counts, and the first+ * N tool names). Gated behind the `logToolSources` setting and emitted as a+ * `log.debug("TOOLS", ...)` line in the chat handler so operators can see, at+ * a glance, which MCP servers / hosted tools / client tools a request carries.+ *+ * No side effects — safe to unit test in isolation.+ */++/** A loosely-typed tool definition as it arrives on a chat request body. */+export interface ToolLike {+ name?: string;+ type?: string;+ function?: { name?: string };+ [key: string]: unknown;+}++const MAX_VISIBLE_NAMES = 80;++/**+ * Resolve the display name of a tool across the OpenAI/Claude/Gemini shapes:+ * top-level `name`, nested `function.name`, or `type` (hosted tools), falling+ * back to `"unknown"`.+ */+export function getToolName(tool: ToolLike | null | undefined): string {+ return tool?.name || tool?.function?.name || tool?.type || "unknown";+}++/**+ * Classify a tool name into its source bucket:+ * - `mcp:<server>` / `mcp` for `mcp__<server>__<tool>` names+ * - `hosted:web` for `web_search` / `web_fetch`+ * - `hosted:computer` for `computer_*` / `str_replace_*`+ * - `client` for everything else (client-defined function tools)+ */+export function getToolSource(name: string): string {+ if (name.startsWith("mcp__")) {+ const parts = name.split("__");+ return parts[1] ? `mcp:${parts[1]}` : "mcp";+ }+ if (name.startsWith("web_search") || name.startsWith("web_fetch")) return "hosted:web";+ if (name.startsWith("computer_") || name.startsWith("str_replace_")) return "hosted:computer";+ return "client";+}++/**+ * Build a one-line diagnostic summary of a request's tools, or `null` when+ * there are no tools to report. Shape:+ * `<N> tools | sources: <src>=<n>, ... | names: <a>, <b>, ... +<k> more`+ */+export function summarizeToolSources(tools: unknown): string | null {+ if (!Array.isArray(tools) || tools.length === 0) return null;+ const names = tools.map((tool) => getToolName(tool as ToolLike));+ const sourceCounts = new Map<string, number>();+ for (const name of names) {+ const source = getToolSource(name);+ sourceCounts.set(source, (sourceCounts.get(source) || 0) + 1);+ }+ const sources = Array.from(sourceCounts.entries())+ .map(([source, count]) => `${source}=${count}`)+ .join(", ");+ const visibleNames = names.slice(0, MAX_VISIBLE_NAMES).join(", ");+ const suffix =+ names.length > MAX_VISIBLE_NAMES ? `, ... +${names.length - MAX_VISIBLE_NAMES} more` : "";+ return `${tools.length} tools | sources: ${sources} | names: ${visibleNames}${suffix}`;+}diff --git a/open-sse/utils/usageTracking.ts b/open-sse/utils/usageTracking.tsindex 8e3e969c4e..7528960ace 100644--- a/open-sse/utils/usageTracking.ts+++ b/open-sse/utils/usageTracking.ts@@ -392,13 +392,29 @@ export function extractUsage(chunk) {}// Gemini format (Antigravity)- if (chunk.usageMetadata && typeof chunk.usageMetadata === "object") {+ // Antigravity wraps usageMetadata inside a `response` envelope:+ // { response: { usageMetadata: {...} } } — fall back to it so AG-shaped+ // chunks do not silently drop token usage.+ const usageMeta = chunk.usageMetadata || chunk.response?.usageMetadata;+ if (usageMeta && typeof usageMeta === "object") {return normalizeUsage({- prompt_tokens: chunk.usageMetadata?.promptTokenCount || 0,- completion_tokens: chunk.usageMetadata?.candidatesTokenCount || 0,- total_tokens: chunk.usageMetadata?.totalTokenCount,- cached_tokens: chunk.usageMetadata?.cachedContentTokenCount,- reasoning_tokens: chunk.usageMetadata?.thoughtsTokenCount,+ prompt_tokens: usageMeta.promptTokenCount || 0,+ completion_tokens: usageMeta.candidatesTokenCount || 0,+ total_tokens: usageMeta.totalTokenCount,+ cached_tokens: usageMeta.cachedContentTokenCount,+ reasoning_tokens: usageMeta.thoughtsTokenCount,+ });+ }++ // Ollama NDJSON format (raw from provider, before translation)+ // Ollama sends: { "model": "...", "done": true, "prompt_eval_count": N, "eval_count": M }+ if (chunk.done === true && typeof chunk.prompt_eval_count === "number") {+ const promptEvalCount = chunk.prompt_eval_count || 0;+ const evalCount = chunk.eval_count || 0;+ return normalizeUsage({+ prompt_tokens: promptEvalCount,+ completion_tokens: evalCount,+ total_tokens: promptEvalCount + evalCount,});}diff --git a/package-lock.json b/package-lock.jsonindex 7d175ad38b..e828ea0f80 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,12 +1,12 @@{"name": "omniroute",- "version": "3.8.36",+ "version": "3.8.37","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "omniroute",- "version": "3.8.36",+ "version": "3.8.37","hasInstallScript": true,"license": "MIT","workspaces": [@@ -2576,23 +2576,23 @@"resolved": "https://registry.npmjs.org/@huggingface/jinja/-/jinja-0.4.1.tgz","integrity": "sha512-3WXbMFaPkk03LRCM0z0sylmn8ddDm4ubjU7X+Hg4M2GOuMklwoGAFXp9V2keq7vltoB/c7McE5aHUVVddAewsw==","license": "MIT",+ "optional": true,"engines": {"node": ">=18"- },- "optional": true+ }},"node_modules/@huggingface/transformers": {"version": "3.5.2","resolved": "https://registry.npmjs.org/@huggingface/transformers/-/transformers-3.5.2.tgz","integrity": "sha512-mfRXkmcL99+ibpjM++pvZmc2h3po8i1ZgSRI5Rtgh++P15GU0lY8UQteYt/w5V+GQw+Jpao93MoipcePzh3mKg==","license": "Apache-2.0",+ "optional": true,"dependencies": {"@huggingface/jinja": "^0.4.1","onnxruntime-node": "1.21.0","onnxruntime-web": "1.22.0-dev.20250409-89f8206ba4","sharp": "^0.34.1"- },- "optional": true+ }},"node_modules/@humanfs/core": {"version": "0.19.1",@@ -2668,10 +2668,10 @@"resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz","integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==","license": "MIT",+ "optional": true,"engines": {"node": ">=18"- },- "optional": true+ }},"node_modules/@img/sharp-darwin-arm64": {"version": "0.34.5",@@ -3562,14 +3562,14 @@"version": "4.0.1","resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz","integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==",+ "devOptional": true,"license": "ISC","dependencies": {"minipass": "^7.0.4"},"engines": {"node": ">=18.0.0"- },- "devOptional": true+ }},"node_modules/@isaacs/string-locale-compare": {"version": "1.1.0",@@ -6277,10 +6277,10 @@"resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.1.tgz","integrity": "sha512-GpptLrs57adMSuHi3VNj0mAF8dwh36LMaYF6XyJ6JMWlVsc+t42tm1HSEDmOs3A8fC9yyeisgLhsTVQokOZ0zw==","license": "BSD-3-Clause",+ "optional": true,"dependencies": {"@protobufjs/aspromise": "^1.1.1"- },- "optional": true+ }},"node_modules/@protobufjs/float": {"version": "1.0.2",@@ -9426,11 +9426,11 @@"version": "26.0.0","resolved": "https://registry.npmjs.org/@types/node/-/node-26.0.0.tgz","integrity": "sha512-vf2YFi1iY9lHGwNJMs01biZFbKJkrZR1T6/MlzjhJLPdntOHLhTrDSnSVcdtvjihi4VQNlrFRIxLsDBlQpAipA==",+ "devOptional": true,"license": "MIT","dependencies": {"undici-types": "~8.3.0"- },- "devOptional": true+ }},"node_modules/@types/node-fetch": {"version": "2.6.13",@@ -13299,6 +13299,7 @@"version": "1.1.4","resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz","integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",+ "devOptional": true,"license": "MIT","dependencies": {"es-define-property": "^1.0.0",@@ -13310,8 +13311,7 @@},"funding": {"url": "https://github.com/sponsors/ljharb"- },- "devOptional": true+ }},"node_modules/define-lazy-prop": {"version": "3.0.0",@@ -13329,6 +13329,7 @@"version": "1.2.1","resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz","integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==",+ "devOptional": true,"license": "MIT","dependencies": {"define-data-property": "^1.0.1",@@ -13340,8 +13341,7 @@},"funding": {"url": "https://github.com/sponsors/ljharb"- },- "devOptional": true+ }},"node_modules/delaunator": {"version": "5.1.0",@@ -16066,6 +16066,7 @@"resolved": "https://registry.npmjs.org/global-agent/-/global-agent-3.0.0.tgz","integrity": "sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==","license": "BSD-3-Clause",+ "optional": true,"dependencies": {"boolean": "^3.0.1","es6-error": "^4.1.1",@@ -16076,21 +16077,20 @@},"engines": {"node": ">=10.0"- },- "optional": true+ }},"node_modules/global-agent/node_modules/semver": {"version": "7.8.4","resolved": "https://registry.npmjs.org/semver/-/semver-7.8.4.tgz","integrity": "sha512-rUCObTnP32Q08R2uuIrt7r9PlEonuTmtuXYcW6s5kjdlj3xbnwe+21yXptAUYcMAABLkYYTtnmzb3w3EDZfueA==","license": "ISC",+ "optional": true,"bin": {"semver": "bin/semver.js"},"engines": {"node": ">=10"- },- "optional": true+ }},"node_modules/global-directory": {"version": "4.0.1",@@ -16133,6 +16133,7 @@"version": "1.0.4","resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz","integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==",+ "devOptional": true,"license": "MIT","dependencies": {"define-properties": "^1.2.1",@@ -16143,8 +16144,7 @@},"funding": {"url": "https://github.com/sponsors/ljharb"- },- "devOptional": true+ }},"node_modules/gopd": {"version": "1.2.0",@@ -16203,14 +16203,14 @@"version": "1.0.2","resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz","integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",+ "devOptional": true,"license": "MIT","dependencies": {"es-define-property": "^1.0.0"},"funding": {"url": "https://github.com/sponsors/ljharb"- },- "devOptional": true+ }},"node_modules/has-proto": {"version": "1.2.0",@@ -19809,13 +19809,13 @@"resolved": "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz","integrity": "sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==","license": "MIT",+ "optional": true,"dependencies": {"escape-string-regexp": "^4.0.0"},"engines": {"node": ">=10"- },- "optional": true+ }},"node_modules/material-symbols": {"version": "0.45.2",@@ -21061,11 +21061,11 @@"version": "7.1.3","resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz","integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==",+ "devOptional": true,"license": "BlueOak-1.0.0","engines": {"node": ">=16 || 14 >=14.17"- },- "devOptional": true+ }},"node_modules/minipass-collect": {"version": "2.0.1",@@ -21181,14 +21181,14 @@"version": "3.1.0","resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz","integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==",+ "devOptional": true,"license": "MIT","dependencies": {"minipass": "^7.1.2"},"engines": {"node": ">= 18"- },- "devOptional": true+ }},"node_modules/mkdirp": {"version": "1.0.4",@@ -22079,11 +22079,11 @@"version": "1.1.1","resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz","integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",+ "devOptional": true,"license": "MIT","engines": {"node": ">= 0.4"- },- "devOptional": true+ }},"node_modules/object.assign": {"version": "4.1.7",@@ -22261,6 +22261,7 @@"integrity": "sha512-NeaCX6WW2L8cRCSqy3bInlo5ojjQqu2fD3D+9W5qb5irwxhEyWKXeH2vZ8W9r6VxaMPUan+4/7NDwZMtouZxEw==","hasInstallScript": true,"license": "MIT",+ "optional": true,"os": ["win32","darwin",@@ -22270,14 +22271,14 @@"global-agent": "^3.0.0","onnxruntime-common": "1.21.0","tar": "^7.0.1"- },- "optional": true+ }},"node_modules/onnxruntime-web": {"version": "1.22.0-dev.20250409-89f8206ba4","resolved": "https://registry.npmjs.org/onnxruntime-web/-/onnxruntime-web-1.22.0-dev.20250409-89f8206ba4.tgz","integrity": "sha512-0uS76OPgH0hWCPrFKlL8kYVV7ckM7t/36HfbgoFw6Nd0CZVVbQC4PkrR8mBX8LtNUFZO25IQBqV2Hx2ho3FlbQ==","license": "MIT",+ "optional": true,"dependencies": {"flatbuffers": "^25.1.24","guid-typescript": "^1.0.9",@@ -22285,8 +22286,7 @@"onnxruntime-common": "1.22.0-dev.20250409-89f8206ba4","platform": "^1.3.6","protobufjs": "^7.2.4"- },- "optional": true+ }},"node_modules/onnxruntime-web/node_modules/long": {"version": "5.3.2",@@ -23312,6 +23312,7 @@"integrity": "sha512-RJJPTTpvFfHcWLkIa2JFWK4XvtSzS0yEWDmunqHXli1h3JlkbcQZXDZdcWxv+JK3Xsl5/UFDPZ0iGm7DAengYw==","hasInstallScript": true,"license": "BSD-3-Clause",+ "optional": true,"dependencies": {"@protobufjs/aspromise": "^1.1.2","@protobufjs/base64": "^1.1.2",@@ -23327,8 +23328,7 @@},"engines": {"node": ">=12.0.0"- },- "optional": true+ }},"node_modules/protobufjs/node_modules/long": {"version": "5.3.2",@@ -24455,6 +24455,7 @@"resolved": "https://registry.npmjs.org/roarr/-/roarr-2.15.4.tgz","integrity": "sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==","license": "BSD-3-Clause",+ "optional": true,"dependencies": {"boolean": "^3.0.1","detect-node": "^2.0.4",@@ -24465,8 +24466,7 @@},"engines": {"node": ">=8.0"- },- "optional": true+ }},"node_modules/roarr/node_modules/sprintf-js": {"version": "1.1.3",@@ -24824,6 +24824,7 @@"resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz","integrity": "sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==","license": "MIT",+ "optional": true,"dependencies": {"type-fest": "^0.13.1"},@@ -24832,21 +24833,20 @@},"funding": {"url": "https://github.com/sponsors/sindresorhus"- },- "optional": true+ }},"node_modules/serialize-error/node_modules/type-fest": {"version": "0.13.1","resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz","integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==","license": "(MIT OR CC0-1.0)",+ "optional": true,"engines": {"node": ">=10"},"funding": {"url": "https://github.com/sponsors/sindresorhus"- },- "optional": true+ }},"node_modules/serve-static": {"version": "2.2.1",@@ -24928,6 +24928,7 @@"integrity": "sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg==","hasInstallScript": true,"license": "Apache-2.0",+ "optional": true,"dependencies": {"@img/colour": "^1.0.0","detect-libc": "^2.1.2",@@ -24964,21 +24965,20 @@"@img/sharp-win32-arm64": "0.34.5","@img/sharp-win32-ia32": "0.34.5","@img/sharp-win32-x64": "0.34.5"- },- "optional": true+ }},"node_modules/sharp/node_modules/semver": {"version": "7.7.4","resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz","integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==","license": "ISC",+ "optional": true,"bin": {"semver": "bin/semver.js"},"engines": {"node": ">=10"- },- "optional": true+ }},"node_modules/shebang-command": {"version": "2.0.0",@@ -26209,6 +26209,7 @@"version": "7.5.16","resolved": "https://registry.npmjs.org/tar/-/tar-7.5.16.tgz","integrity": "sha512-56adEpPMouktRlBLXiaYFFzZ/3+JXa8P9n7WbR+ibIjtviN55mEaOkiysCnPnWm+7kkui1Dn8J9l+g6zV8731w==",+ "devOptional": true,"license": "BlueOak-1.0.0","dependencies": {"@isaacs/fs-minipass": "^4.0.0",@@ -26219,8 +26220,7 @@},"engines": {"node": ">=18"- },- "devOptional": true+ }},"node_modules/tar-fs": {"version": "2.1.4",@@ -26256,21 +26256,21 @@"version": "3.0.0","resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz","integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==",+ "devOptional": true,"license": "BlueOak-1.0.0","engines": {"node": ">=18"- },- "devOptional": true+ }},"node_modules/tar/node_modules/yallist": {"version": "5.0.0","resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz","integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==",+ "devOptional": true,"license": "BlueOak-1.0.0","engines": {"node": ">=18"- },- "devOptional": true+ }},"node_modules/terminal-size": {"version": "4.0.1",@@ -27035,8 +27035,8 @@"version": "8.3.0","resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz","integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==",- "license": "MIT",- "devOptional": true+ "devOptional": true,+ "license": "MIT"},"node_modules/unicode-emoji-modifier-base": {"version": "1.0.0",@@ -28551,7 +28551,7 @@},"open-sse": {"name": "@omniroute/open-sse",- "version": "3.8.36"+ "version": "3.8.37"}}}diff --git a/package.json b/package.jsonindex 916d5184c6..2d31648785 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "omniroute",- "version": "3.8.36",+ "version": "3.8.37","description": "Unified AI router with 160+ providers, RTK+Caveman compression, auto fallback, MCP/A2A, desktop, PWA, and OpenAI-compatible APIs.","type": "module","bin": {@@ -123,6 +123,7 @@"i18n:check-ui-coverage": "node scripts/i18n/check-ui-keys-coverage.mjs","check:node-runtime": "node --import tsx scripts/check/check-supported-node-runtime.ts","check:pack-artifact": "node --import tsx scripts/build/validate-pack-artifact.ts",+ "check:pack-policy": "node --import tsx scripts/build/validate-pack-artifact.ts --policy-only","check:cli-i18n": "node scripts/check/check-cli-i18n.mjs","check:openapi-coverage": "node scripts/check/check-openapi-coverage.mjs","check:openapi-security-tiers": "node scripts/check/check-openapi-security-tiers.mjs",@@ -137,6 +138,7 @@"check:tracked-artifacts": "node scripts/check/check-tracked-artifacts.mjs","check:test-masking": "node scripts/check/check-test-masking.mjs","check:test-runner-api": "node scripts/check/check-test-runner-api.mjs",+ "check:build-scope": "node scripts/check/check-build-scope.mjs","check:error-helper": "node scripts/check/check-error-helper.mjs","check:migration-numbering": "node scripts/check/check-migration-numbering.mjs","check:public-creds": "node scripts/check/check-public-creds.mjs",diff --git a/scripts/build/build-next-isolated.mjs b/scripts/build/build-next-isolated.mjsindex 323b428409..58a8162bac 100644--- a/scripts/build/build-next-isolated.mjs+++ b/scripts/build/build-next-isolated.mjs@@ -120,7 +120,12 @@ export function resolveNextBuildEnv(baseEnv = process.env) {// was left unprotected. Respect an existing --max-old-space-size (Docker already// sets one — don't clobber/duplicate) and let OMNIROUTE_BUILD_MEMORY_MB override.if (!/--max-old-space-size/.test(env.NODE_OPTIONS || "")) {- const heapMb = Number(baseEnv.OMNIROUTE_BUILD_MEMORY_MB) || 4096;+ // Default 8 GB (was 4 GB): the clean module graph peaks ~3.9 GB during the webpack+ // production pass, which brushed the old 4 GB ceiling on a borderline OOM. 8 GB gives+ // headroom without risk. NOTE: heap size does NOT fix a poisoned scope — if the build+ // OOMs/livelocks far above this, check for worktrees/cruft leaking into the tsconfig+ // scope (run `npm run check:build-scope`), not for "more heap". See incident 2026-06-25.+ const heapMb = Number(baseEnv.OMNIROUTE_BUILD_MEMORY_MB) || 8192;env.NODE_OPTIONS = `${env.NODE_OPTIONS || ""} --max-old-space-size=${heapMb}`.trim();}diff --git a/scripts/build/validate-pack-artifact.ts b/scripts/build/validate-pack-artifact.tsindex bd92a48ecd..94b09fe166 100644--- a/scripts/build/validate-pack-artifact.ts+++ b/scripts/build/validate-pack-artifact.ts@@ -74,18 +74,25 @@ function formatBytes(bytes: number): string {return `${value.toFixed(value >= 10 ? 0 : 1)} ${units[unitIndex]}`;}+// --policy-only: skip the build (ensureAppStagingReady → build:cli) and the+// required-runtime-files check (which needs the built dist/), running ONLY the+// unexpected-files allowlist check. The unexpected files (e.g. stray bin/*.sh) are+// SOURCE files that `npm pack --dry-run` lists regardless of build, so this catches+// the "new file leaked into the tarball" regression cheaply on the fast-path (PR→release),+// instead of only on the release PR's full Package Artifact job. See incident v3.8.36 (#5029).+const POLICY_ONLY = process.argv.includes("--policy-only");+try {- ensureAppStagingReady();+ if (!POLICY_ONLY) ensureAppStagingReady();const packReport = runPackDryRun();const artifactPaths: string[] = packReport.files.map((file: any) => file.path);const unexpectedPaths: string[] = findUnexpectedArtifactPaths(artifactPaths, {exactPaths: PACK_ARTIFACT_ALLOWED_EXACT_PATHS,prefixPaths: PACK_ARTIFACT_ALLOWED_PATH_PREFIXES,});- const missingRequiredPaths: string[] = findMissingArtifactPaths(- artifactPaths,- PACK_ARTIFACT_REQUIRED_PATHS- );+ const missingRequiredPaths: string[] = POLICY_ONLY+ ? []+ : findMissingArtifactPaths(artifactPaths, PACK_ARTIFACT_REQUIRED_PATHS);console.log("📦 npm pack artifact summary");console.log(` File: ${packReport.filename}`);diff --git a/scripts/check/check-build-scope.mjs b/scripts/check/check-build-scope.mjsnew file mode 100644index 0000000000..5880f84581--- /dev/null+++ b/scripts/check/check-build-scope.mjs@@ -0,0 +1,95 @@+#!/usr/bin/env node+// check-build-scope.mjs — guards against worktrees / cruft leaking into the+// TypeScript build scope and poisoning `next build`.+//+// Root cause of the 2026-06-25 build OOM/GC-livelock incident: `tsconfig.json`+// uses `include: ["**/*.ts","**/*.tsx","**/*.js","**/*.jsx"]` (recursive glob),+// and 69 git worktrees under `.claude/worktrees/` were NOT in `exclude` — so the+// TS scope ballooned to 355,215 files (vs 4,547 real source files) and `next build`+// processed ~70x the codebase, OOMing even at a 64 GB heap. The CI built fine+// because its checkout is clean.+//+// This gate counts the .ts/.tsx/.js/.jsx files that tsconfig's include would match+// (respecting its top-level exclude dirs) and FAILS if the count exceeds a+// threshold — catching a leak BEFORE it detonates the build. Heap size is NOT the+// fix for an over-large scope; a clean scope is.+//+// Usage: node scripts/check/check-build-scope.mjs [--max N] [--json]++import fs from "node:fs";+import path from "node:path";+import { fileURLToPath } from "node:url";++const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..");+const args = process.argv.slice(2);+const MAX = Number(args[args.indexOf("--max") + 1]) || 12000;+const JSON_OUT = args.includes("--json");++const EXT = new Set([".ts", ".tsx", ".js", ".jsx"]);++// Read tsconfig.json exclude (the source of truth for what's out of scope).+const tsconfigPath = path.join(ROOT, "tsconfig.json");+let exclude = [];+try {+ exclude = JSON.parse(fs.readFileSync(tsconfigPath, "utf8")).exclude || [];+} catch {+ console.error("[build-scope] could not read tsconfig.json exclude — aborting");+ process.exit(2);+}+// Always skip VCS + the exclude dirs (normalise to bare top-level names).+const SKIP_DIRS = new Set([".git", ...exclude.map((e) => e.replace(/^\.\//, "").replace(/\/.*$/, ""))]);++let count = 0;+const byTop = {};+function walk(dir, top) {+ let entries;+ try {+ entries = fs.readdirSync(dir, { withFileTypes: true });+ } catch {+ return;+ }+ for (const e of entries) {+ if (e.isSymbolicLink()) continue; // don't follow symlinks (e.g. node_modules)+ const full = path.join(dir, e.name);+ if (e.isDirectory()) {+ walk(full, top);+ } else if (EXT.has(path.extname(e.name))) {+ count++;+ byTop[top] = (byTop[top] || 0) + 1;+ }+ }+}++for (const e of fs.readdirSync(ROOT, { withFileTypes: true })) {+ if (!e.isDirectory()) {+ if (EXT.has(path.extname(e.name))) {+ count++;+ byTop["(root)"] = (byTop["(root)"] || 0) + 1;+ }+ continue;+ }+ if (SKIP_DIRS.has(e.name)) continue;+ walk(path.join(ROOT, e.name), e.name);+}++if (JSON_OUT) {+ console.log(JSON.stringify({ count, max: MAX, byTop }, null, 2));+} else {+ console.log(`[build-scope] ${count} .ts/.tsx/.js/.jsx files in tsconfig scope (max ${MAX})`);+ const top = Object.entries(byTop)+ .sort((a, b) => b[1] - a[1])+ .slice(0, 8);+ for (const [d, n] of top) console.log(` ${String(n).padStart(7)} ${d}`);+}++if (count > MAX) {+ console.error(+ `\n❌ [build-scope] scope of ${count} files exceeds ${MAX} — something is leaking into the\n` ++ ` tsconfig include scope (worktree, vendored copy, or build output). This poisons\n` ++ ` \`next build\` (OOM/GC-livelock). Add the offending dir to tsconfig.json "exclude"\n` ++ ` (and .dockerignore). Worktrees MUST live under .claude/worktrees/ (already excluded).\n` ++ ` Heap size does NOT fix this — a clean scope does. See incident 2026-06-25.`+ );+ process.exit(1);+}+console.log("✅ [build-scope] OK — no leak into the build scope.");diff --git a/src/app/(dashboard)/dashboard/api-manager/ApiManagerPageClient.tsx b/src/app/(dashboard)/dashboard/api-manager/ApiManagerPageClient.tsxindex 120ec6cb0d..b776f2455b 100644--- a/src/app/(dashboard)/dashboard/api-manager/ApiManagerPageClient.tsx+++ b/src/app/(dashboard)/dashboard/api-manager/ApiManagerPageClient.tsx@@ -16,7 +16,6 @@ import {computeApiKeyCounts,formatUsdCost,toLocalDateTimeInputValue,- maskKey,toggleKeyVisibility,} from "./apiManagerPageUtils";import type { KeyStatus, KeyType } from "./apiManagerPageUtils";@@ -987,7 +986,7 @@ export default function ApiManagerPageClient() {<code className="text-sm text-text-muted font-mono truncate">{visibleKeys.has(key.id)? (revealedKeys.get(key.id) ?? key.key)- : maskKey(key.key)}+ : key.key}</code>{allowKeyReveal ? (<>diff --git a/src/app/(dashboard)/dashboard/cli-code/components/DroidToolCard.tsx b/src/app/(dashboard)/dashboard/cli-code/components/DroidToolCard.tsxindex 6b656c59bb..1faafa9f51 100644--- a/src/app/(dashboard)/dashboard/cli-code/components/DroidToolCard.tsx+++ b/src/app/(dashboard)/dashboard/cli-code/components/DroidToolCard.tsx@@ -28,7 +28,12 @@ export default function DroidToolCard({const [restoring, setRestoring] = useState(false);const [message, setMessage] = useState(null);const [selectedApiKeyId, setSelectedApiKeyId] = useState("");- const [selectedModel, setSelectedModel] = useState("");+ // (#618) Multi-model support: list of model ids + input box for the next entry.+ // `selectedModel` is derived as the first entry so existing call sites+ // (manual-config preview, ModelSelectModal) continue to work.+ const [modelList, setModelList] = useState([]);+ const [modelInput, setModelInput] = useState("");+ const selectedModel = modelList[0] || "";const [modalOpen, setModalOpen] = useState(false);const [modelAliases, setModelAliases] = useState({});const [showManualConfigModal, setShowManualConfigModal] = useState(false);@@ -40,11 +45,12 @@ export default function DroidToolCard({const [restoringBackup, setRestoringBackup] = useState(null);const cliReady = !!(droidStatus?.installed && droidStatus?.runnable);+ // (#618) Match any custom:OmniRoute-<i> entry (multi-model).+ const isOmniRouteEntry = (m) => typeof m?.id === "string" && m.id.startsWith("custom:OmniRoute");+const getConfigStatus = () => {if (!cliReady) return null;- const currentConfig = droidStatus.settings?.customModels?.find(- (m) => m.id === "custom:OmniRoute-0"- );+ const currentConfig = droidStatus.settings?.customModels?.find(isOmniRouteEntry);if (!currentConfig) return "not_configured";const localMatch =currentConfig.baseUrl?.includes("localhost") || currentConfig.baseUrl?.includes("127.0.0.1");@@ -87,15 +93,19 @@ export default function DroidToolCard({useEffect(() => {if (droidStatus?.installed && !hasInitializedModel.current) {hasInitializedModel.current = true;- const customModel = droidStatus.settings?.customModels?.find(- (m) => m.id === "custom:OmniRoute-0"- );- if (customModel) {- if (customModel.model) setSelectedModel(customModel.model);- if (customModel.apiKey) {+ // (#618) Pre-fill the multi-model list from every custom:OmniRoute-<i>+ // entry, preserving the original index order.+ const existing = (droidStatus.settings?.customModels || [])+ .filter(isOmniRouteEntry)+ .slice()+ .sort((a, b) => (a.index || 0) - (b.index || 0));+ if (existing.length > 0) {+ setModelList(existing.map((m) => m.model).filter(Boolean));+ const first = existing[0];+ if (first?.apiKey) {// (#523) Keys from /api/keys are masked. Match by prefix/suffix.- const fileKeyPrefix = customModel.apiKey.slice(0, 8);- const fileKeySuffix = customModel.apiKey.slice(-4);+ const fileKeyPrefix = first.apiKey.slice(0, 8);+ const fileKeySuffix = first.apiKey.slice(-4);const matchedKey = apiKeys?.find((k) => k.key && k.key.startsWith(fileKeyPrefix) && k.key.endsWith(fileKeySuffix));@@ -105,6 +115,15 @@ export default function DroidToolCard({}}, [droidStatus, apiKeys]);+ // (#618) Multi-model list manipulation helpers.+ const addModel = (value) => {+ const v = (value ?? modelInput).trim();+ if (!v || modelList.includes(v)) return;+ setModelList((prev) => [...prev, v]);+ setModelInput("");+ };+ const removeModel = (id) => setModelList((prev) => prev.filter((m) => m !== id));+const checkDroidStatus = async () => {setCheckingDroid(true);try {@@ -143,7 +162,12 @@ export default function DroidToolCard({baseUrl: getEffectiveBaseUrl(),apiKey: !cloudEnabled ? "sk_omniroute" : null,keyId: selectedKeyId,+ // (#618) Send both `model` (legacy, first entry) and `models` (array).+ // Backend prefers `models` when present; `model` keeps Zod happy+ // for callers still on the single-model contract.model: selectedModel,+ models: modelList,+ activeModel: selectedModel,}),});const data = await res.json();@@ -173,7 +197,7 @@ export default function DroidToolCard({const data = await res.json();if (res.ok) {setMessage({ type: "success", text: t("settingsReset") });- setSelectedModel("");+ setModelList([]);setSelectedApiKeyId("");checkDroidStatus();} else {@@ -192,7 +216,12 @@ export default function DroidToolCard({};const handleModelSelect = (model) => {- setSelectedModel(model.value);+ // (#618) Append to the model list rather than replacing the single slot.+ if (!model?.value || modelList.includes(model.value)) {+ setModalOpen(false);+ return;+ }+ setModelList((prev) => [...prev, model.value]);setModalOpen(false);};@@ -242,20 +271,21 @@ export default function DroidToolCard({const keyToDisplay =selectedKeyObj?.key || (!cloudEnabled ? "sk_omniroute" : "<API_KEY_FROM_DASHBOARD>");+ // (#618) Render one entry per requested model; fall back to a placeholder+ // when the list is empty so manual-config preview still shows the shape.+ const modelsForPreview = modelList.length > 0 ? modelList : ["provider/model-id"];const settingsContent = {- customModels: [- {- model: selectedModel || "provider/model-id",- id: "custom:OmniRoute-0",- index: 0,- baseUrl: getEffectiveBaseUrl(),- apiKey: keyToDisplay,- displayName: selectedModel || "provider/model-id",- maxOutputTokens: 131072,- noImageSupport: false,- provider: "openai",- },- ],+ customModels: modelsForPreview.map((m, i) => ({+ model: m,+ id: `custom:OmniRoute-${i}`,+ index: i,+ baseUrl: getEffectiveBaseUrl(),+ apiKey: keyToDisplay,+ displayName: m,+ maxOutputTokens: 131072,+ noImageSupport: false,+ provider: "openai",+ })),};const platform = typeof navigator !== "undefined" && navigator.platform;@@ -332,9 +362,8 @@ export default function DroidToolCard({{!checkingDroid && cliReady && (<><div className="flex flex-col gap-2">- {/* Current Base URL */}- {droidStatus?.settings?.customModels?.find((m) => m.id === "custom:OmniRoute-0")- ?.baseUrl && (+ {/* Current Base URL — first OmniRoute entry, any index (#618) */}+ {droidStatus?.settings?.customModels?.find(isOmniRouteEntry)?.baseUrl && (<div className="flex items-center gap-2"><span className="w-32 shrink-0 text-sm font-semibold text-text-main text-right">{t("current")}@@ -343,10 +372,7 @@ export default function DroidToolCard({arrow_forward</span><span className="flex-1 px-2 py-1.5 text-xs text-text-muted truncate">- {- droidStatus.settings.customModels.find((m) => m.id === "custom:OmniRoute-0")- .baseUrl- }+ {droidStatus.settings.customModels.find(isOmniRouteEntry).baseUrl}</span></div>)}@@ -404,37 +430,68 @@ export default function DroidToolCard({)}</div>- {/* Model */}- <div className="flex items-center gap-2">- <span className="w-32 shrink-0 text-sm font-semibold text-text-main text-right">+ {/* Models — multi-model support (#618) */}+ <div className="flex items-start gap-2">+ <span className="w-32 shrink-0 text-sm font-semibold text-text-main text-right pt-1.5">{t("model")}+ {modelList.length > 0 && (+ <span className="text-primary"> ({modelList.length})</span>+ )}</span>- <span className="material-symbols-outlined text-text-muted text-[14px]">+ <span className="material-symbols-outlined text-text-muted text-[14px] pt-2">arrow_forward</span>- <input- type="text"- value={selectedModel}- onChange={(e) => setSelectedModel(e.target.value)}- placeholder={t("providerModelPlaceholder")}- className="flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"- />- <button- onClick={() => setModalOpen(true)}- disabled={!hasActiveProviders}- className={`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${hasActiveProviders ? "bg-surface border-border text-text-main hover:border-primary cursor-pointer" : "opacity-50 cursor-not-allowed border-border"}`}- >- {t("selectModel")}- </button>- {selectedModel && (- <button- onClick={() => setSelectedModel("")}- className="p-1 text-text-muted hover:text-red-500 rounded transition-colors"- title={t("clear")}- >- <span className="material-symbols-outlined text-[14px]">close</span>- </button>- )}+ <div className="flex-1 flex flex-col gap-1">+ {modelList.length > 0 && (+ <div className="flex flex-col gap-0.5 mb-1">+ {modelList.map((id) => (+ <div+ key={id}+ className="flex items-center gap-1.5 px-2 py-1 bg-bg-secondary rounded border border-border"+ >+ <span className="flex-1 text-xs font-mono truncate">{id}</span>+ <button+ onClick={() => removeModel(id)}+ className="text-text-muted hover:text-red-500 transition-colors shrink-0"+ title={t("clear")}+ >+ <span className="material-symbols-outlined text-[12px]">close</span>+ </button>+ </div>+ ))}+ </div>+ )}+ <div className="flex items-center gap-1.5">+ <input+ type="text"+ value={modelInput}+ onChange={(e) => setModelInput(e.target.value)}+ onKeyDown={(e) => {+ if (e.key === "Enter") {+ e.preventDefault();+ addModel();+ }+ }}+ placeholder={t("providerModelPlaceholder")}+ className="flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"+ />+ <button+ onClick={() => setModalOpen(true)}+ disabled={!hasActiveProviders}+ className={`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${hasActiveProviders ? "bg-surface border-border text-text-main hover:border-primary cursor-pointer" : "opacity-50 cursor-not-allowed border-border"}`}+ >+ {t("selectModel")}+ </button>+ <button+ onClick={() => addModel()}+ disabled={!modelInput.trim() || modelList.includes(modelInput.trim())}+ className="px-2 py-1.5 rounded border bg-surface border-border hover:border-primary text-xs shrink-0 disabled:opacity-50"+ title="Add model"+ >+ <span className="material-symbols-outlined text-[14px]">add</span>+ </button>+ </div>+ </div></div></div>@@ -454,7 +511,7 @@ export default function DroidToolCard({variant="primary"size="sm"onClick={handleApplySettings}- disabled={!selectedModel}+ disabled={modelList.length === 0}loading={applying}><span className="material-symbols-outlined text-[14px] mr-1">save</span>diff --git a/src/app/(dashboard)/dashboard/context/combos/CompressionCombosPageClient.tsx b/src/app/(dashboard)/dashboard/context/combos/CompressionCombosPageClient.tsxindex a9b48c3e47..8bdfc4703d 100644--- a/src/app/(dashboard)/dashboard/context/combos/CompressionCombosPageClient.tsx+++ b/src/app/(dashboard)/dashboard/context/combos/CompressionCombosPageClient.tsx@@ -8,6 +8,7 @@// matching `EngineConfigPage` / `CompressionHub`, both of which hydrate cleanly.import { useEffect, useState } from "react";+import { STACKED_PIPELINE_ENGINE_INTENSITIES } from "@/shared/validation/compressionConfigSchemas";import CompressionHub from "./CompressionHub";type PipelineStep = { engine: string; intensity?: string };@@ -29,17 +30,9 @@ const EMPTY_PIPELINE: PipelineStep[] = [{ engine: "caveman", intensity: "full" },];-const ENGINE_INTENSITIES: Record<string, string[]> = {- rtk: ["minimal", "standard", "aggressive"],- caveman: ["lite", "full", "ultra"],- lite: ["lite"],- aggressive: ["standard"],- ultra: ["ultra"],- headroom: ["standard"],- "session-dedup": ["standard"],- ccr: ["standard"],- llmlingua: ["standard"],-};+// Engine list is sourced from the API schema so the dropdown can never offer an engine+// the `PUT /api/context/combos/[id]` route would reject with HTTP 400 (#4955).+const ENGINE_INTENSITIES: Record<string, readonly string[]> = STACKED_PIPELINE_ENGINE_INTENSITIES;function NamedCombosManager() {const [combos, setCombos] = useState<CompressionCombo[]>([]);@@ -55,6 +48,7 @@ function NamedCombosManager() {const [assignmentIds, setAssignmentIds] = useState<string[]>([]);const [saving, setSaving] = useState(false);const [activeComboId, setActiveComboId] = useState<string | null>(null);+ const [error, setError] = useState<string | null>(null);const refresh = () => {fetch("/api/context/combos")@@ -88,6 +82,7 @@ function NamedCombosManager() {setOutputMode(false);setOutputModeIntensity("full");setAssignmentIds([]);+ setError(null);};const loadAssignments = async (id: string) => {@@ -112,7 +107,15 @@ function NamedCombosManager() {const saveCombo = async () => {const trimmed = name.trim();- if (!trimmed) return;+ if (!trimmed) {+ setError("Enter a combo name before saving.");+ return;+ }+ if (pipeline.length === 0) {+ setError("Add at least one pipeline step before saving.");+ return;+ }+ setError(null);setSaving(true);try {const payload = {@@ -131,7 +134,11 @@ function NamedCombosManager() {body: JSON.stringify(payload),});- if (!res.ok) return;+ if (!res.ok) {+ const body = await res.json().catch(() => null);+ setError(body?.error || `Failed to save combo (HTTP ${res.status}).`);+ return;+ }const combo = await res.json();await fetch(`/api/context/combos/${combo.id}/assignments`, {method: "PUT",@@ -315,6 +322,12 @@ function NamedCombosManager() {</div></div>+ {error && (+ <p className="mt-4 text-sm text-danger" role="alert">+ {error}+ </p>+ )}+<div className="mt-4 flex flex-wrap gap-2"><buttononClick={saveCombo}diff --git a/src/app/(dashboard)/dashboard/providers/[id]/components/modals/AddApiKeyModal.tsx b/src/app/(dashboard)/dashboard/providers/[id]/components/modals/AddApiKeyModal.tsxindex 7f0447d4db..e4eb1c5498 100644--- a/src/app/(dashboard)/dashboard/providers/[id]/components/modals/AddApiKeyModal.tsx+++ b/src/app/(dashboard)/dashboard/providers/[id]/components/modals/AddApiKeyModal.tsx@@ -45,6 +45,7 @@ export interface AddApiKeyModalProps {apiKey?: string;priority: number;baseUrl?: string;+ defaultModel?: string;providerSpecificData?: Record<string, unknown>;}) => Promise<void | unknown>;onClose: () => void;@@ -100,6 +101,7 @@ export default function AddApiKeyModal({const [formData, setFormData] = useState({name: "",apiKey: "",+ defaultModel: "",priority: 1,baseUrl: initialBaseUrl || defaultBaseUrl,cx: "",@@ -303,6 +305,7 @@ export default function AddApiKeyModal({apiKey: credentialInput.trim() || undefined,priority: formData.priority,testStatus: "active",+ defaultModel: isCompatible ? formData.defaultModel.trim() || undefined : undefined,providerSpecificData,};@@ -696,6 +699,16 @@ export default function AddApiKeyModal({onChange={(patch) => setFormData({ ...formData, ...patch })}t={t}/>+ {isCompatible && (+ <Input+ label={t("compatibleDefaultModelLabel")}+ value={formData.defaultModel}+ onChange={(e) => setFormData({ ...formData, defaultModel: e.target.value })}+ placeholder={isAnthropic ? "claude-3-5-sonnet-latest" : "gpt-4o-mini"}+ hint={t("compatibleDefaultModelHint")}+ data-testid="compat-default-model-input"+ />+ )}{isCompatible && !isCcCompatible && (<p className="text-xs text-text-muted">{isAnthropic@@ -832,6 +845,7 @@ export default function AddApiKeyModal({disabled={!formData.name ||(!isCompatible && !apiKeyOptional && !formData.apiKey) ||+ (isCompatible && !formData.defaultModel.trim()) ||(isGooglePse && !formData.cx.trim()) ||saving ||(usesBaseUrl && !formData.baseUrl.trim() && !defaultBaseUrl)diff --git a/src/app/api/cli-tools/droid-settings/route.ts b/src/app/api/cli-tools/droid-settings/route.tsindex 7313faef81..856edf2e49 100644--- a/src/app/api/cli-tools/droid-settings/route.ts+++ b/src/app/api/cli-tools/droid-settings/route.ts@@ -11,10 +11,15 @@ import {} from "@/shared/services/cliRuntime";import { createBackup } from "@/shared/services/backupService";import { saveCliToolLastConfigured, deleteCliToolLastConfigured } from "@/lib/db/cliToolState";-import { cliModelConfigSchema } from "@/shared/validation/schemas";+import { cliMultiModelConfigSchema } from "@/shared/validation/schemas";import { isValidationFailure, validateBody } from "@/shared/validation/helpers";import { resolveApiKey } from "@/shared/services/apiKeyResolver";import { readJsoncConfig } from "../_lib/jsoncConfig";+import {+ buildDroidCustomModels,+ isOmniRouteCustomModel,+ normalizeDroidModelList,+} from "@/shared/services/droidCustomModels";const getDroidSettingsPath = () => getCliPrimaryConfigPath("droid");const getDroidDir = () => path.dirname(getDroidSettingsPath());@@ -25,10 +30,12 @@ const getDroidDir = () => path.dirname(getDroidSettingsPath());// "installed but not configured" instead of a 500 misread as "not installed".const readSettings = async () => readJsoncConfig(getDroidSettingsPath());-// Check if settings has OmniRoute customModels+// Check if settings has OmniRoute customModels.+// Multi-model entries are stored as `custom:OmniRoute-0`, `custom:OmniRoute-1`, …+// (Ported from upstream PR decolua/9router#618.)const hasOmniRouteConfig = (settings: any) => {if (!settings || !settings.customModels) return false;- return settings.customModels.some((m) => m.id === "custom:OmniRoute-0");+ return settings.customModels.some(isOmniRouteCustomModel);};// GET - Check droid CLI and read current settings@@ -103,13 +110,30 @@ export async function POST(request: Request) {// (#549) Extract keyId BEFORE validation — Zod strips unknown fields!const keyId = typeof rawBody?.keyId === "string" ? rawBody.keyId.trim() : null;- const validation = validateBody(cliModelConfigSchema, rawBody);+ const validation = validateBody(cliMultiModelConfigSchema, rawBody);if (isValidationFailure(validation)) {return NextResponse.json({ error: validation.error }, { status: 400 });}- const { baseUrl, model } = validation.data;+ const { baseUrl, model, models, activeModel } = validation.data;const apiKey = await resolveApiKey(keyId, validation.data.apiKey);+ // Multi-model support (ported from decolua/9router#618): accept either a+ // `models` array or the legacy single `model` string.+ const modelList = normalizeDroidModelList({ model, models });+ if (modelList.length === 0) {+ return NextResponse.json(+ {+ error: {+ message: "Invalid request",+ details: [+ { field: "models", message: "baseUrl and at least one model are required" },+ ],+ },+ },+ { status: 400 }+ );+ }+const droidDir = getDroidDir();const settingsPath = getDroidSettingsPath();@@ -133,26 +157,19 @@ export async function POST(request: Request) {settings.customModels = [];}- // Remove existing OmniRoute config if any- settings.customModels = settings.customModels.filter((m) => m.id !== "custom:OmniRoute-0");+ // Remove every existing OmniRoute config (multi-model: index 0..N)+ settings.customModels = settings.customModels.filter((m) => !isOmniRouteCustomModel(m));// Normalize baseUrl to ensure /v1 suffixconst normalizedBaseUrl = baseUrl.endsWith("/v1") ? baseUrl : `${baseUrl}/v1`;- // Add new OmniRoute config- const customModel = {- model: model,- id: "custom:OmniRoute-0",- index: 0,+ // Build and prepend OmniRoute entries (one per requested model)+ const newEntries = buildDroidCustomModels(modelList, {baseUrl: normalizedBaseUrl,apiKey: apiKey || "your_api_key",- displayName: model,- maxOutputTokens: 131072,- noImageSupport: false,- provider: "openai",- };-- settings.customModels.unshift(customModel);+ activeModel,+ });+ settings.customModels = [...newEntries, ...settings.customModels];// Write settingsawait fs.writeFile(settingsPath, JSON.stringify(settings, null, 2));@@ -206,9 +223,9 @@ export async function DELETE(request: Request) {throw error;}- // Remove OmniRoute customModels+ // Remove OmniRoute customModels (every index, multi-model)if (settings.customModels) {- settings.customModels = settings.customModels.filter((m) => m.id !== "custom:OmniRoute-0");+ settings.customModels = settings.customModels.filter((m) => !isOmniRouteCustomModel(m));// Remove customModels array if emptyif (settings.customModels.length === 0) {diff --git a/src/app/api/headroom/start/route.ts b/src/app/api/headroom/start/route.tsnew file mode 100644index 0000000000..e2fe685db7--- /dev/null+++ b/src/app/api/headroom/start/route.ts@@ -0,0 +1,49 @@+import { getSettings } from "@/lib/db/settings";+import {+ DEFAULT_HEADROOM_URL,+ isLoopbackHeadroomUrl,+ parsePortFromHeadroomUrl,+} from "@/lib/headroom/detect";+import { startHeadroomProxy, HeadroomError } from "@/lib/headroom/process";+import { createErrorResponse } from "@/lib/api/errorResponse";+import { sanitizeErrorMessage } from "@omniroute/open-sse/utils/error";++export const dynamic = "force-dynamic";++export async function POST(): Promise<Response> {+ try {+ const settings = await getSettings();+ const url =+ typeof settings.headroomUrl === "string" && settings.headroomUrl+ ? settings.headroomUrl+ : DEFAULT_HEADROOM_URL;++ // Pair commit 50ed79fe: refuse to spawn against a non-loopback URL.+ // External Docker sidecars must be started outside OmniRoute.+ if (!isLoopbackHeadroomUrl(url)) {+ return createErrorResponse({+ status: 400,+ message: "External Headroom proxies must be started outside OmniRoute",+ type: "invalid_request",+ });+ }++ const port = parsePortFromHeadroomUrl(url) ?? 8787;+ const result = await startHeadroomProxy({ port });+ return Response.json({ success: true, ...result });+ } catch (error) {+ if (error instanceof HeadroomError && error.code === "NOT_INSTALLED") {+ return createErrorResponse({+ status: 400,+ message: error.message,+ type: "invalid_request",+ details: { code: error.code },+ });+ }+ return createErrorResponse({+ status: 500,+ message: sanitizeErrorMessage(error),+ type: "server_error",+ });+ }+}diff --git a/src/app/api/headroom/status/route.ts b/src/app/api/headroom/status/route.tsnew file mode 100644index 0000000000..03d08ee6c5--- /dev/null+++ b/src/app/api/headroom/status/route.ts@@ -0,0 +1,26 @@+import { getSettings } from "@/lib/db/settings";+import { DEFAULT_HEADROOM_URL, getHeadroomStatus } from "@/lib/headroom/detect";+import { getManagedPid } from "@/lib/headroom/process";+import { createErrorResponse } from "@/lib/api/errorResponse";+import { sanitizeErrorMessage } from "@omniroute/open-sse/utils/error";++export const dynamic = "force-dynamic";++export async function GET(): Promise<Response> {+ try {+ const settings = await getSettings();+ const url =+ typeof settings.headroomUrl === "string" && settings.headroomUrl+ ? settings.headroomUrl+ : DEFAULT_HEADROOM_URL;+ const status = await getHeadroomStatus(url);+ const managedPid = getManagedPid();+ return Response.json({ ...status, url, managedPid });+ } catch (error) {+ return createErrorResponse({+ status: 500,+ message: sanitizeErrorMessage(error),+ type: "server_error",+ });+ }+}diff --git a/src/app/api/headroom/stop/route.ts b/src/app/api/headroom/stop/route.tsnew file mode 100644index 0000000000..8472accdb5--- /dev/null+++ b/src/app/api/headroom/stop/route.ts@@ -0,0 +1,19 @@+import { stopHeadroomProxy } from "@/lib/headroom/process";+import { createErrorResponse } from "@/lib/api/errorResponse";+import { sanitizeErrorMessage } from "@omniroute/open-sse/utils/error";++export const dynamic = "force-dynamic";++export async function POST(): Promise<Response> {+ try {+ const result = stopHeadroomProxy();+ const status = result.stopped ? 200 : 409;+ return Response.json(result, { status });+ } catch (error) {+ return createErrorResponse({+ status: 500,+ message: sanitizeErrorMessage(error),+ type: "server_error",+ });+ }+}diff --git a/src/app/api/oauth/codex/import/route.ts b/src/app/api/oauth/codex/import/route.tsnew file mode 100644index 0000000000..5e37803696--- /dev/null+++ b/src/app/api/oauth/codex/import/route.ts@@ -0,0 +1,107 @@+import { NextResponse } from "next/server";+import { z } from "zod";+import { normalizeCodexImportRecord, flattenCodexImportPayload } from "@/lib/oauth/services/codexImport";+import { createProviderConnection } from "@/models";+import { isAuthRequired, isAuthenticated } from "@/shared/utils/apiAuth";+import { sanitizeErrorMessage } from "@omniroute/open-sse/utils/error.ts";++/**+ * POST /api/oauth/codex/import+ *+ * Bulk-import Codex (OpenAI) accounts from JSON payloads produced by the Codex+ * CLI or common token-export tools. Each item may be a flat export+ * (`access_token`, `refresh_token`, …) or the CLI's nested `auth.json` shape.+ *+ * Body: `{ accounts: object | object[] }`+ *+ * Returns a per-record summary so partial successes are surfaced to the UI.+ *+ * Ported from decolua/9router#1257 (beaaan).+ */++const bodySchema = z.object({+ accounts: z.union([z.record(z.unknown()), z.array(z.unknown())], {+ errorMap: () => ({ message: "accounts must be an object or an array of objects" }),+ }),+});++async function requireAuth(request: Request): Promise<NextResponse | null> {+ if (!(await isAuthRequired(request))) return null;+ if (await isAuthenticated(request)) return null;+ return NextResponse.json({ error: "Unauthorized" }, { status: 401 });+}++export async function POST(request: Request) {+ const authResponse = await requireAuth(request);+ if (authResponse) return authResponse;++ let rawBody: unknown;+ try {+ rawBody = await request.json();+ } catch {+ return NextResponse.json(+ { error: "Invalid or empty JSON body" },+ { status: 400 },+ );+ }++ const parsed = bodySchema.safeParse(rawBody);+ if (!parsed.success) {+ return NextResponse.json(+ { error: parsed.error.errors[0]?.message ?? "Invalid request body" },+ { status: 400 },+ );+ }++ const flat = flattenCodexImportPayload(parsed.data.accounts);+ if (!flat.ok) {+ return NextResponse.json({ error: flat.error }, { status: 400 });+ }+ if (flat.records.length === 0) {+ return NextResponse.json(+ { error: "No accounts found in payload" },+ { status: 400 },+ );+ }++ const results: Array<+ | { index: number; ok: true; connectionId: string; email: string }+ | { index: number; ok: false; error: string }+ > = [];+ let imported = 0;+ let failed = 0;++ for (let i = 0; i < flat.records.length; i++) {+ const norm = normalizeCodexImportRecord(flat.records[i]);+ if (!norm.ok) {+ failed += 1;+ results.push({ index: i, ok: false, error: norm.error });+ continue;+ }+ try {+ const conn = await createProviderConnection(norm.payload as Record<string, unknown>);+ imported += 1;+ results.push({+ index: i,+ ok: true,+ connectionId: String(conn.id),+ email: String(conn.email ?? norm.payload.email),+ });+ } catch (error) {+ failed += 1;+ results.push({+ index: i,+ ok: false,+ error: sanitizeErrorMessage(error instanceof Error ? error.message : String(error)),+ });+ }+ }++ return NextResponse.json({+ success: failed === 0,+ imported,+ failed,+ total: flat.records.length,+ results,+ });+}diff --git a/src/app/api/oauth/cursor/auto-import/route.ts b/src/app/api/oauth/cursor/auto-import/route.tsindex b5a114d580..85f9c8baa8 100755--- a/src/app/api/oauth/cursor/auto-import/route.ts+++ b/src/app/api/oauth/cursor/auto-import/route.ts@@ -2,8 +2,65 @@ import { NextResponse } from "next/server";import { access, constants, readFile } from "fs/promises";import { homedir } from "os";import { join } from "path";+import { execFile } from "child_process";+import { promisify } from "util";import { isAuthRequired, isAuthenticated } from "@/shared/utils/apiAuth";+const execFileAsync = promisify(execFile);++/**+ * Probe dependencies for {@link verifyLinuxCursorInstalled}. Injectable so the+ * guard can be unit-tested without spawning a real `which` process or touching+ * the filesystem — mirrors the `__setExecFileImpl` pattern in+ * `src/lib/cli-helper/tool-detector.ts`.+ */+export interface CursorInstallProbe {+ /** Runs `which <binary>`; rejects when the binary is not on PATH. */+ execFile?: (+ file: string,+ args: string[],+ options: { timeout: number }+ ) => Promise<{ stdout: string; stderr: string }>;+ /** Resolves when the path is readable; rejects otherwise (e.g. `fs.access`). */+ access?: (path: string, mode: number) => Promise<void>;+ /** Override the home directory used to locate the `.desktop` fallback. */+ home?: string;+}++/**+ * On Linux, verify that the Cursor IDE is actually installed before trusting+ * leftover config files (state.vscdb). A removed Cursor install can leave its+ * `~/.config/Cursor/...` directory behind, which would otherwise trigger a+ * false-positive auto-import and create a phantom Cursor provider connection.+ *+ * The check prefers `which cursor` and falls back to a readable+ * `~/.local/share/applications/cursor.desktop` entry (the desktop launcher a+ * package install drops even when the CLI shim is not on PATH).+ *+ * Port of decolua/9router#313 — only the linux probe is added; macOS/Windows+ * keep their existing behavior (no install probe).+ */+export async function verifyLinuxCursorInstalled(+ probe: CursorInstallProbe = {}+): Promise<boolean> {+ const exec = probe.execFile ?? execFileAsync;+ const canAccess = probe.access ?? access;+ const home = probe.home ?? homedir();++ try {+ await exec("which", ["cursor"], { timeout: 5000 });+ return true;+ } catch {+ try {+ const desktopFile = join(home, ".local/share/applications/cursor.desktop");+ await canAccess(desktopFile, constants.R_OK);+ return true;+ } catch {+ return false;+ }+ }+}+/*** Known key names Cursor IDE has used over time to persist the auth token* and machine id in the local `state.vscdb`. Order matters — the first@@ -184,6 +241,17 @@ async function tryIdeAuth(): Promise<{};}} else {+ // On Linux, verify Cursor is actually installed before trusting leftover+ // config files — a removed install can leave ~/.config/Cursor behind and+ // would otherwise create a phantom Cursor connection (port: 9router#313).+ if (platform === "linux" && !(await verifyLinuxCursorInstalled())) {+ return {+ found: false,+ error:+ "Cursor config files found but Cursor IDE does not appear to be " ++ "installed. Skipping auto-import.",+ };+ }dbPath = candidates[0];}diff --git a/src/app/api/provider-nodes/validate/route.ts b/src/app/api/provider-nodes/validate/route.tsindex 024818fcaa..c7bc7b7648 100644--- a/src/app/api/provider-nodes/validate/route.ts+++ b/src/app/api/provider-nodes/validate/route.ts@@ -16,6 +16,48 @@ import { isCcCompatibleProviderEnabled } from "@/shared/utils/featureFlags";import { providerNodeValidateSchema } from "@/shared/validation/schemas";import { isValidationFailure, validateBody } from "@/shared/validation/helpers";+// Matches a base URL whose host is localhost / 127.0.0.1 (with an optional port).+const LOCALHOST_BASE_URL_RE = /^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?(?:[/?#]|$)/i;++// Extract the underlying network error code from a SafeOutboundFetchError chain.+// safeOutboundFetch wraps fetch failures and preserves the original error as `cause`,+// so a connection-refused surfaces as cause.code === "ECONNREFUSED".+function getOutboundCauseCode(error: unknown): string | undefined {+ const cause = (error as { cause?: unknown })?.cause;+ if (cause && typeof cause === "object") {+ const direct = (cause as { code?: unknown }).code;+ if (typeof direct === "string") return direct;+ const nested = (cause as { cause?: { code?: unknown } }).cause?.code;+ if (typeof nested === "string") return nested;+ }+ return undefined;+}++// When a connection error happens against a localhost base URL, the most common+// cause is running OmniRoute in Docker — `localhost` then points at the container,+// not the host. Augment the surfaced message with an actionable hint in that case.+// Ported from decolua/9router#642.+export function augmentDockerLocalhostHint(+ error: unknown,+ baseUrl: string | undefined,+ fallbackMessage: string+): string {+ if (!baseUrl || !LOCALHOST_BASE_URL_RE.test(baseUrl)) return fallbackMessage;++ const code =+ error instanceof SafeOutboundFetchError && error.code === "TIMEOUT"+ ? "ETIMEDOUT"+ : getOutboundCauseCode(error);++ if (code === "ECONNREFUSED") {+ return "Connection refused — are you running OmniRoute in Docker? localhost points to the container, not your host. Use your host IP (e.g. http://192.168.x.x:11434) or http://host.docker.internal:11434 on Linux/Mac.";+ }+ if (code === "ETIMEDOUT") {+ return "Connection timeout — are you running OmniRoute in Docker? Use your host IP (e.g. http://192.168.x.x:11434) or http://host.docker.internal:11434 on Linux/Mac.";+ }+ return fallbackMessage;+}+function sanitizeAnthropicBaseUrl(baseUrl: string) {return (baseUrl || "").trim()@@ -212,18 +254,19 @@ export async function POST(request) {}return NextResponse.json({ valid: false, error: getModelsErrorMessage(res.status) });} catch (error) {+ const attemptedBaseUrl =+ rawBody && typeof rawBody === "object" && "baseUrl" in rawBody+ ? String((rawBody as { baseUrl?: unknown }).baseUrl || "")+ : "";const status = getSafeOutboundFetchErrorStatus(error);if (status) {- const message = error instanceof Error ? error.message : "Validation failed";+ const rawMessage = error instanceof Error ? error.message : "Validation failed";+ const message = augmentDockerLocalhostHint(error, attemptedBaseUrl, rawMessage);if (error instanceof SafeOutboundFetchError &&error.code === "URL_GUARD_BLOCKED" &&message.includes(PROVIDER_URL_BLOCKED_MESSAGE)) {- const attemptedBaseUrl =- rawBody && typeof rawBody === "object" && "baseUrl" in rawBody- ? String((rawBody as { baseUrl?: unknown }).baseUrl || "")- : "";logAuditEvent({action: "provider.validation.ssrf_blocked",actor: "admin",@@ -242,6 +285,7 @@ export async function POST(request) {return NextResponse.json({ error: message }, { status });}console.log("Error validating provider node:", error);- return NextResponse.json({ error: "Validation failed" }, { status: 500 });+ const message = augmentDockerLocalhostHint(error, attemptedBaseUrl, "Validation failed");+ return NextResponse.json({ error: message }, { status: 500 });}}diff --git a/src/app/api/providers/[id]/models/route.ts b/src/app/api/providers/[id]/models/route.tsindex 51053397c4..21b3894eea 100755--- a/src/app/api/providers/[id]/models/route.ts+++ b/src/app/api/providers/[id]/models/route.ts@@ -191,6 +191,9 @@ const NAMED_OPENAI_STYLE_PROVIDERS = new Set([// but was left out of the sweep, so it served a stale hardcoded seed (grok-3, grok-2-1212,// claude-3.7-sonnet …). Live fetch keeps it fresh; seed stays as the offline fallback."api-airforce",+ // DGrid is an OpenAI-compatible gateway whose default seed is the free auto-router;+ // the full model catalog is discovered live from https://api.dgrid.ai/v1/models.+ "dgrid",]);function isNamedOpenAIStyleProvider(provider: string): boolean {diff --git a/src/app/globals.css b/src/app/globals.cssindex 489a58688f..4df43dff07 100644--- a/src/app/globals.css+++ b/src/app/globals.css@@ -496,3 +496,15 @@ select option {.react-flow__controls-button svg {fill: var(--color-text-main);}++/* Desktop sidebar visibility must not depend on Tailwind's hidden/lg:flex cascade+ (ordering/specificity can collapse it). Explicit class + 1024px media query. */+.dashboard-sidebar-desktop {+ display: none;+ min-height: 0;+}+@media (min-width: 1024px) {+ .dashboard-sidebar-desktop {+ display: flex;+ }+}diff --git a/src/i18n/messages/en.json b/src/i18n/messages/en.jsonindex 2b8b5edf35..4296f4eba3 100644--- a/src/i18n/messages/en.json+++ b/src/i18n/messages/en.json@@ -4173,6 +4173,8 @@"optional": "Optional","anthropicCompatibleName": "Anthropic Compatible","openaiCompatibleName": "OpenAI Compatible",+ "compatibleDefaultModelLabel": "Default Model",+ "compatibleDefaultModelHint": "Enter the model ID exactly as your compatible endpoint expects it. This model will be saved as the connection default.","failedImportModels": "Failed to import models","noModelsReturnedFromEndpoint": "No models returned from /models endpoint.","importingModelsProgress": "Importing {current} of {total} models...",diff --git a/src/lib/combos/autoPromote.ts b/src/lib/combos/autoPromote.tsnew file mode 100644index 0000000000..e5928b3cc8--- /dev/null+++ b/src/lib/combos/autoPromote.ts@@ -0,0 +1,92 @@+/**+ * combos/autoPromote.ts — pure reorder helper for the "auto-promote successful+ * combo model" feature.+ *+ * When the `comboAutoPromoteEnabled` setting is on and a combo model responds+ * successfully, the winning model is moved to position #1 of the persisted+ * combo so future requests try it first.+ *+ * OmniRoute stores `combo.models` as an array of `ComboStep` objects+ * (`{ kind: "model", model, ... }`), unlike the upstream project which stores+ * plain model strings. This helper accepts both shapes and reorders in place+ * without mutating the input, returning `null` when no change is required+ * (winner already first, winner absent, or empty list).+ */++type StepLike = { kind?: unknown; model?: unknown } | string;++/** Extract the model id from a step entry (object or bare string). */+export function comboStepModelId(step: unknown): string | null {+ if (typeof step === "string") return step.trim().length > 0 ? step : null;+ if (step && typeof step === "object") {+ const model = (step as { model?: unknown }).model;+ if (typeof model === "string" && model.trim().length > 0) return model;+ }+ return null;+}++/**+ * Return a reordered copy of `models` with the entry matching `winningModel`+ * moved to the front, or `null` if no reordering is needed/possible.+ *+ * Pure: never mutates the input array or its entries.+ */+export function promoteModelToFront<T extends StepLike>(+ models: readonly T[] | null | undefined,+ winningModel: string | null | undefined+): T[] | null {+ if (!Array.isArray(models) || models.length === 0) return null;+ if (typeof winningModel !== "string" || winningModel.length === 0) return null;++ const matchIndex = models.findIndex((step) => comboStepModelId(step) === winningModel);+ // Winner not in the combo (e.g. global fallback) or already first → no-op.+ if (matchIndex <= 0) return null;++ const winner = models[matchIndex];+ const rest = models.filter((_, index) => index !== matchIndex);+ return [winner, ...rest];+}++interface PromoteComboDeps {+ updateCombo: (id: string, data: { models: unknown[] }) => Promise<unknown>;+ info?: (tag: string, msg: string) => void;+ warn?: (tag: string, msg: string) => void;+}++/**+ * Persist the auto-promotion of a successful combo model to position #1.+ *+ * Opt-in via the `comboAutoPromoteEnabled` setting. Best-effort: a DB failure is+ * logged and swallowed so it never affects the already-successful response.+ * No-op when the flag is off, the combo has no id, or the model is already first+ * / absent. `updateCombo` is injected so this stays unit-testable without a DB.+ */+export async function promoteSuccessfulComboModel(+ combo: { id?: unknown; name?: unknown; models?: unknown } | null | undefined,+ winningModel: string | null | undefined,+ settings: Record<string, unknown> | null | undefined,+ deps: PromoteComboDeps+): Promise<boolean> {+ if (!combo || !settings || !settings.comboAutoPromoteEnabled) return false;+ const comboId = typeof combo.id === "string" ? combo.id : null;+ if (!comboId) return false;+ const reordered = promoteModelToFront(+ Array.isArray(combo.models) ? (combo.models as unknown[]) : null,+ winningModel+ );+ if (!reordered) return false;+ const label = typeof combo.name === "string" ? combo.name : comboId;+ try {+ await deps.updateCombo(comboId, { models: reordered });+ deps.info?.("COMBO", `Model "${winningModel}" succeeded — promoted to #1 in combo "${label}"`);+ return true;+ } catch (dbErr: any) {+ deps.warn?.(+ "COMBO",+ `Failed to promote model "${winningModel}" in combo "${label}": ${+ dbErr?.message || "unknown error"+ }`+ );+ return false;+ }+}diff --git a/src/lib/dataPaths.ts b/src/lib/dataPaths.tsindex 3152265828..5ad61ddbee 100644--- a/src/lib/dataPaths.ts+++ b/src/lib/dataPaths.ts@@ -70,6 +70,45 @@ export function resolveDataDir({ isCloud = false }: { isCloud?: boolean } = {}):return getDefaultDataDir();}+/**+ * Resolve the data directory and guarantee it is writable.+ *+ * Unlike {@link resolveDataDir} (a pure, side-effect-free path resolver used by+ * many callers), this variant probes the resolved directory by attempting to+ * create it. When a configured `DATA_DIR` is not writable (`EACCES`/`EPERM`),+ * it falls back to the default user directory so the app keeps working instead+ * of crashing on an unwritable, operator-supplied path. Any other error (e.g.+ * `ENOTDIR`, `ENOSPC`) still propagates.+ *+ * Use this only at the single startup site that owns directory creation+ * (currently `db/core.ts`); everywhere else keep using the pure resolver.+ */+export function resolveWritableDataDir({ isCloud = false }: { isCloud?: boolean } = {}): string {+ const resolved = resolveDataDir({ isCloud });++ // Cloud/serverless never owns a writable home dir; leave its sentinel alone.+ if (isCloud) return resolved;++ // No explicit override → already the default user dir; nothing to fall back to.+ const configured = normalizeConfiguredPath(process.env.DATA_DIR);+ if (!configured) return resolved;++ try {+ fs.mkdirSync(resolved, { recursive: true });+ return resolved;+ } catch (err: unknown) {+ const code = (err as NodeJS.ErrnoException | null)?.code;+ if (code === "EACCES" || code === "EPERM") {+ const fallback = getDefaultDataDir();+ console.warn(+ `[DATA_DIR] '${resolved}' is not writable (${code}) → falling back to '${fallback}'`+ );+ return fallback;+ }+ throw err;+ }+}+export function isSamePath(a: string | null | undefined, b: string | null | undefined): boolean {if (!a || !b) return false;const normalizedA = path.resolve(a);diff --git a/src/lib/db/combos.ts b/src/lib/db/combos.tsindex 51cb0892b2..b24f6e7e9b 100644--- a/src/lib/db/combos.ts+++ b/src/lib/db/combos.ts@@ -125,6 +125,24 @@ export async function getComboByName(name: string) {return normalizeStoredCombo(combo, db, [name]);}+// #4446: case-insensitive name lookup. The opencode dispatch path forwards a+// lowercased combo slug (e.g. "master-light") for a combo provisioned as+// "MASTER-LIGHT"; the default BINARY collation of getComboByName misses it.+// Used only as a fallback after the exact match fails, so it cannot change the+// resolution of any combo that already resolves today.+export async function getComboByNameInsensitive(name: string) {+ const db = getDbInstance();+ const row = db+ .prepare(+ "SELECT data, sort_order, context_cache_protection FROM combos WHERE name = ? COLLATE NOCASE"+ )+ .get(name);+ const combo = parseComboRow(row);+ if (!combo) return null;+ const storedName = typeof combo.name === "string" ? combo.name : name;+ return normalizeStoredCombo(combo, db, [storedName]);+}+export async function createCombo(data: JsonRecord) {const db = getDbInstance();const now = new Date().toISOString();diff --git a/src/lib/db/core.ts b/src/lib/db/core.tsindex 99a04cda7f..261749a814 100644--- a/src/lib/db/core.ts+++ b/src/lib/db/core.ts@@ -13,7 +13,7 @@ import {} from "./adapters/driverFactory";import path from "path";import fs from "fs";-import { resolveDataDir, getLegacyDotDataDir } from "../dataPaths";+import { resolveWritableDataDir, getLegacyDotDataDir } from "../dataPaths";import { runMigrations } from "./migrationRunner";import { runDbHealthCheck } from "./healthCheck";import { resetAllDbModuleState } from "./stateReset";@@ -83,7 +83,7 @@ export const isBuildPhase = process.env.NEXT_PHASE === "phase-production-build";// ──────────────── Paths ────────────────-export const DATA_DIR = resolveDataDir({ isCloud });+export const DATA_DIR = resolveWritableDataDir({ isCloud });const LEGACY_DATA_DIR = isCloud ? null : getLegacyDotDataDir();export const SQLITE_FILE = isCloud ? null : path.join(DATA_DIR, "storage.sqlite");const JSON_DB_FILE = isCloud ? null : path.join(DATA_DIR, "db.json");diff --git a/src/lib/db/settings.ts b/src/lib/db/settings.tsindex f6b207b775..10341b3860 100644--- a/src/lib/db/settings.ts+++ b/src/lib/db/settings.ts@@ -124,6 +124,7 @@ export async function getSettings() {autoRefreshProviderQuota: false,autoRefreshProviderQuotaInterval: 180,comboConfigMode: "guided",+ comboAutoPromoteEnabled: false,codexServiceTier: { enabled: false },claudeFastMode: {enabled: false,@@ -136,6 +137,9 @@ export async function getSettings() {wsAuth: false,maxBodySizeMb: requestBodyLimitMbFromEnv(process.env.MAX_BODY_SIZE_BYTES),debugMode: true,+ // Opt-in diagnostic: when true, the chat handler emits a `log.debug("TOOLS", …)`+ // line per request summarizing tool count + MCP/hosted/client source breakdown.+ logToolSources: false,// LOCAL_ONLY manage-scope bypass policy defaults (T-011 / spec §Data Model).// Preserves PR #2473 behaviour on migration — the bypass starts ENABLED// for `/api/mcp/` so existing manage-scope Bearer clients keep working.diff --git a/src/lib/embeddings/service.ts b/src/lib/embeddings/service.tsindex 7c445fe2cb..3c467c066c 100644--- a/src/lib/embeddings/service.ts+++ b/src/lib/embeddings/service.ts@@ -13,6 +13,7 @@ import { toJsonErrorPayload } from "@/shared/utils/upstreamError";import { getProviderCredentials, clearRecoveredProviderState } from "@/sse/services/auth";import { getProviderNodes, getComboByName, getCombos, getDatabaseSettings } from "@/lib/localDb";import { handleComboChat } from "@omniroute/open-sse/services/combo.ts";+import { resolveBareModelToConnectionDefault } from "@omniroute/open-sse/services/model.ts";import { findEmbeddingComboDimensionConflict } from "./familyGuard";import { calculateCost } from "@/lib/usage/costCalculator";import { attachOmniRouteMetaHeaders } from "@/domain/omnirouteResponseMeta";@@ -71,8 +72,22 @@ export async function createEmbeddingResponse(settings = getDatabaseSettings();} catch {}+ // Inject the combo's configured dimensions into the request body so that+ // every upstream embedding call within this combo receives the same+ // dimensions override. The client's own dimensions value takes precedence+ // if already set. Ported from decolua/9router#1530.+ const comboRecord = combo as Record<string, unknown>;+ const comboDimensions =+ comboRecord.dimensions !== undefined && comboRecord.dimensions !== null+ ? String(comboRecord.dimensions)+ : undefined;+ const bodyWithDimensions =+ comboDimensions !== undefined && body.dimensions === undefined+ ? { ...body, dimensions: comboDimensions }+ : body;+return handleComboChat({- body,+ body: bodyWithDimensions,combo: combo as any,handleSingleModel: async (reqBody: any, targetModelStr: string, target?: any) => {const newBody = { ...reqBody, model: targetModelStr };@@ -191,15 +206,29 @@ export async function createEmbeddingResponse(}}+ // #474: when the request used a bare model name (no "/" — e.g. an alias that+ // resolved to "auto") and the selected connection declares a defaultModel,+ // resolve the bare name to that real model ID before the upstream call so the+ // provider receives a concrete model. A "/"-qualified name is left untouched.+ const connectionDefaultModel =+ credentials && typeof (credentials as { defaultModel?: unknown }).defaultModel === "string"+ ? ((credentials as { defaultModel?: string }).defaultModel as string)+ : null;+ const effectiveModel = resolveBareModelToConnectionDefault(+ modelStr,+ resolvedModel,+ connectionDefaultModel+ );+const result = await handleEmbedding({- body,+ body: effectiveModel !== resolvedModel ? { ...body, model: `${provider}/${effectiveModel}` } : body,// getProviderCredentials returns a richer connection object; handleEmbedding// only reads apiKey/accessToken, both present at runtime. Bridge the wider// selection type to the handler's narrow credential shape.credentials: credentials as { apiKey?: string; accessToken?: string } | null,log,resolvedProvider: providerConfig,- resolvedModel,+ resolvedModel: effectiveModel,clientRawRequest: options.clientRawRequest || null,apiKeyId: options.apiKeyId || null,apiKeyName: options.apiKeyName || null,@@ -212,10 +241,10 @@ export async function createEmbeddingResponse(if (credentials) await clearRecoveredProviderState(credentials);responseHeaders.set("Content-Type", "application/json");const usage = (result.data as { usage?: Record<string, number> })?.usage ?? null;- const costUsd = usage ? await calculateCost(provider, resolvedModel ?? "", usage) : 0;+ const costUsd = usage ? await calculateCost(provider, effectiveModel ?? "", usage) : 0;attachOmniRouteMetaHeaders(responseHeaders, {provider,- model: resolvedModel,+ model: effectiveModel,usage,costUsd,latencyMs: Date.now() - startTime,diff --git a/src/lib/headroom/detect.ts b/src/lib/headroom/detect.tsnew file mode 100644index 0000000000..cbdd9dd240--- /dev/null+++ b/src/lib/headroom/detect.ts@@ -0,0 +1,167 @@+/**+ * Headroom proxy detection helpers.+ *+ * Ported from upstream 9router (decolua/9router @ b55cf36d + 50ed79fe).+ * Original authors: decolua, Carmelo Campos (@carmelogunsroses), Cursor.+ *+ * Headroom is the optional third-party token-saver proxy (headroom-ai+ * Python CLI). OmniRoute can either:+ * 1. Manage a local proxy lifecycle (loopback URL → start/stop from the+ * dashboard via `process.ts`).+ * 2. Use an external Docker sidecar proxy (non-loopback HEADROOM_URL).+ * In this case we only probe /health; start/stop are NOT exposed.+ *+ * All functions here are pure / side-effect-free where possible so they can+ * be unit-tested without spawning processes.+ */++import { execFileSync } from "node:child_process";++const EXTRA_BINS = ["/usr/local/bin", "/opt/homebrew/bin", "/usr/bin", "/bin"];+const EXTENDED_PATH = [...EXTRA_BINS, process.env.PATH || ""].filter(Boolean).join(":");++const PYTHON_CANDIDATES = [+ "python3.13",+ "python3.12",+ "python3.11",+ "python3.10",+ "python3",+ "python",+];+const MIN_VERSION: readonly [number, number] = [3, 10];+const HEADROOM_HEALTH_TIMEOUT_MS = 1500;+const LOOPBACK_HOSTS = new Set(["localhost", "127.0.0.1", "::1", "[::1]", "0.0.0.0"]);++export const DEFAULT_HEADROOM_URL = process.env.HEADROOM_URL || "http://localhost:8787";++export interface HeadroomStatus {+ installed: boolean;+ path: string | null;+ running: boolean;+ python: string | null;+ localUrl: boolean;+ canStart: boolean;+}++export interface BuildHeadroomStatusInput {+ url: string;+ binaryPath: string | null;+ python: string | null;+ proxyReachable: boolean;+}++// ──────────────── Pure helpers (unit-testable) ────────────────++export function isLoopbackHeadroomUrl(url: string): boolean {+ try {+ const parsed = new URL(url);+ return LOOPBACK_HOSTS.has(parsed.hostname);+ } catch {+ return false;+ }+}++export function parsePortFromHeadroomUrl(url: string): number | null {+ try {+ const u = new URL(url);+ if (!u.port) return null;+ const p = parseInt(u.port, 10);+ if (Number.isFinite(p) && p > 0 && p < 65536) return p;+ } catch {+ // fall through+ }+ return null;+}++/**+ * Assemble the headroom status payload from already-resolved inputs.+ * Kept pure so unit tests can exercise every branch without spawning+ * processes or hitting the network.+ *+ * - `running` reflects /health reachability regardless of local CLI presence+ * (pair commit 50ed79fe — Docker sidecar support).+ * - `canStart` is only true for a loopback URL with the CLI installed; we+ * never spawn against a non-loopback URL.+ */+export function buildHeadroomStatus(input: BuildHeadroomStatusInput): HeadroomStatus {+ const installed = Boolean(input.binaryPath);+ const localUrl = isLoopbackHeadroomUrl(input.url);+ return {+ installed,+ path: input.binaryPath,+ running: input.proxyReachable,+ python: input.python,+ localUrl,+ canStart: installed && localUrl,+ };+}++// ──────────────── Side-effecting probes ────────────────++export function findHeadroomBinary(): string | null {+ try {+ // execFileSync (no shell): "which" is invoked directly with "headroom" as an+ // arg, so even if some upstream caller passes attacker-controlled input the+ // shell metacharacters cannot reach a shell parser.+ const out = execFileSync("which", ["headroom"], {+ stdio: ["ignore", "pipe", "ignore"],+ windowsHide: true,+ env: { ...process.env, PATH: EXTENDED_PATH },+ })+ .toString()+ .trim();+ return out || null;+ } catch {+ return null;+ }+}++export function findPython310(): string | null {+ for (const candidate of PYTHON_CANDIDATES) {+ try {+ // candidate is from a fixed allowlist (PYTHON_CANDIDATES) above — no+ // user input — but use execFileSync anyway to remove the shell entirely.+ const ver = execFileSync(candidate, ["--version"], {+ stdio: ["ignore", "pipe", "ignore"],+ windowsHide: true,+ env: { ...process.env, PATH: EXTENDED_PATH },+ })+ .toString()+ .trim();+ const match = ver.match(/(\d+)\.(\d+)/);+ if (!match) continue;+ const major = parseInt(match[1], 10);+ const minor = parseInt(match[2], 10);+ if (major > MIN_VERSION[0] || (major === MIN_VERSION[0] && minor >= MIN_VERSION[1])) {+ return candidate;+ }+ } catch {+ // try next candidate+ }+ }+ return null;+}++export async function probeProxyRunning(url: string): Promise<boolean> {+ if (!url) return false;+ const base = String(url).replace(/\/$/, "");+ try {+ const res = await fetch(`${base}/health`, {+ signal: AbortSignal.timeout(HEADROOM_HEALTH_TIMEOUT_MS),+ });+ return res.ok;+ } catch {+ return false;+ }+}++/**+ * Aggregated dashboard status. Composes the three probes above with the+ * pure builder so the I/O happens in one place.+ */+export async function getHeadroomStatus(url: string): Promise<HeadroomStatus> {+ const binaryPath = findHeadroomBinary();+ const python = findPython310();+ const proxyReachable = await probeProxyRunning(url);+ return buildHeadroomStatus({ url, binaryPath, python, proxyReachable });+}diff --git a/src/lib/headroom/process.ts b/src/lib/headroom/process.tsnew file mode 100644index 0000000000..b788bf6600--- /dev/null+++ b/src/lib/headroom/process.ts@@ -0,0 +1,193 @@+/**+ * Local headroom-proxy lifecycle management.+ *+ * Ported from upstream 9router @ b55cf36d (Cursor / decolua).+ *+ * Spawns the local `headroom proxy --port <port>` as a detached process,+ * tracks its PID in `<DATA_DIR>/headroom/proxy.pid`, and exposes start/stop/+ * status helpers. Only invoked behind the LOCAL_ONLY route-guard tier+ * (Hard Rules #15 + #17): a tunneled JWT cannot reach the start/stop routes.+ */++import fs from "node:fs";+import path from "node:path";+import { spawn } from "node:child_process";+import { DATA_DIR } from "@/lib/db/core";+import { findHeadroomBinary } from "./detect";++const HEADROOM_DIR = path.join(DATA_DIR ?? ".", "headroom");+const PID_FILE = path.join(HEADROOM_DIR, "proxy.pid");+const LOG_FILE = path.join(HEADROOM_DIR, "proxy.log");+const DEFAULT_PORT = 8787;+const STARTUP_TIMEOUT_MS = 8000;+const STOP_GRACE_MS = 2000;++export interface StartResult {+ pid: number;+ alreadyRunning: boolean;+}++export interface StopResult {+ stopped: boolean;+ pid?: number;+ reason?: string;+}++export class HeadroomError extends Error {+ code: string;+ constructor(message: string, code: string) {+ super(message);+ this.code = code;+ }+}++function ensureDir(): void {+ if (!fs.existsSync(HEADROOM_DIR)) fs.mkdirSync(HEADROOM_DIR, { recursive: true });+}++function readPid(): number | null {+ try {+ if (!fs.existsSync(PID_FILE)) return null;+ const raw = fs.readFileSync(PID_FILE, "utf8").trim();+ const pid = parseInt(raw, 10);+ return Number.isFinite(pid) && pid > 0 ? pid : null;+ } catch {+ return null;+ }+}++function writePid(pid: number): void {+ ensureDir();+ fs.writeFileSync(PID_FILE, String(pid));+}++function clearPid(): void {+ try {+ if (fs.existsSync(PID_FILE)) fs.unlinkSync(PID_FILE);+ } catch {+ // ignore+ }+}++export function isPidAlive(pid: number | null | undefined): boolean {+ if (!pid || typeof pid !== "number") return false;+ try {+ process.kill(pid, 0);+ return true;+ } catch {+ return false;+ }+}++export function getManagedPid(): number | null {+ const pid = readPid();+ return pid && isPidAlive(pid) ? pid : null;+}++function safePort(port: unknown): number {+ const n = Number(port);+ return Number.isFinite(n) && n > 0 && n < 65536 ? n : DEFAULT_PORT;+}++export async function startHeadroomProxy(+ opts: { port?: number } = {}+): Promise<StartResult> {+ const binary = findHeadroomBinary();+ if (!binary) {+ throw new HeadroomError("Headroom CLI not installed", "NOT_INSTALLED");+ }++ const existing = getManagedPid();+ if (existing) return { pid: existing, alreadyRunning: true };++ ensureDir();+ const outFd = fs.openSync(LOG_FILE, "a");++ // spawn (no shell) with array args — argv is passed directly to the+ // headroom binary, so no shell-metacharacter handling is needed.+ const child = spawn(binary, ["proxy", "--port", String(safePort(opts.port))], {+ stdio: ["ignore", outFd, outFd],+ detached: true,+ windowsHide: true,+ env: { ...process.env },+ });++ if (!child.pid) {+ fs.closeSync(outFd);+ throw new HeadroomError("Failed to spawn headroom proxy", "SPAWN_FAILED");+ }++ child.unref();+ writePid(child.pid);++ await new Promise<void>((resolve, reject) => {+ const timer = setTimeout(() => {+ if (isPidAlive(child.pid!)) resolve();+ else+ reject(+ new HeadroomError(+ "headroom proxy exited during startup — see proxy.log",+ "EARLY_EXIT"+ )+ );+ }, STARTUP_TIMEOUT_MS);++ child.once("exit", (code) => {+ clearTimeout(timer);+ clearPid();+ try {+ fs.closeSync(outFd);+ } catch {+ // already closed+ }+ reject(+ new HeadroomError(+ `headroom proxy exited early (code=${code}) — see proxy.log`,+ "EARLY_EXIT"+ )+ );+ });+ });++ try {+ fs.closeSync(outFd);+ } catch {+ // already closed+ }++ return { pid: child.pid, alreadyRunning: false };+}++export function stopHeadroomProxy(): StopResult {+ const pid = getManagedPid();+ if (!pid) return { stopped: false, reason: "not_running" };+ try {+ process.kill(pid, "SIGTERM");+ setTimeout(() => {+ if (isPidAlive(pid)) {+ try {+ process.kill(pid, "SIGKILL");+ } catch {+ // already gone+ }+ }+ }, STOP_GRACE_MS);+ clearPid();+ return { stopped: true, pid };+ } catch (e) {+ clearPid();+ const msg = e instanceof Error ? e.message : String(e);+ throw new HeadroomError(`Failed to stop headroom proxy: ${msg}`, "STOP_FAILED");+ }+}++export function getHeadroomLogTail(maxLines = 200): string {+ try {+ if (!fs.existsSync(LOG_FILE)) return "";+ const content = fs.readFileSync(LOG_FILE, "utf8");+ const lines = content.split(/\r?\n/).filter(Boolean);+ return lines.slice(-maxLines).join("\n");+ } catch {+ return "";+ }+}diff --git a/src/lib/ipUtils.ts b/src/lib/ipUtils.tsindex b1881b28d2..3bf92d3127 100644--- a/src/lib/ipUtils.ts+++ b/src/lib/ipUtils.ts@@ -26,9 +26,41 @@ export function extractClientIp(return remoteAddress?.trim() ?? "unknown";}+/**+ * Strip an IPv4-mapped IPv6 prefix ("::ffff:127.0.0.1" -> "127.0.0.1") so the+ * loopback check below catches both representations Node may report.+ */+function normalizePeer(addr: string | undefined): string {+ const trimmed = (addr ?? "").trim();+ if (!trimmed) return "";+ return trimmed.startsWith("::ffff:") ? trimmed.slice("::ffff:".length) : trimmed;+}++/**+ * Whether the TCP peer is a loopback address (i.e. the request reached us via+ * a local reverse proxy such as nginx). Only then is it safe to trust the+ * forwarding headers — from a direct public socket those headers are+ * attacker-controlled and must be ignored, otherwise per-IP brute-force+ * buckets (login lockout, etc.) become spoofable / shareable.+ *+ * Ported from decolua/9router#1893.+ */+function isLoopbackPeer(addr: string | undefined): boolean {+ const ip = normalizePeer(addr);+ if (!ip) return false;+ if (ip === "::1") return true;+ return ip.startsWith("127.");+}+/*** Extract client IP from a Request or NextRequest object.- * Checks X-Forwarded-For, X-Real-IP, CF-Connecting-IP, then socket.+ *+ * Behind a local reverse proxy (TCP peer is loopback) we trust the standard+ * forwarding headers in priority order: CF-Connecting-IP > X-Forwarded-For >+ * X-Real-IP. Directly from a public socket those headers are spoofable, so we+ * key by the unspoofable TCP peer address instead. When no peer is known+ * (edge runtime / fetch path with no socket) we fall back to the headers so+ * we don't regress to "unknown" for every request in that path.*/export function getClientIpFromRequest(req: {headers?: Headers | { get?: (n: string) => string | null };@@ -44,13 +76,19 @@ export function getClientIpFromRequest(req: {return null;};- // Priority: CF-Connecting-IP (Cloudflare) > X-Forwarded-For > X-Real-IP > socket- const cfIp = getHeader("cf-connecting-ip");- if (cfIp && isIP(cfIp.trim()) !== 0) return cfIp.trim();-- const xff = getHeader("x-forwarded-for");- const realIp = getHeader("x-real-ip");const remoteAddress = req.ip ?? req.socket?.remoteAddress;+ const hasPeer = Boolean(normalizePeer(remoteAddress));+ const trustForwardingHeaders = !hasPeer || isLoopbackPeer(remoteAddress);++ if (trustForwardingHeaders) {+ const cfIp = getHeader("cf-connecting-ip");+ if (cfIp && isIP(cfIp.trim()) !== 0) return cfIp.trim();++ const xff = getHeader("x-forwarded-for");+ const realIp = getHeader("x-real-ip");+ return extractClientIp(xff ?? realIp, remoteAddress);+ }- return extractClientIp(xff ?? realIp, remoteAddress);+ // Direct public peer — forwarding headers are attacker-controlled, ignore.+ return normalizePeer(remoteAddress);}diff --git a/src/lib/localDb.ts b/src/lib/localDb.tsindex 68b1245590..1fcadda8f7 100755--- a/src/lib/localDb.ts+++ b/src/lib/localDb.ts@@ -83,6 +83,7 @@ export {getCombos,getComboById,getComboByName,+ getComboByNameInsensitive,createCombo,updateCombo,reorderCombos,diff --git a/src/lib/oauth/services/codexImport.ts b/src/lib/oauth/services/codexImport.tsnew file mode 100644index 0000000000..5ef19be84f--- /dev/null+++ b/src/lib/oauth/services/codexImport.ts@@ -0,0 +1,214 @@+/**+ * Codex (OpenAI) bulk-import normalization+ *+ * Accepts the JSON shape produced by Codex CLI / common token-export tools and+ * returns a {@link createProviderConnection} payload (or a typed error).+ *+ * Pure: no I/O, no network. Safe to unit-test.+ *+ * Ported from decolua/9router#1257 (beaaan).+ */++const REQUIRED_FIELDS = ["access_token", "refresh_token"] as const;++/** 10 days — the typical OpenAI access-token lifetime when no `expired` is supplied. */+const DEFAULT_EXPIRY_MS = 10 * 24 * 60 * 60 * 1000;++const BASE64_BLOCK_SIZE = 4;++// ── Types ─────────────────────────────────────────────────────────────────────++export type CodexImportPayload = {+ provider: "codex";+ authType: "oauth";+ accessToken: string;+ refreshToken: string;+ idToken?: string;+ email: string;+ expiresAt: string;+ testStatus: "active";+ providerSpecificData?: {+ chatgptAccountId?: string;+ chatgptPlanType?: string;+ };+};++export type NormalizeOk = { ok: true; payload: CodexImportPayload };+export type NormalizeErr = { ok: false; error: string };+export type NormalizeResult = NormalizeOk | NormalizeErr;++export type FlattenOk = { ok: true; records: unknown[] };+export type FlattenErr = { ok: false; error: string };+export type FlattenResult = FlattenOk | FlattenErr;++// ── Internal helpers ──────────────────────────────────────────────────────────++/**+ * Decode a JWT payload to a plain object (no signature verification).+ *+ * Mirrors the helper in `providers.ts` but is kept local so this module has no+ * runtime dependency on the larger OAuth module graph.+ */+function decodeJwtPayload(jwt: unknown): Record<string, unknown> | null {+ try {+ if (!jwt || typeof jwt !== "string") return null;+ const parts = jwt.split(".");+ if (parts.length !== 3) return null;+ const base64 = parts[1].replace(/-/g, "+").replace(/_/g, "/");+ const missingPadding =+ (BASE64_BLOCK_SIZE - (base64.length % BASE64_BLOCK_SIZE)) % BASE64_BLOCK_SIZE;+ const padded = base64 + "=".repeat(missingPadding);+ return JSON.parse(Buffer.from(padded, "base64").toString("utf8")) as Record<+ string,+ unknown+ >;+ } catch {+ return null;+ }+}++function extractCodexAccountInfo(idToken: string): {+ email?: string;+ chatgptAccountId?: string;+ chatgptPlanType?: string;+} {+ const payload = decodeJwtPayload(idToken);+ if (!payload) return {};+ const chatgpt =+ (payload["https://api.openai.com/auth"] as Record<string, unknown>) || {};+ return {+ email: typeof payload.email === "string" ? payload.email : undefined,+ chatgptAccountId:+ typeof chatgpt.chatgpt_account_id === "string"+ ? chatgpt.chatgpt_account_id+ : undefined,+ chatgptPlanType:+ typeof chatgpt.chatgpt_plan_type === "string"+ ? chatgpt.chatgpt_plan_type+ : undefined,+ };+}++function pickString(...candidates: (string | undefined)[]): string | undefined {+ for (const c of candidates) {+ if (typeof c === "string" && c.trim()) return c.trim();+ }+ return undefined;+}++function parseExpiry(value: unknown): string | undefined {+ if (typeof value === "string" && value) {+ const ms = Date.parse(value);+ if (Number.isFinite(ms)) return new Date(ms).toISOString();+ }+ return undefined;+}++function parseAccessTokenExp(accessToken: string): string {+ const payload = decodeJwtPayload(accessToken);+ const exp = payload && typeof payload.exp === "number" ? payload.exp : null;+ if (exp && Number.isFinite(exp)) {+ return new Date(exp * 1000).toISOString();+ }+ return new Date(Date.now() + DEFAULT_EXPIRY_MS).toISOString();+}++/**+ * Codex CLI persists tokens to `auth.json` with the OAuth fields nested under+ * a `tokens` object: `{ auth_mode, OPENAI_API_KEY, tokens: { id_token, ... } }`.+ * Flatten that into the same shape as a simple top-level export so the rest of+ * the normalizer can stay unchanged.+ */+function unwrapCodexAuthJson(rec: Record<string, unknown>): Record<string, unknown> {+ const tokens = rec.tokens as Record<string, unknown> | undefined;+ if (!tokens || typeof tokens !== "object" || Array.isArray(tokens)) {+ return rec;+ }+ if (typeof tokens.access_token !== "string") return rec;+ // Tokens take priority; carry through siblings (email / account_id / expired)+ // only when the nested object doesn't already define them.+ return { ...rec, ...tokens };+}++// ── Public API ────────────────────────────────────────────────────────────────++/**+ * Normalize a single raw record from an uploaded JSON file into a+ * `createProviderConnection` payload.+ *+ * @param input — single record from the uploaded JSON+ */+export function normalizeCodexImportRecord(input: unknown): NormalizeResult {+ if (!input || typeof input !== "object" || Array.isArray(input)) {+ return { ok: false, error: "Record is not an object" };+ }++ const rec = unwrapCodexAuthJson(input as Record<string, unknown>);++ // Allow type field to be missing or "codex"; reject anything else explicitly so+ // users don't accidentally import claude/gemini exports through this path.+ if (rec.type !== undefined && rec.type !== null && rec.type !== "codex") {+ return { ok: false, error: `Unsupported type: ${String(rec.type)}` };+ }++ for (const f of REQUIRED_FIELDS) {+ if (typeof rec[f] !== "string" || !rec[f]) {+ return { ok: false, error: `Missing required field: ${f}` };+ }+ }++ const accessToken = String(rec.access_token);+ const refreshToken = String(rec.refresh_token);+ const idToken = typeof rec.id_token === "string" ? rec.id_token : undefined;++ // Prefer JWT-derived account info, fall back to top-level fields.+ const fromJwt = idToken ? extractCodexAccountInfo(idToken) : {};+ const email = pickString(fromJwt.email, rec.email as string | undefined);++ if (!email) {+ return { ok: false, error: "Missing email (and id_token does not contain one)" };+ }++ const chatgptAccountId = pickString(+ fromJwt.chatgptAccountId,+ rec.account_id as string | undefined,+ );+ const chatgptPlanType = pickString(fromJwt.chatgptPlanType);++ const expiresAt =+ parseExpiry(rec.expired) ?? parseAccessTokenExp(accessToken);++ const providerSpecificData: CodexImportPayload["providerSpecificData"] = {};+ if (chatgptAccountId) providerSpecificData.chatgptAccountId = chatgptAccountId;+ if (chatgptPlanType) providerSpecificData.chatgptPlanType = chatgptPlanType;++ const payload: CodexImportPayload = {+ provider: "codex",+ authType: "oauth",+ accessToken,+ refreshToken,+ email,+ expiresAt,+ testStatus: "active",+ };+ if (idToken) payload.idToken = idToken;+ if (Object.keys(providerSpecificData).length > 0) {+ payload.providerSpecificData = providerSpecificData;+ }++ return { ok: true, payload };+}++/**+ * Flatten the user-uploaded JSON into an array of candidate records.+ * Accepts a single record or an array; rejects anything else.+ */+export function flattenCodexImportPayload(parsed: unknown): FlattenResult {+ if (Array.isArray(parsed)) {+ return { ok: true, records: parsed };+ }+ if (parsed && typeof parsed === "object") {+ return { ok: true, records: [parsed] };+ }+ return { ok: false, error: "JSON must be an object or an array of objects" };+}diff --git a/src/lib/providers/validation.ts b/src/lib/providers/validation.tsindex eaf6062478..091cc51aa6 100644--- a/src/lib/providers/validation.ts+++ b/src/lib/providers/validation.ts@@ -95,6 +95,7 @@ import {validateOpenAILikeProvider,validateCommandCodeProvider,validateGeminiLikeProvider,+ validateHuggingFaceProvider,validateOpenAICompatibleProvider,} from "./validation/openaiFormat";import {@@ -280,6 +281,7 @@ export async function validateProviderApiKey({ provider, apiKey, providerSpecifi}},"command-code": validateCommandCodeProvider,+ huggingface: validateHuggingFaceProvider,deepgram: validateDeepgramProvider,assemblyai: validateAssemblyAIProvider,"fal-ai": ({ apiKey, providerSpecificData }: any) =>diff --git a/src/lib/providers/validation/openaiFormat.ts b/src/lib/providers/validation/openaiFormat.tsindex b7e63cf317..a2813cf6b3 100644--- a/src/lib/providers/validation/openaiFormat.ts+++ b/src/lib/providers/validation/openaiFormat.ts@@ -227,6 +227,35 @@ export async function validateCommandCodeProvider({ apiKey, providerSpecificData}+// HuggingFace fine-grained Inference-Provider tokens are valid even when+// model/task endpoints reject them, so the generic OpenAI-like probe against+// router.huggingface.co/v1/models falsely marks them invalid. Validate the+// token strictly as an auth check via the whoami-v2 endpoint instead: only+// 401/403 means the token is invalid; any other non-OK status is a transient+// upstream failure, NOT an invalid key.+export async function validateHuggingFaceProvider({ apiKey }: any) {+ try {+ const response = await validationRead("https://huggingface.co/api/whoami-v2", {+ method: "GET",+ headers: { Authorization: `Bearer ${apiKey}` },+ });++ if (response.ok) {+ return { valid: true, error: null, method: "huggingface_whoami" };+ }++ if (response.status === 401 || response.status === 403) {+ return { valid: false, error: "Invalid API key" };+ }++ // Non-auth, non-OK status — surface as a transient upstream failure rather+ // than declaring the (potentially valid) fine-grained token invalid.+ return { valid: false, error: `HuggingFace token check returned ${response.status}` };+ } catch (error: unknown) {+ return toValidationErrorResult(error);+ }+}+export async function validateGeminiLikeProvider({apiKey,baseUrl,diff --git a/src/lib/providers/xai/thinking.ts b/src/lib/providers/xai/thinking.tsnew file mode 100644index 0000000000..8348d08864--- /dev/null+++ b/src/lib/providers/xai/thinking.ts@@ -0,0 +1,115 @@+/**+ * xAI Reasoning / Thinking Patcher+ *+ * Source of truth: router-for-me/CLIProxyAPI internal/thinking/provider/xai/apply.go+ *+ * Maps the various inbound reasoning/thinking spec shapes (OpenAI Chat,+ * OpenAI Responses, Anthropic Messages, Gemini) onto the xAI Responses+ * `reasoning` field. Single source of truth for budget mapping.+ *+ * Defaults policy mirrors CLIProxyAPI:+ * - never proactively enable reasoning when the caller omits it+ * - honor explicit caller intent verbatim+ */++const VALID_EFFORTS = new Set(["minimal", "low", "medium", "high"]);++export type ReasoningEffort = "minimal" | "low" | "medium" | "high";++/**+ * Map a numeric token budget to a discrete effort tier.+ * <=0 → undefined (disabled)+ * 1..3999 → "low"+ * 4000..15999 → "medium"+ * >=16000 → "high"+ */+export function budgetToEffort(budget: number): ReasoningEffort | undefined {+ if (typeof budget !== "number" || !Number.isFinite(budget) || budget <= 0) return undefined;+ if (budget >= 16000) return "high";+ if (budget >= 4000) return "medium";+ return "low";+}++interface AnthropicThinking {+ type?: string;+ budget_tokens?: number;+}++interface GeminiThinkingConfig {+ thinkingBudget?: number;+ includeThoughts?: boolean;+}++interface XaiReasoning {+ effort: ReasoningEffort;+}++interface ThinkingRequest {+ reasoning?: XaiReasoning | Record<string, unknown>;+ reasoning_effort?: string;+ thinking?: AnthropicThinking;+ thinkingConfig?: GeminiThinkingConfig;+ [key: string]: unknown;+}++interface ApplyThinkingOptions {+ defaultEffort?: ReasoningEffort;+}++/**+ * Apply reasoning/thinking patch to an xAI request body.+ *+ * Returns a new object — caller's request is not mutated.+ *+ * Recognized inbound shapes:+ * - request.reasoning_effort: "minimal"|"low"|"medium"|"high" (OpenAI Chat)+ * - request.reasoning: { effort: ... } (OpenAI Responses)+ * - request.thinking: { type: "enabled", budget_tokens: N } (Anthropic)+ * - request.thinkingConfig: { thinkingBudget: N, includeThoughts } (Gemini)+ */+export function applyThinking(+ request: ThinkingRequest,+ options: ApplyThinkingOptions = {},+): ThinkingRequest {+ if (!request || typeof request !== "object") return request;+ const out: ThinkingRequest = { ...request };++ // 1) Already xAI-native? Honor and stop.+ if (out.reasoning && typeof out.reasoning === "object") {+ const reasoning = out.reasoning as Record<string, unknown>;+ if (typeof reasoning.effort === "string" && VALID_EFFORTS.has(reasoning.effort)) {+ return out;+ }+ }++ // 2) OpenAI Chat reasoning_effort+ if (typeof out.reasoning_effort === "string" && VALID_EFFORTS.has(out.reasoning_effort)) {+ out.reasoning = { effort: out.reasoning_effort as ReasoningEffort };+ delete out.reasoning_effort;+ return out;+ }++ // 3) Anthropic-style thinking+ if (out.thinking && typeof out.thinking === "object") {+ if (out.thinking.type === "enabled") {+ const eff = budgetToEffort(out.thinking.budget_tokens ?? 0) ?? "medium";+ out.reasoning = { effort: eff };+ }+ delete out.thinking;+ return out;+ }++ // 4) Gemini-style thinkingConfig+ if (out.thinkingConfig && typeof out.thinkingConfig === "object") {+ const eff = budgetToEffort(out.thinkingConfig.thinkingBudget ?? 0);+ if (eff) out.reasoning = { effort: eff };+ delete out.thinkingConfig;+ return out;+ }++ // 5) Default — leave untouched, optionally apply defaultEffort+ if (options.defaultEffort && VALID_EFFORTS.has(options.defaultEffort)) {+ out.reasoning = { effort: options.defaultEffort };+ }+ return out;+}diff --git a/src/lib/providers/xai/translators/claude.ts b/src/lib/providers/xai/translators/claude.tsnew file mode 100644index 0000000000..7f9850ca1d--- /dev/null+++ b/src/lib/providers/xai/translators/claude.ts@@ -0,0 +1,368 @@+/**+ * Claude (Anthropic Messages) ↔ xAI Responses translator+ *+ * Source of truth: router-for-me/CLIProxyAPI internal/translator/claude/xai/*+ *+ * Inbound: Anthropic /v1/messages { model, system, messages, tools, ... }+ * Outbound (to xAI): xAI Responses { model, input, instructions, tools, ... }+ *+ * Reverse direction:+ * - xAI completed → Anthropic Messages JSON (full message)+ * - per-event xAI SSE → Anthropic SSE frames:+ * message_start, content_block_start, content_block_delta,+ * content_block_stop, message_delta, message_stop+ */++// ─── Types ────────────────────────────────────────────────────────────────────++interface AnthropicImageSource {+ type: "base64" | "url";+ media_type?: string;+ data?: string;+ url?: string;+}++interface AnthropicContentBlock {+ type: string;+ text?: string;+ source?: AnthropicImageSource;+ id?: string;+ name?: string;+ input?: unknown;+ tool_use_id?: string;+ content?: unknown;+ thinking?: string;+ [key: string]: unknown;+}++interface AnthropicMessage {+ role: "user" | "assistant";+ content: string | AnthropicContentBlock[];+}++interface AnthropicTool {+ name?: string;+ description?: string;+ input_schema?: unknown;+ parameters?: unknown;+ type?: string;+ function?: unknown;+ [key: string]: unknown;+}++interface AnthropicThinking {+ type?: string;+ budget_tokens?: number;+}++interface AnthropicRequest {+ model?: string;+ messages?: AnthropicMessage[];+ system?: string | Array<{ type: string; text: string }>;+ tools?: AnthropicTool[];+ tool_choice?: unknown;+ temperature?: number;+ top_p?: number;+ max_tokens?: number;+ stop_sequences?: string[];+ metadata?: unknown;+ thinking?: AnthropicThinking;+ [key: string]: unknown;+}++interface XaiInputBlock {+ type: string;+ text?: string;+ image_url?: string;+ [key: string]: unknown;+}++interface XaiInputItem {+ role?: string;+ content?: XaiInputBlock[];+ type?: string;+ call_id?: string;+ name?: string;+ arguments?: string;+ output?: string;+ [key: string]: unknown;+}++interface XaiTool {+ type: "function";+ function: {+ name?: string;+ description?: string;+ parameters?: unknown;+ };+}++interface XaiReasoning {+ effort: "low" | "medium" | "high";+}++interface XaiResponsesRequest {+ model?: string;+ input: XaiInputItem[];+ instructions?: string;+ tools?: XaiTool[];+ tool_choice?: unknown;+ temperature?: number;+ top_p?: number;+ max_output_tokens?: number;+ stop?: string[];+ metadata?: unknown;+ reasoning?: XaiReasoning;+ [key: string]: unknown;+}++interface XaiOutputContent {+ type: string;+ text?: string;+ refusal?: string;+}++interface XaiOutputItem {+ type: string;+ content?: XaiOutputContent[];+ call_id?: string;+ id?: string;+ name?: string;+ arguments?: string;+ summary?: Array<{ text?: string }>;+ [key: string]: unknown;+}++interface XaiUsage {+ input_tokens?: number;+ output_tokens?: number;+ prompt_tokens?: number;+ completion_tokens?: number;+}++interface XaiCompleted {+ id?: string;+ model?: string;+ output?: XaiOutputItem[];+ usage?: XaiUsage;+ [key: string]: unknown;+}++// ─── Helpers ─────────────────────────────────────────────────────────────────++function genId(prefix: string): string {+ return `${prefix}_${Math.random().toString(36).slice(2, 14)}`;+}++/**+ * Translate Anthropic content blocks into xAI input content blocks.+ * Anthropic block types:+ * "text", "image", "tool_use", "tool_result", "thinking"+ */+function blocksToXai(+ blocks: string | AnthropicContentBlock[],+): XaiInputBlock[] {+ if (typeof blocks === "string") return [{ type: "input_text", text: blocks }];+ if (!Array.isArray(blocks)) return [];+ const out: XaiInputBlock[] = [];+ for (const b of blocks) {+ if (!b || typeof b !== "object") continue;+ if (b.type === "text") out.push({ type: "input_text", text: b.text ?? "" });+ else if (b.type === "image" && b.source) {+ // Anthropic source { type: "base64"|"url", media_type, data | url }+ if (b.source.type === "url") {+ out.push({ type: "input_image", image_url: b.source.url });+ } else {+ const dataUrl = `data:${b.source.media_type ?? "image/png"};base64,${b.source.data ?? ""}`;+ out.push({ type: "input_image", image_url: dataUrl });+ }+ } else if (b.type === "thinking") {+ // dropped on the input side — xAI does not accept caller thinking blocks+ } else {+ out.push(b as XaiInputBlock);+ }+ }+ return out;+}++/**+ * Translate Anthropic tools[] into xAI tools[].+ * Anthropic uses { name, description, input_schema } — xAI uses+ * function-tool shape { type: "function", function: { name, description, parameters } }.+ */+function toolsAnthropicToXai(tools: AnthropicTool[]): XaiTool[] | undefined {+ if (!Array.isArray(tools)) return undefined;+ return tools.map((t) => {+ if (!t || typeof t !== "object") return t as unknown as XaiTool;+ if (t.type === "function" && t.function) return t as unknown as XaiTool;+ return {+ type: "function" as const,+ function: {+ name: t.name,+ description: t.description,+ parameters:+ (t.input_schema ?? t.parameters ?? { type: "object" }),+ },+ };+ });+}++function mapClaudeThinking(+ thinking: AnthropicThinking,+): XaiReasoning | undefined {+ if (!thinking || typeof thinking !== "object") return undefined;+ if (thinking.type === "enabled") {+ if (typeof thinking.budget_tokens === "number") {+ const b = thinking.budget_tokens;+ if (b >= 16000) return { effort: "high" };+ if (b >= 4000) return { effort: "medium" };+ if (b > 0) return { effort: "low" };+ }+ return { effort: "medium" };+ }+ return undefined;+}++// ─── Public API ──────────────────────────────────────────────────────────────++/**+ * Translate an Anthropic Messages request body into an xAI Responses body.+ */+export function claudeRequestToXaiResponses(req: AnthropicRequest): XaiResponsesRequest {+ if (!req || typeof req !== "object") return req as unknown as XaiResponsesRequest;+ const input: XaiInputItem[] = [];++ for (const m of req.messages ?? []) {+ if (!m) continue;+ if (m.role === "user") {+ // Detect tool_result blocks → emit as function_call_output items+ const blocks: AnthropicContentBlock[] = Array.isArray(m.content)+ ? m.content+ : [{ type: "text", text: m.content as string }];+ const userBlocks: AnthropicContentBlock[] = [];+ for (const b of blocks) {+ if (b?.type === "tool_result") {+ input.push({+ type: "function_call_output",+ call_id: b.tool_use_id,+ output:+ typeof b.content === "string"+ ? b.content+ : JSON.stringify(b.content ?? ""),+ });+ } else {+ userBlocks.push(b);+ }+ }+ if (userBlocks.length) input.push({ role: "user", content: blocksToXai(userBlocks) });+ continue;+ }+ if (m.role === "assistant") {+ const blocks: AnthropicContentBlock[] = Array.isArray(m.content)+ ? m.content+ : [{ type: "text", text: m.content as string }];+ const textBlocks: AnthropicContentBlock[] = [];+ for (const b of blocks) {+ if (b?.type === "tool_use") {+ if (textBlocks.length) {+ input.push({ role: "assistant", content: blocksToXai(textBlocks.splice(0)) });+ }+ input.push({+ type: "function_call",+ call_id: b.id,+ name: b.name,+ arguments:+ typeof b.input === "string" ? b.input : JSON.stringify(b.input ?? {}),+ });+ } else {+ textBlocks.push(b);+ }+ }+ if (textBlocks.length) input.push({ role: "assistant", content: blocksToXai(textBlocks) });+ continue;+ }+ }++ const out: XaiResponsesRequest = { model: req.model, input };++ // System → instructions+ if (req.system) {+ if (typeof req.system === "string") {+ out.instructions = req.system;+ } else if (Array.isArray(req.system)) {+ out.instructions = (req.system as Array<{ text?: string }>)+ .map((b) => (typeof b === "string" ? b : (b?.text ?? "")))+ .filter(Boolean)+ .join("\n\n");+ }+ }++ if (req.temperature != null) out.temperature = req.temperature;+ if (req.top_p != null) out.top_p = req.top_p;+ if (req.max_tokens != null) out.max_output_tokens = req.max_tokens;+ if (req.stop_sequences) out.stop = req.stop_sequences;+ if (req.metadata) out.metadata = req.metadata;+ if (req.tool_choice) out.tool_choice = req.tool_choice;+ if (req.thinking) out.reasoning = mapClaudeThinking(req.thinking);++ const tools = req.tools ? toolsAnthropicToXai(req.tools) : undefined;+ if (tools) out.tools = tools;+ return out;+}++/**+ * Convert an xAI completed response into an Anthropic Messages JSON.+ */+export function xaiCompletedToClaudeJson(+ completed: XaiCompleted,+ origReq: AnthropicRequest | null = null,+): object {+ const content: unknown[] = [];+ let stopReason = "end_turn";+ for (const item of completed?.output ?? []) {+ if (!item) continue;+ if (item.type === "message" && Array.isArray(item.content)) {+ for (const c of item.content) {+ if (c?.type === "output_text") content.push({ type: "text", text: c.text ?? "" });+ if (c?.type === "refusal") content.push({ type: "text", text: c.refusal ?? "" });+ }+ } else if (item.type === "function_call") {+ stopReason = "tool_use";+ let inputObj: unknown = {};+ try {+ inputObj = item.arguments ? JSON.parse(item.arguments) : {};+ } catch {+ inputObj = { _raw: item.arguments };+ }+ content.push({+ type: "tool_use",+ id: item.call_id ?? item.id ?? genId("toolu"),+ name: item.name,+ input: inputObj,+ });+ } else if (item.type === "reasoning" && Array.isArray(item.summary)) {+ const text = (item.summary as Array<{ text?: string }>)+ .map((s) => s?.text ?? "")+ .filter(Boolean)+ .join("\n");+ if (text) content.push({ type: "thinking", thinking: text });+ }+ }+ const out: Record<string, unknown> = {+ id: completed?.id ?? genId("msg"),+ type: "message",+ role: "assistant",+ model: completed?.model ?? origReq?.model ?? null,+ content,+ stop_reason: stopReason,+ stop_sequence: null,+ };+ if (completed?.usage) {+ const u = completed.usage;+ out.usage = {+ input_tokens: u.input_tokens ?? u.prompt_tokens ?? 0,+ output_tokens: u.output_tokens ?? u.completion_tokens ?? 0,+ };+ }+ return out;+}diff --git a/src/lib/providers/xai/translators/gemini.ts b/src/lib/providers/xai/translators/gemini.tsnew file mode 100644index 0000000000..531dff4a9a--- /dev/null+++ b/src/lib/providers/xai/translators/gemini.ts@@ -0,0 +1,371 @@+/**+ * Gemini ↔ xAI Responses translator+ *+ * Source of truth: router-for-me/CLIProxyAPI internal/translator/gemini/xai/*+ *+ * Inbound: Google Gemini generateContent { contents, systemInstruction, tools, ... }+ * Outbound (to xAI): xAI Responses { model, input, instructions, tools, ... }+ *+ * Reverse direction:+ * - xAI completed → Gemini generateContent JSON ({ candidates: [...] })+ * - per-event xAI SSE → Gemini streamGenerateContent chunks+ */++// ─── Types ────────────────────────────────────────────────────────────────────++interface GeminiInlineData {+ mimeType?: string;+ data?: string;+}++interface GeminiFileData {+ fileUri?: string;+}++interface GeminiFunctionCall {+ id?: string;+ name: string;+ args?: unknown;+}++interface GeminiFunctionResponse {+ id?: string;+ name: string;+ response?: unknown;+}++interface GeminiPart {+ text?: string;+ inlineData?: GeminiInlineData;+ fileData?: GeminiFileData;+ functionCall?: GeminiFunctionCall;+ functionResponse?: GeminiFunctionResponse;+}++interface GeminiContent {+ role?: string;+ parts?: GeminiPart[];+}++interface GeminiFunctionDeclaration {+ name: string;+ description?: string;+ parameters?: unknown;+}++interface GeminiTool {+ functionDeclarations?: GeminiFunctionDeclaration[];+ type?: string;+ function?: unknown;+}++interface GeminiThinkingConfig {+ thinkingBudget?: number;+}++interface GeminiGenerationConfig {+ temperature?: number;+ topP?: number;+ maxOutputTokens?: number;+ stopSequences?: string[];+ responseSchema?: unknown;+ thinkingConfig?: GeminiThinkingConfig;+}++interface GeminiRequest {+ model?: string;+ contents?: GeminiContent[];+ systemInstruction?: string | { parts?: GeminiPart[] };+ tools?: GeminiTool[];+ toolConfig?: {+ functionCallingConfig?: { mode?: string };+ };+ generationConfig?: GeminiGenerationConfig;+ [key: string]: unknown;+}++interface XaiInputBlock {+ type: string;+ text?: string;+ image_url?: string;+}++interface XaiInputItem {+ role?: string;+ content?: XaiInputBlock[];+ type?: string;+ call_id?: string;+ name?: string;+ arguments?: string;+ output?: string;+}++interface XaiTool {+ type: "function";+ function: {+ name: string;+ description?: string;+ parameters?: unknown;+ };+}++interface XaiReasoning {+ effort: "low" | "medium" | "high";+}++interface XaiResponsesRequest {+ model?: string | null;+ input: XaiInputItem[];+ instructions?: string;+ tools?: XaiTool[];+ tool_choice?: string;+ temperature?: number;+ top_p?: number;+ max_output_tokens?: number;+ stop?: string[];+ text?: unknown;+ reasoning?: XaiReasoning;+}++interface XaiOutputContent {+ type: string;+ text?: string;+ refusal?: string;+}++interface XaiFunctionCallItem {+ type: "function_call";+ name: string;+ arguments?: string;+ [key: string]: unknown;+}++interface XaiOutputItem {+ type: string;+ content?: XaiOutputContent[];+ name?: string;+ arguments?: string;+ [key: string]: unknown;+}++interface XaiUsage {+ input_tokens?: number;+ output_tokens?: number;+ prompt_tokens?: number;+ completion_tokens?: number;+ total_tokens?: number;+}++interface XaiCompleted {+ output?: XaiOutputItem[];+ model?: string;+ usage?: XaiUsage;+ [key: string]: unknown;+}++// ─── Helpers ─────────────────────────────────────────────────────────────────++/**+ * Convert Gemini parts[] into xAI input content blocks.+ *+ * Gemini part types:+ * text, inlineData (mime+data b64), fileData (uri),+ * functionCall (name, args), functionResponse (name, response)+ */+function partsToXaiBlocks(parts: GeminiPart[]): XaiInputBlock[] {+ if (!Array.isArray(parts)) return [];+ const out: XaiInputBlock[] = [];+ for (const p of parts) {+ if (!p || typeof p !== "object") continue;+ if (typeof p.text === "string") {+ out.push({ type: "input_text", text: p.text });+ } else if (p.inlineData?.data) {+ const mime = p.inlineData.mimeType ?? "image/png";+ out.push({+ type: "input_image",+ image_url: `data:${mime};base64,${p.inlineData.data}`,+ });+ } else if (p.fileData?.fileUri) {+ out.push({ type: "input_image", image_url: p.fileData.fileUri });+ }+ // functionCall / functionResponse handled at message level+ }+ return out;+}++/**+ * Pull functionCall / functionResponse parts out of a Gemini message+ * — these need to become standalone xAI input items, not nested content blocks.+ */+function extractFunctionItems(parts: GeminiPart[]): XaiInputItem[] {+ const items: XaiInputItem[] = [];+ if (!Array.isArray(parts)) return items;+ for (const p of parts) {+ if (p?.functionCall) {+ items.push({+ type: "function_call",+ call_id: p.functionCall.id ?? p.functionCall.name,+ name: p.functionCall.name,+ arguments:+ typeof p.functionCall.args === "string"+ ? p.functionCall.args+ : JSON.stringify(p.functionCall.args ?? {}),+ });+ } else if (p?.functionResponse) {+ items.push({+ type: "function_call_output",+ call_id: p.functionResponse.id ?? p.functionResponse.name,+ output:+ typeof p.functionResponse.response === "string"+ ? p.functionResponse.response+ : JSON.stringify(p.functionResponse.response ?? {}),+ });+ }+ }+ return items;+}++/**+ * Convert Gemini tools[] into xAI tools[].+ * Gemini: [{ functionDeclarations: [{ name, description, parameters }] }, ...]+ * xAI: [{ type: "function", function: { name, description, parameters } }, ...]+ */+function toolsGeminiToXai(tools: GeminiTool[]): XaiTool[] | undefined {+ if (!Array.isArray(tools)) return undefined;+ const out: XaiTool[] = [];+ for (const t of tools) {+ if (!t) continue;+ if (Array.isArray(t.functionDeclarations)) {+ for (const fn of t.functionDeclarations) {+ out.push({+ type: "function",+ function: {+ name: fn.name,+ description: fn.description,+ parameters: fn.parameters ?? { type: "object" },+ },+ });+ }+ } else if (t.type === "function") {+ out.push(t as unknown as XaiTool);+ }+ }+ return out.length ? out : undefined;+}++// ─── Public API ──────────────────────────────────────────────────────────────++/**+ * Translate a Gemini generateContent request body into an xAI Responses body.+ *+ * @param req - The Gemini request body+ * @param model - Gemini path-level model (Gemini puts model in URL)+ */+export function geminiRequestToXaiResponses(+ req: GeminiRequest,+ model: string | null = null,+): XaiResponsesRequest {+ if (!req || typeof req !== "object") return req as unknown as XaiResponsesRequest;+ const input: XaiInputItem[] = [];+ for (const c of req.contents ?? []) {+ if (!c) continue;+ const role = c.role === "model" ? "assistant" : (c.role ?? "user");+ // Pull function items first (they become standalone)+ const fnItems = extractFunctionItems(c.parts ?? []);+ if (fnItems.length) {+ for (const it of fnItems) input.push(it);+ // Filter remaining text/image parts+ const remaining = (c.parts ?? []).filter(+ (p) => !p?.functionCall && !p?.functionResponse,+ );+ if (remaining.length) input.push({ role, content: partsToXaiBlocks(remaining) });+ } else {+ input.push({ role, content: partsToXaiBlocks(c.parts ?? []) });+ }+ }++ const out: XaiResponsesRequest = { model: model ?? req.model, input };++ if (req.systemInstruction) {+ const sys = req.systemInstruction;+ if (typeof sys === "string") {+ out.instructions = sys;+ } else if (sys.parts) {+ out.instructions = sys.parts+ .map((p) => p?.text ?? "")+ .filter(Boolean)+ .join("\n\n");+ }+ }++ const cfg: GeminiGenerationConfig = req.generationConfig ?? {};+ if (cfg.temperature != null) out.temperature = cfg.temperature;+ if (cfg.topP != null) out.top_p = cfg.topP;+ if (cfg.maxOutputTokens != null) out.max_output_tokens = cfg.maxOutputTokens;+ if (cfg.stopSequences) out.stop = cfg.stopSequences;+ if (cfg.responseSchema)+ out.text = { format: { type: "json_schema", schema: cfg.responseSchema } };+ if (cfg.thinkingConfig?.thinkingBudget != null) {+ const b = cfg.thinkingConfig.thinkingBudget;+ if (b >= 16000) out.reasoning = { effort: "high" };+ else if (b >= 4000) out.reasoning = { effort: "medium" };+ else if (b > 0) out.reasoning = { effort: "low" };+ }++ const tools = req.tools ? toolsGeminiToXai(req.tools) : undefined;+ if (tools) out.tools = tools;++ if (req.toolConfig?.functionCallingConfig?.mode === "ANY") out.tool_choice = "required";+ return out;+}++/**+ * Convert an xAI completed response into a Gemini generateContent JSON.+ */+export function xaiCompletedToGeminiJson(+ completed: XaiCompleted,+ origReq: GeminiRequest | null = null,+): object {+ const parts: unknown[] = [];+ const finishReason = "STOP";+ for (const item of completed?.output ?? []) {+ if (!item) continue;+ if (item.type === "message" && Array.isArray(item.content)) {+ for (const c of item.content) {+ if (c?.type === "output_text") parts.push({ text: c.text ?? "" });+ if (c?.type === "refusal") parts.push({ text: c.refusal ?? "" });+ }+ } else if (item.type === "function_call") {+ let args: unknown = {};+ try {+ args = (item as XaiFunctionCallItem).arguments+ ? JSON.parse((item as XaiFunctionCallItem).arguments ?? "")+ : {};+ } catch {+ args = { _raw: (item as XaiFunctionCallItem).arguments };+ }+ parts.push({+ functionCall: { name: item.name, args },+ });+ }+ }+ const candidate = {+ content: { role: "model", parts },+ finishReason,+ index: 0,+ };+ const out: Record<string, unknown> = {+ candidates: [candidate],+ modelVersion: completed?.model ?? origReq?.model ?? null,+ };+ if (completed?.usage) {+ const u = completed.usage;+ out.usageMetadata = {+ promptTokenCount: u.input_tokens ?? u.prompt_tokens ?? 0,+ candidatesTokenCount: u.output_tokens ?? u.completion_tokens ?? 0,+ totalTokenCount:+ u.total_tokens ?? ((u.input_tokens ?? 0) + (u.output_tokens ?? 0)),+ };+ }+ return out;+}diff --git a/src/lib/providers/xai/translators/openai-chat.ts b/src/lib/providers/xai/translators/openai-chat.tsnew file mode 100644index 0000000000..aa2bee6deb--- /dev/null+++ b/src/lib/providers/xai/translators/openai-chat.ts@@ -0,0 +1,304 @@+/**+ * OpenAI Chat Completions ↔ xAI Responses translator+ *+ * Source of truth: router-for-me/CLIProxyAPI internal/translator/openai/xai/*+ *+ * Inbound: OpenAI Chat Completions { model, messages, tools, ... }+ * Outbound (to xAI): xAI Responses { model, input, instructions, tools, ... }+ *+ * Reverse direction:+ * - aggregated xAI response.completed → OpenAI ChatCompletion JSON+ * - per-event xAI SSE → OpenAI ChatCompletion stream chunks+ */++// ─── Types ────────────────────────────────────────────────────────────────────++interface ContentPart {+ type: string;+ text?: string;+ image_url?: unknown;+ input_audio?: unknown;+ [key: string]: unknown;+}++type MessageContent = string | ContentPart[];++interface OpenAiToolCall {+ id: string;+ type: "function";+ function: {+ name: string;+ arguments: string;+ };+}++interface OpenAiMessage {+ role: string;+ content?: MessageContent;+ tool_calls?: OpenAiToolCall[];+ tool_call_id?: string;+}++interface OpenAiChatRequest {+ model?: string;+ messages?: OpenAiMessage[];+ tools?: unknown[];+ tool_choice?: unknown;+ temperature?: number;+ top_p?: number;+ max_tokens?: number;+ max_output_tokens?: number;+ stop?: string | string[];+ user?: string;+ metadata?: unknown;+ response_format?: unknown;+ parallel_tool_calls?: boolean;+ seed?: number;+ reasoning_effort?: string;+ reasoning?: unknown;+ [key: string]: unknown;+}++interface XaiInputBlock {+ type: string;+ text?: string;+ image_url?: unknown;+ input_audio?: unknown;+ [key: string]: unknown;+}++interface XaiInputItem {+ role?: string;+ content?: XaiInputBlock[];+ type?: string;+ call_id?: string;+ name?: string;+ arguments?: string;+ output?: string;+ [key: string]: unknown;+}++interface XaiResponsesRequest {+ model?: string;+ input: XaiInputItem[];+ instructions?: string;+ tools?: unknown[];+ tool_choice?: unknown;+ temperature?: number;+ top_p?: number;+ max_output_tokens?: number;+ stop?: string | string[];+ user?: string;+ metadata?: unknown;+ text?: unknown;+ parallel_tool_calls?: boolean;+ seed?: number;+ reasoning?: unknown;+ [key: string]: unknown;+}++interface XaiUsage {+ input_tokens?: number;+ output_tokens?: number;+ prompt_tokens?: number;+ completion_tokens?: number;+ total_tokens?: number;+}++interface XaiOutputItem {+ type: string;+ content?: Array<{ type: string; text?: string; refusal?: string }>;+ call_id?: string;+ id?: string;+ name?: string;+ arguments?: string;+ [key: string]: unknown;+}++interface XaiCompleted {+ id?: string;+ model?: string;+ created_at?: number;+ output?: XaiOutputItem[];+ usage?: XaiUsage;+ [key: string]: unknown;+}++// ─── Helpers ─────────────────────────────────────────────────────────────────++function genId(prefix: string): string {+ return `${prefix}_${Math.random().toString(36).slice(2, 14)}`;+}++/**+ * Convert OpenAI message content (string | array of parts) into xAI input+ * content blocks. Mirrors CLIProxyAPI mapping:+ * "text" → { type: "input_text", text }+ * "image_url" → { type: "input_image", image_url }+ * "input_audio"→ { type: "input_audio", input_audio }+ */+function messageContentToXaiBlocks(content: MessageContent): XaiInputBlock[] {+ if (typeof content === "string") {+ return [{ type: "input_text", text: content }];+ }+ if (!Array.isArray(content)) return [];+ return content+ .map((p): XaiInputBlock | null => {+ if (!p || typeof p !== "object") return null;+ if (p.type === "text") return { type: "input_text", text: p.text ?? "" };+ if (p.type === "image_url") return { type: "input_image", image_url: p.image_url };+ if (p.type === "input_audio") return { type: "input_audio", input_audio: p.input_audio };+ return p as XaiInputBlock; // passthrough unknown+ })+ .filter((b): b is XaiInputBlock => b !== null);+}++/**+ * Convert OpenAI Chat tools[] (function-calling spec) into xAI tools[].+ * xAI accepts the OpenAI function-tool shape verbatim, so passthrough.+ */+function toolsPassthrough(tools: unknown[]): unknown[] | undefined {+ if (!Array.isArray(tools)) return undefined;+ return tools.map((t) => ({ ...(t as object) }));+}++// ─── Public API ──────────────────────────────────────────────────────────────++/**+ * Translate an inbound OpenAI Chat Completions request body into an xAI Responses body.+ */+export function chatRequestToXaiResponses(req: OpenAiChatRequest): XaiResponsesRequest {+ if (!req || typeof req !== "object") return req as unknown as XaiResponsesRequest;+ const messages: OpenAiMessage[] = Array.isArray(req.messages) ? req.messages : [];+ const instructionsParts: string[] = [];+ const input: XaiInputItem[] = [];++ for (const m of messages) {+ if (!m) continue;+ if (m.role === "system" || m.role === "developer") {+ const txt =+ typeof m.content === "string"+ ? m.content+ : Array.isArray(m.content)+ ? (m.content as ContentPart[])+ .map((p) => p?.text ?? "")+ .filter(Boolean)+ .join("\n")+ : "";+ if (txt) instructionsParts.push(txt);+ continue;+ }+ if (m.role === "tool") {+ input.push({+ type: "function_call_output",+ call_id: m.tool_call_id,+ output:+ typeof m.content === "string" ? m.content : JSON.stringify(m.content ?? ""),+ });+ continue;+ }+ if (m.role === "assistant" && Array.isArray(m.tool_calls) && m.tool_calls.length > 0) {+ // Emit any pre-existing assistant text first+ if (m.content) {+ input.push({ role: "assistant", content: messageContentToXaiBlocks(m.content) });+ }+ for (const tc of m.tool_calls) {+ if (tc.type !== "function" || !tc.function) continue;+ input.push({+ type: "function_call",+ call_id: tc.id,+ name: tc.function.name,+ arguments: tc.function.arguments ?? "",+ });+ }+ continue;+ }+ input.push({ role: m.role ?? "user", content: messageContentToXaiBlocks(m.content ?? "") });+ }++ const out: XaiResponsesRequest = { model: req.model, input };+ if (instructionsParts.length) out.instructions = instructionsParts.join("\n\n");++ if (req.temperature != null) out.temperature = req.temperature;+ if (req.top_p != null) out.top_p = req.top_p;+ if (req.max_tokens != null) out.max_output_tokens = req.max_tokens;+ if (req.max_output_tokens != null) out.max_output_tokens = req.max_output_tokens;+ if (req.stop != null) out.stop = req.stop;+ if (req.user) out.user = req.user;+ if (req.metadata) out.metadata = req.metadata;+ if (req.response_format) out.text = { format: req.response_format };+ if (req.parallel_tool_calls != null) out.parallel_tool_calls = req.parallel_tool_calls;+ if (req.seed != null) out.seed = req.seed;+ if (req.reasoning_effort) out.reasoning = { effort: req.reasoning_effort };+ if (req.reasoning) out.reasoning = req.reasoning;+ if (req.tool_choice) out.tool_choice = req.tool_choice;++ const tools = req.tools ? toolsPassthrough(req.tools) : undefined;+ if (tools) out.tools = tools;+ return out;+}++/**+ * Aggregate output_text content blocks from an xAI completed response.+ */+function extractAssistantTextAndCalls(completed: XaiCompleted): {+ text: string;+ toolCalls: OpenAiToolCall[];+ refusal: string | undefined;+} {+ let text = "";+ const toolCalls: OpenAiToolCall[] = [];+ const refusal: string[] = [];+ for (const item of completed?.output ?? []) {+ if (!item) continue;+ if (item.type === "message" && Array.isArray(item.content)) {+ for (const c of item.content) {+ if (c?.type === "output_text" && typeof c.text === "string") text += c.text;+ if (c?.type === "refusal" && typeof c.refusal === "string") refusal.push(c.refusal);+ }+ } else if (item.type === "function_call") {+ toolCalls.push({+ id: item.call_id ?? item.id ?? genId("call"),+ type: "function",+ function: { name: item.name ?? "", arguments: item.arguments ?? "" },+ });+ }+ }+ return { text, toolCalls, refusal: refusal.join("\n") || undefined };+}++/**+ * Convert an aggregated xAI completed response into an OpenAI ChatCompletion JSON.+ */+export function xaiCompletedToChatJson(+ completed: XaiCompleted,+ origReq: OpenAiChatRequest | null = null,+): object {+ const { text, toolCalls, refusal } = extractAssistantTextAndCalls(completed);+ const finishReason = toolCalls.length ? "tool_calls" : "stop";++ const message: Record<string, unknown> = {+ role: "assistant",+ content: text || (toolCalls.length ? null : ""),+ };+ if (toolCalls.length) message.tool_calls = toolCalls;+ if (refusal) message.refusal = refusal;++ const out: Record<string, unknown> = {+ id: completed?.id ?? genId("chatcmpl"),+ object: "chat.completion",+ created: completed?.created_at ?? Math.floor(Date.now() / 1000),+ model: completed?.model ?? origReq?.model ?? null,+ choices: [{ index: 0, message, finish_reason: finishReason }],+ };+ if (completed?.usage) {+ const u = completed.usage;+ out.usage = {+ prompt_tokens: u.input_tokens ?? u.prompt_tokens ?? 0,+ completion_tokens: u.output_tokens ?? u.completion_tokens ?? 0,+ total_tokens:+ u.total_tokens ?? ((u.input_tokens ?? 0) + (u.output_tokens ?? 0)),+ };+ }+ return out;+}diff --git a/src/lib/providers/xai/translators/openai-responses.ts b/src/lib/providers/xai/translators/openai-responses.tsnew file mode 100644index 0000000000..9f5c9f9884--- /dev/null+++ b/src/lib/providers/xai/translators/openai-responses.ts@@ -0,0 +1,77 @@+/**+ * OpenAI Responses ↔ xAI Responses translator+ *+ * Source of truth: router-for-me/CLIProxyAPI internal/translator/openai-responses/xai/*+ *+ * xAI's Responses API is shape-compatible with OpenAI Responses, so this is+ * mostly a passthrough. Translator responsibilities:+ * - normalize response.id when synthesized+ * - reconcile a small set of unsupported fields (drop unknown vendor-only opts)+ * - apply the thinking patcher hook (delegated upstream)+ */++interface OpenAiResponsesRequest {+ service_tier?: string;+ messages?: unknown[];+ input?: unknown[];+ [key: string]: unknown;+}++interface XaiCompletedResponse {+ object?: string;+ status?: string;+ [key: string]: unknown;+}++interface SseEvent {+ event: string;+ data: string;+}++/**+ * Translate an inbound OpenAI-Responses request body into an xAI request body.+ */+export function openaiResponsesRequestToXai(req: OpenAiResponsesRequest): OpenAiResponsesRequest {+ if (!req || typeof req !== "object") return req;+ const out: OpenAiResponsesRequest = { ...req };++ // xAI does not currently honor `parallel_tool_calls: false` on every model;+ // mirror CLIProxyAPI: leave the flag as caller specified.++ // Drop OpenAI-specific service_tier hint that xAI rejects.+ if ("service_tier" in out) delete out.service_tier;++ // xAI expects `input` (Responses-style); if the caller passed `messages`+ // instead, leave them — xAI also accepts messages, but warn via metadata.+ return out;+}++/**+ * Translate an xAI completed response (already aggregated by collectSseToCompleted)+ * into the OpenAI Responses JSON shape that callers expect.+ */+export function xaiCompletedToOpenaiResponses(+ completed: XaiCompletedResponse,+): XaiCompletedResponse {+ if (!completed || typeof completed !== "object") return completed;+ return {+ ...completed,+ object: completed.object ?? "response",+ status: completed.status ?? "completed",+ };+}++/**+ * Pass-through transform for SSE event objects { event, data } emitted by+ * iterateSseEvents(). For OpenAI Responses callers we forward verbatim — only+ * normalize event names that diverge.+ *+ * Returns null to drop the event.+ */+export function xaiSseEventToOpenaiResponses(ev: SseEvent): SseEvent | null {+ if (!ev || !ev.event) return ev;+ // CLIProxyAPI drops xAI-internal `response.output_text.annotation.added`+ // when the caller is OpenAI Responses, since OpenAI emits a different name.+ if (ev.event === "response.output_text.annotation.added") return null;+ return ev;+}diff --git a/src/lib/usage/providerLimits.ts b/src/lib/usage/providerLimits.tsindex 40898f7727..7bf6371f87 100644--- a/src/lib/usage/providerLimits.ts+++ b/src/lib/usage/providerLimits.ts@@ -327,7 +327,12 @@ export async function refreshAndUpdateCredentials(| null;if (!refreshResult) {- if (connection.provider === "github" && connection.accessToken) {+ // Refresh failed but we still have an accessToken — fall back to the+ // existing token for ANY OAuth provider (graceful degradation) instead of+ // hard-failing. Previously this was qualified to `provider === "github"`,+ // which left every other provider stuck on a transient refresh failure even+ // when a usable access token was still on hand.+ if (connection.accessToken) {return { connection, refreshed: false };}throw withStatus(diff --git a/src/server/authz/routeGuard.ts b/src/server/authz/routeGuard.tsindex cab7af2560..a5fda0bc5d 100644--- a/src/server/authz/routeGuard.ts+++ b/src/server/authz/routeGuard.ts@@ -38,6 +38,9 @@ export const LOCAL_ONLY_API_PREFIXES: ReadonlyArray<string> = ["/api/system/version", // auto-update: spawns git checkout + npm install — RCE-via-tunnel surface (Hard Rules #15 + #17, found by 6A.8 route-guard gate)"/api/db-backups/exportAll", // spawns tar for export archive (Hard Rules #15 + #17, found by 6A.8 route-guard gate)"/api/local/", // T-12: 1-click local service launchers (Redis today; spawns podman/docker) — loopback-enforced by isLocalRequestAllowed() in src/lib/security/localEndpoints.ts (Hard Rules #15 + #17)+ "/api/headroom/start", // Headroom token-saver proxy lifecycle: spawns headroom-ai python CLI (Hard Rules #15 + #17)+ "/api/headroom/stop", // Headroom token-saver proxy lifecycle: sends SIGTERM/SIGKILL to managed PID (Hard Rules #15 + #17)+ "/api/oauth/cursor/auto-import", // spawns `execFile("which", ["cursor"])` to verify a local Cursor install before importing creds — RCE-via-tunnel surface (Hard Rules #15 + #17, found by 6A.8 route-guard gate). Specific path only: the rest of /api/oauth/ (browser redirect/callback flows) must stay remote-reachable.];/**@@ -78,6 +81,8 @@ export const SPAWN_CAPABLE_PREFIXES: ReadonlyArray<string> = ["/api/tools/traffic-inspector/", // http-proxy listener + system proxy (Hard Rules #15 + #17)"/api/plugins/", // plugins: load/execute via worker_threads + child_process (Hard Rules #15 + #17)"/api/local/", // T-12: 1-click local service launchers (Redis today) — must never be whitelistable via manage-scope bypass (Hard Rules #15 + #17)+ "/api/headroom/start", // spawns headroom-ai python CLI — must never be bypassable (Hard Rules #15 + #17)+ "/api/headroom/stop", // kills tracked PID — must never be bypassable (Hard Rules #15 + #17)];/**diff --git a/src/shared/components/ModelSelectModal.tsx b/src/shared/components/ModelSelectModal.tsxindex c6360bc920..e44dddecf4 100644--- a/src/shared/components/ModelSelectModal.tsx+++ b/src/shared/components/ModelSelectModal.tsx@@ -3,6 +3,7 @@import { useState, useMemo, useEffect } from "react";import { useTranslations } from "next-intl";import Modal from "./Modal";+import { buildPassthroughAliasModels } from "./modelSelectModalHelpers";import { getModelsByProviderId, PROVIDER_ID_TO_ALIAS } from "@/shared/constants/models";import { getCompatibleFallbackModels } from "@/lib/providers/managedAvailableModels";import {@@ -235,14 +236,14 @@ export default function ModelSelectModal({const providerCustomModels = customModels[providerId] || [];if (providerInfo.passthroughModels) {- const aliasModels = Object.entries(modelAliases as Record<string, string>)- .filter(([, fullModel]: [string, string]) => fullModel.startsWith(`${alias}/`))- .map(([aliasName, fullModel]: [string, string]) => ({- id: fullModel.replace(`${alias}/`, ""),- name: aliasName,- value: fullModel,- source: "alias",- }));+ // Passthrough aliases are stored prefixed by the canonical providerId+ // (e.g. "github/gpt-4"), not the public alias (e.g. "gh/"), so we must+ // filter/strip by providerId — matching the sibling custom-provider+ // branch below. (port: decolua/9router#485)+ const aliasModels = buildPassthroughAliasModels(+ modelAliases as Record<string, string>,+ providerId+ );// Merge custom models for passthrough providersconst customEntries = providerCustomModelsdiff --git a/src/shared/components/layouts/DashboardLayout.tsx b/src/shared/components/layouts/DashboardLayout.tsxindex 0a0a3fa866..f72841a6e7 100644--- a/src/shared/components/layouts/DashboardLayout.tsx+++ b/src/shared/components/layouts/DashboardLayout.tsx@@ -73,8 +73,8 @@ export default function DashboardLayout({ children }) {/>)}- {/* Sidebar - Desktop */}- <div className="hidden min-h-0 lg:flex">+ {/* Sidebar - Desktop: keep visibility independent from Tailwind hidden/lg:flex ordering. */}+ <div className="dashboard-sidebar-desktop"><Sidebarcollapsed={collapsed}onToggleCollapse={handleToggleCollapse}diff --git a/src/shared/components/modelSelectModalHelpers.ts b/src/shared/components/modelSelectModalHelpers.tsnew file mode 100644index 0000000000..01d7f26011--- /dev/null+++ b/src/shared/components/modelSelectModalHelpers.ts@@ -0,0 +1,37 @@+// Pure helpers extracted from ModelSelectModal so the grouping logic is+// unit-testable (the component itself lives inside a useMemo and is not+// directly exercisable by node:test). Keep these free of React imports.++export type PassthroughAliasModel = {+ id: string;+ name: string;+ value: string;+ source: "alias";+};++/**+ * Build the alias-derived model rows for a passthrough provider.+ *+ * `modelAliases` maps an alias name → the fully-qualified model string, which+ * is prefixed by the provider's *canonical id* (e.g. `github/gpt-4`), NOT by+ * its public alias (e.g. `gh`). Filtering/stripping must therefore use the+ * `providerId`, mirroring the sibling custom-provider branch. Using the alias+ * here meant aliases registered under a providerId whose alias differs (the+ * common case) never resolved.+ *+ * Inspired by upstream PR decolua/9router#485 (Anurag Saxena).+ */+export function buildPassthroughAliasModels(+ modelAliases: Record<string, string>,+ providerId: string+): PassthroughAliasModel[] {+ const prefix = `${providerId}/`;+ return Object.entries(modelAliases || {})+ .filter(([, fullModel]) => typeof fullModel === "string" && fullModel.startsWith(prefix))+ .map(([aliasName, fullModel]) => ({+ id: fullModel.replace(prefix, ""),+ name: aliasName,+ value: fullModel,+ source: "alias" as const,+ }));+}diff --git a/src/shared/constants/config.ts b/src/shared/constants/config.tsindex 453a32e513..2a1e373360 100644--- a/src/shared/constants/config.ts+++ b/src/shared/constants/config.ts@@ -20,6 +20,7 @@ export const API_ENDPOINTS = {export const PROVIDER_ENDPOINTS = {agentrouter: "https://agentrouter.org/v1/chat/completions",openrouter: "https://openrouter.ai/api/v1/chat/completions",+ dgrid: "https://api.dgrid.ai/v1/chat/completions",glm: "https://api.z.ai/api/anthropic/v1/messages",glmt: "https://api.z.ai/api/anthropic/v1/messages","bailian-coding-plan": "https://coding-intl.dashscope.aliyuncs.com/apps/anthropic/v1/messages",diff --git a/src/shared/constants/pricing/regional.ts b/src/shared/constants/pricing/regional.tsindex 739ec566fe..7f5886ab7d 100644--- a/src/shared/constants/pricing/regional.ts+++ b/src/shared/constants/pricing/regional.ts@@ -71,6 +71,22 @@ export const DEFAULT_PRICING_REGIONAL = {"kimi-latest": { input: 1.0, output: 4.0, cached: 0.5, reasoning: 6.0, cache_creation: 1.0 },},minimax: {+ // MiniMax M3 — new default model (upstream upgrade from M2.7).+ // Same api.minimax.io endpoint; pricing mirrors the M2.x base tier.+ "minimax-m3": {+ input: 0.5,+ output: 2.0,+ cached: 0.25,+ reasoning: 3.0,+ cache_creation: 0.5,+ },+ "MiniMax-M3": {+ input: 0.5,+ output: 2.0,+ cached: 0.25,+ reasoning: 3.0,+ cache_creation: 0.5,+ },"minimax-m2.1": {input: 0.5,output: 2.0,diff --git a/src/shared/constants/providers/apikey/frontier-labs.ts b/src/shared/constants/providers/apikey/frontier-labs.tsindex 1339e374e1..dc99ff4be1 100644--- a/src/shared/constants/providers/apikey/frontier-labs.ts+++ b/src/shared/constants/providers/apikey/frontier-labs.ts@@ -27,6 +27,23 @@ export const APIKEY_PROVIDERS_FRONTIER = {hasFree: true,freeNote: "$10/month recurring free API credits",},+ pioneer: {+ id: "pioneer",+ alias: "pn",+ name: "Pioneer AI",+ icon: "rocket_launch",+ color: "#7C5CFF",+ textIcon: "PN",+ website: "https://pioneer.ai",+ notice: {+ text: "Pioneer AI by Fastino Labs. Free $75 usage credits, no credit card required. Use API key auth with a pio_sk_... key. Only open-tier models (Qwen3, Llama, Gemma, SmolLM) work directly — gated models (Claude/GPT/Gemini) require prior fine-tuning via the Pioneer platform.",+ apiKeyUrl: "https://agent.pioneer.ai/settings/api-keys",+ signupUrl: "https://agent.pioneer.ai/auth",+ },+ hasFree: true,+ freeNote: "$75 free usage credits — no credit card required",+ serviceKinds: ["llm"],+ },anthropic: {id: "anthropic",alias: "anthropic",diff --git a/src/shared/constants/providers/apikey/gateways.ts b/src/shared/constants/providers/apikey/gateways.tsindex 51ca63fbae..3b668e567f 100644--- a/src/shared/constants/providers/apikey/gateways.ts+++ b/src/shared/constants/providers/apikey/gateways.ts@@ -40,6 +40,23 @@ export const APIKEY_PROVIDERS_GATEWAYS = {hasFree: true,freeNote: "Free models at $0/token with :free suffix - 20 RPM / 200 RPD",},+ dgrid: {+ id: "dgrid",+ alias: "dgrid",+ name: "DGrid",+ icon: "router",+ color: "#65A30D",+ textIcon: "DG",+ passthroughModels: true,+ website: "https://dgrid.ai",+ hasFree: true,+ freeNote:+ "DGrid Free Models Router: 10 requests/minute and 100 requests/day. " ++ "A $5 lifetime top-up unlocks up to 20 requests/minute and 1,000 requests/day.",+ apiHint:+ "Create a DGrid API key at https://dgrid.ai, then use https://api.dgrid.ai/v1 " ++ "as the OpenAI-compatible base URL.",+ },orcarouter: {id: "orcarouter",alias: "orcarouter",diff --git a/src/shared/services/droidCustomModels.ts b/src/shared/services/droidCustomModels.tsnew file mode 100644index 0000000000..f637db7fde--- /dev/null+++ b/src/shared/services/droidCustomModels.ts@@ -0,0 +1,118 @@+/**+ * Build the OmniRoute `customModels` entries for Factory Droid's `settings.json`.+ *+ * Ported from upstream PR decolua/9router#618 (author Anurag Saxena) — multi-model+ * support for the Factory Droid CLI tool. Adapted to OmniRoute branding+ * (`custom:OmniRoute-<i>`) and extracted as a pure helper so the route-handler+ * logic is unit-testable without touching the filesystem.+ */++export interface DroidCustomModelOptions {+ /** Already-normalized base URL (callers must ensure /v1 suffix). */+ baseUrl: string;+ /** API key to embed in every entry. */+ apiKey: string;+ /**+ * Model id (e.g. `"openai/gpt-5"`) that should appear first in the array.+ * When omitted (or not in `models`), entry index 0 stays first.+ * When the empty string `""` is passed explicitly, no reordering happens+ * — the caller signalled "do not promote any model to default".+ */+ activeModel?: string;+}++export interface DroidCustomModelEntry {+ model: string;+ id: string;+ index: number;+ baseUrl: string;+ apiKey: string;+ displayName: string;+ maxOutputTokens: number;+ noImageSupport: boolean;+ provider: string;+}++/**+ * Returns the trimmed, deduplicated, non-empty model ids in input order.+ * Accepts either a `models` array (multi-model, upstream #618) or a legacy+ * `model` string (single-model, pre-#618 behavior).+ */+export function normalizeDroidModelList(input: {+ model?: unknown;+ models?: unknown;+}): string[] {+ const raw: unknown[] = Array.isArray(input.models)+ ? input.models+ : typeof input.model === "string"+ ? [input.model]+ : [];++ const seen = new Set<string>();+ const out: string[] = [];+ for (const m of raw) {+ if (typeof m !== "string") continue;+ const trimmed = m.trim();+ if (!trimmed || seen.has(trimmed)) continue;+ seen.add(trimmed);+ out.push(trimmed);+ }+ return out;+}++/**+ * Build the final `customModels` array. Throws when `models` is empty —+ * callers should validate before invoking.+ */+export function buildDroidCustomModels(+ models: string[],+ opts: DroidCustomModelOptions+): DroidCustomModelEntry[] {+ if (models.length === 0) {+ throw new Error("buildDroidCustomModels requires at least one model");+ }++ // Default index resolution:+ // - undefined → 0 (first entry stays first)+ // - "" → -1 (do not promote anything)+ // - <value> → index of value in models (or 0 if not found)+ let defaultIndex: number;+ if (typeof opts.activeModel === "string") {+ if (opts.activeModel === "") {+ defaultIndex = -1;+ } else {+ const idx = models.indexOf(opts.activeModel);+ defaultIndex = idx >= 0 ? idx : 0;+ }+ } else {+ defaultIndex = 0;+ }++ const entries: DroidCustomModelEntry[] = models.map((m, i) => ({+ model: m,+ id: `custom:OmniRoute-${i}`,+ index: i,+ baseUrl: opts.baseUrl,+ apiKey: opts.apiKey,+ displayName: m,+ maxOutputTokens: 131072,+ noImageSupport: false,+ provider: "openai",+ }));++ if (defaultIndex > 0 && entries[defaultIndex]) {+ const [defaultEntry] = entries.splice(defaultIndex, 1);+ entries.unshift({ ...defaultEntry, index: 0 });+ entries.forEach((e, i) => {+ e.index = i;+ e.id = `custom:OmniRoute-${i}`;+ });+ }++ return entries;+}++/** True when a `customModels` entry was written by OmniRoute (any index). */+export function isOmniRouteCustomModel(entry: { id?: unknown } | null | undefined): boolean {+ return typeof entry?.id === "string" && entry.id.startsWith("custom:OmniRoute");+}diff --git a/src/shared/utils/circuitBreaker.ts b/src/shared/utils/circuitBreaker.tsindex 00dbf6c28f..ee898e319b 100644--- a/src/shared/utils/circuitBreaker.ts+++ b/src/shared/utils/circuitBreaker.ts@@ -25,6 +25,28 @@ import {} from "../../lib/db/domainState";import type { FailureKind } from "./classify429";+/**+ * #4602 — Detect a LOCAL stream-lifecycle error that must NOT count as a+ * whole-provider failure. The Codex WebSocket→SSE bridge can throw a bare+ * `Invalid state: Controller is already closed` (an enqueue-after-close on our+ * own ReadableStream controller). It carries no `statusCode`, so it defaults to+ * HTTP 502 and would otherwise trip the provider circuit breaker — blacklisting+ * the entire Codex provider for a bug that lives in our bridge, not upstream.+ * Use this with the breaker's `isFailure` option so the bridge error is ignored+ * by the provider breaker while genuine upstream 5xx failures still count.+ */+export function isLocalStreamLifecycleError(error: unknown): boolean {+ if (!error) return false;+ const message =+ typeof error === "string"+ ? error+ : typeof (error as { message?: unknown }).message === "string"+ ? ((error as { message: string }).message as string)+ : "";+ if (!message) return false;+ return /controller is already closed/i.test(message);+}+export const STATE = {CLOSED: "CLOSED",DEGRADED: "DEGRADED",diff --git a/src/shared/utils/clineAuth.ts b/src/shared/utils/clineAuth.tsnew file mode 100644index 0000000000..929e61cbae--- /dev/null+++ b/src/shared/utils/clineAuth.ts@@ -0,0 +1,62 @@+/**+ * Cline (cline.bot) auth-shape helpers.+ *+ * Cline's API expects the bearer token to be prefixed with `workos:` (the+ * upstream auth provider), and a set of Cline client-identification headers+ * (HTTP-Referer / X-Title / X-CLIENT-* / X-PLATFORM*). Plain `Bearer <token>`+ * without the `workos:` prefix is rejected upstream, so every Cline request+ * must route its headers through `buildClineHeaders()`.+ */++const APP_VERSION = process.env.npm_package_version || "0.0.0";++/**+ * Normalize a raw Cline token into the `workos:`-prefixed access-token shape+ * Cline expects. Idempotent: a token that already carries the prefix is+ * returned untouched. Non-string / empty input yields an empty string.+ */+export function getClineAccessToken(token: unknown): string {+ if (typeof token !== "string") return "";+ const trimmed = token.trim();+ if (!trimmed) return "";+ return trimmed.startsWith("workos:") ? trimmed : `workos:${trimmed}`;+}++/**+ * Build the full `Authorization` header value for a Cline request, or an empty+ * string when no usable token is present.+ */+export function getClineAuthorizationHeader(token: unknown): string {+ const accessToken = getClineAccessToken(token);+ return accessToken ? `Bearer ${accessToken}` : "";+}++/**+ * Build the complete Cline client header set, optionally merged with caller+ * extras. The `Authorization` header is only added when a usable token is+ * present (so callers can build probe headers without a token).+ */+export function buildClineHeaders(+ token: unknown,+ extraHeaders: Record<string, string> = {}+): Record<string, string> {+ const authorization = getClineAuthorizationHeader(token);+ const headers: Record<string, string> = {+ "HTTP-Referer": "https://cline.bot",+ "X-Title": "Cline",+ "User-Agent": `OmniRoute/${APP_VERSION}`,+ "X-PLATFORM": process.platform || "unknown",+ "X-PLATFORM-VERSION": process.version || "unknown",+ "X-CLIENT-TYPE": "omniroute",+ "X-CLIENT-VERSION": APP_VERSION,+ "X-CORE-VERSION": APP_VERSION,+ "X-IS-MULTIROOT": "false",+ ...extraHeaders,+ };++ if (authorization) {+ headers.Authorization = authorization;+ }++ return headers;+}diff --git a/src/shared/validation/compressionConfigSchemas.ts b/src/shared/validation/compressionConfigSchemas.tsindex 293c11694f..e5ba212711 100644--- a/src/shared/validation/compressionConfigSchemas.ts+++ b/src/shared/validation/compressionConfigSchemas.ts@@ -177,6 +177,26 @@ export const stackedPipelineStepSchema = z.discriminatedUnion("engine", [.strict(),]);+/**+ * Canonical engine → selectable-intensities map for the named-combos pipeline editor+ * (Engine Combos UI). This is the SINGLE source of truth shared by the dashboard+ * dropdowns and `stackedPipelineStepSchema`: every engine/intensity offered here is,+ * by construction, accepted by the API update schema.+ *+ * Do NOT add an engine here that is not a branch of `stackedPipelineStepSchema` — the+ * `PUT /api/context/combos/[id]` route validates against that discriminated union and+ * would reject the payload with HTTP 400 (#4955: the UI previously offered `headroom`,+ * `session-dedup`, `ccr`, `llmlingua`, none of which the union accepts, so selecting+ * one silently failed the save). The parity is guarded by a unit test.+ */+export const STACKED_PIPELINE_ENGINE_INTENSITIES: Record<string, readonly string[]> = {+ rtk: ["minimal", "standard", "aggressive"],+ caveman: ["lite", "full", "ultra"],+ lite: ["lite"],+ aggressive: ["standard"],+ ultra: ["ultra"],+};+export const engineToggleSchema = z.object({enabled: z.boolean(),level: z.string().optional(),diff --git a/src/shared/validation/schemas/cli.ts b/src/shared/validation/schemas/cli.tsindex 61e45ca001..b3e6a223e8 100644--- a/src/shared/validation/schemas/cli.ts+++ b/src/shared/validation/schemas/cli.ts@@ -72,4 +72,15 @@ export const cliModelConfigSchema = z.object({reasoningEffort: z.enum(["none", "low", "medium", "high", "xhigh"]).optional(),wireApi: z.enum(["chat", "responses"]).optional(),modelMappings: z.record(z.string().trim().min(1), z.string().trim().min(1)).optional(),+});++/**+ * Multi-model variant of `cliModelConfigSchema`. Adds optional `models`+ * (array of strings, takes precedence over `model`) and `activeModel`+ * (string id to promote to first position). Ported from upstream PR+ * decolua/9router#618 for the Factory Droid CLI tool.+ */+export const cliMultiModelConfigSchema = cliModelConfigSchema.extend({+ models: z.array(z.string().trim().min(1)).optional(),+ activeModel: z.string().optional(),});\ No newline at end of filediff --git a/src/shared/validation/schemas/combo.ts b/src/shared/validation/schemas/combo.tsindex 8590ff9ebf..92d87757b5 100644--- a/src/shared/validation/schemas/combo.ts+++ b/src/shared/validation/schemas/combo.ts@@ -229,6 +229,12 @@ export const createComboSchema = z.object({tool_filter_regex: z.string().max(1000).optional(),context_cache_protection: z.boolean().optional(),context_length: z.number().int().min(1000).max(2000000).optional(),+ // Optional embedding dimensions override for embedding combos.+ // When set, the value is injected into every upstream embedding request as+ // the `dimensions` field (and translated to `outputDimensionality` for Gemini).+ // Stored as a string to match the OpenAI API convention; coerced to number+ // by the embedding handler. Leave unset to use each model's default.+ dimensions: z.string().regex(/^\d+$/, "dimensions must be a positive integer string").optional().nullable(),});export const updateComboDefaultsSchema = z@@ -278,6 +284,7 @@ export const updateComboSchema = zcontext_cache_protection: z.boolean().optional(),context_length: z.number().int().min(1000).max(2000000).optional().nullable(),compressionOverride: comboCompressionOverrideSchema.optional(),+ dimensions: z.string().regex(/^\d+$/, "dimensions must be a positive integer string").optional().nullable(),}).superRefine((value, ctx) => {if (@@ -292,7 +299,8 @@ export const updateComboSchema = zvalue.tool_filter_regex === undefined &&value.context_cache_protection === undefined &&value.context_length === undefined &&- value.compressionOverride === undefined+ value.compressionOverride === undefined &&+ value.dimensions === undefined) {ctx.addIssue({code: z.ZodIssueCode.custom,diff --git a/src/sse/handlers/chat.ts b/src/sse/handlers/chat.tsindex d52a9fab00..0856af5cb9 100644--- a/src/sse/handlers/chat.ts+++ b/src/sse/handlers/chat.ts@@ -17,6 +17,7 @@ import {isDailyQuotaExhausted,} from "@omniroute/open-sse/services/accountFallback.ts";import { getModelInfo, getComboForModel } from "../services/model";+import { resolveBareModelToConnectionDefault } from "@omniroute/open-sse/services/model.ts";import { errorResponse } from "@omniroute/open-sse/utils/error.ts";import { applyNoThinkingAlias } from "@omniroute/open-sse/utils/noThinkingAlias.ts";import { handleComboChat } from "@omniroute/open-sse/services/combo.ts";@@ -45,6 +46,8 @@ import * as log from "../utils/logger";import { checkAndRefreshToken } from "../services/tokenRefresh";import { createHookContext, runHooks, initPreRequestRegistry } from "@/lib/middleware/registry";import { deleteHandoff, getHandoff } from "@/lib/db/contextHandoffs";+import { updateCombo } from "@/lib/db/combos";+import { promoteSuccessfulComboModel } from "@/lib/combos/autoPromote";import {deleteSessionAccountAffinity,getCachedSettings,@@ -74,7 +77,7 @@ import { connectionHasExtraKeys } from "@omniroute/open-sse/services/apiKeyRotat// Pipeline integration — wired modulesimport { classify429FromError, type FailureKind } from "@/shared/utils/classify429";import { resolveUseUpstream429BreakerHints } from "@/shared/utils/providerHints";-import { getCircuitBreaker } from "../../shared/utils/circuitBreaker";+import { getCircuitBreaker, isLocalStreamLifecycleError } from "../../shared/utils/circuitBreaker";import { markAccountExhaustedFrom429 } from "../../domain/quotaCache";import { RequestTelemetry, recordTelemetry } from "../../shared/utils/requestTelemetry";import { generateRequestId } from "../../shared/utils/requestId";@@ -191,6 +194,7 @@ function intersectAllowedConnectionIds(primary: unknown, secondary: unknown): st}const PROVIDER_BREAKER_FAILURE_STATUSES = new Set([408, 500, 502, 503, 504]);+const comboPromoteDeps = { updateCombo, info: log.info, warn: log.warn };/*** Handle chat completion request@@ -269,11 +273,13 @@ export async function handleChat(`${url.pathname} | ${modelStr} | ${msgCount} msgs${toolCount ? ` | ${toolCount} tools` : ""}${effort ? ` | effort=${effort}` : ""}`);- // Log API key (masked)+ // Log only that an API key was provided — never the key itself, not even a+ // masked prefix/last4. These debug lines get copied verbatim into bug reports+ // and support tickets, so any key fragment is sensitive.const authHeader = request.headers.get("Authorization");const apiKey = extractApiKey(request);if (authHeader && apiKey) {- log.debug("AUTH", `API Key: ${log.maskKey(apiKey)}`);+ log.debug("AUTH", "API key provided");} else {log.debug("AUTH", "No API key provided (local mode)");}@@ -670,7 +676,17 @@ export async function handleChat(},target?.effectiveComboStrategy ?? combo.strategy,true- ),+ ).then(async (res: Response) => {+ // Auto-promote the winning combo model to position #1 (opt-in flag).+ if (res?.ok)+ await promoteSuccessfulComboModel(+ combo,+ m,+ settings as Record<string, unknown>,+ comboPromoteDeps+ );+ return res;+ }),isModelAvailable: checkModelAvailable,log,settings,@@ -934,6 +950,9 @@ async function handleSingleModelChat(const breaker = getCircuitBreaker(provider, {failureThreshold: providerProfile.failureThreshold,resetTimeout: providerProfile.resetTimeoutMs,+ // #4602: a local WS-bridge "Controller is already closed" throw is not an+ // upstream outage — keep it from tripping the whole-provider breaker.+ isFailure: (e) => !isLocalStreamLifecycleError(e),onStateChange: (name: string, from: string, to: string) =>log.info("CIRCUIT", `${name}: ${from} → ${to}`),...(useHints429@@ -1076,7 +1095,15 @@ async function handleSingleModelChat(const accountId = credentials.connectionId.slice(0, 8);log.info("AUTH", `Using ${provider} account: ${accountId}...`);- let requestBody = body;+ // #474: when the request used a bare model name (no "/" — e.g. an alias+ // that resolved to "auto") and the selected connection declares a+ // defaultModel, resolve the bare name to that real model ID before the+ // upstream call so the provider receives a concrete model rather than the+ // placeholder. A "/"-qualified model name is always left untouched.+ const effectiveModel =+ resolveBareModelToConnectionDefault(modelStr, model, credentials.defaultModel) ?? model;+ let requestBody =+ effectiveModel !== model ? { ...body, model: `${provider}/${effectiveModel}` } : body;let injectedHandoff = null;if (comboStrategy === "context-relay" &&@@ -1139,7 +1166,7 @@ async function handleSingleModelChat(breaker,body: requestBody,provider,- model,+ model: effectiveModel,refreshedCredentials,proxyInfo,log,diff --git a/src/sse/handlers/chatHelpers.ts b/src/sse/handlers/chatHelpers.tsindex e8abf6533e..daad871601 100644--- a/src/sse/handlers/chatHelpers.ts+++ b/src/sse/handlers/chatHelpers.ts@@ -26,7 +26,11 @@ import {isTlsFingerprintActive,} from "@omniroute/open-sse/utils/proxyFetch.ts";import { resolveProxyForConnection } from "@/lib/localDb";-import { CircuitBreakerOpenError, getCircuitBreaker } from "../../shared/utils/circuitBreaker";+import {+ CircuitBreakerOpenError,+ getCircuitBreaker,+ isLocalStreamLifecycleError,+} from "../../shared/utils/circuitBreaker";import { classify429FromError, type FailureKind } from "../../shared/utils/classify429";import { resolveUseUpstream429BreakerHints } from "../../shared/utils/providerHints";@@ -324,6 +328,9 @@ export async function checkPipelineGates(failureThreshold: providerProfile.failureThreshold ?? providerProfile.circuitBreakerThreshold,degradationThreshold: providerProfile.degradationThreshold,resetTimeout: providerProfile.resetTimeoutMs ?? providerProfile.circuitBreakerReset,+ // #4602: a local WS-bridge "Controller is already closed" throw is not an+ // upstream outage — keep it from tripping the whole-provider breaker.+ isFailure: (e) => !isLocalStreamLifecycleError(e),onStateChange: (name: string, from: string, to: string) =>log.info("CIRCUIT", `${name}: ${from} → ${to}`),...(useHints429diff --git a/src/sse/services/auth.ts b/src/sse/services/auth.tsindex f11681a23b..1ea8d7f3dc 100644--- a/src/sse/services/auth.ts+++ b/src/sse/services/auth.ts@@ -78,6 +78,7 @@ interface ProviderConnectionView {tokenExpiresAt: string | null;expiresAt: string | null;projectId: string | null;+ defaultModel: string | null;providerSpecificData: JsonRecord;lastUsedAt: string | null;consecutiveUseCount: number;@@ -171,6 +172,7 @@ function toProviderConnection(value: unknown): ProviderConnectionView {tokenExpiresAt: toStringOrNull(row.tokenExpiresAt),expiresAt: toStringOrNull(row.expiresAt),projectId: toStringOrNull(row.projectId),+ defaultModel: toStringOrNull(row.defaultModel),providerSpecificData: asRecord(row.providerSpecificData),lastUsedAt: toStringOrNull(row.lastUsedAt),consecutiveUseCount: toNumber(row.consecutiveUseCount, 0),@@ -787,6 +789,7 @@ function buildSyntheticNoAuthCredentials(providerSpecificData: JsonRecord = {}):refreshToken: null;expiresAt: null;projectId: null;+ defaultModel: null;copilotToken: null;providerSpecificData: JsonRecord;connectionId: typeof SYNTHETIC_NOAUTH_CONNECTION_ID;@@ -808,6 +811,7 @@ function buildSyntheticNoAuthCredentials(providerSpecificData: JsonRecord = {}):refreshToken: null,expiresAt: null,projectId: null,+ defaultModel: null,copilotToken: null,providerSpecificData,connectionId: SYNTHETIC_NOAUTH_CONNECTION_ID,@@ -1600,6 +1604,10 @@ export async function getProviderCredentials(refreshToken: connection.refreshToken,expiresAt: connection.tokenExpiresAt || connection.expiresAt || null,projectId: connection.projectId,+ // #474: surface the connection's configured defaultModel so the chat /+ // embeddings handlers can resolve a bare model name (e.g. an alias that+ // resolved to "auto") to a real provider model ID before the upstream call.+ defaultModel: connection.defaultModel || null,copilotToken:typeof connection.providerSpecificData.copilotToken === "string"? connection.providerSpecificData.copilotTokendiff --git a/src/sse/services/model.ts b/src/sse/services/model.tsindex 651694281f..cb49cf4f4e 100644--- a/src/sse/services/model.ts+++ b/src/sse/services/model.ts@@ -1,5 +1,12 @@// Re-export from open-sse with localDb integration-import { getModelAliases, getComboByName, getProviderNodes, getCustomModels } from "@/lib/localDb";+import {+ getModelAliases,+ getComboByName,+ getComboById,+ getComboByNameInsensitive,+ getProviderNodes,+ getCustomModels,+} from "@/lib/localDb";import { getCachedSettings } from "@/lib/localDb";import { getComboStepTarget } from "@/lib/combos/steps";import {@@ -213,6 +220,22 @@ export async function getCombo(modelStr) {}}+ // #4446: the opencode-plugin publishes combos as ModelV2 `id: combo.id`, and+ // the OpenCode `--model` dispatch path forwards a lowercased bare slug. The+ // exact, case-sensitive name match above misses both a combo addressed by its+ // stored id (UUID/slug) and a lowercased display name (e.g. "master-light" for+ // a combo named "MASTER-LIGHT"). These two fallbacks only run after the exact+ // match fails, so they never re-route a combo that already resolves today.+ combo = await getComboById(modelStr);+ if (combo && combo.models && combo.models.length > 0) {+ return combo;+ }++ combo = await getComboByNameInsensitive(modelStr);+ if (combo && combo.models && combo.models.length > 0) {+ return combo;+ }+return null;}diff --git a/src/sse/services/tokenRefresh.ts b/src/sse/services/tokenRefresh.tsindex 63415b09b0..ab51be2742 100755--- a/src/sse/services/tokenRefresh.ts+++ b/src/sse/services/tokenRefresh.ts@@ -174,7 +174,7 @@ export async function checkAndRefreshToken(provider: string, credentials: any) {if (updatedCredentials.expiresAt) {const expiresAt = new Date(updatedCredentials.expiresAt).getTime();const now = Date.now();- const refreshLead = _getRefreshLeadMs(provider);+ const refreshLead = _getRefreshLeadMs(provider, updatedCredentials.providerSpecificData);if (expiresAt - now < refreshLead) {log.info("TOKEN_REFRESH", "Token expiring soon, refreshing proactively", {diff --git a/tests/snapshots/provider/translate-path.json b/tests/snapshots/provider/translate-path.jsonnew file mode 100644index 0000000000..8a81378082--- /dev/null+++ b/tests/snapshots/provider/translate-path.json@@ -0,0 +1,4146 @@+{+ "adapta-web": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://agent.adapta.one/api/chat/stream/v1",+ "stream": "https://agent.adapta.one/api/chat/stream/v1"+ }+ },+ "agentrouter": {+ "format": "claude",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Anthropic-Beta": "claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28,advisor-tool-2026-03-01,extended-cache-ttl-2025-04-11,cache-diagnosis-2026-04-07",+ "Anthropic-Dangerous-Direct-Browser-Access": "true",+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "User-Agent": "claude-cli/2.1.187 (external, cli)",+ "X-App": "cli",+ "X-Stainless-Arch": "x64",+ "X-Stainless-Helper-Method": "stream",+ "X-Stainless-Lang": "js",+ "X-Stainless-Os": "Linux",+ "X-Stainless-Package-Version": "0.94.0",+ "X-Stainless-Retry-Count": "0",+ "X-Stainless-Runtime": "node",+ "X-Stainless-Runtime-Version": "v24.3.0",+ "X-Stainless-Timeout": "600",+ "x-api-key": "<CRED>"+ },+ "nonStream": {+ "Anthropic-Beta": "claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28,advisor-tool-2026-03-01,extended-cache-ttl-2025-04-11,cache-diagnosis-2026-04-07",+ "Anthropic-Dangerous-Direct-Browser-Access": "true",+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "User-Agent": "claude-cli/2.1.187 (external, cli)",+ "X-App": "cli",+ "X-Stainless-Arch": "x64",+ "X-Stainless-Helper-Method": "stream",+ "X-Stainless-Lang": "js",+ "X-Stainless-Os": "Linux",+ "X-Stainless-Package-Version": "0.94.0",+ "X-Stainless-Retry-Count": "0",+ "X-Stainless-Runtime": "node",+ "X-Stainless-Runtime-Version": "v24.3.0",+ "X-Stainless-Timeout": "600",+ "x-api-key": "<CRED>"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Anthropic-Beta": "claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28,advisor-tool-2026-03-01,extended-cache-ttl-2025-04-11,cache-diagnosis-2026-04-07",+ "Anthropic-Dangerous-Direct-Browser-Access": "true",+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "User-Agent": "claude-cli/2.1.187 (external, cli)",+ "X-App": "cli",+ "X-Stainless-Arch": "x64",+ "X-Stainless-Helper-Method": "stream",+ "X-Stainless-Lang": "js",+ "X-Stainless-Os": "Linux",+ "X-Stainless-Package-Version": "0.94.0",+ "X-Stainless-Retry-Count": "0",+ "X-Stainless-Runtime": "node",+ "X-Stainless-Runtime-Version": "v24.3.0",+ "X-Stainless-Timeout": "600",+ "x-api-key": "<CRED>"+ }+ },+ "url": {+ "nonStream": "https://agentrouter.org/v1/messages",+ "stream": "https://agentrouter.org/v1/messages"+ }+ },+ "agy": {+ "format": "antigravity",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "User-Agent": "Antigravity/4.2.0 (X11; Linux x86_64) Chrome/132.0.6834.160 Electron/39.2.3"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "User-Agent": "Antigravity/4.2.0 (X11; Linux x86_64) Chrome/132.0.6834.160 Electron/39.2.3"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "User-Agent": "Antigravity/4.2.0 (X11; Linux x86_64) Chrome/132.0.6834.160 Electron/39.2.3"+ }+ },+ "url": {+ "nonStream": "https://daily-cloudcode-pa.googleapis.com/v1internal:generateContent",+ "stream": "https://daily-cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse"+ }+ },+ "ai21": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.ai21.com/studio/v1/chat/completions",+ "stream": "https://api.ai21.com/studio/v1/chat/completions"+ }+ },+ "aimlapi": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.aimlapi.com/v1/chat/completions",+ "stream": "https://api.aimlapi.com/v1/chat/completions"+ }+ },+ "alibaba": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions",+ "stream": "https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions"+ }+ },+ "alibaba-cn": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",+ "stream": "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions"+ }+ },+ "anthropic": {+ "format": "claude",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28,advisor-tool-2026-03-01,extended-cache-ttl-2025-04-11,cache-diagnosis-2026-04-07",+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "x-api-key": "<CRED>"+ },+ "nonStream": {+ "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28,advisor-tool-2026-03-01,extended-cache-ttl-2025-04-11,cache-diagnosis-2026-04-07",+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "x-api-key": "<CRED>"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28,advisor-tool-2026-03-01,extended-cache-ttl-2025-04-11,cache-diagnosis-2026-04-07",+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "x-api-key": "<CRED>"+ }+ },+ "url": {+ "nonStream": "https://api.anthropic.com/v1/messages?beta=true",+ "stream": "https://api.anthropic.com/v1/messages?beta=true"+ }+ },+ "antigravity": {+ "format": "antigravity",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "User-Agent": "Antigravity/4.2.0 (X11; Linux x86_64) Chrome/132.0.6834.160 Electron/39.2.3"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "User-Agent": "Antigravity/4.2.0 (X11; Linux x86_64) Chrome/132.0.6834.160 Electron/39.2.3"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "User-Agent": "Antigravity/4.2.0 (X11; Linux x86_64) Chrome/132.0.6834.160 Electron/39.2.3"+ }+ },+ "url": {+ "nonStream": "https://daily-cloudcode-pa.googleapis.com/v1internal:generateContent",+ "stream": "https://daily-cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse"+ }+ },+ "api-airforce": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "HTTP-Referer": "https://endpoint-proxy.local",+ "X-Title": "Endpoint Proxy"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "HTTP-Referer": "https://endpoint-proxy.local",+ "X-Title": "Endpoint Proxy"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "HTTP-Referer": "https://endpoint-proxy.local",+ "X-Title": "Endpoint Proxy"+ }+ },+ "url": {+ "nonStream": "https://api.airforce/v1/chat/completions",+ "stream": "https://api.airforce/v1/chat/completions"+ }+ },+ "baichuan": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.baichuan-ai.com/v1/chat/completions",+ "stream": "https://api.baichuan-ai.com/v1/chat/completions"+ }+ },+ "baidu": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://qianfan.baidubce.com/v2/chat/completions",+ "stream": "https://qianfan.baidubce.com/v2/chat/completions"+ }+ },+ "bailian-coding-plan": {+ "format": "claude",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "x-api-key": "<CRED>"+ },+ "nonStream": {+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "x-api-key": "<CRED>"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "x-api-key": "<CRED>"+ }+ },+ "url": {+ "nonStream": "https://coding-intl.dashscope.aliyuncs.com/apps/anthropic/v1",+ "stream": "https://coding-intl.dashscope.aliyuncs.com/apps/anthropic/v1"+ }+ },+ "baseten": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://inference.baseten.co/v1/chat/completions",+ "stream": "https://inference.baseten.co/v1/chat/completions"+ }+ },+ "bazaarlink": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://bazaarlink.ai/api/v1/chat/completions",+ "stream": "https://bazaarlink.ai/api/v1/chat/completions"+ }+ },+ "bedrock": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {}+ },+ "blackbox": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.blackbox.ai/v1/chat/completions",+ "stream": "https://api.blackbox.ai/v1/chat/completions"+ }+ },+ "blackbox-web": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://app.blackbox.ai/api/chat",+ "stream": "https://app.blackbox.ai/api/chat"+ }+ },+ "bluesminds": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.bluesminds.com/v1/chat/completions",+ "stream": "https://api.bluesminds.com/v1/chat/completions"+ }+ },+ "byteplus": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://ark.ap-southeast.bytepluses.com/api/v3/chat/completions",+ "stream": "https://ark.ap-southeast.bytepluses.com/api/v3/chat/completions"+ }+ },+ "bytez": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.bytez.com/models/v2",+ "stream": "https://api.bytez.com/models/v2"+ }+ },+ "cerebras": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.cerebras.ai/v1/chat/completions",+ "stream": "https://api.cerebras.ai/v1/chat/completions"+ }+ },+ "chatgpt-web": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://chatgpt.com/backend-api/conversation",+ "stream": "https://chatgpt.com/backend-api/conversation"+ }+ },+ "chipotle": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://amelia.chipotle.com",+ "stream": "https://amelia.chipotle.com"+ }+ },+ "chutes": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.chutesai.com/v1/chat/completions",+ "stream": "https://api.chutesai.com/v1/chat/completions"+ }+ },+ "claude": {+ "format": "claude",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Anthropic-Beta": "claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28,advisor-tool-2026-03-01,extended-cache-ttl-2025-04-11,cache-diagnosis-2026-04-07",+ "Anthropic-Dangerous-Direct-Browser-Access": "true",+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "User-Agent": "claude-cli/2.1.187 (external, cli)",+ "X-App": "cli",+ "X-Stainless-Arch": "x64",+ "X-Stainless-Helper-Method": "stream",+ "X-Stainless-Lang": "js",+ "X-Stainless-Os": "Linux",+ "X-Stainless-Package-Version": "0.94.0",+ "X-Stainless-Retry-Count": "0",+ "X-Stainless-Runtime": "node",+ "X-Stainless-Runtime-Version": "v24.3.0",+ "X-Stainless-Timeout": "600",+ "x-api-key": "<CRED>"+ },+ "nonStream": {+ "Anthropic-Beta": "claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28,advisor-tool-2026-03-01,extended-cache-ttl-2025-04-11,cache-diagnosis-2026-04-07",+ "Anthropic-Dangerous-Direct-Browser-Access": "true",+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "User-Agent": "claude-cli/2.1.187 (external, cli)",+ "X-App": "cli",+ "X-Stainless-Arch": "x64",+ "X-Stainless-Helper-Method": "stream",+ "X-Stainless-Lang": "js",+ "X-Stainless-Os": "Linux",+ "X-Stainless-Package-Version": "0.94.0",+ "X-Stainless-Retry-Count": "0",+ "X-Stainless-Runtime": "node",+ "X-Stainless-Runtime-Version": "v24.3.0",+ "X-Stainless-Timeout": "600",+ "x-api-key": "<CRED>"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Anthropic-Beta": "claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28,advisor-tool-2026-03-01,extended-cache-ttl-2025-04-11,cache-diagnosis-2026-04-07",+ "Anthropic-Dangerous-Direct-Browser-Access": "true",+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "User-Agent": "claude-cli/2.1.187 (external, cli)",+ "X-App": "cli",+ "X-Stainless-Arch": "x64",+ "X-Stainless-Helper-Method": "stream",+ "X-Stainless-Lang": "js",+ "X-Stainless-Os": "Linux",+ "X-Stainless-Package-Version": "0.94.0",+ "X-Stainless-Retry-Count": "0",+ "X-Stainless-Runtime": "node",+ "X-Stainless-Runtime-Version": "v24.3.0",+ "X-Stainless-Timeout": "600",+ "x-api-key": "<CRED>"+ }+ },+ "url": {+ "nonStream": "https://api.anthropic.com/v1/messages?beta=true",+ "stream": "https://api.anthropic.com/v1/messages?beta=true"+ }+ },+ "claude-web": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://claude.ai/api/organizations",+ "stream": "https://claude.ai/api/organizations"+ }+ },+ "cline": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "HTTP-Referer": "https://cline.bot",+ "User-Agent": "OmniRoute/0.0.0",+ "X-CLIENT-TYPE": "omniroute",+ "X-CLIENT-VERSION": "0.0.0",+ "X-CORE-VERSION": "0.0.0",+ "X-IS-MULTIROOT": "false",+ "X-PLATFORM": "linux",+ "X-PLATFORM-VERSION": "v24.16.0",+ "X-Title": "Cline"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "HTTP-Referer": "https://cline.bot",+ "User-Agent": "OmniRoute/0.0.0",+ "X-CLIENT-TYPE": "omniroute",+ "X-CLIENT-VERSION": "0.0.0",+ "X-CORE-VERSION": "0.0.0",+ "X-IS-MULTIROOT": "false",+ "X-PLATFORM": "linux",+ "X-PLATFORM-VERSION": "v24.16.0",+ "X-Title": "Cline"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "HTTP-Referer": "https://cline.bot",+ "User-Agent": "OmniRoute/0.0.0",+ "X-CLIENT-TYPE": "omniroute",+ "X-CLIENT-VERSION": "0.0.0",+ "X-CORE-VERSION": "0.0.0",+ "X-IS-MULTIROOT": "false",+ "X-PLATFORM": "linux",+ "X-PLATFORM-VERSION": "v24.16.0",+ "X-Title": "Cline"+ }+ },+ "url": {+ "nonStream": "https://api.cline.bot/api/v1/chat/completions",+ "stream": "https://api.cline.bot/api/v1/chat/completions"+ }+ },+ "cloudflare-ai": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.cloudflare.com/client/v4/accounts",+ "stream": "https://api.cloudflare.com/client/v4/accounts"+ }+ },+ "codebuddy-cn": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "User-Agent": "CLI/2.108.1 CodeBuddy/2.108.1",+ "X-IDE-Name": "CLI",+ "X-IDE-Type": "CLI",+ "X-Product": "SaaS",+ "x-codebuddy-request": "1",+ "x-requested-with": "XMLHttpRequest"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "User-Agent": "CLI/2.108.1 CodeBuddy/2.108.1",+ "X-IDE-Name": "CLI",+ "X-IDE-Type": "CLI",+ "X-Product": "SaaS",+ "x-codebuddy-request": "1",+ "x-requested-with": "XMLHttpRequest"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "User-Agent": "CLI/2.108.1 CodeBuddy/2.108.1",+ "X-IDE-Name": "CLI",+ "X-IDE-Type": "CLI",+ "X-Product": "SaaS",+ "x-codebuddy-request": "1",+ "x-requested-with": "XMLHttpRequest"+ }+ },+ "url": {+ "nonStream": "https://copilot.tencent.com/v2/chat/completions",+ "stream": "https://copilot.tencent.com/v2/chat/completions"+ }+ },+ "codestral": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://codestral.mistral.ai/v1/chat/completions",+ "stream": "https://codestral.mistral.ai/v1/chat/completions"+ }+ },+ "codex": {+ "format": "openai-responses",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "Openai-Beta": "responses=experimental",+ "User-Agent": "codex-cli/0.142.0 (Windows 10.0.26200; x64)",+ "Version": "0.142.0",+ "X-Codex-Beta-Features": "responses_websockets"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "Openai-Beta": "responses=experimental",+ "User-Agent": "codex-cli/0.142.0 (Windows 10.0.26200; x64)",+ "Version": "0.142.0",+ "X-Codex-Beta-Features": "responses_websockets"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "Openai-Beta": "responses=experimental",+ "User-Agent": "codex-cli/0.142.0 (Windows 10.0.26200; x64)",+ "Version": "0.142.0",+ "X-Codex-Beta-Features": "responses_websockets"+ }+ },+ "url": {+ "nonStream": "https://chatgpt.com/backend-api/codex/responses",+ "stream": "https://chatgpt.com/backend-api/codex/responses"+ }+ },+ "cohere": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.cohere.com/compatibility/v1/chat/completions",+ "stream": "https://api.cohere.com/compatibility/v1/chat/completions"+ }+ },+ "command-code": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.commandcode.ai",+ "stream": "https://api.commandcode.ai"+ }+ },+ "copilot-web": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "wss://copilot.microsoft.com/c/api/chat?api-version=2",+ "stream": "wss://copilot.microsoft.com/c/api/chat?api-version=2"+ }+ },+ "coze": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.coze.com/v1/chat/completions",+ "stream": "https://api.coze.com/v1/chat/completions"+ }+ },+ "crof": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://crof.ai/v1/chat/completions",+ "stream": "https://crof.ai/v1/chat/completions"+ }+ },+ "cursor": {+ "format": "cursor",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/connect+proto",+ "User-Agent": "Cursor/3.3",+ "connect-accept-encoding": "gzip",+ "connect-protocol-version": "1"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/connect+proto",+ "User-Agent": "Cursor/3.3",+ "connect-accept-encoding": "gzip",+ "connect-protocol-version": "1"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/connect+proto",+ "User-Agent": "Cursor/3.3",+ "connect-accept-encoding": "gzip",+ "connect-protocol-version": "1"+ }+ },+ "url": {+ "nonStream": "https://api2.cursor.sh",+ "stream": "https://api2.cursor.sh"+ }+ },+ "databricks": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://adb-0000000000000000.0.azuredatabricks.net/serving-endpoints",+ "stream": "https://adb-0000000000000000.0.azuredatabricks.net/serving-endpoints"+ }+ },+ "deepinfra": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.deepinfra.com/v1/openai/chat/completions",+ "stream": "https://api.deepinfra.com/v1/openai/chat/completions"+ }+ },+ "deepseek": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.deepseek.com/v1/chat/completions",+ "stream": "https://api.deepseek.com/v1/chat/completions"+ }+ },+ "deepseek-web": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://chat.deepseek.com/api/v0/chat/completion",+ "stream": "https://chat.deepseek.com/api/v0/chat/completion"+ }+ },+ "devin-cli": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "devin://acp/stdio",+ "stream": "devin://acp/stdio"+ }+ },+ "dify": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.dify.ai/v1/chat/completions",+ "stream": "https://api.dify.ai/v1/chat/completions"+ }+ },+ "dit": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.dit.ai/v1/chat/completions",+ "stream": "https://api.dit.ai/v1/chat/completions"+ }+ },+ "doubao": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://ark.cn-beijing.volces.com/api/v3/chat/completions",+ "stream": "https://ark.cn-beijing.volces.com/api/v3/chat/completions"+ }+ },+ "doubao-web": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://www.doubao.com/api/chat",+ "stream": "https://www.doubao.com/api/chat"+ }+ },+ "duckduckgo-web": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://duckduckgo.com/duckchat/v1/chat",+ "stream": "https://duckduckgo.com/duckchat/v1/chat"+ }+ },+ "featherless-ai": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.featherless.ai/v1/chat/completions",+ "stream": "https://api.featherless.ai/v1/chat/completions"+ }+ },+ "fireworks": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.fireworks.ai/inference/v1/chat/completions",+ "stream": "https://api.fireworks.ai/inference/v1/chat/completions"+ }+ },+ "freeaiapikey": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://freeaiapikey.com/v1/chat/completions",+ "stream": "https://freeaiapikey.com/v1/chat/completions"+ }+ },+ "freemodel-dev": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.freemodel.dev/v1/chat/completions",+ "stream": "https://api.freemodel.dev/v1/chat/completions"+ }+ },+ "friendliai": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.friendli.ai/dedicated/v1/chat/completions",+ "stream": "https://api.friendli.ai/dedicated/v1/chat/completions"+ }+ },+ "galadriel": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.galadriel.ai/v1/chat/completions",+ "stream": "https://api.galadriel.ai/v1/chat/completions"+ }+ },+ "gemini": {+ "format": "gemini",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Content-Type": "application/json",+ "x-goog-api-key": "<CRED>"+ },+ "nonStream": {+ "Content-Type": "application/json",+ "x-goog-api-key": "<CRED>"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://generativelanguage.googleapis.com/v1beta/models/test-model:generateContent",+ "stream": "https://generativelanguage.googleapis.com/v1beta/models/test-model:streamGenerateContent?alt=sse"+ }+ },+ "gemini-cli": {+ "format": "gemini-cli",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Content-Type": "application/json",+ "x-goog-api-key": "<CRED>"+ },+ "nonStream": {+ "Content-Type": "application/json",+ "x-goog-api-key": "<CRED>"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://cloudcode-pa.googleapis.com/v1internal:generateContent",+ "stream": "https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse"+ }+ },+ "gemini-web": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://gemini.google.com/app",+ "stream": "https://gemini.google.com/app"+ }+ },+ "gigachat": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://gigachat.devices.sberbank.ru/api/v1",+ "stream": "https://gigachat.devices.sberbank.ru/api/v1"+ }+ },+ "github": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "X-Initiator": "user",+ "copilot-integration-id": "vscode-chat",+ "editor-plugin-version": "copilot-chat/0.45.1",+ "editor-version": "vscode/1.117.0",+ "openai-intent": "conversation-panel",+ "user-agent": "GitHubCopilotChat/0.45.1",+ "x-github-api-version": "2025-04-01",+ "x-request-id": "<UUID>",+ "x-vscode-user-agent-library-version": "electron-fetch"+ },+ "nonStream": {+ "Accept": "application/json",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "X-Initiator": "user",+ "copilot-integration-id": "vscode-chat",+ "editor-plugin-version": "copilot-chat/0.45.1",+ "editor-version": "vscode/1.117.0",+ "openai-intent": "conversation-panel",+ "user-agent": "GitHubCopilotChat/0.45.1",+ "x-github-api-version": "2025-04-01",+ "x-request-id": "<UUID>",+ "x-vscode-user-agent-library-version": "electron-fetch"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "X-Initiator": "user",+ "copilot-integration-id": "vscode-chat",+ "editor-plugin-version": "copilot-chat/0.45.1",+ "editor-version": "vscode/1.117.0",+ "openai-intent": "conversation-panel",+ "user-agent": "GitHubCopilotChat/0.45.1",+ "x-github-api-version": "2025-04-01",+ "x-request-id": "<UUID>",+ "x-vscode-user-agent-library-version": "electron-fetch"+ }+ },+ "url": {+ "nonStream": "https://api.githubcopilot.com/chat/completions",+ "stream": "https://api.githubcopilot.com/chat/completions"+ }+ },+ "github-models": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "X-GitHub-Api-Version": "2022-11-28"+ },+ "nonStream": {+ "Accept": "application/vnd.github+json",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "X-GitHub-Api-Version": "2022-11-28"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "X-GitHub-Api-Version": "2022-11-28"+ }+ },+ "url": {+ "nonStream": "https://models.github.ai/inference/chat/completions",+ "stream": "https://models.github.ai/inference/chat/completions"+ }+ },+ "gitlab-duo": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://gitlab.com/api/v4/code_suggestions/completions",+ "stream": "https://gitlab.com/api/v4/code_suggestions/completions"+ }+ },+ "gitlawb": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "HTTP-Referer": "https://github.com/Gitlawb/openclaude",+ "User-Agent": "OpenClaude/1.0 (linux; x86_64)",+ "X-Title": "OpenClaude CLI"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "HTTP-Referer": "https://github.com/Gitlawb/openclaude",+ "User-Agent": "OpenClaude/1.0 (linux; x86_64)",+ "X-Title": "OpenClaude CLI"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "HTTP-Referer": "https://github.com/Gitlawb/openclaude",+ "User-Agent": "OpenClaude/1.0 (linux; x86_64)",+ "X-Title": "OpenClaude CLI"+ }+ },+ "url": {+ "nonStream": "https://opengateway.gitlawb.com/v1/xiaomi-mimo",+ "stream": "https://opengateway.gitlawb.com/v1/xiaomi-mimo"+ }+ },+ "gitlawb-gmi": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "HTTP-Referer": "https://github.com/Gitlawb/openclaude",+ "User-Agent": "OpenClaude/1.0 (linux; x86_64)",+ "X-Title": "OpenClaude CLI"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "HTTP-Referer": "https://github.com/Gitlawb/openclaude",+ "User-Agent": "OpenClaude/1.0 (linux; x86_64)",+ "X-Title": "OpenClaude CLI"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "HTTP-Referer": "https://github.com/Gitlawb/openclaude",+ "User-Agent": "OpenClaude/1.0 (linux; x86_64)",+ "X-Title": "OpenClaude CLI"+ }+ },+ "url": {+ "nonStream": "https://opengateway.gitlawb.com/v1/gmi-cloud",+ "stream": "https://opengateway.gitlawb.com/v1/gmi-cloud"+ }+ },+ "glhf": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.laf.run/v1/chat/completions",+ "stream": "https://api.laf.run/v1/chat/completions"+ }+ },+ "glm": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.z.ai/api/coding/paas/v4/chat/completions",+ "stream": "https://api.z.ai/api/coding/paas/v4/chat/completions"+ }+ },+ "glm-cn": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://open.bigmodel.cn/api/coding/paas/v4/chat/completions",+ "stream": "https://open.bigmodel.cn/api/coding/paas/v4/chat/completions"+ }+ },+ "glmt": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.z.ai/api/coding/paas/v4/chat/completions",+ "stream": "https://api.z.ai/api/coding/paas/v4/chat/completions"+ }+ },+ "grok-web": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://grok.com/rest/app-chat/conversations/new",+ "stream": "https://grok.com/rest/app-chat/conversations/new"+ }+ },+ "groq": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.groq.com/openai/v1/chat/completions",+ "stream": "https://api.groq.com/openai/v1/chat/completions"+ }+ },+ "hackclub": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://ai.hackclub.com/proxy/v1/chat/completions",+ "stream": "https://ai.hackclub.com/proxy/v1/chat/completions"+ }+ },+ "haiper": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.haiper.ai/v1",+ "stream": "https://api.haiper.ai/v1"+ }+ },+ "heroku": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://us.inference.heroku.com/v1/chat/completions",+ "stream": "https://us.inference.heroku.com/v1/chat/completions"+ }+ },+ "huggingchat": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://huggingface.co/chat/conversation",+ "stream": "https://huggingface.co/chat/conversation"+ }+ },+ "huggingface": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://router.huggingface.co/v1/chat/completions",+ "stream": "https://router.huggingface.co/v1/chat/completions"+ }+ },+ "hyperbolic": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.hyperbolic.xyz/v1/chat/completions",+ "stream": "https://api.hyperbolic.xyz/v1/chat/completions"+ }+ },+ "ideogram": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.ideogram.ai",+ "stream": "https://api.ideogram.ai"+ }+ },+ "iflytek": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://spark-api.xf-yun.com/v1/chat/completions",+ "stream": "https://spark-api.xf-yun.com/v1/chat/completions"+ }+ },+ "inclusionai": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.inclusionai.tech/v1/chat/completions",+ "stream": "https://api.inclusionai.tech/v1/chat/completions"+ }+ },+ "inference-net": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.inference.net/v1/chat/completions",+ "stream": "https://api.inference.net/v1/chat/completions"+ }+ },+ "inner-ai": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://chatapi.innerai.com/chat",+ "stream": "https://chatapi.innerai.com/chat"+ }+ },+ "kie": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.kie.ai/v1/chat/completions",+ "stream": "https://api.kie.ai/v1/chat/completions"+ }+ },+ "kilo-gateway": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.kilo.ai/api/gateway/chat/completions",+ "stream": "https://api.kilo.ai/api/gateway/chat/completions"+ }+ },+ "kilocode": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.kilo.ai/api/openrouter/chat/completions",+ "stream": "https://api.kilo.ai/api/openrouter/chat/completions"+ }+ },+ "kimi": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.moonshot.ai/v1/chat/completions",+ "stream": "https://api.moonshot.ai/v1/chat/completions"+ }+ },+ "kimi-coding": {+ "format": "claude",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "x-api-key": "<CRED>"+ },+ "nonStream": {+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "x-api-key": "<CRED>"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "x-api-key": "<CRED>"+ }+ },+ "url": {+ "nonStream": "https://api.kimi.com/coding/v1/messages?beta=true",+ "stream": "https://api.kimi.com/coding/v1/messages?beta=true"+ }+ },+ "kimi-coding-apikey": {+ "format": "claude",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "x-api-key": "<CRED>"+ },+ "nonStream": {+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "x-api-key": "<CRED>"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "x-api-key": "<CRED>"+ }+ },+ "url": {+ "nonStream": "https://api.kimi.com/coding/v1/messages",+ "stream": "https://api.kimi.com/coding/v1/messages"+ }+ },+ "kimi-web": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://kimi.moonshot.cn/api/chat",+ "stream": "https://kimi.moonshot.cn/api/chat"+ }+ },+ "kiro": {+ "format": "kiro",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "User-Agent": "AWS-SDK-JS/3.0.0 kiro-ide/1.0.0",+ "X-Amz-Target": "AmazonCodeWhispererStreamingService.GenerateAssistantResponse",+ "X-Amz-User-Agent": "aws-sdk-js/3.0.0 kiro-ide/1.0.0"+ },+ "nonStream": {+ "Accept": "application/vnd.amazon.eventstream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "User-Agent": "AWS-SDK-JS/3.0.0 kiro-ide/1.0.0",+ "X-Amz-Target": "AmazonCodeWhispererStreamingService.GenerateAssistantResponse",+ "X-Amz-User-Agent": "aws-sdk-js/3.0.0 kiro-ide/1.0.0"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "User-Agent": "AWS-SDK-JS/3.0.0 kiro-ide/1.0.0",+ "X-Amz-Target": "AmazonCodeWhispererStreamingService.GenerateAssistantResponse",+ "X-Amz-User-Agent": "aws-sdk-js/3.0.0 kiro-ide/1.0.0"+ }+ },+ "url": {+ "nonStream": "https://codewhisperer.us-east-1.amazonaws.com/generateAssistantResponse",+ "stream": "https://codewhisperer.us-east-1.amazonaws.com/generateAssistantResponse"+ }+ },+ "kluster": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.kluster.ai/v1/chat/completions",+ "stream": "https://api.kluster.ai/v1/chat/completions"+ }+ },+ "lambda-ai": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.lambda.ai/v1/chat/completions",+ "stream": "https://api.lambda.ai/v1/chat/completions"+ }+ },+ "leonardo": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://cloud.leonardo.ai/api/rest/v1",+ "stream": "https://cloud.leonardo.ai/api/rest/v1"+ }+ },+ "liquid": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.liquid.ai/v1/chat/completions",+ "stream": "https://api.liquid.ai/v1/chat/completions"+ }+ },+ "llamagate": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://llamagate.ai/v1/chat/completions",+ "stream": "https://llamagate.ai/v1/chat/completions"+ }+ },+ "llm7": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.llm7.io/v1/chat/completions",+ "stream": "https://api.llm7.io/v1/chat/completions"+ }+ },+ "longcat": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.longcat.chat/openai/v1/chat/completions",+ "stream": "https://api.longcat.chat/openai/v1/chat/completions"+ }+ },+ "maritalk": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Key <CRED>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Key <CRED>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Key <CRED>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://chat.maritaca.ai/api",+ "stream": "https://chat.maritaca.ai/api"+ }+ },+ "meta-llama": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.llama.com/compat/v1/chat/completions",+ "stream": "https://api.llama.com/compat/v1/chat/completions"+ }+ },+ "mimocode": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.xiaomimimo.com",+ "stream": "https://api.xiaomimimo.com"+ }+ },+ "minimax": {+ "format": "claude",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Anthropic-Version": "2023-06-01",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Anthropic-Version": "2023-06-01",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Anthropic-Version": "2023-06-01",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.minimax.io/anthropic/v1/messages?beta=true",+ "stream": "https://api.minimax.io/anthropic/v1/messages?beta=true"+ }+ },+ "minimax-cn": {+ "format": "claude",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Anthropic-Version": "2023-06-01",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Anthropic-Version": "2023-06-01",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Anthropic-Version": "2023-06-01",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.minimaxi.com/anthropic/v1/messages?beta=true",+ "stream": "https://api.minimaxi.com/anthropic/v1/messages?beta=true"+ }+ },+ "mistral": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.mistral.ai/v1/chat/completions",+ "stream": "https://api.mistral.ai/v1/chat/completions"+ }+ },+ "modal": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.modal.ai/v1/chat/completions",+ "stream": "https://api.modal.ai/v1/chat/completions"+ }+ },+ "monsterapi": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.monsterapi.ai/v1/chat/completions",+ "stream": "https://api.monsterapi.ai/v1/chat/completions"+ }+ },+ "moonshot": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.moonshot.ai/v1/chat/completions",+ "stream": "https://api.moonshot.ai/v1/chat/completions"+ }+ },+ "morph": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.morphllm.com/v1/chat/completions",+ "stream": "https://api.morphllm.com/v1/chat/completions"+ }+ },+ "muse-spark-web": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://www.meta.ai/api/graphql",+ "stream": "https://www.meta.ai/api/graphql"+ }+ },+ "nanogpt": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://nano-gpt.com/api/v1/chat/completions",+ "stream": "https://nano-gpt.com/api/v1/chat/completions"+ }+ },+ "nebius": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.tokenfactory.nebius.com/v1/chat/completions",+ "stream": "https://api.tokenfactory.nebius.com/v1/chat/completions"+ }+ },+ "nlpcloud": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.nlpcloud.io/v1/chat/completions",+ "stream": "https://api.nlpcloud.io/v1/chat/completions"+ }+ },+ "nous-research": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://inference-api.nousresearch.com/v1/chat/completions",+ "stream": "https://inference-api.nousresearch.com/v1/chat/completions"+ }+ },+ "novita": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.novita.ai/v3/chat/completions",+ "stream": "https://api.novita.ai/v3/chat/completions"+ }+ },+ "nscale": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://inference.api.nscale.com/v1/chat/completions",+ "stream": "https://inference.api.nscale.com/v1/chat/completions"+ }+ },+ "nvidia": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://integrate.api.nvidia.com/v1/chat/completions",+ "stream": "https://integrate.api.nvidia.com/v1/chat/completions"+ }+ },+ "ollama-cloud": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://ollama.com/v1/chat/completions",+ "stream": "https://ollama.com/v1/chat/completions"+ }+ },+ "openadapter": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.openadapter.in/v1/chat/completions",+ "stream": "https://api.openadapter.in/v1/chat/completions"+ }+ },+ "openai": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.openai.com/v1/chat/completions",+ "stream": "https://api.openai.com/v1/chat/completions"+ }+ },+ "opencode": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://opencode.ai/zen/v1",+ "stream": "https://opencode.ai/zen/v1"+ }+ },+ "opencode-go": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://opencode.ai/zen/go/v1",+ "stream": "https://opencode.ai/zen/go/v1"+ }+ },+ "opencode-zen": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://opencode.ai/zen/v1",+ "stream": "https://opencode.ai/zen/v1"+ }+ },+ "openrouter": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "HTTP-Referer": "https://endpoint-proxy.local",+ "X-Title": "Endpoint Proxy"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "HTTP-Referer": "https://endpoint-proxy.local",+ "X-Title": "Endpoint Proxy"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "HTTP-Referer": "https://endpoint-proxy.local",+ "X-Title": "Endpoint Proxy"+ }+ },+ "url": {+ "nonStream": "https://openrouter.ai/api/v1/chat/completions",+ "stream": "https://openrouter.ai/api/v1/chat/completions"+ }+ },+ "orcarouter": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "HTTP-Referer": "https://endpoint-proxy.local",+ "X-Title": "Endpoint Proxy"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "HTTP-Referer": "https://endpoint-proxy.local",+ "X-Title": "Endpoint Proxy"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "HTTP-Referer": "https://endpoint-proxy.local",+ "X-Title": "Endpoint Proxy"+ }+ },+ "url": {+ "nonStream": "https://api.orcarouter.ai/v1",+ "stream": "https://api.orcarouter.ai/v1"+ }+ },+ "ovhcloud": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://oai.endpoints.kepler.ai.cloud.ovh.net/v1/chat/completions",+ "stream": "https://oai.endpoints.kepler.ai.cloud.ovh.net/v1/chat/completions"+ }+ },+ "perplexity": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.perplexity.ai/chat/completions",+ "stream": "https://api.perplexity.ai/chat/completions"+ }+ },+ "perplexity-web": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://www.perplexity.ai/rest/sse/perplexity_ask",+ "stream": "https://www.perplexity.ai/rest/sse/perplexity_ask"+ }+ },+ "phind": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://www.phind.com/api/chat",+ "stream": "https://www.phind.com/api/chat"+ }+ },+ "pollinations": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://gen.pollinations.ai/v1/chat/completions",+ "stream": "https://gen.pollinations.ai/v1/chat/completions"+ }+ },+ "predibase": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://serving.app.predibase.com/v1/chat/completions",+ "stream": "https://serving.app.predibase.com/v1/chat/completions"+ }+ },+ "publicai": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.publicai.co/v1/chat/completions",+ "stream": "https://api.publicai.co/v1/chat/completions"+ }+ },+ "puter": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.puter.com/puterai/openai/v1/chat/completions",+ "stream": "https://api.puter.com/puterai/openai/v1/chat/completions"+ }+ },+ "qianfan": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://qianfan.baidubce.com/v2/chat/completions",+ "stream": "https://qianfan.baidubce.com/v2/chat/completions"+ }+ },+ "qoder": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "User-Agent": "Qoder-Cli"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "User-Agent": "Qoder-Cli"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json",+ "User-Agent": "Qoder-Cli"+ }+ },+ "url": {+ "nonStream": "https://api.qoder.com/v1/chat/completions",+ "stream": "https://api.qoder.com/v1/chat/completions"+ }+ },+ "qwen": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Accept-Language": "*",+ "Authorization": "Bearer <TOK>",+ "Connection": "keep-alive",+ "Content-Type": "application/json",+ "Sec-Fetch-Mode": "cors",+ "User-Agent": "QwenCode/0.15.9 (linux; x64)",+ "X-Dashscope-AuthType": "qwen-oauth",+ "X-Dashscope-CacheControl": "enable",+ "X-Dashscope-UserAgent": "QwenCode/0.15.9 (linux; x64)",+ "X-Stainless-Arch": "x64",+ "X-Stainless-Lang": "js",+ "X-Stainless-Os": "Linux",+ "X-Stainless-Package-Version": "5.11.0",+ "X-Stainless-Retry-Count": "1",+ "X-Stainless-Runtime": "node",+ "X-Stainless-Runtime-Version": "v24.16.0"+ },+ "nonStream": {+ "Accept-Language": "*",+ "Authorization": "Bearer <TOK>",+ "Connection": "keep-alive",+ "Content-Type": "application/json",+ "Sec-Fetch-Mode": "cors",+ "User-Agent": "QwenCode/0.15.9 (linux; x64)",+ "X-Dashscope-AuthType": "qwen-oauth",+ "X-Dashscope-CacheControl": "enable",+ "X-Dashscope-UserAgent": "QwenCode/0.15.9 (linux; x64)",+ "X-Stainless-Arch": "x64",+ "X-Stainless-Lang": "js",+ "X-Stainless-Os": "Linux",+ "X-Stainless-Package-Version": "5.11.0",+ "X-Stainless-Retry-Count": "1",+ "X-Stainless-Runtime": "node",+ "X-Stainless-Runtime-Version": "v24.16.0"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Accept-Language": "*",+ "Authorization": "Bearer <TOK>",+ "Connection": "keep-alive",+ "Content-Type": "application/json",+ "Sec-Fetch-Mode": "cors",+ "User-Agent": "QwenCode/0.15.9 (linux; x64)",+ "X-Dashscope-AuthType": "qwen-oauth",+ "X-Dashscope-CacheControl": "enable",+ "X-Dashscope-UserAgent": "QwenCode/0.15.9 (linux; x64)",+ "X-Stainless-Arch": "x64",+ "X-Stainless-Lang": "js",+ "X-Stainless-Os": "Linux",+ "X-Stainless-Package-Version": "5.11.0",+ "X-Stainless-Retry-Count": "1",+ "X-Stainless-Runtime": "node",+ "X-Stainless-Runtime-Version": "v24.16.0"+ }+ },+ "url": {+ "nonStream": "https://chat.qwen.ai/api/v1/services/aigc/text-generation/generation",+ "stream": "https://chat.qwen.ai/api/v1/services/aigc/text-generation/generation"+ }+ },+ "qwen-web": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://chat.qwen.ai/api/v2/chat/completions",+ "stream": "https://chat.qwen.ai/api/v2/chat/completions"+ }+ },+ "reka": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.reka.ai/v1/chat/completions",+ "stream": "https://api.reka.ai/v1/chat/completions"+ }+ },+ "sambanova": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.sambanova.ai/v1/chat/completions",+ "stream": "https://api.sambanova.ai/v1/chat/completions"+ }+ },+ "scaleway": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.scaleway.ai/v1/chat/completions",+ "stream": "https://api.scaleway.ai/v1/chat/completions"+ }+ },+ "sensenova": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.sensenova.cn/v1/chat/completions",+ "stream": "https://api.sensenova.cn/v1/chat/completions"+ }+ },+ "siliconflow": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.siliconflow.com/v1/chat/completions",+ "stream": "https://api.siliconflow.com/v1/chat/completions"+ }+ },+ "snowflake": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://{account}.snowflakecomputing.com/api/v2",+ "stream": "https://{account}.snowflakecomputing.com/api/v2"+ }+ },+ "sparkdesk": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://spark-api.xf-yun.com/v3.1/chat/completions",+ "stream": "https://spark-api.xf-yun.com/v3.1/chat/completions"+ }+ },+ "stepfun": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.stepfun.com/v1/chat/completions",+ "stream": "https://api.stepfun.com/v1/chat/completions"+ }+ },+ "suno": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://studio-api.suno.ai/api/generate/v2/",+ "stream": "https://studio-api.suno.ai/api/generate/v2/"+ }+ },+ "synthetic": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.synthetic.new/openai/v1/chat/completions",+ "stream": "https://api.synthetic.new/openai/v1/chat/completions"+ }+ },+ "t3-web": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://t3.chat/api/chat",+ "stream": "https://t3.chat/api/chat"+ }+ },+ "tencent": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.hunyuan.cloud.tencent.com/v1/chat/completions",+ "stream": "https://api.hunyuan.cloud.tencent.com/v1/chat/completions"+ }+ },+ "theoldllm": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://theoldllm.vercel.app/api/chatgpt",+ "stream": "https://theoldllm.vercel.app/api/chatgpt"+ }+ },+ "together": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.together.xyz/v1/chat/completions",+ "stream": "https://api.together.xyz/v1/chat/completions"+ }+ },+ "tokenrouter": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.tokenrouter.com/v1/chat/completions",+ "stream": "https://api.tokenrouter.com/v1/chat/completions"+ }+ },+ "trae": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://core-normal.trae.ai/api/remote/v1",+ "stream": "https://core-normal.trae.ai/api/remote/v1"+ }+ },+ "udio": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://www.udio.com/api/generate-proxy",+ "stream": "https://www.udio.com/api/generate-proxy"+ }+ },+ "uncloseai": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://hermes.ai.unturf.com/v1/chat/completions",+ "stream": "https://hermes.ai.unturf.com/v1/chat/completions"+ }+ },+ "upstage": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.upstage.ai/v1/chat/completions",+ "stream": "https://api.upstage.ai/v1/chat/completions"+ }+ },+ "v0-vercel": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.v0.dev/v1/chat/completions",+ "stream": "https://api.v0.dev/v1/chat/completions"+ }+ },+ "venice": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.venice.ai/api/v1/chat/completions",+ "stream": "https://api.venice.ai/api/v1/chat/completions"+ }+ },+ "veoaifree-web": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://veoaifree.com/wp-admin/admin-ajax.php",+ "stream": "https://veoaifree.com/wp-admin/admin-ajax.php"+ }+ },+ "vercel-ai-gateway": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://ai-gateway.vercel.sh/v1/chat/completions",+ "stream": "https://ai-gateway.vercel.sh/v1/chat/completions"+ }+ },+ "vertex": {+ "format": "gemini",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://generativelanguage.googleapis.com/v1beta/models/test-model:generateContent",+ "stream": "https://generativelanguage.googleapis.com/v1beta/models/test-model:streamGenerateContent?alt=sse"+ }+ },+ "vertex-partner": {+ "format": "gemini",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://us-central1-aiplatform.googleapis.com/v1/projects",+ "stream": "https://us-central1-aiplatform.googleapis.com/v1/projects"+ }+ },+ "volcengine": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://ark.cn-beijing.volces.com/api/v3/chat/completions",+ "stream": "https://ark.cn-beijing.volces.com/api/v3/chat/completions"+ }+ },+ "wafer": {+ "format": "claude",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Anthropic-Version": "2023-06-01",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Anthropic-Version": "2023-06-01",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Anthropic-Version": "2023-06-01",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://pass.wafer.ai/v1/messages",+ "stream": "https://pass.wafer.ai/v1/messages"+ }+ },+ "wandb": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.inference.wandb.ai/v1/chat/completions",+ "stream": "https://api.inference.wandb.ai/v1/chat/completions"+ }+ },+ "windsurf": {+ "format": "windsurf",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://server.self-serve.windsurf.com",+ "stream": "https://server.self-serve.windsurf.com"+ }+ },+ "xai": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.x.ai/v1/chat/completions",+ "stream": "https://api.x.ai/v1/chat/completions"+ }+ },+ "xiaomi-mimo": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.xiaomimimo.com/v1",+ "stream": "https://api.xiaomimimo.com/v1"+ }+ },+ "yi": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://api.lingyiwanwu.com/v1/chat/completions",+ "stream": "https://api.lingyiwanwu.com/v1/chat/completions"+ }+ },+ "zai": {+ "format": "claude",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "x-api-key": "<CRED>"+ },+ "nonStream": {+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "x-api-key": "<CRED>"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Anthropic-Version": "2023-06-01",+ "Content-Type": "application/json",+ "x-api-key": "<CRED>"+ }+ },+ "url": {+ "nonStream": "https://api.z.ai/api/anthropic/v1/messages?beta=true",+ "stream": "https://api.z.ai/api/anthropic/v1/messages?beta=true"+ }+ },+ "zenmux": {+ "format": "openai",+ "headers": {+ "apiKey": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "nonStream": {+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ },+ "oauth": {+ "Accept": "text/event-stream",+ "Authorization": "Bearer <TOK>",+ "Content-Type": "application/json"+ }+ },+ "url": {+ "nonStream": "https://zenmux.ai/api/v1/chat/completions",+ "stream": "https://zenmux.ai/api/v1/chat/completions"+ }+ }+}diff --git a/tests/unit/antigravity-retry-hook.test.ts b/tests/unit/antigravity-retry-hook.test.tsnew file mode 100644index 0000000000..8c1328aedb--- /dev/null+++ b/tests/unit/antigravity-retry-hook.test.ts@@ -0,0 +1,141 @@+/**+ * TDD tests for port of upstream PR #2054 (decolua/9router):+ * fix(antigravity): retry transient upstream failures+ *+ * Covers:+ * 1. isTransientAntigravityError classifies 5xx + body patterns correctly+ * 2. extractErrorMessage extracts message from various JSON shapes+ * 3. Tool-name deduplication in buildGeminiTools (via geminiToolsSanitizer)+ */++import { test } from "node:test";+import assert from "node:assert/strict";++import { AntigravityExecutor } from "../../open-sse/executors/antigravity.ts";+import { buildGeminiTools } from "../../open-sse/translator/helpers/geminiToolsSanitizer.ts";++// ── isTransientAntigravityError ────────────────────────────────────────────────++test("isTransientAntigravityError: 503 → true (transient status)", () => {+ const ex = new AntigravityExecutor();+ assert.equal(ex.isTransientAntigravityError(503, ""), true);+});++test("isTransientAntigravityError: 500 + 'Agent execution terminated due to error' body → true", () => {+ const ex = new AntigravityExecutor();+ assert.equal(+ ex.isTransientAntigravityError(500, "Agent execution terminated due to error"),+ true+ );+});++test("isTransientAntigravityError: 500 + 'high traffic' body → true", () => {+ const ex = new AntigravityExecutor();+ assert.equal(ex.isTransientAntigravityError(500, "high traffic"), true);+});++test("isTransientAntigravityError: 500 + 'capacity' body → true", () => {+ const ex = new AntigravityExecutor();+ assert.equal(ex.isTransientAntigravityError(500, "service is at capacity"), true);+});++test("isTransientAntigravityError: 400 + 'Invalid request' body → false (veto)", () => {+ const ex = new AntigravityExecutor();+ assert.equal(ex.isTransientAntigravityError(400, "Invalid request"), false);+});++test("isTransientAntigravityError: 404 → false", () => {+ const ex = new AntigravityExecutor();+ assert.equal(ex.isTransientAntigravityError(404, "not found"), false);+});++test("isTransientAntigravityError: 429 → true (rate limited is transient)", () => {+ const ex = new AntigravityExecutor();+ assert.equal(ex.isTransientAntigravityError(429, ""), true);+});++test("isTransientAntigravityError: 502 → true (bad gateway is transient)", () => {+ const ex = new AntigravityExecutor();+ assert.equal(ex.isTransientAntigravityError(502, ""), true);+});++test("isTransientAntigravityError: 504 → true (gateway timeout is transient)", () => {+ const ex = new AntigravityExecutor();+ assert.equal(ex.isTransientAntigravityError(504, ""), true);+});++// ── extractErrorMessage ────────────────────────────────────────────────────────++test("extractErrorMessage: extracts error.message from standard JSON shape", () => {+ const ex = new AntigravityExecutor();+ const json = { error: { message: "quota exceeded" } };+ const msg = ex.extractErrorMessage(json, "");+ assert.ok(msg.includes("quota exceeded"), `expected 'quota exceeded' in: ${msg}`);+});++test("extractErrorMessage: falls back to top-level message field", () => {+ const ex = new AntigravityExecutor();+ const json = { message: "service unavailable" };+ const msg = ex.extractErrorMessage(json, "");+ assert.ok(msg.includes("service unavailable"), `expected 'service unavailable' in: ${msg}`);+});++test("extractErrorMessage: falls back to bodyText when json has no message", () => {+ const ex = new AntigravityExecutor();+ const msg = ex.extractErrorMessage(null, "raw error body text");+ assert.ok(msg.includes("raw error body text"), `expected body text in: ${msg}`);+});++// ── Tool-name deduplication ────────────────────────────────────────────────────++test("buildGeminiTools: deduplicates tool names that sanitize to the same value", () => {+ // "read/file" and "read/file" appear twice → only one after dedup+ const tools = [+ {+ functionDeclarations: [+ {+ name: "read/file",+ description: "Read a file",+ parameters: { type: "object", properties: {} },+ },+ {+ name: "read/file",+ description: "Read a file (dup)",+ parameters: { type: "object", properties: {} },+ },+ ],+ },+ ];++ const result = buildGeminiTools(tools);+ assert.ok(Array.isArray(result), "should return array");+ const decls = result![0]?.functionDeclarations ?? [];+ // After sanitizing "read/file" → "read_file", both resolve to same name; only 1 should remain+ const names = decls.map((d) => d.name);+ assert.equal(new Set(names).size, names.length, `Duplicate names found: ${names}`);+ assert.equal(names.length, 1, `Expected 1 declaration, got ${names.length}: ${names}`);+});++test("buildGeminiTools: tools with different sanitized names are both kept", () => {+ const tools = [+ {+ functionDeclarations: [+ {+ name: "read_file",+ description: "Read a file",+ parameters: { type: "object", properties: {} },+ },+ {+ name: "write_file",+ description: "Write a file",+ parameters: { type: "object", properties: {} },+ },+ ],+ },+ ];++ const result = buildGeminiTools(tools);+ assert.ok(Array.isArray(result), "should return array");+ const decls = result![0]?.functionDeclarations ?? [];+ assert.equal(decls.length, 2, `Expected 2 declarations, got ${decls.length}`);+});diff --git a/tests/unit/antigravity-strip-builtin-tools-funcdecls-1095.test.ts b/tests/unit/antigravity-strip-builtin-tools-funcdecls-1095.test.tsnew file mode 100644index 0000000000..d7ccf8e954--- /dev/null+++ b/tests/unit/antigravity-strip-builtin-tools-funcdecls-1095.test.ts@@ -0,0 +1,102 @@+import test from "node:test";+import assert from "node:assert/strict";++import { openaiToAntigravityRequest } from "../../open-sse/translator/request/openai-to-gemini.ts";++// Regression guard for the Antigravity v1internal 400 that fires when a Gemini+// built-in tool (google_search / web_search / googleSearch ...) is sent in the+// same request as functionDeclarations. The Cloud Code envelope must strip the+// built-in tool names out of functionDeclarations before dispatch.+// Inspired-by decolua/9router#1095 (author @vanszs).++type EnvelopeTool = { functionDeclarations?: Array<{ name: string }> };++function declaredToolNames(result: { request: { tools?: EnvelopeTool[] } }): string[] {+ return (result.request.tools ?? []).flatMap((tool) =>+ (tool.functionDeclarations ?? []).map((fn) => fn.name)+ );+}++const CREDS = { projectId: "proj-1" } as never;++test("Antigravity envelope strips built-in tool names mixed with custom functionDeclarations (#1095)", () => {+ const result = openaiToAntigravityRequest(+ "gemini-2.5-pro",+ {+ messages: [{ role: "user", content: "Search and read" }],+ tools: [+ {+ type: "function",+ function: { name: "google_search", parameters: { type: "object", properties: {} } },+ },+ {+ type: "function",+ function: { name: "read_file", parameters: { type: "object", properties: {} } },+ },+ ],+ },+ false,+ CREDS+ );++ const names = declaredToolNames(result);+ // Built-in tool name must be gone from functionDeclarations...+ assert.ok(+ !names.includes("google_search") && !names.includes("googleSearch"),+ `expected built-in tool name stripped, got ${JSON.stringify(names)}`+ );+ // ...while the custom declaration survives.+ assert.ok(names.includes("read_file"), `expected custom tool kept, got ${JSON.stringify(names)}`);+ // toolConfig stays set because custom declarations remain.+ assert.deepEqual(result.request.toolConfig, {+ functionCallingConfig: { mode: "VALIDATED" },+ });+});++test("Antigravity envelope keeps a normal custom-only tool request intact (#1095 regression)", () => {+ const result = openaiToAntigravityRequest(+ "gemini-2.5-pro",+ {+ messages: [{ role: "user", content: "Hello" }],+ tools: [+ {+ type: "function",+ function: { name: "weather", parameters: { type: "object", properties: {} } },+ },+ ],+ },+ false,+ CREDS+ );++ const names = declaredToolNames(result);+ assert.deepEqual(names, ["weather"]);+ assert.deepEqual(result.request.toolConfig, {+ functionCallingConfig: { mode: "VALIDATED" },+ });+});++test("Antigravity envelope drops tools + toolConfig when only built-in tools are present (#1095)", () => {+ const result = openaiToAntigravityRequest(+ "gemini-2.5-pro",+ {+ messages: [{ role: "user", content: "Search the web" }],+ tools: [+ {+ type: "function",+ function: { name: "google_search", parameters: { type: "object", properties: {} } },+ },+ ],+ },+ false,+ CREDS+ );++ const names = declaredToolNames(result);+ assert.ok(+ !names.includes("google_search") && !names.includes("googleSearch"),+ `expected no built-in functionDeclarations, got ${JSON.stringify(names)}`+ );+ // No custom declarations remain -> no VALIDATED toolConfig is forced.+ assert.equal(result.request.toolConfig, undefined);+});diff --git a/tests/unit/antigravity-tool-cloaking.test.ts b/tests/unit/antigravity-tool-cloaking.test.tsindex cf413718e4..3770eab655 100644--- a/tests/unit/antigravity-tool-cloaking.test.ts+++ b/tests/unit/antigravity-tool-cloaking.test.ts@@ -5,6 +5,7 @@ import {AG_DECOY_TOOLS,AG_TOOL_SUFFIX,cloakAntigravityToolPayload,+ stripEnumDescriptions,} from "../../open-sse/config/toolCloaking.ts";test("cloakAntigravityToolPayload cloaks custom tools, preserves native tools and injects decoys", () => {@@ -92,3 +93,101 @@ test("cloakAntigravityToolPayload composes namespace sanitization maps with Anti"mcp__filesystem__workspace_read");});++test("stripEnumDescriptions removes enumDescriptions at every nesting level", () => {+ const schema = {+ type: "OBJECT",+ enumDescriptions: ["should be removed at root"],+ properties: {+ mode: {+ type: "STRING",+ enum: ["a", "b"],+ enumDescriptions: ["desc a", "desc b"],+ },+ nested: {+ type: "OBJECT",+ properties: {+ choice: {+ type: "STRING",+ enumDescriptions: ["deep desc"],+ },+ },+ },+ list: {+ type: "ARRAY",+ items: {+ type: "STRING",+ enumDescriptions: ["item desc"],+ },+ },+ },+ };++ const stripped = stripEnumDescriptions(schema) as any;++ assert.equal("enumDescriptions" in stripped, false);+ assert.equal("enumDescriptions" in stripped.properties.mode, false);+ assert.equal("enumDescriptions" in stripped.properties.nested.properties.choice, false);+ assert.equal("enumDescriptions" in stripped.properties.list.items, false);+ // Non-target fields are preserved.+ assert.deepEqual(stripped.properties.mode.enum, ["a", "b"]);+ // Input is not mutated.+ assert.ok(Array.isArray((schema.properties.mode as any).enumDescriptions));+});++test("cloakAntigravityToolPayload strips enumDescriptions from declaration parameters", () => {+ const payload = {+ request: {+ tools: [+ {+ functionDeclarations: [+ {+ name: "workspace_read",+ description: "Read a file",+ parameters: {+ type: "OBJECT",+ enumDescriptions: ["root-level"],+ properties: {+ mode: {+ type: "STRING",+ enum: ["read", "write"],+ enumDescriptions: ["read mode", "write mode"],+ },+ },+ },+ },+ {+ name: "run_command",+ description: "Native tool keeps visible name but loses enumDescriptions",+ parameters: {+ type: "OBJECT",+ properties: {+ shell: {+ type: "STRING",+ enumDescriptions: ["bash", "zsh"],+ },+ },+ },+ },+ ],+ },+ ],+ contents: [],+ },+ };++ const result = cloakAntigravityToolPayload(payload);+ const declarations = (result.body.request.tools?.[0] as any)?.functionDeclarations || [];++ const cloaked = declarations.find(+ (d: { name: string }) => d.name === `workspace_read${AG_TOOL_SUFFIX}`+ );+ assert.ok(cloaked, "cloaked client tool present");+ assert.equal("enumDescriptions" in cloaked.parameters, false);+ assert.equal("enumDescriptions" in cloaked.parameters.properties.mode, false);+ assert.deepEqual(cloaked.parameters.properties.mode.enum, ["read", "write"]);++ const native = declarations.find((d: { name: string }) => d.name === "run_command");+ assert.ok(native, "native tool preserved");+ assert.equal("enumDescriptions" in native.parameters.properties.shell, false);+});diff --git a/tests/unit/api-manager-mask-key-passthrough.test.ts b/tests/unit/api-manager-mask-key-passthrough.test.tsnew file mode 100644index 0000000000..27706872f4--- /dev/null+++ b/tests/unit/api-manager-mask-key-passthrough.test.ts@@ -0,0 +1,39 @@+import test from "node:test";+import assert from "node:assert/strict";+import { maskKey } from "../../src/app/(dashboard)/dashboard/api-manager/apiManagerPageUtils.ts";+import { maskStoredApiKey } from "../../src/lib/apiKeyExposure.ts";++/**+ * Regression guard for #4671 (stop double-masking already-masked API keys).+ *+ * The keys-list endpoint (`/api/keys`) returns `key` already masked via+ * `maskStoredApiKey` → `slice(0,8) + "****" + slice(-4)`, which preserves the+ * last-4 suffix (e.g. `sk-live-****1002`). The dashboard list used to render that+ * value through `maskKey()` a SECOND time. Before maskKey gained its `"****"`+ * passthrough guard, the second pass truncated the value to `sk-live-...`,+ * dropping the suffix the user relies on to tell keys apart.+ *+ * #4671 drops the redundant `maskKey(key.key)` call and renders `key.key`+ * verbatim. These tests pin the invariant that makes that simplification safe:+ * an already-masked (`"****"`-bearing) value must round-trip unchanged through+ * maskKey, so `key.key` and `maskKey(key.key)` are equivalent for the real+ * server format. (At the pre-guard maskKey the second assertion would fail,+ * which is exactly the historical double-mask bug.)+ */+test("maskKey returns an already-masked (****) value verbatim — no double-mask", () => {+ const serverMasked = maskStoredApiKey("sk-live-abcdefgh-secret-tail-1002");+ assert.ok(serverMasked && serverMasked.includes("****"));+ // The suffix the user identifies the key by must survive.+ assert.ok(serverMasked.endsWith("1002"), "server mask must preserve the last-4 suffix");+ // The dashboard renders key.key directly; that must equal what maskKey would+ // have produced, i.e. the verbatim already-masked value (no truncation).+ assert.equal(maskKey(serverMasked), serverMasked);+});++test("maskKey still masks a fully-revealed key (no '****') — first-pass behavior intact", () => {+ // A genuinely unmasked key (no "****") must still be shortened, so removing the+ // redundant second pass does not weaken masking of truly-revealed values.+ const full = "sk-live-abcdefgh-secret-tail-1002";+ assert.ok(!full.includes("****"));+ assert.equal(maskKey(full), "sk-live-...");+});diff --git a/tests/unit/authz/route-guard-local-prefix.test.ts b/tests/unit/authz/route-guard-local-prefix.test.tsindex 54cb8538fc..cce40edc55 100644--- a/tests/unit/authz/route-guard-local-prefix.test.ts+++ b/tests/unit/authz/route-guard-local-prefix.test.ts@@ -27,6 +27,25 @@ test("isLocalOnlyPath: /api/local* does NOT match the bare /api/localificationsassert.equal(isLocalOnlyPath("/api/localhost-check"), false);});+// ─── /api/oauth/cursor/auto-import is local-only (spawns `which cursor`) ──++test("isLocalOnlyPath: /api/oauth/cursor/auto-import is local-only (spawns child process)", () => {+ // The Cursor auto-import route runs `execFile("which", ["cursor"])` to verify a+ // local Cursor install before importing its credentials — a child-process spawn+ // that must be loopback-enforced BEFORE any auth check (Hard Rules #15/#17), so a+ // leaked JWT via tunnel cannot reach the spawn. Found by check:route-guard-membership.+ assert.equal(isLocalOnlyPath("/api/oauth/cursor/auto-import"), true);+});++test("isLocalOnlyPath: the rest of /api/oauth/ stays remote-reachable (no over-broadening)", () => {+ // Only the spawn-capable auto-import path is loopback-locked. The rest of the OAuth+ // surface (browser redirect / callback flows) MUST remain reachable remotely — a+ // flat /api/oauth/ prefix would wrongly lock the whole OAuth subtree.+ assert.equal(isLocalOnlyPath("/api/oauth/cursor"), false);+ assert.equal(isLocalOnlyPath("/api/oauth/cursor/callback"), false);+ assert.equal(isLocalOnlyPath("/api/oauth/anthropic/callback"), false);+});+test("isLocalOnlyBypassableByManageScope: /api/local/ is NOT bypassable (defence in depth)", () => {// The kill-switch path. Even if a DB row tries to whitelist /api/local/ via// the manage-scope bypass list, the runtime predicate must reject it becausediff --git a/tests/unit/chat-auth-log-redaction.test.ts b/tests/unit/chat-auth-log-redaction.test.tsnew file mode 100644index 0000000000..ea8437c93e--- /dev/null+++ b/tests/unit/chat-auth-log-redaction.test.ts@@ -0,0 +1,43 @@+import { test } from "node:test";+import assert from "node:assert/strict";+import { readFileSync } from "node:fs";+import { fileURLToPath } from "node:url";+import { dirname, resolve } from "node:path";++/**+ * Regression guard: the AUTH debug log in the SSE chat handler must NOT+ * emit any form of the API key — not even a masked prefix/last4 — because+ * such logs get copied verbatim into bug reports and support tickets.+ *+ * Before the fix, src/sse/handlers/chat.ts logged:+ * log.debug("AUTH", `API Key: ${log.maskKey(apiKey)}`)+ * which leaks a masked key. After the fix it logs a fixed string:+ * log.debug("AUTH", "API key provided")+ *+ * Ported from decolua/9router#1794 (thanks @sacwooky).+ */+const here = dirname(fileURLToPath(import.meta.url));+const chatHandlerPath = resolve(here, "../../src/sse/handlers/chat.ts");++test("chat handler AUTH debug log does not interpolate the (masked) api key", () => {+ const src = readFileSync(chatHandlerPath, "utf8");++ // The leaky pattern: a debug log that interpolates maskKey(apiKey).+ assert.ok(+ !/log\.debug\([^)]*maskKey\(/s.test(src),+ "chat.ts must not pass log.maskKey(apiKey) into a debug log — it leaks the key into logs/bug reports"+ );++ // And no "API Key: ${...}" style interpolation in a debug AUTH line.+ assert.ok(+ !/log\.debug\(\s*["']AUTH["']\s*,\s*`[^`]*API Key:[^`]*\$\{/s.test(src),+ 'chat.ts must not log `API Key: ${...}` — use a fixed "API key provided" string instead'+ );++ // Positive assertion: the redacted fixed string is present.+ assert.match(+ src,+ /log\.debug\(\s*["']AUTH["']\s*,\s*["']API key provided["']\s*\)/,+ 'chat.ts should log the fixed "API key provided" string when an api key is present'+ );+});diff --git a/tests/unit/circuit-breaker-stream-controller-4602.test.ts b/tests/unit/circuit-breaker-stream-controller-4602.test.tsnew file mode 100644index 0000000000..941d39d997--- /dev/null+++ b/tests/unit/circuit-breaker-stream-controller-4602.test.ts@@ -0,0 +1,79 @@+/**+ * #4602 — Codex WebSocket bridge failures must not trip the whole-provider+ * circuit breaker.+ *+ * When `codexTransport = websocket`, a `/v1/responses` request can fail in+ * ~300ms with a bare `Invalid state: Controller is already closed` throw (the+ * WS→SSE bridge enqueues after the response controller is closed). That error+ * carries no `statusCode`, so it defaults to HTTP 502, and 502 is a+ * provider-failure code — a burst trips the OAuth provider breaker (threshold+ * 3) and every subsequent Codex request fails with `503 ... circuit breaker is+ * open`, even on the healthy HTTP/SSE path. A local stream-lifecycle error is+ * NOT an upstream provider outage and must be excluded from the breaker.+ */+import { test } from "node:test";+import assert from "node:assert/strict";+import {+ CircuitBreaker,+ isLocalStreamLifecycleError,+} from "../../src/shared/utils/circuitBreaker.ts";++const uniqueName = (suffix: string) =>+ `cb-test-#4602-${suffix}-${Date.now()}-${Math.floor(Math.random() * 1e6)}`;++test("#4602 isLocalStreamLifecycleError flags the WS controller-closed error and nothing else", () => {+ assert.equal(+ isLocalStreamLifecycleError(new Error("Invalid state: Controller is already closed")),+ true+ );+ assert.equal(+ isLocalStreamLifecycleError({ message: "Controller is already closed" }),+ true+ );+ // Real upstream failures must still count.+ assert.equal(isLocalStreamLifecycleError(new Error("502 Bad Gateway")), false);+ assert.equal(isLocalStreamLifecycleError(new Error("upstream timed out")), false);+ assert.equal(isLocalStreamLifecycleError(undefined), false);+ assert.equal(isLocalStreamLifecycleError(null), false);+});++test("#4602 breaker stays CLOSED when only the WS controller-closed error is thrown", async () => {+ const cb = new CircuitBreaker(uniqueName("ws-closed"), {+ failureThreshold: 3,+ resetTimeout: 30_000,+ isFailure: (e) => !isLocalStreamLifecycleError(e),+ });++ for (let i = 0; i < 5; i++) {+ await assert.rejects(+ cb.execute(async () => {+ throw new Error("Invalid state: Controller is already closed");+ }),+ /Controller is already closed/+ );+ }++ // 5 bridge errors past a threshold of 3 — the provider breaker must NOT open.+ assert.equal(cb.state, "CLOSED");+ assert.equal(cb.failureCount, 0);+ cb.reset();+});++test("#4602 a genuine upstream failure still trips the breaker with the same isFailure guard", async () => {+ const cb = new CircuitBreaker(uniqueName("real-failure"), {+ failureThreshold: 3,+ resetTimeout: 30_000,+ isFailure: (e) => !isLocalStreamLifecycleError(e),+ });++ for (let i = 0; i < 3; i++) {+ await assert.rejects(+ cb.execute(async () => {+ throw new Error("502 Bad Gateway from upstream");+ })+ );+ }++ assert.equal(cb.state, "OPEN");+ cb.reset();+});diff --git a/tests/unit/cli/autostart-macos-launchctl.test.ts b/tests/unit/cli/autostart-macos-launchctl.test.tsnew file mode 100644index 0000000000..329bbb1bff--- /dev/null+++ b/tests/unit/cli/autostart-macos-launchctl.test.ts@@ -0,0 +1,91 @@+import test from "node:test";+import assert from "node:assert/strict";+import { readFileSync } from "node:fs";+import { join } from "node:path";+import {+ parseAgentSelfFromLaunchctl,+ isLaunchdAgentLoaded,+} from "../../../bin/cli/tray/autostart.mjs";++// ---------------------------------------------------------------------------+// parseAgentSelfFromLaunchctl — pure parse of `launchctl list <label>` output.+// True only when the agent's "PID" line matches the current process PID, so the+// enable()/disable() macOS paths can skip launchctl unload/load when the running+// process IS the autostart agent (the unload would self-SIGTERM the tray).+// ---------------------------------------------------------------------------++test("parseAgentSelfFromLaunchctl returns true when PID matches", () => {+ const output = `{+\t"StandardOutPath" = "/tmp/omniroute.out.log";+\t"PID" = 4242;+\t"Label" = "com.omniroute.autostart";+}`;+ assert.equal(parseAgentSelfFromLaunchctl(output, 4242), true);+});++test("parseAgentSelfFromLaunchctl returns false when PID differs", () => {+ const output = `{+\t"PID" = 9999;+\t"Label" = "com.omniroute.autostart";+}`;+ assert.equal(parseAgentSelfFromLaunchctl(output, 4242), false);+});++test("parseAgentSelfFromLaunchctl returns false when no PID present", () => {+ // Loaded-but-not-running agent: launchctl omits the PID key.+ const output = `{+\t"Label" = "com.omniroute.autostart";+\t"LastExitStatus" = 0;+}`;+ assert.equal(parseAgentSelfFromLaunchctl(output, 4242), false);+});++test("parseAgentSelfFromLaunchctl tolerates whitespace variations", () => {+ assert.equal(parseAgentSelfFromLaunchctl('"PID"=4242;', 4242), true);+ assert.equal(parseAgentSelfFromLaunchctl('"PID" = 4242 ;', 4242), true);+});++test("parseAgentSelfFromLaunchctl returns false on empty/garbage", () => {+ assert.equal(parseAgentSelfFromLaunchctl("", 4242), false);+ assert.equal(parseAgentSelfFromLaunchctl("not launchctl output", 4242), false);+});++// ---------------------------------------------------------------------------+// isLaunchdAgentLoaded — true only when `launchctl list <label>` succeeds.+// This is what closes the false-"Enabled" gap: a plist on disk that launchd+// does not actually recognize must report NOT enabled.+// ---------------------------------------------------------------------------++test("isLaunchdAgentLoaded returns true when launchctl list succeeds", () => {+ const ran = isLaunchdAgentLoaded(() => {+ /* launchctl exited 0 — agent recognized */+ });+ assert.equal(ran, true);+});++test("isLaunchdAgentLoaded returns false when launchctl list throws", () => {+ const ran = isLaunchdAgentLoaded(() => {+ throw new Error("Could not find service");+ });+ assert.equal(ran, false);+});++// ---------------------------------------------------------------------------+// Source-level guard: isEnabledMac() must verify with launchctl, not just the+// plist file existence. Mirrors the repo's existing Linux source-assertion test+// (the darwin branch can't execute on the Linux CI runner).+// ---------------------------------------------------------------------------++test("isEnabledMac verifies launchd registration, not just plist existence", () => {+ const source = readFileSync(join(process.cwd(), "bin/cli/tray/autostart.mjs"), "utf8");+ // The verification helper is wired into the darwin enabled-check.+ assert.match(source, /isLaunchdAgentLoaded/);+ // launchctl list is queried with the app label, no shell interpolation.+ assert.match(source, /launchctl",\s*\["list",\s*APP_LABEL\]/);+});++test("enable/disable macOS skip launchctl when the current process is the agent", () => {+ const source = readFileSync(join(process.cwd(), "bin/cli/tray/autostart.mjs"), "utf8");+ assert.match(source, /isAgentSelfMac/);+ assert.match(source, /parseAgentSelfFromLaunchctl/);+});diff --git a/tests/unit/cline-workos-auth-token-shape.test.ts b/tests/unit/cline-workos-auth-token-shape.test.tsnew file mode 100644index 0000000000..595ff5d88d--- /dev/null+++ b/tests/unit/cline-workos-auth-token-shape.test.ts@@ -0,0 +1,73 @@+import test from "node:test";+import assert from "node:assert/strict";++import {+ buildClineHeaders,+ getClineAccessToken,+ getClineAuthorizationHeader,+} from "../../src/shared/utils/clineAuth.ts";+import { buildProviderHeaders } from "../../open-sse/services/provider.ts";+import { DefaultExecutor } from "../../open-sse/executors/default.ts";++test("getClineAccessToken prefixes the token with workos:", () => {+ assert.equal(getClineAccessToken("abc123"), "workos:abc123");+});++test("getClineAccessToken is idempotent when already prefixed", () => {+ assert.equal(getClineAccessToken("workos:abc123"), "workos:abc123");+});++test("getClineAccessToken trims and rejects empty / non-string input", () => {+ assert.equal(getClineAccessToken(" abc123 "), "workos:abc123");+ assert.equal(getClineAccessToken(" "), "");+ assert.equal(getClineAccessToken(""), "");+ assert.equal(getClineAccessToken(undefined), "");+ assert.equal(getClineAccessToken(null), "");+ assert.equal(getClineAccessToken(42), "");+});++test("getClineAuthorizationHeader builds a workos-prefixed bearer header", () => {+ assert.equal(getClineAuthorizationHeader("abc123"), "Bearer workos:abc123");+ assert.equal(getClineAuthorizationHeader(""), "");+});++test("buildClineHeaders emits the full cline client header set", () => {+ const headers = buildClineHeaders("abc123");+ assert.equal(headers.Authorization, "Bearer workos:abc123");+ assert.equal(headers["HTTP-Referer"], "https://cline.bot");+ assert.equal(headers["X-Title"], "Cline");+ assert.equal(headers["X-CLIENT-TYPE"], "omniroute");+ assert.equal(headers["X-IS-MULTIROOT"], "false");+ // Branding must be OmniRoute, never 9Router.+ assert.ok(/^OmniRoute\//.test(headers["User-Agent"]));+ assert.ok(!/9router/i.test(JSON.stringify(headers)));+});++test("buildClineHeaders merges extra headers and omits Authorization with no token", () => {+ const headers = buildClineHeaders("", { Accept: "application/json" });+ assert.equal(headers.Accept, "application/json");+ assert.ok(!("Authorization" in headers));+ // Client-identification headers are still present even without a token.+ assert.equal(headers["X-CLIENT-TYPE"], "omniroute");+});++test("buildProviderHeaders uses the cline workos auth token shape", () => {+ const headers = buildProviderHeaders("cline", { apiKey: "tok-abc" }, true);+ assert.equal(headers.Authorization, "Bearer workos:tok-abc");+ assert.equal(headers["HTTP-Referer"], "https://cline.bot");+ assert.equal(headers["X-CLIENT-TYPE"], "omniroute");+});++test("buildProviderHeaders honors an accessToken for cline", () => {+ const headers = buildProviderHeaders("cline", { accessToken: "acc-xyz" }, false);+ assert.equal(headers.Authorization, "Bearer workos:acc-xyz");+});++test("DefaultExecutor.buildHeaders uses the cline workos auth token shape", () => {+ const executor = new DefaultExecutor("cline");+ const headers = executor.buildHeaders({ apiKey: "tok-abc" }, true);+ assert.equal(headers.Authorization, "Bearer workos:tok-abc");+ assert.equal(headers["HTTP-Referer"], "https://cline.bot");+ assert.equal(headers["X-CLIENT-TYPE"], "omniroute");+ assert.equal(headers["X-Title"], "Cline");+});diff --git a/tests/unit/codexBulkImport.test.ts b/tests/unit/codexBulkImport.test.tsnew file mode 100644index 0000000000..7551fe330b--- /dev/null+++ b/tests/unit/codexBulkImport.test.ts@@ -0,0 +1,245 @@+/**+ * Unit tests for the Codex bulk-import normalizer.+ *+ * Pure helpers — no I/O, no network. Synthetic id_tokens are crafted by+ * base64url-encoding a header/payload/signature triple (only the payload is+ * decoded; we never verify the signature).+ *+ * Ported from decolua/9router#1257 (beaaan).+ */++import test, { describe } from "node:test";+import assert from "node:assert/strict";+import {+ normalizeCodexImportRecord,+ flattenCodexImportPayload,+} from "../../src/lib/oauth/services/codexImport.ts";++// ── Helpers ───────────────────────────────────────────────────────────────────++function b64url(obj: unknown): string {+ return Buffer.from(JSON.stringify(obj))+ .toString("base64")+ .replace(/=+$/, "")+ .replace(/\+/g, "-")+ .replace(/\//g, "_");+}++function makeIdToken(payload: Record<string, unknown>): string {+ const header = b64url({ alg: "RS256", typ: "JWT" });+ const body = b64url(payload);+ return `${header}.${body}.signature`;+}++const FULL_RECORD = {+ id_token: makeIdToken({+ email: "[email protected]",+ "https://api.openai.com/auth": {+ chatgpt_account_id: "acct-from-jwt",+ chatgpt_plan_type: "plus",+ },+ }),+ access_token: "access-xyz",+ refresh_token: "refresh-xyz",+ account_id: "acct-from-record",+ email: "[email protected]",+ type: "codex",+ expired: "2026-05-22T10:34:04+07:00",+};++// ── normalizeCodexImportRecord ────────────────────────────────────────────────++describe("normalizeCodexImportRecord", () => {+ test("normalizes a full Codex export record", () => {+ const result = normalizeCodexImportRecord(FULL_RECORD);+ assert.equal(result.ok, true);+ if (!result.ok) return;+ const { payload } = result;+ assert.equal(payload.provider, "codex");+ assert.equal(payload.authType, "oauth");+ assert.equal(payload.accessToken, "access-xyz");+ assert.equal(payload.refreshToken, "refresh-xyz");+ assert.equal(payload.idToken, FULL_RECORD.id_token);+ assert.equal(payload.testStatus, "active");+ // JWT email wins over the record-level email.+ assert.equal(payload.email, "[email protected]");+ assert.deepEqual(payload.providerSpecificData, {+ chatgptAccountId: "acct-from-jwt",+ chatgptPlanType: "plus",+ });+ // ISO-formatted, parses back to the right instant.+ const expiresMs = Date.parse(payload.expiresAt);+ assert.ok(Number.isFinite(expiresMs));+ assert.equal(expiresMs, Date.parse(FULL_RECORD.expired));+ });++ test("falls back to record email when id_token has none", () => {+ const idToken = makeIdToken({+ "https://api.openai.com/auth": { chatgpt_account_id: "x" },+ });+ const result = normalizeCodexImportRecord({+ access_token: "a",+ refresh_token: "r",+ email: "[email protected]",+ id_token: idToken,+ });+ assert.equal(result.ok, true);+ if (!result.ok) return;+ assert.equal(result.payload.email, "[email protected]");+ assert.equal(result.payload.providerSpecificData?.chatgptAccountId, "x");+ });++ test("falls back to account_id when id_token is missing", () => {+ const result = normalizeCodexImportRecord({+ access_token: "a",+ refresh_token: "r",+ email: "[email protected]",+ account_id: "acct-top-level",+ });+ assert.equal(result.ok, true);+ if (!result.ok) return;+ assert.equal(result.payload.providerSpecificData?.chatgptAccountId, "acct-top-level");+ assert.equal(result.payload.idToken, undefined);+ });++ test("synthesizes expiresAt when `expired` is missing", () => {+ const before = Date.now();+ const result = normalizeCodexImportRecord({+ access_token: "a",+ refresh_token: "r",+ email: "[email protected]",+ });+ const after = Date.now();+ assert.equal(result.ok, true);+ if (!result.ok) return;+ const expiresMs = Date.parse(result.payload.expiresAt);+ assert.ok(expiresMs > before, "expiresAt should be in the future");+ // Default lifetime is 10 days; allow a generous upper bound.+ assert.ok(+ expiresMs <= after + 11 * 24 * 60 * 60 * 1000,+ "expiresAt should be within ~11 days",+ );+ });++ test("rejects invalid `expired` strings by falling back to default", () => {+ const result = normalizeCodexImportRecord({+ access_token: "a",+ refresh_token: "r",+ email: "[email protected]",+ expired: "not-a-date",+ });+ assert.equal(result.ok, true);+ if (!result.ok) return;+ assert.ok(Number.isFinite(Date.parse(result.payload.expiresAt)));+ });++ test("rejects records missing required fields", () => {+ assert.equal(normalizeCodexImportRecord({}).ok, false);+ assert.equal(+ normalizeCodexImportRecord({ access_token: "a", email: "[email protected]" }).ok,+ false,+ );+ assert.equal(+ normalizeCodexImportRecord({ access_token: "a", refresh_token: "r" }).ok,+ false, // no email anywhere+ );+ });++ test("rejects records with non-codex `type`", () => {+ const result = normalizeCodexImportRecord({+ access_token: "a",+ refresh_token: "r",+ email: "[email protected]",+ type: "claude",+ });+ assert.equal(result.ok, false);+ if (result.ok) return;+ assert.match(result.error, /Unsupported type/);+ });++ test("rejects non-objects", () => {+ assert.equal(normalizeCodexImportRecord(null).ok, false);+ assert.equal(normalizeCodexImportRecord("foo").ok, false);+ assert.equal(normalizeCodexImportRecord([]).ok, false);+ });++ test("omits providerSpecificData when no account info is present", () => {+ const result = normalizeCodexImportRecord({+ access_token: "a",+ refresh_token: "r",+ email: "[email protected]",+ });+ assert.equal(result.ok, true);+ if (!result.ok) return;+ assert.equal(result.payload.providerSpecificData, undefined);+ });++ test("unwraps the Codex CLI auth.json shape", () => {+ const idToken = makeIdToken({+ email: "[email protected]",+ "https://api.openai.com/auth": {+ chatgpt_account_id: "acct-cli",+ chatgpt_plan_type: "free",+ },+ });+ // Access token's `exp` is the only expiry signal in auth.json.+ const expEpoch = Math.floor(Date.now() / 1000) + 3600;+ const accessToken = makeIdToken({ exp: expEpoch });+ const authJson = {+ auth_mode: "chatgpt",+ OPENAI_API_KEY: null,+ tokens: {+ id_token: idToken,+ access_token: accessToken,+ refresh_token: "rt-cli",+ account_id: "acct-cli",+ },+ last_refresh: "2026-05-16T11:35:58.322795500Z",+ };+ const result = normalizeCodexImportRecord(authJson);+ assert.equal(result.ok, true);+ if (!result.ok) return;+ assert.equal(result.payload.accessToken, accessToken);+ assert.equal(result.payload.refreshToken, "rt-cli");+ assert.equal(result.payload.idToken, idToken);+ assert.equal(result.payload.email, "[email protected]");+ assert.deepEqual(result.payload.providerSpecificData, {+ chatgptAccountId: "acct-cli",+ chatgptPlanType: "free",+ });+ // Falls back to the access_token's `exp` claim when no `expired` field exists.+ assert.equal(Date.parse(result.payload.expiresAt), expEpoch * 1000);+ });++ test("rejects auth.json when nested tokens are incomplete", () => {+ const result = normalizeCodexImportRecord({+ auth_mode: "chatgpt",+ tokens: { id_token: "x" }, // missing access_token + refresh_token+ });+ assert.equal(result.ok, false);+ });+});++// ── flattenCodexImportPayload ─────────────────────────────────────────────────++describe("flattenCodexImportPayload", () => {+ test("wraps a single object", () => {+ const result = flattenCodexImportPayload({ a: 1 });+ assert.equal(result.ok, true);+ if (!result.ok) return;+ assert.deepEqual(result.records, [{ a: 1 }]);+ });++ test("passes arrays through", () => {+ const result = flattenCodexImportPayload([{ a: 1 }, { b: 2 }]);+ assert.equal(result.ok, true);+ if (!result.ok) return;+ assert.deepEqual(result.records, [{ a: 1 }, { b: 2 }]);+ });++ test("rejects scalars", () => {+ assert.equal(flattenCodexImportPayload("nope").ok, false);+ assert.equal(flattenCodexImportPayload(42).ok, false);+ assert.equal(flattenCodexImportPayload(null).ok, false);+ });+});diff --git a/tests/unit/combo-auto-promote.test.ts b/tests/unit/combo-auto-promote.test.tsnew file mode 100644index 0000000000..2b0f0b67d0--- /dev/null+++ b/tests/unit/combo-auto-promote.test.ts@@ -0,0 +1,154 @@+import test from "node:test";+import assert from "node:assert/strict";++import {+ promoteModelToFront,+ comboStepModelId,+ promoteSuccessfulComboModel,+} from "@/lib/combos/autoPromote";++function makeCombo() {+ return {+ id: "combo-1",+ name: "my-combo",+ models: [+ { kind: "model", model: "a/1", weight: 1 },+ { kind: "model", model: "b/2", weight: 1 },+ ],+ };+}++test("comboStepModelId extracts model id from ComboStep object", () => {+ assert.equal(comboStepModelId({ kind: "model", model: "openai/gpt-4o" }), "openai/gpt-4o");+});++test("comboStepModelId extracts model id from bare string", () => {+ assert.equal(comboStepModelId("anthropic/claude-3"), "anthropic/claude-3");+});++test("comboStepModelId returns null for empty/invalid entries", () => {+ assert.equal(comboStepModelId(""), null);+ assert.equal(comboStepModelId(" "), null);+ assert.equal(comboStepModelId({ kind: "combo-ref", comboName: "x" }), null);+ assert.equal(comboStepModelId(null), null);+ assert.equal(comboStepModelId(42), null);+});++test("promoteModelToFront moves the winning ComboStep to position #1", () => {+ const models = [+ { kind: "model", model: "a/1", weight: 1 },+ { kind: "model", model: "b/2", weight: 1 },+ { kind: "model", model: "c/3", weight: 1 },+ ];+ const result = promoteModelToFront(models, "b/2");+ assert.deepEqual(result, [+ { kind: "model", model: "b/2", weight: 1 },+ { kind: "model", model: "a/1", weight: 1 },+ { kind: "model", model: "c/3", weight: 1 },+ ]);+});++test("promoteModelToFront preserves order of the remaining models", () => {+ const result = promoteModelToFront(["a", "b", "c", "d"], "d");+ assert.deepEqual(result, ["d", "a", "b", "c"]);+});++test("promoteModelToFront does not mutate the input array or entries", () => {+ const step = { kind: "model", model: "b/2", weight: 1 };+ const models = [{ kind: "model", model: "a/1", weight: 1 }, step];+ const snapshot = JSON.parse(JSON.stringify(models));+ promoteModelToFront(models, "b/2");+ assert.deepEqual(models, snapshot);+ assert.equal(models[1], step); // same reference, untouched+});++test("promoteModelToFront returns null when winner is already first", () => {+ assert.equal(promoteModelToFront(["a", "b", "c"], "a"), null);+});++test("promoteModelToFront returns null when winner is absent from the combo", () => {+ assert.equal(promoteModelToFront(["a", "b"], "z"), null);+});++test("promoteModelToFront returns null for empty / missing inputs", () => {+ assert.equal(promoteModelToFront([], "a"), null);+ assert.equal(promoteModelToFront(null, "a"), null);+ assert.equal(promoteModelToFront(undefined, "a"), null);+ assert.equal(promoteModelToFront(["a", "b"], ""), null);+ assert.equal(promoteModelToFront(["a", "b"], null), null);+});++test("promoteSuccessfulComboModel persists the reordered combo when flag is on", async () => {+ const calls: Array<{ id: string; data: { models: unknown[] } }> = [];+ const ok = await promoteSuccessfulComboModel(+ makeCombo(),+ "b/2",+ { comboAutoPromoteEnabled: true },+ {+ updateCombo: async (id, data) => {+ calls.push({ id, data });+ return data;+ },+ }+ );+ assert.equal(ok, true);+ assert.equal(calls.length, 1);+ assert.equal(calls[0].id, "combo-1");+ assert.deepEqual(+ (calls[0].data.models as Array<{ model: string }>).map((m) => m.model),+ ["b/2", "a/1"]+ );+});++test("promoteSuccessfulComboModel is a no-op when the flag is off", async () => {+ let called = false;+ const ok = await promoteSuccessfulComboModel(+ makeCombo(),+ "b/2",+ { comboAutoPromoteEnabled: false },+ {+ updateCombo: async (id, data) => {+ called = true;+ return data;+ },+ }+ );+ assert.equal(ok, false);+ assert.equal(called, false);+});++test("promoteSuccessfulComboModel is a no-op when the winner is already first", async () => {+ let called = false;+ const ok = await promoteSuccessfulComboModel(+ makeCombo(),+ "a/1",+ { comboAutoPromoteEnabled: true },+ {+ updateCombo: async (id, data) => {+ called = true;+ return data;+ },+ }+ );+ assert.equal(ok, false);+ assert.equal(called, false);+});++test("promoteSuccessfulComboModel swallows DB errors and never throws", async () => {+ let warned = "";+ const ok = await promoteSuccessfulComboModel(+ makeCombo(),+ "b/2",+ { comboAutoPromoteEnabled: true },+ {+ updateCombo: async () => {+ throw new Error("db is down");+ },+ warn: (_tag, msg) => {+ warned = msg;+ },+ }+ );+ assert.equal(ok, false);+ assert.match(warned, /Failed to promote/);+});diff --git a/tests/unit/combo-flatten-anthropic-tool-messages.test.ts b/tests/unit/combo-flatten-anthropic-tool-messages.test.tsnew file mode 100644index 0000000000..b42d747e1f--- /dev/null+++ b/tests/unit/combo-flatten-anthropic-tool-messages.test.ts@@ -0,0 +1,161 @@+/**+ * Tests for flattenToolHistory — a defensive normalizer that flattens+ * structured tool turns (OpenAI tool_calls + tool role messages, and+ * Anthropic-style tool_use / tool_result content blocks) into plain+ * assistant prose.+ *+ * Why this matters in combo legs: when a combo's panel/expert leg is asked+ * to emit prose (tools stripped) but the prior history still carries tool+ * call structures, agentic models keep emitting tool_calls — returning+ * empty prose and triggering an upstream 503. Flattening the history+ * preserves context but removes the tool-loop trigger.+ *+ * Ported from upstream decolua/9router commits 86162eeb + 9ab14e77 (PR #1910).+ */+import { describe, it } from "node:test";+import assert from "node:assert/strict";+import {+ flattenToolHistory,+ TOOL_CALL_PREFIX,+ TOOL_RESULT_PREFIX,+} from "../../open-sse/utils/flattenToolHistory.ts";++describe("flattenToolHistory", () => {+ it("flattens OpenAI tool role messages into assistant prose", () => {+ const msgs = [+ { role: "user", content: "find files" },+ {+ role: "assistant",+ content: "",+ tool_calls: [{ id: "c1", type: "function", function: { name: "find" } }],+ },+ { role: "tool", tool_call_id: "c1", content: "['a.js']" },+ { role: "user", content: "describe it" },+ ];+ const out = flattenToolHistory(msgs);+ assert.equal(out.length, 4);+ assert.equal(out[0].role, "user");+ // assistant tool_calls flattened+ assert.equal(out[1].tool_calls, undefined);+ assert.ok(typeof out[1].content === "string");+ assert.ok((out[1].content as string).includes("find"));+ assert.ok((out[1].content as string).includes(TOOL_CALL_PREFIX));+ // tool role -> assistant prose+ assert.equal(out[2].role, "assistant");+ assert.ok((out[2].content as string).includes("['a.js']"));+ assert.ok((out[2].content as string).includes(TOOL_RESULT_PREFIX));+ assert.deepEqual(out[3], { role: "user", content: "describe it" });+ });++ it("flattens Anthropic-style tool_use and tool_result content blocks", () => {+ const msgs = [+ { role: "user", content: "do it" },+ {+ role: "assistant",+ content: [+ { type: "text", text: "ok" },+ { type: "tool_use", id: "t1", name: "run" },+ ],+ },+ {+ role: "user",+ content: [{ type: "tool_result", tool_use_id: "t1", content: "done" }],+ },+ ];+ const out = flattenToolHistory(msgs);+ assert.equal(out.length, 3);+ // assistant Anthropic tool_use flattened+ assert.equal(out[1].content, `ok\n${TOOL_CALL_PREFIX}run]`);+ // user tool_result flattened (preserved role; content becomes prose)+ assert.equal(out[2].content, `${TOOL_RESULT_PREFIX}done]`);+ });++ it("preserves messages without tool turns unchanged", () => {+ const msgs = [+ { role: "system", content: "you are helpful" },+ { role: "user", content: "hello" },+ { role: "assistant", content: "hi" },+ ];+ const out = flattenToolHistory(msgs);+ assert.deepEqual(out, msgs);+ });++ it("filters out null/undefined entries", () => {+ const msgs = [+ { role: "user", content: "a" },+ null,+ undefined,+ { role: "assistant", content: "b" },+ ] as Array<Record<string, unknown> | null | undefined>;+ const out = flattenToolHistory(msgs);+ assert.equal(out.length, 2);+ });++ it("flattens function role (legacy) into assistant prose", () => {+ const msgs = [+ { role: "user", content: "q" },+ { role: "function", name: "f", content: "result" },+ ];+ const out = flattenToolHistory(msgs);+ assert.equal(out[1].role, "assistant");+ assert.ok((out[1].content as string).includes("result"));+ });++ it("handles assistant with text content + tool_calls (preserves the text)", () => {+ const msgs = [+ {+ role: "assistant",+ content: "thinking out loud",+ tool_calls: [{ function: { name: "search" } }, { function: { name: "fetch" } }],+ },+ ];+ const out = flattenToolHistory(msgs);+ assert.equal(out[0].tool_calls, undefined);+ assert.equal(out[0].content, `thinking out loud\n${TOOL_CALL_PREFIX}search, fetch]`);+ });++ it("handles Anthropic tool_use with no text block (only tool calls)", () => {+ const msgs = [+ {+ role: "assistant",+ content: [+ { type: "tool_use", id: "t1", name: "alpha" },+ { type: "tool_use", id: "t2", name: "beta" },+ ],+ },+ ];+ const out = flattenToolHistory(msgs);+ assert.equal(out[0].content, `${TOOL_CALL_PREFIX}alpha, beta]`);+ });++ it("handles Anthropic tool_result content as array of text blocks", () => {+ const msgs = [+ {+ role: "user",+ content: [+ {+ type: "tool_result",+ tool_use_id: "t1",+ content: [{ type: "text", text: "file: a.js" }],+ },+ ],+ },+ ];+ const out = flattenToolHistory(msgs);+ assert.equal(out[0].content, `${TOOL_RESULT_PREFIX}file: a.js]`);+ });++ it("is a pure function (does not mutate input)", () => {+ const msgs = [+ { role: "tool", tool_call_id: "c1", content: "x" },+ {+ role: "assistant",+ content: "",+ tool_calls: [{ function: { name: "n" } }],+ },+ ];+ const snapshot = JSON.parse(JSON.stringify(msgs));+ flattenToolHistory(msgs);+ assert.deepEqual(msgs, snapshot);+ });+});diff --git a/tests/unit/combo-id-resolution-4446.test.ts b/tests/unit/combo-id-resolution-4446.test.tsnew file mode 100644index 0000000000..7a450a3602--- /dev/null+++ b/tests/unit/combo-id-resolution-4446.test.ts@@ -0,0 +1,84 @@+import test from "node:test";+import assert from "node:assert/strict";+import fs from "node:fs";+import os from "node:os";+import path from "node:path";++// #4446 — opencode-plugin publishes combos by `combo.id` and the OpenCode+// `--model` dispatch path forwards a lowercased bare slug (e.g. "master-light")+// for a combo provisioned as "MASTER-LIGHT". OmniRoute's combo resolver only+// matched by EXACT, case-sensitive `name`, so the slug resolved to nothing and+// the request fell through to provider inference → "Unable to determine+// provider for model 'master-light'". These tests lock the additive fallbacks:+// resolve a combo by its `id` and by a case-insensitive `name` match.++const TEST_DATA_DIR = fs.mkdtempSync(path.join(os.tmpdir(), "omniroute-combo-id-4446-"));+process.env.DATA_DIR = TEST_DATA_DIR;++const core = await import("../../src/lib/db/core.ts");+const combosDb = await import("../../src/lib/db/combos.ts");+const sseModelService = await import("../../src/sse/services/model.ts");++async function resetStorage() {+ core.resetDbInstance();+ fs.rmSync(TEST_DATA_DIR, { recursive: true, force: true });+ fs.mkdirSync(TEST_DATA_DIR, { recursive: true });+}++test.beforeEach(async () => {+ await resetStorage();+});++test.after(() => {+ core.resetDbInstance();+ fs.rmSync(TEST_DATA_DIR, { recursive: true, force: true });+});++test("#4446 getComboForModel resolves a combo by a case-insensitive name (lowercased slug)", async () => {+ await combosDb.createCombo({+ name: "MASTER-LIGHT",+ models: [+ { provider: "groq", model: "llama-3.1-8b-instant" },+ { provider: "cerebras", model: "llama-3.3-70b" },+ ],+ });++ // The opencode `--model opencode-omniroute/master-light` path arrives as the+ // bare lowercased slug "master-light".+ const resolved = await sseModelService.getComboForModel("master-light");++ assert.ok(resolved, "expected the lowercased slug to resolve to the MASTER-LIGHT combo");+ assert.equal((resolved as { name: string }).name, "MASTER-LIGHT");+ assert.ok(+ Array.isArray((resolved as { models: unknown[] }).models) &&+ (resolved as { models: unknown[] }).models.length === 2+ );+});++test("#4446 getComboForModel resolves a combo by its stored id", async () => {+ const created = (await combosDb.createCombo({+ name: "Explore Combo",+ models: [{ provider: "groq", model: "llama-3.1-8b-instant" }],+ })) as { id: string; name: string };++ // The opencode plugin publishes combos as ModelV2 `id: combo.id`, so the+ // dispatch path can forward the combo's id rather than its display name.+ const resolved = await sseModelService.getComboForModel(created.id);++ assert.ok(resolved, "expected the combo id to resolve to the combo");+ assert.equal((resolved as { name: string }).name, "Explore Combo");+});++test("#4446 exact name match still wins and unknown slugs still return null", async () => {+ await combosDb.createCombo({+ name: "MASTER-LIGHT",+ models: [{ provider: "groq", model: "llama-3.1-8b-instant" }],+ });++ const exact = await sseModelService.getComboForModel("MASTER-LIGHT");+ assert.ok(exact, "exact name must still resolve");+ assert.equal((exact as { name: string }).name, "MASTER-LIGHT");++ const unknown = await sseModelService.getComboForModel("no-such-combo-xyz");+ assert.equal(unknown, null, "an unknown slug must not resolve to any combo");+});diff --git a/tests/unit/compression/combos-engine-ui-schema-parity-4955.test.ts b/tests/unit/compression/combos-engine-ui-schema-parity-4955.test.tsnew file mode 100644index 0000000000..2162dd765d--- /dev/null+++ b/tests/unit/compression/combos-engine-ui-schema-parity-4955.test.ts@@ -0,0 +1,51 @@+import { describe, it } from "node:test";+import assert from "node:assert/strict";++import {+ STACKED_PIPELINE_ENGINE_INTENSITIES,+ stackedPipelineStepSchema,+} from "../../../src/shared/validation/compressionConfigSchemas.ts";++// Regression guard for #4955: the Engine Combos pipeline editor used to offer engines+// (headroom, session-dedup, ccr, llmlingua) that `stackedPipelineStepSchema` rejects, so+// selecting one made `PUT /api/context/combos/[id]` fail with HTTP 400 and the UI swallowed+// it. The fix routes the dropdown through STACKED_PIPELINE_ENGINE_INTENSITIES, which MUST stay+// in lockstep with the discriminated union below.+describe("Engine Combos UI ↔ stackedPipelineStepSchema parity (#4955)", () => {+ const unionEngines = stackedPipelineStepSchema.options+ .map((option: { shape: { engine: { value: string } } }) => option.shape.engine.value)+ .sort();++ it("offers exactly the engines the API update schema accepts (no drift)", () => {+ const uiEngines = Object.keys(STACKED_PIPELINE_ENGINE_INTENSITIES).sort();+ assert.deepEqual(uiEngines, unionEngines);+ });++ it("every (engine, intensity) the UI can emit is accepted by the schema", () => {+ for (const [engine, intensities] of Object.entries(STACKED_PIPELINE_ENGINE_INTENSITIES)) {+ for (const intensity of intensities) {+ const result = stackedPipelineStepSchema.safeParse({ engine, intensity });+ assert.equal(+ result.success,+ true,+ `expected { engine: "${engine}", intensity: "${intensity}" } to be accepted`+ );+ }+ }+ });++ it("the engines removed from the UI in #4955 are indeed rejected by the schema", () => {+ for (const engine of ["headroom", "session-dedup", "ccr", "llmlingua"]) {+ assert.equal(+ stackedPipelineStepSchema.safeParse({ engine, intensity: "standard" }).success,+ false,+ `engine "${engine}" must not be a valid stacked-pipeline step`+ );+ assert.equal(+ STACKED_PIPELINE_ENGINE_INTENSITIES[engine],+ undefined,+ `engine "${engine}" must not be offered by the combos UI`+ );+ }+ });+});diff --git a/tests/unit/cursor-composer-thinking.test.ts b/tests/unit/cursor-composer-thinking.test.tsindex a269269f78..8e1c58503d 100644--- a/tests/unit/cursor-composer-thinking.test.ts+++ b/tests/unit/cursor-composer-thinking.test.ts@@ -71,6 +71,41 @@ test("visibleComposerContentFromThinking returns suffix after last </think> (triassert.equal(visibleComposerContentFromThinking("ends with</think>"), "");});+test("visibleComposerContentFromThinking strips `<|final|>` sentinel markers (full-width + ASCII)", () => {+ // Full-width pipe sentinels (decolua/9router#1316).+ assert.equal(+ visibleComposerContentFromThinking("reasoning</think><|final|>OK_PR1316<|/final|>"),+ "OK_PR1316"+ );+ // ASCII pipe sentinels.+ assert.equal(+ visibleComposerContentFromThinking("reasoning</think><|final|>HELLO<|/final|>"),+ "HELLO"+ );+ // Open marker without a closing tag still gets stripped.+ assert.equal(+ visibleComposerContentFromThinking("r</think><|final|>just open"),+ "just open"+ );+ // No sentinel — plain suffix is unchanged.+ assert.equal(+ visibleComposerContentFromThinking("reasoning</think>plain answer"),+ "plain answer"+ );+});++test("visibleComposerContentFromThinking holds back a partial opening marker until complete", () => {+ // A streamed chunk delivered only the start of the sentinel — emit nothing yet.+ assert.equal(visibleComposerContentFromThinking("r</think><"), "");+ assert.equal(visibleComposerContentFromThinking("r</think><|fin"), "");+ assert.equal(visibleComposerContentFromThinking("r</think><|fin"), "");+ // Once the full marker + payload arrive the real content surfaces.+ assert.equal(+ visibleComposerContentFromThinking("r</think><|final|>NOW_VISIBLE"),+ "NOW_VISIBLE"+ );+});+test("composerReasoningRemainder returns only the hidden portion before last </think>", () => {assert.equal(composerReasoningRemainder("private reasoning</think>OK"),@@ -135,6 +170,27 @@ test("Composer non-streaming aggregation: thinking with </think> populates totalassert.equal(ctx.totalText, "OK");});+test("Composer streaming: partial `<|final|>` sentinel split across chunks never leaks", () => {+ const chunks: string[] = [];+ const ctx: StreamCtx = newStreamCtx("cu/composer-2.5", (c) => chunks.push(c));+ // The sentinel arrives byte-fragmented across three thinking-delta frames.+ processFrame(buildThinkingDeltaPayload("reasoning</think><|fina"), ctx, new Set());+ processFrame(buildThinkingDeltaPayload("l|>OK_S"), ctx, new Set());+ processFrame(buildThinkingDeltaPayload("TREAM"), ctx, new Set());++ const events = parseSSE(chunks.join(""));+ const content = events+ .map((e) => {+ const choices = (e as { choices?: Array<{ delta?: { content?: string } }> }).choices;+ return choices?.[0]?.delta?.content ?? "";+ })+ .join("");+ assert.equal(content, "OK_STREAM");+ assert.equal(ctx.totalText, "OK_STREAM");+ assert.ok(!chunks.join("").includes("final"), "sentinel literal must not leak");+ assert.ok(!chunks.join("").includes("|"), "full-width pipe must not leak");+});+test("Non-Composer model: thinking field stays in reasoning_content (unchanged contract)", () => {const chunks: string[] = [];const ctx: StreamCtx = newStreamCtx("gpt-5.3-codex", (c) => chunks.push(c));diff --git a/tests/unit/dashboard-sidebar-desktop-visible.test.ts b/tests/unit/dashboard-sidebar-desktop-visible.test.tsnew file mode 100644index 0000000000..de1a9a65ed--- /dev/null+++ b/tests/unit/dashboard-sidebar-desktop-visible.test.ts@@ -0,0 +1,64 @@+import test from "node:test";+import assert from "node:assert/strict";+import { readFileSync } from "node:fs";+import { dirname, join } from "node:path";+import { fileURLToPath } from "node:url";++const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..", "..");++function readSrc(path: string): string {+ return readFileSync(join(ROOT, path), "utf8");+}++// Regression guard: the desktop dashboard sidebar must stay visible on desktop.+// The old `hidden ... lg:flex` Tailwind cascade is fragile — class ordering /+// specificity can collapse the `lg:flex` and leave the sidebar permanently+// hidden. The fix moves visibility into an explicit `.dashboard-sidebar-desktop`+// class backed by a 1024px media query in globals.css.++test("DashboardLayout desktop sidebar uses the explicit visibility class, not the hidden/lg:flex cascade", () => {+ const source = readSrc("src/shared/components/layouts/DashboardLayout.tsx");++ // The desktop sidebar wrapper must reference the dedicated class.+ assert.match(+ source,+ /className="dashboard-sidebar-desktop"/,+ "Desktop sidebar wrapper must use the dashboard-sidebar-desktop class"+ );++ // The fragile Tailwind cascade must be gone.+ assert.doesNotMatch(+ source,+ /className="hidden[^"]*lg:flex"/,+ "Desktop sidebar wrapper must not rely on the hidden/lg:flex Tailwind cascade"+ );+});++test("globals.css defines dashboard-sidebar-desktop hidden by default and flex at >=1024px", () => {+ const css = readSrc("src/app/globals.css");++ // Class exists.+ assert.match(+ css,+ /\.dashboard-sidebar-desktop\s*\{/,+ "globals.css must define .dashboard-sidebar-desktop"+ );++ // Hidden by default (mobile-first), then shown via a 1024px desktop media query.+ const classIndex = css.indexOf(".dashboard-sidebar-desktop");+ const desktopRule =+ /@media\s*\(min-width:\s*1024px\)\s*\{[^}]*\.dashboard-sidebar-desktop\s*\{[^}]*display:\s*flex/;+ assert.match(+ css.slice(classIndex - 200),+ desktopRule,+ "globals.css must show .dashboard-sidebar-desktop with display:flex at min-width:1024px"+ );++ // Default state hides it (display:none) so mobile is unaffected.+ const baseRule = /\.dashboard-sidebar-desktop\s*\{[^}]*display:\s*none/;+ assert.match(+ css,+ baseRule,+ "globals.css must hide .dashboard-sidebar-desktop by default (display:none)"+ );+});diff --git a/tests/unit/data-dir-writable-fallback.test.ts b/tests/unit/data-dir-writable-fallback.test.tsnew file mode 100644index 0000000000..77661b530c--- /dev/null+++ b/tests/unit/data-dir-writable-fallback.test.ts@@ -0,0 +1,115 @@+import test from "node:test";+import assert from "node:assert/strict";+import fs from "node:fs";+import os from "node:os";+import path from "node:path";++import {+ resolveWritableDataDir,+ getDefaultDataDir,+ resolveDataDir,+} from "../../src/lib/dataPaths.ts";++// Running as root bypasses POSIX permission bits, so a chmod-based "unwritable"+// directory would still be writable and the EACCES/EPERM branch never triggers.+const IS_ROOT = typeof process.getuid === "function" && process.getuid() === 0;+const IS_WINDOWS = process.platform === "win32";++async function withTempEnv(+ fn: (paths: { root: string; home: string }) => void | Promise<void>+) {+ const originalEnv = { ...process.env };+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "omni-datadir-"));+ const home = path.join(root, "home");+ fs.mkdirSync(home, { recursive: true });++ delete process.env.DATA_DIR;+ delete process.env.XDG_CONFIG_HOME;+ delete process.env.APPDATA;+ process.env.HOME = home;+ process.env.USERPROFILE = home;++ try {+ await fn({ root, home });+ } finally {+ for (const key of Object.keys(process.env)) {+ if (!(key in originalEnv)) delete process.env[key];+ }+ for (const [key, value] of Object.entries(originalEnv)) {+ process.env[key] = value;+ }+ // Restore perms before cleanup so rmSync can delete read-only parents.+ try {+ fs.chmodSync(root, 0o755);+ } catch {+ // ignore+ }+ fs.rmSync(root, { recursive: true, force: true });+ }+}++test("resolveWritableDataDir returns the configured DATA_DIR when it is writable", async () => {+ await withTempEnv(({ root }) => {+ const configured = path.join(root, "writable-data");+ process.env.DATA_DIR = configured;++ const resolved = resolveWritableDataDir();+ assert.equal(resolved, path.resolve(configured));+ // The probe creates the directory as a side effect.+ assert.ok(fs.existsSync(configured));+ });+});++test("resolveWritableDataDir falls back to the default dir when DATA_DIR is not writable (EACCES/EPERM)", { skip: IS_ROOT || IS_WINDOWS }, async () => {+ await withTempEnv(({ root, home }) => {+ // A read-only parent makes mkdir of the child fail with EACCES/EPERM.+ const lockedParent = path.join(root, "locked");+ fs.mkdirSync(lockedParent, { recursive: true });+ fs.chmodSync(lockedParent, 0o555);++ const configured = path.join(lockedParent, "data");+ process.env.DATA_DIR = configured;++ const resolved = resolveWritableDataDir();+ const expectedFallback = getDefaultDataDir();++ // It must NOT return the unwritable configured dir...+ assert.notEqual(resolved, path.resolve(configured));+ // ...and instead fall back to the default user dir (~/.omniroute under HOME).+ assert.equal(resolved, expectedFallback);+ assert.ok(resolved.startsWith(path.resolve(home)));+ });+});++test("resolveWritableDataDir returns the default dir (no probe) when DATA_DIR is unset", async () => {+ await withTempEnv(() => {+ delete process.env.DATA_DIR;+ const resolved = resolveWritableDataDir();+ assert.equal(resolved, getDefaultDataDir());+ // Matches the pure resolver when no override is present.+ assert.equal(resolved, resolveDataDir());+ });+});++test("resolveWritableDataDir rethrows non-permission errors", { skip: IS_WINDOWS }, async () => {+ await withTempEnv(({ root }) => {+ // Point DATA_DIR at a path whose parent is a regular file → ENOTDIR, not EACCES.+ const fileParent = path.join(root, "iam-a-file");+ fs.writeFileSync(fileParent, "x");++ const configured = path.join(fileParent, "data");+ process.env.DATA_DIR = configured;++ assert.throws(() => resolveWritableDataDir(), (err: NodeJS.ErrnoException) => {+ return err.code !== "EACCES" && err.code !== "EPERM";+ });+ });+});++test("resolveWritableDataDir leaves the cloud sentinel untouched", async () => {+ await withTempEnv(() => {+ process.env.DATA_DIR = "/some/configured/path";+ const resolved = resolveWritableDataDir({ isCloud: true });+ assert.equal(resolved, "/tmp");+ });+});diff --git a/tests/unit/dgrid-provider.test.ts b/tests/unit/dgrid-provider.test.tsnew file mode 100644index 0000000000..4542afad33--- /dev/null+++ b/tests/unit/dgrid-provider.test.ts@@ -0,0 +1,162 @@+import test from "node:test";+import assert from "node:assert/strict";+import fs from "node:fs";+import os from "node:os";+import path from "node:path";++const { APIKEY_PROVIDERS } = await import("../../src/shared/constants/providers.ts");+const { PROVIDER_ENDPOINTS } = await import("../../src/shared/constants/config.ts");+const { REGISTRY: providerRegistry } = await import("../../open-sse/config/providerRegistry.ts");+const { isValidModel } = await import("../../src/shared/constants/models.ts");++const DGRID_CHAT_URL = "https://api.dgrid.ai/v1/chat/completions";+const DGRID_MODELS_URL = "https://api.dgrid.ai/v1/models";+const DGRID_FREE_ROUTER = "dgridai/free";++test("DGrid is registered as a free API-key provider", () => {+ const entry = APIKEY_PROVIDERS.dgrid;+ assert.ok(entry, "APIKEY_PROVIDERS.dgrid must be defined");+ assert.equal(entry.id, "dgrid");+ assert.equal(entry.alias, "dgrid");+ assert.equal(entry.name, "DGrid");+ assert.equal(entry.website, "https://dgrid.ai");+ assert.equal(entry.hasFree, true);+ assert.equal(entry.passthroughModels, true);+ assert.match(entry.freeNote, /10 requests\/minute/);+ assert.match(entry.freeNote, /100 requests\/day/);+ assert.match(entry.freeNote, /\$5 lifetime top-up/);+});++test("DGrid exposes the OpenAI-compatible chat completions endpoint", () => {+ assert.equal(PROVIDER_ENDPOINTS.dgrid, DGRID_CHAT_URL);+});++test("DGrid registry entry uses OpenAI format with bearer API-key auth", () => {+ const entry = providerRegistry.dgrid;+ assert.ok(entry, "providerRegistry.dgrid must be defined");+ assert.equal(entry.id, "dgrid");+ assert.equal(entry.alias, "dgrid");+ assert.equal(entry.format, "openai");+ assert.equal(entry.executor, "default");+ assert.equal(entry.authType, "apikey");+ assert.equal(entry.authHeader, "bearer");+ assert.equal(entry.baseUrl, DGRID_CHAT_URL);+ assert.equal(entry.modelsUrl, DGRID_MODELS_URL);+ assert.equal(entry.passthroughModels, true);+});++test("DGrid ships the Free Models Router as the seeded default model", () => {+ const models = providerRegistry.dgrid.models;+ const ids = models.map((model: { id: string }) => model.id);+ assert.ok(ids.includes(DGRID_FREE_ROUTER), "seed list must include dgridai/free");+ assert.equal(new Set(ids).size, ids.length, "model ids must be unique");+ assert.equal(+ models.find((model: { id: string }) => model.id === DGRID_FREE_ROUTER)?.name,+ "DGrid Free Models Router"+ );+});++test("DGrid accepts the free router and the 200+ live catalog via passthrough models", () => {+ assert.equal(isValidModel("dgrid", DGRID_FREE_ROUTER), true);+ assert.equal(isValidModel("dgrid", "openai/gpt-4o"), true);+ assert.equal(isValidModel("dgrid", "anthropic/claude-sonnet-4"), true);+});++const TEST_DATA_DIR = fs.mkdtempSync(path.join(os.tmpdir(), "omniroute-dgrid-"));+process.env.DATA_DIR = TEST_DATA_DIR;++const core = await import("../../src/lib/db/core.ts");+const providersDb = await import("../../src/lib/db/providers.ts");+const modelsRoute = await import("../../src/app/api/providers/[id]/models/route.ts");++async function resetStorage() {+ core.resetDbInstance();+ fs.rmSync(TEST_DATA_DIR, { recursive: true, force: true });+ fs.mkdirSync(TEST_DATA_DIR, { recursive: true });+}++test.after(() => {+ core.resetDbInstance();+ fs.rmSync(TEST_DATA_DIR, { recursive: true, force: true });+});++interface ModelsBody {+ provider: string;+ connectionId: string;+ models: Array<{ id: string }>;+ source?: string;+}++test("DGrid import fetches the live /v1/models catalog", async () => {+ await resetStorage();+ const connection = await providersDb.createProviderConnection({+ provider: "dgrid",+ authType: "apikey",+ name: "dgrid-live",+ apiKey: "dgrid-key",+ });++ let fetched = false;+ const originalFetch = globalThis.fetch;+ globalThis.fetch = async (url) => {+ if (String(url) === DGRID_MODELS_URL) {+ fetched = true;+ return Response.json({+ object: "list",+ data: [+ { id: DGRID_FREE_ROUTER },+ { id: "openai/gpt-4o" },+ { id: "anthropic/claude-sonnet-4" },+ ],+ });+ }+ return new Response("not found", { status: 404 });+ };++ try {+ const response = await modelsRoute.GET(+ new Request(`http://localhost/api/providers/${connection.id}/models?refresh=true`),+ { params: { id: connection.id } }+ );+ assert.equal(response.status, 200);+ const body = (await response.json()) as ModelsBody;+ assert.equal(body.provider, "dgrid");+ assert.equal(body.source, "api", "should serve the live upstream catalog");+ assert.ok(fetched, `should have probed ${DGRID_MODELS_URL}`);+ const ids = body.models.map((model) => model.id);+ assert.ok(ids.includes(DGRID_FREE_ROUTER), `free router missing: ${ids.join(",")}`);+ assert.ok(ids.includes("openai/gpt-4o"), `live catalog model missing: ${ids.join(",")}`);+ } finally {+ globalThis.fetch = originalFetch;+ }+});++test("DGrid import falls back to the seeded free router when live fetch fails", async () => {+ await resetStorage();+ const connection = await providersDb.createProviderConnection({+ provider: "dgrid",+ authType: "apikey",+ name: "dgrid-fallback",+ apiKey: "dgrid-key-2",+ });++ const originalFetch = globalThis.fetch;+ globalThis.fetch = async () => new Response("bad gateway", { status: 502 });++ try {+ const response = await modelsRoute.GET(+ new Request(`http://localhost/api/providers/${connection.id}/models?refresh=true`),+ { params: { id: connection.id } }+ );+ assert.equal(response.status, 200);+ const body = (await response.json()) as ModelsBody;+ assert.equal(body.provider, "dgrid");+ assert.equal(body.source, "local_catalog", "import must not break when upstream is down");+ assert.deepEqual(+ body.models.map((model) => model.id),+ [DGRID_FREE_ROUTER]+ );+ } finally {+ globalThis.fetch = originalFetch;+ }+});diff --git a/tests/unit/diagnostics.test.ts b/tests/unit/diagnostics.test.tsnew file mode 100644index 0000000000..82b202e385--- /dev/null+++ b/tests/unit/diagnostics.test.ts@@ -0,0 +1,200 @@+/**+ * Tests for open-sse/utils/diagnostics.ts+ *+ * Covers:+ * (a) synthOpenAIErrorChunk — shape validation+ * (b) synthResponsesFailure — matches a response.failed event+ * (c) detectMalformedNonStream — empty/malformed input classified correctly+ * (d) no stack trace leakage in error chunk message+ */++import test from "node:test";+import assert from "node:assert/strict";++import {+ reportMalformed200,+ synthOpenAIErrorChunk,+ synthResponsesFailure,+ detectMalformedNonStream,+} from "../../open-sse/utils/diagnostics.ts";++// ── (a) synthOpenAIErrorChunk shape ──────────────────────────────────────────++test("synthOpenAIErrorChunk returns a valid SSE data line", () => {+ const line = synthOpenAIErrorChunk({+ provider: "testprovider",+ model: "gpt-test",+ reason: "empty_stream",+ });+ assert.match(line, /^data: /);+ assert.ok(line.endsWith("\n\n"), "must end with double newline");+});++test("synthOpenAIErrorChunk payload has expected OpenAI chunk shape", () => {+ const line = synthOpenAIErrorChunk({ provider: "myprovider", model: "mymodel", reason: "empty" });+ const payload = JSON.parse(line.slice("data: ".length).trimEnd());+ assert.equal(payload.object, "chat.completion.chunk");+ assert.ok(Array.isArray(payload.choices), "must have choices array");+ assert.equal(payload.choices.length, 1);+ assert.ok(payload.error, "must have error field");+ assert.equal(payload.error.type, "upstream_empty_response");+ assert.ok(typeof payload.error.message === "string" && payload.error.message.length > 0);+});++test("synthOpenAIErrorChunk references provider in message", () => {+ const line = synthOpenAIErrorChunk({+ provider: "mymysteriosprovider",+ model: "m",+ reason: "stall",+ });+ const payload = JSON.parse(line.slice("data: ".length).trimEnd());+ assert.ok(+ payload.error.message.includes("mymysteriosprovider"),+ `message should reference provider, got: ${payload.error.message}`+ );+});++// ── (b) synthResponsesFailure matches a response.failed event ────────────────++test("synthResponsesFailure produces a response.failed SSE event", () => {+ const sseText = synthResponsesFailure("empty_stream");+ assert.match(sseText, /event: response\.failed/);+ assert.match(sseText, /data: /);+});++test("synthResponsesFailure includes a reason in the data payload", () => {+ const sseText = synthResponsesFailure("no_terminal");+ // Extract JSON after "data: " line+ const dataLine = sseText.split("\n").find((l) => l.startsWith("data: "));+ assert.ok(dataLine, "must have a data line");+ const parsed = JSON.parse(dataLine.slice("data: ".length));+ assert.ok(+ parsed?.response?.error?.message?.length > 0,+ `response.error.message should be non-empty, got: ${JSON.stringify(parsed?.response?.error)}`+ );+});++// ── (c) detectMalformedNonStream ─────────────────────────────────────────────++test("detectMalformedNonStream returns 'empty_choices' for null input", () => {+ assert.equal(detectMalformedNonStream(null), "empty_choices");+});++test("detectMalformedNonStream returns 'empty_choices' for empty object", () => {+ assert.equal(detectMalformedNonStream({}), "empty_choices");+});++test("detectMalformedNonStream returns 'empty_choices' for choices:[]", () => {+ assert.equal(detectMalformedNonStream({ choices: [] }), "empty_choices");+});++test("detectMalformedNonStream returns 'empty_choices' when choice message has no content", () => {+ const body = {+ choices: [{ message: { content: "", tool_calls: null }, finish_reason: "stop" }],+ };+ assert.equal(detectMalformedNonStream(body), "empty_choices");+});++test("detectMalformedNonStream returns null for valid chat completion", () => {+ const body = {+ choices: [{ message: { content: "Hello!", tool_calls: null }, finish_reason: "stop" }],+ };+ assert.equal(detectMalformedNonStream(body), null);+});++test("detectMalformedNonStream returns null when tool_calls present", () => {+ const body = {+ choices: [+ {+ message: { content: null, tool_calls: [{ id: "call_1", type: "function" }] },+ finish_reason: "tool_calls",+ },+ ],+ };+ assert.equal(detectMalformedNonStream(body), null);+});++test("detectMalformedNonStream returns null when reasoning_content present (reasoning-only)", () => {+ const body = {+ choices: [+ {+ message: { content: "", reasoning_content: "some reasoning text", tool_calls: null },+ finish_reason: "stop",+ },+ ],+ };+ assert.equal(detectMalformedNonStream(body), null);+});++test("detectMalformedNonStream returns 'empty_choices' for Responses API with empty output", () => {+ const body = { object: "response", output: [], status: "completed" };+ assert.equal(detectMalformedNonStream(body), "empty_choices");+});++test("detectMalformedNonStream returns null for Responses API with text output", () => {+ const body = {+ object: "response",+ status: "completed",+ output: [+ {+ type: "message",+ content: [{ type: "output_text", text: "Hello there!" }],+ },+ ],+ };+ assert.equal(detectMalformedNonStream(body), null);+});++test("detectMalformedNonStream returns 'no_terminal' for Responses API with failed status", () => {+ const body = {+ object: "response",+ status: "failed",+ output: [+ {+ type: "message",+ content: [{ type: "output_text", text: "Some text" }],+ },+ ],+ };+ assert.equal(detectMalformedNonStream(body), "no_terminal");+});++test("detectMalformedNonStream allows Responses API function_call items as valid output", () => {+ const body = {+ object: "response",+ status: "completed",+ output: [{ type: "function_call", name: "search", arguments: "{}" }],+ };+ assert.equal(detectMalformedNonStream(body), null);+});++// ── (d) no stack trace leakage ───────────────────────────────────────────────++test("synthOpenAIErrorChunk message does NOT contain stack trace path", () => {+ const line = synthOpenAIErrorChunk({ provider: "p", model: "m", reason: "empty_stream" });+ const payload = JSON.parse(line.slice("data: ".length).trimEnd());+ const msg = payload.error.message as string;+ assert.ok(+ !msg.includes("at /"),+ `error.message must not contain stack trace patterns, got: ${msg}`+ );+});++test("reportMalformed200 runs without throwing", () => {+ // smoke: it only logs, should not throw+ assert.doesNotThrow(() =>+ reportMalformed200({+ mode: "nonstream",+ provider: "testprov",+ model: "testmodel",+ connectionId: "conn-123",+ reason: "empty_choices",+ recvBytes: 42,+ recvLines: -1,+ emitted: -1,+ events: { "response.completed": 1 },+ ttftMs: 100,+ elapsedMs: 200,+ })+ );+});diff --git a/tests/unit/droid-custom-models.test.ts b/tests/unit/droid-custom-models.test.tsnew file mode 100644index 0000000000..7f2e439531--- /dev/null+++ b/tests/unit/droid-custom-models.test.ts@@ -0,0 +1,122 @@+import test from "node:test";+import assert from "node:assert/strict";++import {+ buildDroidCustomModels,+ isOmniRouteCustomModel,+ normalizeDroidModelList,+} from "../../src/shared/services/droidCustomModels.ts";++test("normalizeDroidModelList accepts legacy single `model` string", () => {+ assert.deepEqual(normalizeDroidModelList({ model: "openai/gpt-5" }), ["openai/gpt-5"]);+});++test("normalizeDroidModelList accepts `models` array (upstream #618)", () => {+ assert.deepEqual(+ normalizeDroidModelList({ models: ["openai/gpt-5", "anthropic/claude-4"] }),+ ["openai/gpt-5", "anthropic/claude-4"]+ );+});++test("normalizeDroidModelList prefers `models` over legacy `model`", () => {+ assert.deepEqual(+ normalizeDroidModelList({ model: "legacy/old", models: ["openai/gpt-5"] }),+ ["openai/gpt-5"]+ );+});++test("normalizeDroidModelList trims and dedupes, drops empty/non-string", () => {+ assert.deepEqual(+ normalizeDroidModelList({+ models: [" openai/gpt-5 ", "openai/gpt-5", "", " ", 42, null, "anthropic/claude-4"],+ }),+ ["openai/gpt-5", "anthropic/claude-4"]+ );+});++test("normalizeDroidModelList returns [] on missing/invalid input", () => {+ assert.deepEqual(normalizeDroidModelList({}), []);+ assert.deepEqual(normalizeDroidModelList({ model: 7 as unknown }), []);+ assert.deepEqual(normalizeDroidModelList({ models: "not-an-array" as unknown }), []);+});++test("buildDroidCustomModels emits one entry per model with sequential ids", () => {+ const out = buildDroidCustomModels(["openai/gpt-5", "anthropic/claude-4"], {+ baseUrl: "http://localhost:20128/v1",+ apiKey: "sk_omniroute",+ });++ assert.equal(out.length, 2);+ assert.equal(out[0].id, "custom:OmniRoute-0");+ assert.equal(out[0].index, 0);+ assert.equal(out[0].model, "openai/gpt-5");+ assert.equal(out[0].displayName, "openai/gpt-5");+ assert.equal(out[0].provider, "openai");+ assert.equal(out[0].maxOutputTokens, 131072);+ assert.equal(out[0].noImageSupport, false);+ assert.equal(out[0].baseUrl, "http://localhost:20128/v1");+ assert.equal(out[0].apiKey, "sk_omniroute");+ assert.equal(out[1].id, "custom:OmniRoute-1");+ assert.equal(out[1].index, 1);+});++test("buildDroidCustomModels promotes activeModel to index 0", () => {+ const out = buildDroidCustomModels(["openai/gpt-5", "anthropic/claude-4", "google/gemini"], {+ baseUrl: "http://localhost:20128/v1",+ apiKey: "sk_omniroute",+ activeModel: "anthropic/claude-4",+ });++ assert.equal(out[0].model, "anthropic/claude-4");+ assert.equal(out[0].id, "custom:OmniRoute-0");+ assert.equal(out[0].index, 0);+ // Remaining entries are re-indexed in their original relative order+ assert.equal(out[1].model, "openai/gpt-5");+ assert.equal(out[1].id, "custom:OmniRoute-1");+ assert.equal(out[1].index, 1);+ assert.equal(out[2].model, "google/gemini");+ assert.equal(out[2].id, "custom:OmniRoute-2");+ assert.equal(out[2].index, 2);+});++test("buildDroidCustomModels keeps order when activeModel is not in the list", () => {+ const out = buildDroidCustomModels(["openai/gpt-5", "anthropic/claude-4"], {+ baseUrl: "http://localhost:20128/v1",+ apiKey: "sk_omniroute",+ activeModel: "unknown/model",+ });+ assert.equal(out[0].model, "openai/gpt-5");+ assert.equal(out[1].model, "anthropic/claude-4");+});++test("buildDroidCustomModels keeps order when activeModel === '' (no promotion)", () => {+ const out = buildDroidCustomModels(["openai/gpt-5", "anthropic/claude-4"], {+ baseUrl: "http://localhost:20128/v1",+ apiKey: "sk_omniroute",+ activeModel: "",+ });+ assert.equal(out[0].model, "openai/gpt-5");+ assert.equal(out[1].model, "anthropic/claude-4");+});++test("buildDroidCustomModels throws on empty list", () => {+ assert.throws(+ () =>+ buildDroidCustomModels([], {+ baseUrl: "http://localhost:20128/v1",+ apiKey: "sk_omniroute",+ }),+ /requires at least one model/+ );+});++test("isOmniRouteCustomModel matches any custom:OmniRoute-<i> id (multi-model)", () => {+ assert.equal(isOmniRouteCustomModel({ id: "custom:OmniRoute-0" }), true);+ assert.equal(isOmniRouteCustomModel({ id: "custom:OmniRoute-1" }), true);+ assert.equal(isOmniRouteCustomModel({ id: "custom:OmniRoute-42" }), true);+ assert.equal(isOmniRouteCustomModel({ id: "custom:Other-0" }), false);+ assert.equal(isOmniRouteCustomModel({ id: 42 as unknown }), false);+ assert.equal(isOmniRouteCustomModel(null), false);+ assert.equal(isOmniRouteCustomModel(undefined), false);+ assert.equal(isOmniRouteCustomModel({}), false);+});diff --git a/tests/unit/embeddings-combo-dimensions.test.ts b/tests/unit/embeddings-combo-dimensions.test.tsnew file mode 100644index 0000000000..0f1f01f59e--- /dev/null+++ b/tests/unit/embeddings-combo-dimensions.test.ts@@ -0,0 +1,115 @@+/**+ * TDD regression guard: embedding combo `dimensions` field is persisted and+ * injected into upstream embedding requests. Ported from decolua/9router#1530.+ *+ * Test 1: `dimensions` can be stored on a combo and is read back correctly.+ * Test 2: When the client omits `dimensions`, the combo-stored value is injected+ * into the body forwarded to handleComboChat (verified by intercepting+ * handleEmbedding at the upstream fetch boundary).+ * Test 3: A client-supplied `dimensions` value wins over the combo default.+ * Test 4: Combos without `dimensions` leave the upstream body unchanged.+ *+ * Uses a throwaway DATA_DIR so migrations run against a temp DB.+ * DB handle released in test.after() per CLAUDE.md learning #3.+ */++import test from "node:test";+import assert from "node:assert/strict";+import { mkdtempSync } from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";++process.env.DATA_DIR = mkdtempSync(join(tmpdir(), "omniroute-embed-dim-"));++const { createCombo, getComboByName } = await import("../../src/lib/db/combos.ts");+const { resetDbInstance } = await import("../../src/lib/db/core.ts");++test.after(() => {+ resetDbInstance();+});++// ─── Test 1: dimensions stored and retrieved from combo ───────────────────────++test("combo created with dimensions persists the value", async () => {+ await createCombo({+ name: "dim-test-store",+ strategy: "priority",+ models: ["openai/text-embedding-3-small"],+ dimensions: "1024",+ });++ const stored = await getComboByName("dim-test-store");+ assert.ok(stored !== null, "combo should exist");+ assert.equal(+ String((stored as Record<string, unknown>).dimensions),+ "1024",+ "dimensions must be persisted in the combo record"+ );+});++test("combo created without dimensions has no dimensions field", async () => {+ await createCombo({+ name: "dim-test-no-dim",+ strategy: "priority",+ models: ["openai/text-embedding-3-small"],+ });++ const stored = await getComboByName("dim-test-no-dim");+ assert.ok(stored !== null, "combo should exist");+ const record = stored as Record<string, unknown>;+ const dim = record.dimensions;+ // dimensions should be absent or null/undefined — not set to some bogus value+ assert.ok(+ dim === undefined || dim === null,+ `dimensions should be absent/null when not set, got: ${JSON.stringify(dim)}`+ );+});++// ─── Test 2–4: dimensions injection logic (unit-level) ───────────────────────+//+// We test the injection predicate directly: the logic that decides whether to+// spread `combo.dimensions` into the body. This is the exact same logic that+// lives in service.ts and is pure (no I/O), so we can verify it here without+// needing a full request pipeline.++function applyDimensionsInjection(+ body: Record<string, unknown>,+ combo: Record<string, unknown>+): Record<string, unknown> {+ // Mirror of the injection logic in src/lib/embeddings/service.ts+ const comboDimensions =+ combo.dimensions !== undefined && combo.dimensions !== null+ ? String(combo.dimensions)+ : undefined;+ return comboDimensions !== undefined && body.dimensions === undefined+ ? { ...body, dimensions: comboDimensions }+ : body;+}++test("combo dimensions injected when client body has no dimensions", () => {+ const body = { model: "my-combo", input: "hello" };+ const combo = { name: "my-combo", dimensions: "512" };+ const result = applyDimensionsInjection(body, combo);+ assert.equal(result.dimensions, "512", "combo dimensions must be injected");+});++test("client-supplied dimensions take precedence over combo dimensions", () => {+ const body = { model: "my-combo", input: "hello", dimensions: "256" };+ const combo = { name: "my-combo", dimensions: "512" };+ const result = applyDimensionsInjection(body, combo);+ assert.equal(result.dimensions, "256", "client dimensions must not be overridden");+});++test("no dimensions injected when combo has none", () => {+ const body = { model: "my-combo", input: "hello" };+ const combo = { name: "my-combo" }; // no dimensions+ const result = applyDimensionsInjection(body, combo);+ assert.equal(result.dimensions, undefined, "dimensions must not appear when combo has none");+});++test("null combo dimensions treated as absent — no injection", () => {+ const body = { model: "my-combo", input: "hello" };+ const combo = { name: "my-combo", dimensions: null };+ const result = applyDimensionsInjection(body, combo);+ assert.equal(result.dimensions, undefined, "null combo dimensions must not be injected");+});diff --git a/tests/unit/executor-codex.test.ts b/tests/unit/executor-codex.test.tsindex 3ece99efe3..7fb6e3be52 100644--- a/tests/unit/executor-codex.test.ts+++ b/tests/unit/executor-codex.test.ts@@ -530,9 +530,12 @@ test("CodexExecutor.transformRequest preserves native assistant commentary histo),true);+ // Reasoning items are stripped from the Responses input — encrypted_content is+ // unusable with store=false (previous_response_id deleted) and the summary blob+ // only inflates context on every subsequent agentic turn (decolua/9router#1599).assert.equal(result.input.some((item) => item.type === "reasoning"),- true+ false);assert.equal(result.input.some((item) => item.type === "function_call"),diff --git a/tests/unit/executor-default-anthropic-compatible-bearer.test.ts b/tests/unit/executor-default-anthropic-compatible-bearer.test.tsnew file mode 100644index 0000000000..fdbe553463--- /dev/null+++ b/tests/unit/executor-default-anthropic-compatible-bearer.test.ts@@ -0,0 +1,68 @@+/**+ * Port of decolua/9router commit b977bf74:+ * Some third-party Anthropic-compatible gateways (configured via+ * `anthropic-compatible-*` provider IDs) require Authorization: Bearer+ * in addition to x-api-key. Without the Bearer header, those gateways+ * return 401 "missing_api_key" on every forward.+ *+ * For NON-official anthropic-compatible endpoints (any `baseUrl` that is+ * not empty AND does not contain "api.anthropic.com"), the default+ * executor's buildHeaders must emit BOTH `x-api-key` and `Authorization:+ * Bearer <apiKey>`. Official api.anthropic.com upstreams are unchanged+ * (x-api-key only).+ */++import test from "node:test";+import assert from "node:assert/strict";++import { DefaultExecutor } from "../../open-sse/executors/default.ts";++const BASE_CREDS_THIRD_PARTY = {+ apiKey: "k-third-party",+ providerSpecificData: { baseUrl: "https://gateway.example/v1" },+} as Record<string, unknown>;++const BASE_CREDS_OFFICIAL = {+ apiKey: "k-official",+ providerSpecificData: { baseUrl: "https://api.anthropic.com/v1" },+} as Record<string, unknown>;++test("anthropic-compatible (third-party gateway): sends x-api-key AND Authorization: Bearer", () => {+ const executor = new DefaultExecutor("anthropic-compatible-thirdparty");+ const headers = executor.buildHeaders(BASE_CREDS_THIRD_PARTY, true) as Record<+ string,+ string+ >;+ assert.equal(headers["x-api-key"], "k-third-party");+ assert.equal(+ headers["Authorization"],+ "Bearer k-third-party",+ "third-party anthropic-compatible upstreams need the Bearer fallback too"+ );+});++test("anthropic-compatible (official api.anthropic.com): only x-api-key, no Bearer", () => {+ const executor = new DefaultExecutor("anthropic-compatible-official");+ const headers = executor.buildHeaders(BASE_CREDS_OFFICIAL, true) as Record<+ string,+ string+ >;+ assert.equal(headers["x-api-key"], "k-official");+ assert.equal(+ headers["Authorization"],+ undefined,+ "official anthropic upstream must NOT receive a Bearer header alongside x-api-key"+ );+});++test("anthropic-compatible (no baseUrl): treated as official, no Bearer", () => {+ // Empty/missing baseUrl means: "talk to api.anthropic.com" — keep the legacy+ // behavior (x-api-key only).+ const executor = new DefaultExecutor("anthropic-compatible-empty");+ const headers = executor.buildHeaders(+ { apiKey: "k-empty", providerSpecificData: {} } as Record<string, unknown>,+ true+ ) as Record<string, string>;+ assert.equal(headers["x-api-key"], "k-empty");+ assert.equal(headers["Authorization"], undefined);+});diff --git a/tests/unit/executor-default-base.test.ts b/tests/unit/executor-default-base.test.tsindex 6266bcb7fa..bdb6546c59 100644--- a/tests/unit/executor-default-base.test.ts+++ b/tests/unit/executor-default-base.test.ts@@ -435,6 +435,43 @@ test("DefaultExecutor.buildHeaders handles GLM, default auth and anthropic-compaassert.equal(anthropicHeaders.Accept, "text/event-stream");});+test("DefaultExecutor.buildHeaders keeps a caller-supplied Anthropic-Version (case-insensitive guard) for anthropic-compatible providers", () => {+ // An operator may configure a Title-Case "Anthropic-Version" via the provider+ // config headers. The default-guard at the anthropic-compatible-* branch must+ // detect it case-insensitively and NOT add a second lowercase+ // "anthropic-version" key, which undici would otherwise combine into+ // "2025-01-01, 2023-06-01" and break the upstream request.+ const anthropicCompat = new DefaultExecutor("anthropic-compatible-test");+ // `config` is shared across instances via the provider registry, so snapshot+ // and restore `config.headers` to avoid leaking the Title-Case override into+ // other tests.+ const originalConfigHeaders = anthropicCompat.config.headers;+ anthropicCompat.config.headers = {+ ...originalConfigHeaders,+ "Anthropic-Version": "2025-01-01",+ };++ try {+ const headers = anthropicCompat.buildHeaders({ apiKey: "anth-key" }, true);++ const versionKeys = Object.keys(headers).filter(+ (key) => key.toLowerCase() === "anthropic-version"+ );+ assert.equal(versionKeys.length, 1, "Duplicate anthropic-version header keys found");+ assert.equal(headers["Anthropic-Version"], "2025-01-01");+ assert.equal(headers["anthropic-version"], undefined);+ assert.equal(headers["x-api-key"], "anth-key");+ } finally {+ anthropicCompat.config.headers = originalConfigHeaders;+ }+});++test("DefaultExecutor.buildHeaders still defaults anthropic-version when no variant is present", () => {+ const anthropicCompat = new DefaultExecutor("anthropic-compatible-test");+ const headers = anthropicCompat.buildHeaders({ apiKey: "anth-key" }, true);+ assert.equal(headers["anthropic-version"], "2023-06-01");+});+test("DefaultExecutor local OpenAI-style providers honor custom base URLs and skip empty bearer headers", () => {const lmStudio = new DefaultExecutor("lm-studio");const vllm = new DefaultExecutor("vllm");@@ -930,6 +967,107 @@ test("DefaultExecutor.transformRequest neutralizes incompatible tool_choice forassert.equal((result as any).tool_choice, "auto");});+// Port of decolua/9router#1343: openai-compatible-* providers (DeepSeek / Ollama /+// local OpenAI-compatible models) often lack native Structured Output, so a+// `json_schema` response_format is downgraded to `json_object` with the schema+// injected into the system prompt instead.+test("DefaultExecutor.transformRequest downgrades json_schema to json_object for openai-compatible providers and injects the schema into a fresh system prompt", () => {+ const executor = new DefaultExecutor("openai-compatible-deepseek");+ const schema = {+ type: "object",+ properties: { answer: { type: "string" } },+ required: ["answer"],+ };+ const body = {+ model: "deepseek-chat",+ messages: [{ role: "user", content: "give me JSON" }],+ response_format: {+ type: "json_schema",+ json_schema: { name: "answer_schema", schema },+ },+ };++ const result = executor.transformRequest("deepseek-chat", body, true, {+ providerSpecificData: { baseUrl: "https://proxy.example/v1" },+ }) as any;++ // response_format is downgraded to json_object.+ assert.deepEqual(result.response_format, { type: "json_object" });+ // A system message carrying the schema is injected at the front.+ assert.equal(result.messages[0].role, "system");+ assert.match(result.messages[0].content, /strictly follows this JSON schema/);+ assert.ok(result.messages[0].content.includes('"answer"'));+ // The original user message is preserved.+ assert.equal(result.messages[1].role, "user");+ assert.equal(result.messages[1].content, "give me JSON");+ // Original body is not mutated.+ assert.equal((body as any).response_format.type, "json_schema");+ assert.equal(body.messages.length, 1);+});++test("DefaultExecutor.transformRequest appends the json_schema prompt to an existing system message", () => {+ const executor = new DefaultExecutor("openai-compatible-ollama");+ const body = {+ model: "llama3.1",+ messages: [+ { role: "system", content: "You are concise." },+ { role: "user", content: "give me JSON" },+ ],+ response_format: {+ type: "json_schema",+ json_schema: { name: "s", schema: { type: "object" } },+ },+ };++ const result = executor.transformRequest("llama3.1", body, true, {+ providerSpecificData: { baseUrl: "https://proxy.example/v1" },+ }) as any;++ assert.deepEqual(result.response_format, { type: "json_object" });+ assert.equal(result.messages[0].role, "system");+ assert.match(result.messages[0].content, /^You are concise\./);+ assert.match(result.messages[0].content, /strictly follows this JSON schema/);+ // Existing system message object is not mutated in place.+ assert.equal(body.messages[0].content, "You are concise.");+});++test("DefaultExecutor.transformRequest leaves json_schema response_format untouched for native providers", () => {+ const executor = new DefaultExecutor("openai");+ const responseFormat = {+ type: "json_schema",+ json_schema: { name: "s", schema: { type: "object" } },+ };+ const body = {+ model: "gpt-4.1",+ messages: [{ role: "user", content: "give me JSON" }],+ response_format: responseFormat,+ };++ const result = executor.transformRequest("gpt-4.1", body, true, {}) as any;++ // Native OpenAI keeps the json_schema response_format; no system prompt injected.+ assert.deepEqual(result.response_format, responseFormat);+ assert.equal(result.messages.length, 1);+ assert.equal(result.messages[0].role, "user");+});++test("DefaultExecutor.transformRequest ignores non-json_schema response_format for openai-compatible providers", () => {+ const executor = new DefaultExecutor("openai-compatible-deepseek");+ const body = {+ model: "deepseek-chat",+ messages: [{ role: "user", content: "hi" }],+ response_format: { type: "json_object" },+ };++ const result = executor.transformRequest("deepseek-chat", body, true, {+ providerSpecificData: { baseUrl: "https://proxy.example/v1" },+ }) as any;++ assert.deepEqual(result.response_format, { type: "json_object" });+ assert.equal(result.messages.length, 1);+ assert.equal(result.messages[0].role, "user");+});+test("DefaultExecutor.transformRequest applies GLMT preset defaults without overriding explicit values", () => {const executor = new DefaultExecutor("glmt");diff --git a/tests/unit/executor-gemini-cli.test.ts b/tests/unit/executor-gemini-cli.test.tsindex 9a122bf33e..9159129ba2 100644--- a/tests/unit/executor-gemini-cli.test.ts+++ b/tests/unit/executor-gemini-cli.test.ts@@ -473,3 +473,55 @@ test("GeminiCLIExecutor.execute applies CLI fingerprint to the final Cloud CodeglobalThis.fetch = originalFetch;}});++test("GeminiCLIExecutor.parseRetryFromErrorMessage reads structured google.rpc.RetryInfo.retryDelay", () => {+ const executor = new GeminiCLIExecutor();++ const body = JSON.stringify({+ error: {+ code: 429,+ message: "Resource has been exhausted (e.g. check quota).",+ status: "RESOURCE_EXHAUSTED",+ details: [+ { "@type": "type.googleapis.com/google.rpc.QuotaFailure", violations: [] },+ { "@type": "type.googleapis.com/google.rpc.RetryInfo", retryDelay: "30s" },+ ],+ },+ });++ // The prose regex would not match this JSON body, so a positive result proves+ // the structured RetryInfo path is what produced the hint.+ assert.equal(executor.parseRetryFromErrorMessage(body), 30_000);+});++test("GeminiCLIExecutor.parseRetryFromErrorMessage parses fractional retryDelay seconds", () => {+ const executor = new GeminiCLIExecutor();++ const body = JSON.stringify({+ error: {+ details: [+ { "@type": "type.googleapis.com/google.rpc.RetryInfo", retryDelay: "1.5s" },+ ],+ },+ });++ assert.equal(executor.parseRetryFromErrorMessage(body), 1_500);+});++test("GeminiCLIExecutor.parseRetryFromErrorMessage still parses prose 'reset after' format", () => {+ const executor = new GeminiCLIExecutor();++ assert.equal(+ executor.parseRetryFromErrorMessage("Your quota will reset after 1h2m3s"),+ 1 * 3600 * 1000 + 2 * 60 * 1000 + 3 * 1000+ );+});++test("GeminiCLIExecutor.parseRetryFromErrorMessage returns null for unrelated JSON", () => {+ const executor = new GeminiCLIExecutor();++ assert.equal(+ executor.parseRetryFromErrorMessage(JSON.stringify({ error: { message: "nope" } })),+ null+ );+});diff --git a/tests/unit/executor-strip-stainless-openai-compat.test.ts b/tests/unit/executor-strip-stainless-openai-compat.test.tsnew file mode 100644index 0000000000..02c693faa7--- /dev/null+++ b/tests/unit/executor-strip-stainless-openai-compat.test.ts@@ -0,0 +1,83 @@+import test from "node:test";+import assert from "node:assert/strict";++const base = await import("../../open-sse/executors/base.ts");++test("isOpenAICompatibleEndpoint matches openai-compatible-* providers", () => {+ assert.equal(base.isOpenAICompatibleEndpoint("openai-compatible-foo", "https://x/y"), true);+ assert.equal(+ base.isOpenAICompatibleEndpoint("claude", "https://api.anthropic.com/v1/messages"),+ false+ );+});++test("isOpenAICompatibleEndpoint matches chat/completions and responses URLs", () => {+ assert.equal(+ base.isOpenAICompatibleEndpoint("groq", "https://api.groq.com/openai/v1/chat/completions"),+ true+ );+ assert.equal(base.isOpenAICompatibleEndpoint("groq", "https://x/v1/responses"), true);+ assert.equal(base.isOpenAICompatibleEndpoint("groq", "https://x/v1/embeddings"), false);+});++test("strips X-Stainless-* headers on OpenAI-compatible passthrough", () => {+ const headers: Record<string, string> = {+ "Content-Type": "application/json",+ Authorization: "Bearer sk-test",+ "X-Stainless-Lang": "js",+ "X-Stainless-OS": "Linux",+ "x-stainless-runtime": "node",+ };+ const stripped = base.stripStainlessHeadersForOpenAICompat(+ headers,+ "openai-compatible-acme",+ "https://acme.example/v1/chat/completions"+ );+ assert.deepEqual(stripped.sort(), ["X-Stainless-Lang", "X-Stainless-OS", "x-stainless-runtime"]);+ assert.equal(headers["X-Stainless-Lang"], undefined);+ assert.equal(headers["X-Stainless-OS"], undefined);+ assert.equal(headers["x-stainless-runtime"], undefined);+ // Non-stainless headers untouched.+ assert.equal(headers["Authorization"], "Bearer sk-test");+ assert.equal(headers["Content-Type"], "application/json");+});++test("does NOT strip X-Stainless-* for non-OpenAI-compatible endpoints", () => {+ const headers: Record<string, string> = {+ "X-Stainless-Lang": "js",+ "X-Stainless-Package-Version": "1.0.0",+ };+ const stripped = base.stripStainlessHeadersForOpenAICompat(+ headers,+ "claude",+ "https://api.anthropic.com/v1/messages"+ );+ assert.deepEqual(stripped, []);+ // Claude-code-compat spoofing path keeps its X-Stainless-* headers intact.+ assert.equal(headers["X-Stainless-Lang"], "js");+ assert.equal(headers["X-Stainless-Package-Version"], "1.0.0");+});++test("normalizes SDK-derived User-Agent on OpenAI-compatible request", () => {+ const headers: Record<string, string> = {+ "User-Agent": "OpenAI/NodeJS 4.20.0 undici",+ };+ base.stripStainlessHeadersForOpenAICompat(+ headers,+ "openai-compatible-acme",+ "https://acme.example/v1/chat/completions"+ );+ assert.equal(headers["User-Agent"], "Mozilla/5.0 (compatible; OpenAI Compatible)");+});++test("leaves a non-SDK User-Agent untouched", () => {+ const headers: Record<string, string> = {+ "User-Agent": "my-custom-agent/2.0",+ };+ base.stripStainlessHeadersForOpenAICompat(+ headers,+ "openai-compatible-acme",+ "https://acme.example/v1/chat/completions"+ );+ assert.equal(headers["User-Agent"], "my-custom-agent/2.0");+});diff --git a/tests/unit/format-provider-error-cause.test.ts b/tests/unit/format-provider-error-cause.test.tsnew file mode 100644index 0000000000..6ac478ec19--- /dev/null+++ b/tests/unit/format-provider-error-cause.test.ts@@ -0,0 +1,47 @@+import test from "node:test";+import assert from "node:assert/strict";++const { formatProviderError } = await import("../../open-sse/utils/error.ts");++test("formatProviderError: appends low-level cause.code for fetch failures", () => {+ const err = Object.assign(new Error("fetch failed"), {+ cause: { code: "UND_ERR_SOCKET" },+ });+ const out = formatProviderError(err, "openai", "gpt-4o", null);+ assert.equal(out, "[FETCH_FAILED]: fetch failed (cause: UND_ERR_SOCKET)");+});++test("formatProviderError: appends both cause.code and cause.message when present", () => {+ const err = Object.assign(new Error("fetch failed"), {+ cause: { code: "ECONNRESET", message: "socket hang up" },+ });+ const out = formatProviderError(err, "anthropic", "claude-3", null);+ assert.equal(out, "[FETCH_FAILED]: fetch failed (cause: ECONNRESET: socket hang up)");+});++test("formatProviderError: appends only cause.message when code is absent", () => {+ const err = Object.assign(new Error("fetch failed"), {+ cause: { message: "ETIMEDOUT raised" },+ });+ const out = formatProviderError(err, "gemini", "gemini-2", null);+ assert.equal(out, "[FETCH_FAILED]: fetch failed (cause: ETIMEDOUT raised)");+});++test("formatProviderError: no cause suffix when error has no cause", () => {+ const err = { code: "rate_limited", message: "Too many requests" };+ const out = formatProviderError(err, "openai", "gpt-4o", 429);+ assert.equal(out, "[429]: Too many requests");+});++test("formatProviderError: ignores a cause that carries neither code nor message", () => {+ const err = Object.assign(new Error("boom"), { cause: {} });+ const out = formatProviderError(err, "openai", "gpt-4o", null);+ assert.equal(out, "[FETCH_FAILED]: boom");+});++test("formatProviderError: handles a primitive (string) cause without crashing", () => {+ const err = Object.assign(new Error("boom"), { cause: "raw string cause" });+ const out = formatProviderError(err, "openai", "gpt-4o", null);+ // primitive cause has no .code/.message → no suffix appended+ assert.equal(out, "[FETCH_FAILED]: boom");+});diff --git a/tests/unit/github-copilot-gpt-4o-mini.test.ts b/tests/unit/github-copilot-gpt-4o-mini.test.tsnew file mode 100644index 0000000000..0f6d0a766d--- /dev/null+++ b/tests/unit/github-copilot-gpt-4o-mini.test.ts@@ -0,0 +1,45 @@+import { test } from "node:test";+import assert from "node:assert/strict";+import { getRegistryEntry } from "../../open-sse/config/providerRegistry.ts";++// Regression guard: the GitHub Copilot (`gh`) provider must expose `gpt-4o-mini`+// alongside `gpt-4o`. Copilot serves the cheaper mini variant via+// chat/completions, so apps that hard-code `gpt-4o-mini` should resolve to the+// Copilot provider — not only to the separate github-models (`ghm`) marketplace+// entry, which lists it under the `openai/` prefix (`openai/gpt-4o-mini`).+//+// Ported from upstream decolua/9router (add GPT-4o mini to GitHub Copilot).++test("github (Copilot) provider exposes gpt-4o-mini next to gpt-4o", () => {+ const entry = getRegistryEntry("github");+ assert.ok(entry, "github registry entry should exist");+ assert.ok(entry.models, "github registry entry should have a models array");++ const ids = entry.models!.map((m) => m.id);+ assert.ok(ids.includes("gpt-4o"), "gpt-4o should remain registered");+ assert.ok(+ ids.includes("gpt-4o-mini"),+ "gpt-4o-mini should be registered on the Copilot (gh) provider"+ );++ const mini = entry.models!.find((m) => m.id === "gpt-4o-mini");+ assert.equal(mini?.name, "GPT-4o mini");+ assert.equal(mini?.contextLength, 128000);+});++test("Copilot gpt-4o-mini is distinct from the github-models openai/gpt-4o-mini", () => {+ const copilot = getRegistryEntry("github");+ const marketplace = getRegistryEntry("github-models");++ const copilotIds = (copilot?.models ?? []).map((m) => m.id);+ const marketplaceIds = (marketplace?.models ?? []).map((m) => m.id);++ // The two providers reference the same upstream model under different ids:+ // Copilot uses the bare `gpt-4o-mini`; the marketplace uses `openai/gpt-4o-mini`.+ assert.ok(copilotIds.includes("gpt-4o-mini"));+ assert.ok(marketplaceIds.includes("openai/gpt-4o-mini"));+ assert.ok(+ !copilotIds.includes("openai/gpt-4o-mini"),+ "Copilot should not carry the marketplace-prefixed id"+ );+});diff --git a/tests/unit/headroom-proxy-lifecycle.test.ts b/tests/unit/headroom-proxy-lifecycle.test.tsnew file mode 100644index 0000000000..487ea71982--- /dev/null+++ b/tests/unit/headroom-proxy-lifecycle.test.ts@@ -0,0 +1,90 @@+import { test } from "node:test";+import assert from "node:assert/strict";+import {+ DEFAULT_HEADROOM_URL,+ isLoopbackHeadroomUrl,+ parsePortFromHeadroomUrl,+ buildHeadroomStatus,+} from "../../src/lib/headroom/detect";+import { isLocalOnlyPath } from "../../src/server/authz/routeGuard";++// ──────────────────────────────────────────────────────────────────────────────+// 1. Route guard: /api/headroom/{start,stop} MUST be classified LOCAL_ONLY+// so a tunneled JWT cannot trigger child-process spawning (Hard Rule #15).+// ──────────────────────────────────────────────────────────────────────────────+test("isLocalOnlyPath gates /api/headroom/start and /stop", () => {+ assert.equal(isLocalOnlyPath("/api/headroom/start"), true);+ assert.equal(isLocalOnlyPath("/api/headroom/stop"), true);+ // status is a read-only probe — keep it accessible (matches upstream b55cf36d).+ assert.equal(isLocalOnlyPath("/api/headroom/status"), false);+});++// ──────────────────────────────────────────────────────────────────────────────+// 2. URL helpers — pure functions, no side effects.+// ──────────────────────────────────────────────────────────────────────────────+test("DEFAULT_HEADROOM_URL falls back to localhost:8787", () => {+ assert.ok(DEFAULT_HEADROOM_URL.startsWith("http"));+ assert.ok(/:8787$/.test(DEFAULT_HEADROOM_URL) || /HEADROOM_URL/.test(DEFAULT_HEADROOM_URL));+});++test("isLoopbackHeadroomUrl recognizes loopback hosts", () => {+ assert.equal(isLoopbackHeadroomUrl("http://localhost:8787"), true);+ assert.equal(isLoopbackHeadroomUrl("http://127.0.0.1:8787"), true);+ assert.equal(isLoopbackHeadroomUrl("http://[::1]:8787"), true);+ assert.equal(isLoopbackHeadroomUrl("http://headroom:8787"), false);+ assert.equal(isLoopbackHeadroomUrl("http://10.0.0.5:8787"), false);+ assert.equal(isLoopbackHeadroomUrl("not-a-url"), false);+});++test("parsePortFromHeadroomUrl extracts valid port or returns null", () => {+ assert.equal(parsePortFromHeadroomUrl("http://localhost:8787"), 8787);+ assert.equal(parsePortFromHeadroomUrl("http://localhost"), null);+ assert.equal(parsePortFromHeadroomUrl("bogus"), null);+ // Pair-port 50ed79fe: Docker sidecar with non-standard port.+ assert.equal(parsePortFromHeadroomUrl("http://headroom:9090"), 9090);+});++// ──────────────────────────────────────────────────────────────────────────────+// 3. buildHeadroomStatus — pure shape assembly (mockable inputs).+// Pair commit 50ed79fe: a reachable external proxy must report+// running=true and canStart=false even without a local CLI.+// ──────────────────────────────────────────────────────────────────────────────+test("buildHeadroomStatus: local CLI present + proxy running → canStart=true", () => {+ const status = buildHeadroomStatus({+ url: "http://localhost:8787",+ binaryPath: "/usr/local/bin/headroom",+ python: "python3.12",+ proxyReachable: true,+ });+ assert.equal(status.installed, true);+ assert.equal(status.running, true);+ assert.equal(status.localUrl, true);+ assert.equal(status.canStart, true);+ assert.equal(status.python, "python3.12");+});++test("buildHeadroomStatus: external proxy reachable, no local CLI → running=true, canStart=false (Docker sidecar)", () => {+ const status = buildHeadroomStatus({+ url: "http://headroom:8787",+ binaryPath: null,+ python: null,+ proxyReachable: true,+ });+ assert.equal(status.installed, false);+ assert.equal(status.running, true);+ assert.equal(status.localUrl, false);+ assert.equal(status.canStart, false);+});++test("buildHeadroomStatus: nothing installed and proxy unreachable → all false", () => {+ const status = buildHeadroomStatus({+ url: "http://localhost:8787",+ binaryPath: null,+ python: null,+ proxyReachable: false,+ });+ assert.equal(status.installed, false);+ assert.equal(status.running, false);+ assert.equal(status.localUrl, true);+ assert.equal(status.canStart, false);+});diff --git a/tests/unit/ipUtils.test.ts b/tests/unit/ipUtils.test.tsnew file mode 100644index 0000000000..cb1c83f638--- /dev/null+++ b/tests/unit/ipUtils.test.ts@@ -0,0 +1,74 @@+import { describe, it } from "node:test";+import assert from "node:assert/strict";+import { extractClientIp, getClientIpFromRequest } from "@/lib/ipUtils";++/**+ * Regression tests for IP detection — ported from decolua/9router#1893.+ *+ * When OmniRoute runs behind a local reverse proxy (nginx etc.) the TCP peer+ * is loopback (127.0.0.1 / ::1) and forwarding headers (X-Forwarded-For,+ * X-Real-IP, CF-Connecting-IP) carry the real client IP. When the request+ * arrives directly from the public internet, the TCP peer IS the client and+ * forwarding headers are spoofable — keying brute-force buckets by them lets+ * one attacker either lock everyone else out or evade the lockout entirely.+ */++function makeReq(headers: Record<string, string>, remoteAddress?: string) {+ return {+ headers: new Headers(headers),+ socket: remoteAddress ? { remoteAddress } : undefined,+ };+}++describe("ipUtils — loopback-gated forwarding headers", () => {+ it("trusts X-Forwarded-For when TCP peer is 127.0.0.1 loopback", () => {+ const req = makeReq({ "x-forwarded-for": "203.0.113.10" }, "127.0.0.1");+ assert.equal(getClientIpFromRequest(req), "203.0.113.10");+ });++ it("trusts X-Forwarded-For when TCP peer is ::1 loopback", () => {+ const req = makeReq({ "x-forwarded-for": "203.0.113.11" }, "::1");+ assert.equal(getClientIpFromRequest(req), "203.0.113.11");+ });++ it("trusts X-Real-IP when TCP peer is loopback", () => {+ const req = makeReq({ "x-real-ip": "203.0.113.12" }, "127.0.0.1");+ assert.equal(getClientIpFromRequest(req), "203.0.113.12");+ });++ it("trusts CF-Connecting-IP when TCP peer is loopback", () => {+ const req = makeReq({ "cf-connecting-ip": "203.0.113.13" }, "127.0.0.1");+ assert.equal(getClientIpFromRequest(req), "203.0.113.13");+ });++ it("ignores spoofed X-Forwarded-For when TCP peer is a public address", () => {+ // Direct public client trying to spoof another IP — must be ignored so+ // the brute-force guard keys by the unspoofable TCP peer.+ const req = makeReq({ "x-forwarded-for": "203.0.113.99" }, "198.51.100.5");+ assert.equal(getClientIpFromRequest(req), "198.51.100.5");+ });++ it("ignores spoofed CF-Connecting-IP when TCP peer is a public address", () => {+ const req = makeReq({ "cf-connecting-ip": "203.0.113.88" }, "198.51.100.7");+ assert.equal(getClientIpFromRequest(req), "198.51.100.7");+ });++ it("falls back to forwarding headers when no socket peer is known", () => {+ // Edge runtime / fetch path where req.socket is absent — preserve prior+ // behavior, otherwise we'd lose all IPs in that path.+ const req = makeReq({ "x-forwarded-for": "203.0.113.20" });+ assert.equal(getClientIpFromRequest(req), "203.0.113.20");+ });++ it("returns loopback peer when no forwarding headers are present", () => {+ const req = makeReq({}, "127.0.0.1");+ assert.equal(getClientIpFromRequest(req), "127.0.0.1");+ });++ it("extractClientIp (lower-level) keeps prior contract", () => {+ // Lower-level helper does NOT know the peer — preserve prior behavior.+ assert.equal(extractClientIp("203.0.113.1, 10.0.0.1", "127.0.0.1"), "203.0.113.1");+ assert.equal(extractClientIp(null, "198.51.100.1"), "198.51.100.1");+ assert.equal(extractClientIp("unknown, 203.0.113.2", "10.0.0.1"), "203.0.113.2");+ });+});diff --git a/tests/unit/kiro-tool-args-streaming.test.ts b/tests/unit/kiro-tool-args-streaming.test.tsnew file mode 100644index 0000000000..52a10c7cb6--- /dev/null+++ b/tests/unit/kiro-tool-args-streaming.test.ts@@ -0,0 +1,167 @@+/**+ * Regression test for Kiro/CodeWhisperer streaming tool_calls.arguments deltas.+ *+ * Kiro streams toolUseEvent.input as PARTIAL OBJECTS that grow over time+ * (e.g. {command:"cat /home"} then {command:"cat /home/wxsys"}). The old executor+ * re-stringified each partial object and emitted it as an OpenAI argument delta, so the+ * overlapping JSON prefixes concatenated downstream into unparseable garbage+ * ("Unterminated string"). The fix buffers object-form payloads keyed by toolCallId, keeps+ * only the latest canonical, and flushes ONCE at a finish boundary. String-form payloads+ * remain concatenable incremental deltas.+ */+import test from "node:test";+import assert from "node:assert/strict";++const { flushBufferedToolArgs } = await import("../../open-sse/executors/kiro.ts");++type ArgsBuffered = Map<string, { toolIndex: number; canonical: string }>;+type State = { toolArgsEmitted: Map<string, string>; toolArgsBuffered: ArgsBuffered };++function makeMockController() {+ const enqueued: string[] = [];+ const decoder = new TextDecoder();+ return {+ enqueued,+ enqueue(bytes: Uint8Array) {+ enqueued.push(decoder.decode(bytes));+ },+ };+}++function parseSSEData(sseLines: string[]) {+ return sseLines+ .map((line) => {+ const m = line.match(/^data: (.+)\n\n$/);+ return m ? JSON.parse(m[1]) : null;+ })+ .filter(Boolean);+}++function reconstructArguments(chunks: any[]) {+ const perIndex = new Map<number, string>();+ for (const chunk of chunks) {+ const tc = chunk.choices?.[0]?.delta?.tool_calls?.[0];+ if (!tc) continue;+ const idx = tc.index as number;+ const args = (tc.function?.arguments as string) || "";+ perIndex.set(idx, (perIndex.get(idx) || "") + args);+ }+ return perIndex;+}++const CTX = { responseId: "resp_test", created: 1, model: "kiro" };++test("flushes a single buffered tool call with valid concatenable JSON", () => {+ const state: State = {+ toolArgsEmitted: new Map(),+ toolArgsBuffered: new Map([+ [+ "tool_abc",+ {+ toolIndex: 0,+ canonical: '{"command":"cat /home/wxsys/Project/naskin/.impeccable.md"}',+ },+ ],+ ]),+ };+ const controller = makeMockController();+ flushBufferedToolArgs(state, controller, CTX);++ const chunks = parseSSEData(controller.enqueued);+ assert.equal(chunks.length, 1);++ const args = reconstructArguments(chunks);+ const final = args.get(0)!;+ assert.doesNotThrow(() => JSON.parse(final));+ assert.deepEqual(JSON.parse(final), {+ command: "cat /home/wxsys/Project/naskin/.impeccable.md",+ });++ assert.equal(state.toolArgsBuffered.size, 0);+ assert.equal(state.toolArgsEmitted.get("tool_abc"), final);+});++test("4 partial-object events produce a single valid flush (reported bug)", () => {+ const state: State = { toolArgsEmitted: new Map(), toolArgsBuffered: new Map() };++ const partialPayloads = [+ { command: "cat /home" },+ { command: "cat /home/wxsys" },+ { command: "cat /home/wxsys/Project" },+ { command: "cat /home/wxsys/Project/naskin/.impeccable.md" },+ ];+ // Each event overwrites the buffered canonical for the same toolCallId.+ for (const input of partialPayloads) {+ state.toolArgsBuffered.set("tool_abc", { toolIndex: 0, canonical: JSON.stringify(input) });+ }++ const controller = makeMockController();+ flushBufferedToolArgs(state, controller, CTX);++ const chunks = parseSSEData(controller.enqueued);+ assert.equal(chunks.length, 1);++ const final = reconstructArguments(chunks).get(0)!;+ assert.doesNotThrow(() => JSON.parse(final));+ assert.equal(JSON.parse(final).command, "cat /home/wxsys/Project/naskin/.impeccable.md");+});++test("flushes multiple concurrent tool calls preserving toolIndex", () => {+ const state: State = {+ toolArgsEmitted: new Map(),+ toolArgsBuffered: new Map([+ ["T1", { toolIndex: 0, canonical: '{"filePath":"/a/b/c.txt"}' }],+ ["T2", { toolIndex: 1, canonical: '{"command":"ls"}' }],+ ]),+ };+ const controller = makeMockController();+ flushBufferedToolArgs(state, controller, CTX);++ const chunks = parseSSEData(controller.enqueued);+ assert.equal(chunks.length, 2);++ const args = reconstructArguments(chunks);+ assert.deepEqual(JSON.parse(args.get(0)!), { filePath: "/a/b/c.txt" });+ assert.deepEqual(JSON.parse(args.get(1)!), { command: "ls" });+});++test("does not re-emit when canonical equals already-emitted (idempotent flush)", () => {+ const state: State = {+ toolArgsEmitted: new Map([["tool_abc", '{"command":"ls"}']]),+ toolArgsBuffered: new Map([["tool_abc", { toolIndex: 0, canonical: '{"command":"ls"}' }]]),+ };+ const controller = makeMockController();+ flushBufferedToolArgs(state, controller, CTX);++ assert.equal(controller.enqueued.length, 0);+ assert.equal(state.toolArgsBuffered.size, 0);+});++test("no-op when buffer is empty", () => {+ const state: State = { toolArgsEmitted: new Map(), toolArgsBuffered: new Map() };+ const controller = makeMockController();+ flushBufferedToolArgs(state, controller, CTX);++ assert.equal(controller.enqueued.length, 0);+});++test("OLD BUG: re-stringifying each partial object produces unparseable concat", () => {+ const partials = [+ { command: "cat /home" },+ { command: "cat /home/wxsys" },+ { command: "cat /home/wxsys/Project/naskin/.impeccable.md" },+ ];+ const buggyConcat = partials.map((p) => JSON.stringify(p)).join("");+ assert.throws(() => JSON.parse(buggyConcat));+});++test("FIX: emitting only the final canonical produces parseable JSON", () => {+ const partials = [+ { command: "cat /home" },+ { command: "cat /home/wxsys" },+ { command: "cat /home/wxsys/Project/naskin/.impeccable.md" },+ ];+ const fixedConcat = JSON.stringify(partials[partials.length - 1]);+ assert.doesNotThrow(() => JSON.parse(fixedConcat));+ assert.equal(JSON.parse(fixedConcat).command, "cat /home/wxsys/Project/naskin/.impeccable.md");+});diff --git a/tests/unit/kiro-tool-schema-sanitize-1375.test.ts b/tests/unit/kiro-tool-schema-sanitize-1375.test.tsnew file mode 100644index 0000000000..13fcf0d790--- /dev/null+++ b/tests/unit/kiro-tool-schema-sanitize-1375.test.ts@@ -0,0 +1,131 @@+import test from "node:test";+import assert from "node:assert/strict";++import { sanitizeKiroTools } from "../../open-sse/utils/kiroSanitizer.ts";+const { convertKiroToOpenAI } = await import(+ "../../open-sse/translator/response/kiro-to-openai.ts"+);++// #1375 — Kiro returns 400 "Improperly formed request" when a tool schema+// carries unsupported JSON-Schema keywords or a tool name longer than 64 chars.++test("sanitizeKiroTools: strips unsupported JSON-Schema keywords recursively", () => {+ const tools = [+ {+ toolSpecification: {+ name: "search",+ inputSchema: {+ json: {+ type: "object",+ additionalProperties: false,+ $schema: "http://json-schema.org/draft-07/schema#",+ properties: {+ filter: {+ anyOf: [{ type: "string" }, { type: "null" }],+ $ref: "#/$defs/Filter",+ description: "kept",+ },+ },+ $defs: { Filter: { type: "string" } },+ },+ },+ },+ },+ ];++ const { tools: out } = sanitizeKiroTools(tools);+ const schema = out[0].toolSpecification.inputSchema.json;++ assert.equal("additionalProperties" in schema, false);+ assert.equal("$schema" in schema, false);+ assert.equal("$defs" in schema, false);+ assert.equal("anyOf" in schema.properties.filter, false);+ assert.equal("$ref" in schema.properties.filter, false);+ // Non-stripped keys survive.+ assert.equal(schema.properties.filter.description, "kept");+ assert.equal(schema.type, "object");+});++test("sanitizeKiroTools: drops empty required array and guarantees required:[]", () => {+ const { tools: out } = sanitizeKiroTools([+ {+ toolSpecification: {+ name: "noop",+ inputSchema: { json: { type: "object", properties: {}, required: [] } },+ },+ },+ ]);++ const schema = out[0].toolSpecification.inputSchema.json;+ assert.deepEqual(schema.required, []);+});++test("sanitizeKiroTools: hash-truncates names >64 chars and records nameMap", () => {+ const longName = "a".repeat(80);+ const { tools: out, nameMap } = sanitizeKiroTools([+ {+ toolSpecification: {+ name: longName,+ inputSchema: { json: { type: "object", properties: {} } },+ },+ },+ ]);++ const truncated = out[0].toolSpecification.name;+ assert.ok(truncated.length <= 64, `truncated name should be <=64, got ${truncated.length}`);+ assert.notEqual(truncated, longName);+ // nameMap maps the truncated name back to the original.+ assert.equal(nameMap.get(truncated), longName);+});++test("sanitizeKiroTools: short names are left untouched with an empty nameMap", () => {+ const { tools: out, nameMap } = sanitizeKiroTools([+ {+ toolSpecification: {+ name: "read_file",+ inputSchema: { json: { type: "object", properties: {}, required: ["path"] } },+ },+ },+ ]);++ assert.equal(out[0].toolSpecification.name, "read_file");+ assert.equal(out[0].toolSpecification.inputSchema.json.required[0], "path");+ assert.equal(nameMap.size, 0);+});++test("sanitizeKiroTools: non-array input is returned untouched", () => {+ const { tools, nameMap } = sanitizeKiroTools(undefined);+ assert.equal(tools, undefined);+ assert.equal(nameMap.size, 0);+});++test("kiro-to-openai: streamed tool name is reverse-mapped via state.toolNameMap (#1375)", () => {+ const longName = "b".repeat(80);+ // Build the truncated name exactly as sanitizeKiroTools would, then verify+ // the response translator maps the streamed (truncated) name back.+ const { tools: out, nameMap } = sanitizeKiroTools([+ {+ toolSpecification: {+ name: longName,+ inputSchema: { json: { type: "object", properties: {} } },+ },+ },+ ]);+ const truncated = out[0].toolSpecification.name;++ const result = convertKiroToOpenAI(+ { _eventType: "toolUseEvent", toolUseId: "call_9", name: truncated, input: {} },+ { toolNameMap: nameMap }+ );++ assert.equal(result.choices[0].delta.tool_calls[0].function.name, longName);+});++test("kiro-to-openai: unmapped tool name passes through unchanged", () => {+ const result = convertKiroToOpenAI(+ { _eventType: "toolUseEvent", toolUseId: "call_10", name: "read_file", input: {} },+ { toolNameMap: new Map() }+ );++ assert.equal(result.choices[0].delta.tool_calls[0].function.name, "read_file");+});diff --git a/tests/unit/model-select-passthrough-alias-485.test.ts b/tests/unit/model-select-passthrough-alias-485.test.tsnew file mode 100644index 0000000000..95cc0d2ecf--- /dev/null+++ b/tests/unit/model-select-passthrough-alias-485.test.ts@@ -0,0 +1,49 @@+import test from "node:test";+import assert from "node:assert/strict";+import { buildPassthroughAliasModels } from "../../src/shared/components/modelSelectModalHelpers.ts";++// Regression guard for port of decolua/9router#485 (Anurag Saxena).+//+// In ModelSelectModal, passthrough-provider model aliases are stored in+// `modelAliases` prefixed by the provider's CANONICAL id (e.g. "github/gpt-4"),+// while the public alias may differ (e.g. providerId "github" → alias "gh").+// The passthrough branch previously filtered/stripped by `${alias}/`, so any+// provider whose alias differed from its id resolved to ZERO models. The fix+// filters by `${providerId}/`, mirroring the sibling custom-provider branch.++test("buildPassthroughAliasModels: resolves aliases keyed by providerId even when the public alias differs", () => {+ // providerId "github", public alias would be "gh" — aliases are stored under the id.+ const modelAliases = {+ "GPT 4o": "github/gpt-4o",+ "GPT 4o mini": "github/gpt-4o-mini",+ Sonnet: "anthropic/claude-3-5-sonnet",+ };++ const result = buildPassthroughAliasModels(modelAliases, "github");++ // The bug (filtering by alias "gh/") would yield [] here. The fix yields the+ // two github-prefixed entries, with the providerId prefix stripped from `id`.+ assert.deepEqual(result, [+ { id: "gpt-4o", name: "GPT 4o", value: "github/gpt-4o", source: "alias" },+ { id: "gpt-4o-mini", name: "GPT 4o mini", value: "github/gpt-4o-mini", source: "alias" },+ ]);+});++test("buildPassthroughAliasModels: only matches the requested providerId prefix", () => {+ const modelAliases = {+ a: "openrouter/model-a",+ b: "github/model-b",+ };+ const result = buildPassthroughAliasModels(modelAliases, "openrouter");+ assert.deepEqual(result, [+ { id: "model-a", name: "a", value: "openrouter/model-a", source: "alias" },+ ]);+});++test("buildPassthroughAliasModels: tolerates empty / malformed maps", () => {+ assert.deepEqual(buildPassthroughAliasModels({}, "github"), []);+ assert.deepEqual(+ buildPassthroughAliasModels({ x: undefined as unknown as string }, "github"),+ []+ );+});diff --git a/tests/unit/next-config.test.ts b/tests/unit/next-config.test.tsindex 4a523e50b2..11ec9ed4bb 100644--- a/tests/unit/next-config.test.ts+++ b/tests/unit/next-config.test.ts@@ -77,6 +77,13 @@ test("next config declares Turbopack aliases, runtime assets and server externaltracingIncludes.includes("./open-sse/services/compression/engines/rtk/filters/**/*.json"));assert.ok(tracingIncludes.includes("./open-sse/services/compression/rules/**/*.json"));+ // sql.js WASM must ship in the standalone bundle: sqljsAdapter resolves it from+ // node_modules/sql.js/dist/sql-wasm.wasm at runtime (driver fallback tier), but+ // Next traces sql-wasm.js without auto-including the runtime .wasm asset.+ assert.ok(+ tracingIncludes.includes("./node_modules/sql.js/dist/sql-wasm.wasm"),+ "sql-wasm.wasm must be trace-included so the sql.js fallback works in standalone builds"+ );assert.ok(tracingExcludes.includes("./_tasks/**/*"));assert.ok(tracingExcludes.includes("./tests/**/*"));diff --git a/tests/unit/oauth-cursor-auto-import.test.ts b/tests/unit/oauth-cursor-auto-import.test.tsindex 6ff18db5ed..7bb3c09720 100644--- a/tests/unit/oauth-cursor-auto-import.test.ts+++ b/tests/unit/oauth-cursor-auto-import.test.ts@@ -5,6 +5,7 @@ import {extractCursorTokensFromRows,fuzzyExtractCursorTokensFromRows,cursorDbCandidatePaths,+ verifyLinuxCursorInstalled,} from "../../src/app/api/oauth/cursor/auto-import/route";describe("normalizeVscDbValue", () => {@@ -138,3 +139,67 @@ describe("cursorDbCandidatePaths", () => {assert.deepEqual(cursorDbCandidatePaths("freebsd" as NodeJS.Platform, { home: "/x" }), []);});});++describe("verifyLinuxCursorInstalled (port: 9router#313)", () => {+ const okExec = async () => ({ stdout: "/usr/bin/cursor\n", stderr: "" });+ const failExec = async () => {+ throw new Error("which: no cursor in PATH");+ };+ const okAccess = async () => {};+ const failAccess = async () => {+ throw Object.assign(new Error("ENOENT"), { code: "ENOENT" });+ };++ it("returns true when `which cursor` succeeds (does not probe the .desktop file)", async () => {+ let accessCalled = false;+ const installed = await verifyLinuxCursorInstalled({+ execFile: okExec,+ access: async () => {+ accessCalled = true;+ },+ home: "/home/test",+ });+ assert.equal(installed, true);+ assert.equal(accessCalled, false);+ });++ it("falls back to the cursor.desktop launcher when `which` fails", async () => {+ let probedPath = "";+ const installed = await verifyLinuxCursorInstalled({+ execFile: failExec,+ access: async (p) => {+ probedPath = p;+ },+ home: "/home/test",+ });+ assert.equal(installed, true);+ assert.equal(probedPath, "/home/test/.local/share/applications/cursor.desktop");+ });++ it("returns false when neither `which` nor the .desktop file resolve (phantom config)", async () => {+ const installed = await verifyLinuxCursorInstalled({+ execFile: failExec,+ access: failAccess,+ home: "/home/test",+ });+ assert.equal(installed, false);+ });++ it("probes `which cursor` with a fixed binary name and a bounded timeout", async () => {+ let calledWith: { file: string; args: string[]; timeout: number } | null = null;+ const installed = await verifyLinuxCursorInstalled({+ execFile: async (file, args, options) => {+ calledWith = { file, args, timeout: options.timeout };+ return { stdout: "/usr/bin/cursor", stderr: "" };+ },+ access: okAccess,+ home: "/home/test",+ });+ assert.equal(installed, true);+ assert.deepEqual(calledWith, {+ file: "which",+ args: ["cursor"],+ timeout: 5000,+ });+ });+});diff --git a/tests/unit/openai-responses-reasoning-effort.test.ts b/tests/unit/openai-responses-reasoning-effort.test.tsnew file mode 100644index 0000000000..9b8151bf15--- /dev/null+++ b/tests/unit/openai-responses-reasoning-effort.test.ts@@ -0,0 +1,72 @@+/**+ * Reasoning-effort mapping across the OpenAI Chat <-> Responses request translators.+ *+ * Chat Completions carries the reasoning hint as top-level `reasoning_effort`; the+ * Responses API nests it as `reasoning.effort`. These tests pin both directions so+ * the hint survives when a request crosses formats (e.g. a Responses client routed+ * to an OpenAI-native Chat Completions upstream).+ *+ * Ported from upstream PR https://github.com/decolua/9router/pull/1817 (ryanngit).+ * Adapted: OmniRoute previously promoted `reasoning.effort` only behind the+ * Copilot-client gate (commit 75d9a83c25), which silently dropped the field for+ * every other Responses client (OpenCode, Cursor, raw OpenAI Responses, ...).+ * This test pins the unconditional promotion of effort while keeping the+ * Copilot-only `summary` -> Claude thinking marker behind its existing gate.+ */+import test from "node:test";+import assert from "node:assert/strict";+import {+ openaiToOpenAIResponsesRequest,+ openaiResponsesToOpenAIRequest,+} from "../../open-sse/translator/request/openai-responses.ts";+import { convertResponsesApiFormat } from "../../open-sse/translator/helpers/responsesApiHelper.ts";++function asRecord(value: unknown): Record<string, unknown> {+ return value as Record<string, unknown>;+}++test("Responses -> Chat promotes reasoning.effort for non-Copilot clients", () => {+ const out = asRecord(+ openaiResponsesToOpenAIRequest(+ "gpt-test",+ { input: "hello", reasoning: { effort: "high" } },+ true,+ {} // no _copilotClient marker+ )+ );+ assert.equal(out.reasoning_effort, "high");+ assert.equal(out.reasoning, undefined);+});++test("Responses -> Chat preserves reasoning.effort via the helper wrapper", () => {+ const out = asRecord(+ convertResponsesApiFormat({ input: "hello", reasoning: { effort: "medium" } })+ );+ assert.equal(out.reasoning_effort, "medium");+ assert.equal(out.reasoning, undefined);+});++test("Responses -> Chat does not overwrite an explicit reasoning_effort", () => {+ const out = asRecord(+ openaiResponsesToOpenAIRequest(+ "gpt-test",+ { input: "hello", reasoning_effort: "low", reasoning: { effort: "high" } },+ true,+ {}+ )+ );+ // Explicit Chat-level field wins over the Responses nesting.+ assert.equal(out.reasoning_effort, "low");+});++test("Chat -> Responses already wraps reasoning_effort into reasoning.effort", () => {+ const out = asRecord(+ openaiToOpenAIResponsesRequest(+ "gpt-test",+ { messages: [{ role: "user", content: "hi" }], reasoning_effort: "high" },+ true,+ {}+ )+ );+ assert.deepEqual(out.reasoning, { effort: "high" });+});diff --git a/tests/unit/openai-to-claude-strip-temperature-thinking.test.ts b/tests/unit/openai-to-claude-strip-temperature-thinking.test.tsnew file mode 100644index 0000000000..480c294f92--- /dev/null+++ b/tests/unit/openai-to-claude-strip-temperature-thinking.test.ts@@ -0,0 +1,69 @@+/**+ * openaiToClaudeRequest — strip `temperature` for Claude models with extended thinking.+ *+ * Claude's Messages API rejects `temperature` when extended thinking is active.+ * Two cases the translator handles:+ * (a) Model-name detection for forced-thinking families (/claude-(opus|sonnet)-4/),+ * used by Claude OAuth which always sends the interleaved-thinking beta header.+ * (b) A final guard that drops `temperature` whenever `result.thinking` was set from+ * `body.thinking` or `body.reasoning_effort`.+ *+ * Ported from decolua/9router PR #1264 (thanks @noestelar).+ */+import test from "node:test";+import assert from "node:assert/strict";++const { openaiToClaudeRequest } = await import(+ "../../open-sse/translator/request/openai-to-claude.ts"+);++const baseBody = () => ({+ messages: [{ role: "user", content: "hi" }],+ temperature: 0.7,+});++test("strips temperature for claude-opus-4 family (forced thinking)", () => {+ const result = openaiToClaudeRequest("claude-opus-4-6", baseBody(), false);+ assert.equal(result.temperature, undefined);+});++test("strips temperature for claude-sonnet-4 family (forced thinking)", () => {+ const result = openaiToClaudeRequest("claude-sonnet-4-5", baseBody(), false);+ assert.equal(result.temperature, undefined);+});++test("preserves temperature for non-thinking models (haiku, older sonnets)", () => {+ const haiku = openaiToClaudeRequest("claude-haiku-5-20251001", baseBody(), false);+ assert.equal(haiku.temperature, 0.7);++ const sonnet35 = openaiToClaudeRequest("claude-3-5-sonnet-20241022", baseBody(), false);+ assert.equal(sonnet35.temperature, 0.7);+});++test("strips temperature when body.thinking is explicitly set (final guard)", () => {+ // Non-thinking-forced model so the model-based strip doesn't fire; the final+ // guard must catch this case.+ const body = {+ ...baseBody(),+ thinking: { type: "enabled", budget_tokens: 4096 },+ };+ const result = openaiToClaudeRequest("claude-haiku-5-20251001", body, false);+ assert.equal(result.temperature, undefined);+ assert.ok(result.thinking, "thinking should still be present");+});++test("strips temperature when reasoning_effort triggers thinking (final guard)", () => {+ const body = { ...baseBody(), reasoning_effort: "medium" };+ const result = openaiToClaudeRequest("claude-haiku-5-20251001", body, false);+ assert.equal(result.temperature, undefined);+ assert.ok(result.thinking, "reasoning_effort should produce a thinking block");+});++test("preserves temperature when reasoning_effort is unrecognized on a non-thinking model", () => {+ // "none" is not in the effort→budget map, so no thinking block is produced and+ // temperature must survive on a model that does not force thinking.+ const body = { ...baseBody(), reasoning_effort: "none" };+ const result = openaiToClaudeRequest("claude-haiku-5-20251001", body, false);+ assert.equal(result.temperature, 0.7);+ assert.equal(result.thinking, undefined);+});diff --git a/tests/unit/pioneer-provider.test.ts b/tests/unit/pioneer-provider.test.tsnew file mode 100644index 0000000000..137859c3e8--- /dev/null+++ b/tests/unit/pioneer-provider.test.ts@@ -0,0 +1,83 @@+import test from "node:test";+import assert from "node:assert/strict";++import { APIKEY_PROVIDERS, AI_PROVIDERS } from "../../src/shared/constants/providers.ts";+import { REGISTRY } from "../../open-sse/config/providerRegistry.ts";+import { PROVIDERS as LEGACY_PROVIDERS } from "../../open-sse/config/constants.ts";++test("pioneer is registered as an API-key provider in the UI catalog", () => {+ const pioneer = APIKEY_PROVIDERS.pioneer;+ assert.ok(pioneer, "APIKEY_PROVIDERS.pioneer must exist");+ assert.equal(pioneer.id, "pioneer");+ assert.equal(pioneer.alias, "pn");+ assert.equal(pioneer.name, "Pioneer AI");+ assert.equal(pioneer.color, "#7C5CFF");+});++test("pioneer appears in AI_PROVIDERS (composed view)", () => {+ const pioneer = AI_PROVIDERS.pioneer;+ assert.ok(pioneer, "AI_PROVIDERS.pioneer must exist");+ assert.equal(pioneer.id, "pioneer");+});++test("pioneer registry entry is correct (format, auth, executor)", () => {+ const pioneer = REGISTRY.pioneer;+ assert.ok(pioneer, "REGISTRY.pioneer must exist");+ assert.equal(pioneer.format, "openai");+ assert.equal(pioneer.executor, "default");+ assert.equal(pioneer.authType, "apikey");+ // X-API-Key auth (not Bearer) — matches upstream preference+ assert.equal(pioneer.authHeader, "x-api-key");+ assert.equal(pioneer.baseUrl, "https://api.pioneer.ai/v1/chat/completions");+ assert.equal(pioneer.alias, "pn");+});++test("pioneer has open-tier models with supports_on_demand_inference", () => {+ const pioneer = REGISTRY.pioneer;+ const ids = pioneer.models.map((m) => m.id);+ // Qwen3 models+ assert.ok(ids.includes("Qwen/Qwen3-32B"), "must include Qwen3 32B");+ assert.ok(ids.includes("Qwen/Qwen3-8B"), "must include Qwen3 8B");+ // Llama models+ assert.ok(ids.includes("meta-llama/Llama-3.1-8B-Instruct"), "must include Llama 3.1 8B Instruct");+ assert.ok(ids.includes("meta-llama/Llama-3.2-1B-Instruct"), "must include Llama 3.2 1B Instruct");+ // At least 10 models total (open-tier catalog)+ assert.ok(pioneer.models.length >= 10, `expected >= 10 models, got ${pioneer.models.length}`);+ // Gated models (Claude/GPT/Gemini) must NOT appear — they require fine-tuning first+ assert.ok(+ !ids.some((id) => id.toLowerCase().includes("claude")),+ "gated Claude models must not be in catalog"+ );+ assert.ok(+ !ids.some((id) => id.toLowerCase().includes("gpt")),+ "gated GPT models must not be in catalog"+ );+ assert.ok(+ !ids.some((id) => id.toLowerCase().includes("gemini")),+ "gated Gemini models must not be in catalog"+ );+});++test("pioneer legacy PROVIDERS entry resolves from generated map", () => {+ const legacy = LEGACY_PROVIDERS.pioneer;+ assert.ok(legacy, "LEGACY_PROVIDERS.pioneer must exist (generated from REGISTRY)");+ assert.equal(legacy.format, "openai");+ // Should not have OAuth fields — pioneer is API-key only+ assert.equal(legacy.clientId, undefined);+ assert.equal(legacy.clientSecret, undefined);+ assert.equal(legacy.tokenUrl, undefined);+});++test("pioneer has hasFree flag and free signup notice", () => {+ const pioneer = APIKEY_PROVIDERS.pioneer;+ assert.equal(pioneer.hasFree, true, "pioneer should advertise free tier");+ assert.ok(pioneer.freeNote?.includes("$75"), "freeNote should mention $75 credits");+ assert.ok(+ pioneer.notice?.signupUrl?.includes("pioneer.ai"),+ "signupUrl should point to pioneer.ai"+ );+ assert.ok(+ pioneer.notice?.apiKeyUrl?.includes("pioneer.ai"),+ "apiKeyUrl should point to pioneer.ai"+ );+});diff --git a/tests/unit/provider-limits-accesstoken-fallback-on-refresh-failure.test.ts b/tests/unit/provider-limits-accesstoken-fallback-on-refresh-failure.test.tsnew file mode 100644index 0000000000..df8fd531c8--- /dev/null+++ b/tests/unit/provider-limits-accesstoken-fallback-on-refresh-failure.test.ts@@ -0,0 +1,85 @@+/**+ * Graceful-degradation fallback when `refreshCredentials` returns null but the+ * connection still holds a usable `accessToken`.+ *+ * Previously this fallback was qualified to `connection.provider === "github"`:+ * every OTHER OAuth provider whose refresh momentarily failed was hard-failed+ * with "Failed to refresh credentials. Please re-authorize the connection.",+ * even though a still-valid access token was on hand. The fix drops the+ * github-specific qualifier so the fallback applies to ANY provider that still+ * has an accessToken.+ *+ * Before the fix this test fails: a non-github provider would throw the 401+ * re-authorize error. After the fix it returns `{ refreshed: false }`.+ */+import test from "node:test";+import assert from "node:assert/strict";+import fs from "node:fs";+import os from "node:os";+import path from "node:path";++process.env.DATA_DIR = fs.mkdtempSync(+ path.join(os.tmpdir(), "omniroute-accesstoken-fallback-")+);++const { getExecutor } = await import("../../open-sse/executors/index.ts");+const { refreshAndUpdateCredentials } = await import("../../src/lib/usage/providerLimits.ts");++// `gemini` is a non-rotating (no rotation lock group), non-github OAuth provider,+// so `shouldAttemptRotatingRefresh` is true and the refresh path is reached.+function geminiConnection() {+ return {+ id: "gemini-fallback-1",+ provider: "gemini",+ accessToken: "still-valid-access-token",+ refreshToken: "some-refresh-token",+ tokenExpiresAt: new Date(Date.now() - 60_000).toISOString(), // expired → needsRefresh fires+ providerSpecificData: {},+ };+}++test("falls back to the existing accessToken for a non-github provider when refreshCredentials returns null", async () => {+ const exec = getExecutor("gemini");+ const origNeeds = exec.needsRefresh;+ const origRefresh = exec.refreshCredentials;+ exec.needsRefresh = () => true; // force the refresh attempt+ exec.refreshCredentials = async () => null; // upstream refresh failed+ try {+ const result = await refreshAndUpdateCredentials(geminiConnection(), {+ allowRotatingRefresh: true,+ });+ assert.equal(+ result.refreshed,+ false,+ "a non-github provider with an accessToken must fall back, not throw"+ );+ assert.equal(+ result.connection.accessToken,+ "still-valid-access-token",+ "the existing access token must be preserved"+ );+ } finally {+ exec.needsRefresh = origNeeds;+ exec.refreshCredentials = origRefresh;+ }+});++test("still throws when refresh fails AND there is no accessToken to fall back on", async () => {+ const exec = getExecutor("gemini");+ const origNeeds = exec.needsRefresh;+ const origRefresh = exec.refreshCredentials;+ exec.needsRefresh = () => true;+ exec.refreshCredentials = async () => null;+ try {+ const conn = geminiConnection();+ conn.accessToken = ""; // no usable token → must not silently degrade+ await assert.rejects(+ () => refreshAndUpdateCredentials(conn, { allowRotatingRefresh: true }),+ /Failed to refresh credentials/,+ "without an accessToken the refresh failure must surface as an error"+ );+ } finally {+ exec.needsRefresh = origNeeds;+ exec.refreshCredentials = origRefresh;+ }+});diff --git a/tests/unit/provider-nodes-validate-docker-hint.test.ts b/tests/unit/provider-nodes-validate-docker-hint.test.tsnew file mode 100644index 0000000000..bf1b44784f--- /dev/null+++ b/tests/unit/provider-nodes-validate-docker-hint.test.ts@@ -0,0 +1,95 @@+import test from "node:test";+import assert from "node:assert/strict";+import { augmentDockerLocalhostHint } from "../../src/app/api/provider-nodes/validate/route.ts";+import { SafeOutboundFetchError } from "../../src/shared/network/safeOutboundFetch.ts";+import { resetDbInstance } from "../../src/lib/db/core.ts";++test.after(() => {+ resetDbInstance();+});++function networkError(causeCode: string): SafeOutboundFetchError {+ const err = new SafeOutboundFetchError("fetch failed", {+ code: "NETWORK_ERROR",+ url: "http://localhost:11434/models",+ method: "GET",+ attempts: 1,+ isRetryable: true,+ cause: { code: causeCode },+ });+ return err;+}++function timeoutError(): SafeOutboundFetchError {+ return new SafeOutboundFetchError("The operation timed out", {+ code: "TIMEOUT",+ url: "http://localhost:11434/models",+ method: "GET",+ attempts: 1,+ isRetryable: true,+ timeoutMs: 10000,+ });+}++const FALLBACK = "Validation failed";++test("ECONNREFUSED against localhost surfaces a Docker host-IP hint", () => {+ const message = augmentDockerLocalhostHint(+ networkError("ECONNREFUSED"),+ "http://localhost:11434",+ FALLBACK+ );+ assert.match(message, /Connection refused/);+ assert.match(message, /Docker/);+ assert.match(message, /host\.docker\.internal/);+ assert.notEqual(message, FALLBACK);+});++test("ECONNREFUSED against 127.0.0.1 surfaces the Docker hint", () => {+ const message = augmentDockerLocalhostHint(+ networkError("ECONNREFUSED"),+ "http://127.0.0.1:11434/v1",+ FALLBACK+ );+ assert.match(message, /Connection refused/);+ assert.match(message, /Docker/);+});++test("TIMEOUT against localhost surfaces a Docker timeout hint", () => {+ const message = augmentDockerLocalhostHint(timeoutError(), "https://localhost:8080", FALLBACK);+ assert.match(message, /Connection timeout/);+ assert.match(message, /Docker/);+ assert.match(message, /host\.docker\.internal/);+});++test("connection error against a NON-localhost host keeps the original message", () => {+ const message = augmentDockerLocalhostHint(+ networkError("ECONNREFUSED"),+ "http://192.168.1.50:11434",+ FALLBACK+ );+ assert.equal(message, FALLBACK);+});++test("a localhost-substring host that is not actually localhost is not hinted", () => {+ const message = augmentDockerLocalhostHint(+ networkError("ECONNREFUSED"),+ "http://localhost.evil.example.com:11434",+ FALLBACK+ );+ assert.equal(message, FALLBACK);+});++test("a non-connection error against localhost keeps the original message", () => {+ const message = augmentDockerLocalhostHint(+ networkError("CERT_HAS_EXPIRED"),+ "http://localhost:11434",+ FALLBACK+ );+ assert.equal(message, FALLBACK);+});++test("a missing base URL keeps the original message", () => {+ const message = augmentDockerLocalhostHint(networkError("ECONNREFUSED"), undefined, FALLBACK);+ assert.equal(message, FALLBACK);+});diff --git a/tests/unit/provider-registry-github-copilot-gpt-4.test.ts b/tests/unit/provider-registry-github-copilot-gpt-4.test.tsnew file mode 100644index 0000000000..a619314261--- /dev/null+++ b/tests/unit/provider-registry-github-copilot-gpt-4.test.ts@@ -0,0 +1,57 @@+/**+ * Port: add GPT-4 to the GitHub Copilot (`github`/alias `gh`) provider.+ *+ * Copilot still serves the original `gpt-4` chat model via its chat/completions+ * endpoint, alongside `gpt-4o` and the GPT-5.x family. The OmniRoute registry+ * shipped GPT-4o + GPT-5.x but not plain `gpt-4`, so apps that explicitly request+ * `gpt-4` against the `gh` alias got an "unknown model" error. Adding the entry+ * restores parity with the upstream Copilot catalog without disturbing the+ * GPT-4o / GPT-5.x / Claude / Gemini lineups already curated.+ *+ * GPT-4 is a chat/completions model — it must NOT use `openai-responses`.+ */+import test from "node:test";+import assert from "node:assert/strict";++const { REGISTRY } = await import("../../open-sse/config/providerRegistry.ts");+const { getModelsByProviderId, getProviderModel, isValidModel } = await import(+ "../../open-sse/config/providerModels.ts"+);++type ModelEntry = { id: string; name?: string; targetFormat?: string; [k: string]: unknown };++function githubModel(id: string): ModelEntry | undefined {+ const provider = (REGISTRY as Record<string, { models?: ModelEntry[] }>)["github"];+ return provider?.models?.find((m) => m.id === id);+}++test("github/gpt-4 is registered under the gh provider", () => {+ const model = githubModel("gpt-4");+ assert.ok(model, "gpt-4 must be registered under the github (gh) provider");+ assert.equal(typeof model?.name, "string");+});++test("github/gpt-4 routes via chat/completions (no openai-responses)", () => {+ const model = githubModel("gpt-4");+ assert.ok(model);+ assert.notEqual(+ model.targetFormat,+ "openai-responses",+ "GPT-4 on GitHub Copilot is a chat/completions model — Responses API would reject it"+ );+});++test("getModelsByProviderId(github) exposes gpt-4", () => {+ const models = getModelsByProviderId("github") as ModelEntry[];+ const gpt4 = models.find((m) => m.id === "gpt-4");+ assert.ok(gpt4, "gpt-4 resolvable via getModelsByProviderId(github)");+});++test("gpt-4 resolves through both the gh alias and the github id", () => {+ // getProviderModel keys on the public alias; isValidModel mirrors it.+ assert.ok(getProviderModel("gh", "gpt-4"), "getProviderModel('gh','gpt-4') must resolve");+ assert.equal(isValidModel("gh", "gpt-4"), true, "isValidModel('gh','gpt-4') must be true");+ // Raw provider id resolves to the same entry via the alias map.+ const viaId = getModelsByProviderId("github").find((m) => m.id === "gpt-4");+ assert.ok(viaId, "gpt-4 resolvable via the raw 'github' provider id");+});diff --git a/tests/unit/provider-translate-path-golden.test.ts b/tests/unit/provider-translate-path-golden.test.tsnew file mode 100644index 0000000000..360dd4df85--- /dev/null+++ b/tests/unit/provider-translate-path-golden.test.ts@@ -0,0 +1,132 @@+import test from "node:test";+import assert from "node:assert/strict";+import fs from "node:fs";+import os from "node:os";+import path from "node:path";++import { PROVIDERS } from "../../open-sse/config/constants.ts";+import {+ buildProviderHeaders,+ buildProviderUrl,+ getTargetFormat,+} from "../../open-sse/services/provider.ts";+import { goldenSnapshot } from "../helpers/goldenSnapshot.ts";++// A1 GOLDEN LOCK: freeze the OUTPUT of services/provider.ts on the translate route+// path — buildProviderUrl / buildProviderHeaders / getTargetFormat — across every+// registered provider. This runs in PARALLEL to the executor URL/header builders.+// Goal: before merging the translate-path with the executor builders, lock the+// current translate-path behavior so any drift is caught as a snapshot diff.+//+// Ported from decolua/9router golden-provider-service test (JS/vitest) — adapted to+// OmniRoute's TS provider service + node:test goldenSnapshot helper.++const API_KEY_CRED = { apiKey: "sk-test-APIKEY", providerSpecificData: {} };+const OAUTH_CRED = { accessToken: "tok-test-ACCESS", providerSpecificData: {} };++// Strip tokens + dynamic fields (github x-request-id uuid, kimi device-id) so the+// snapshot is stable run-to-run.+function sanitize(headers: Record<string, unknown>): Record<string, unknown> {+ const out: Record<string, unknown> = {};+ for (const [k, v] of Object.entries(headers)) {+ out[k] =+ typeof v === "string"+ ? v+ .replace(/Bearer .+/, "Bearer <TOK>")+ .replace(/sk-test-APIKEY|tok-test-ACCESS/g, "<CRED>")+ .replace(/kimi-\d{10,}/g, "kimi-<TS>")+ .replace(+ /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,+ "<UUID>"+ )+ : v;+ }+ return out;+}++function safe<T>(fn: () => T): T | string {+ try {+ return fn();+ } catch (e) {+ return `THROW: ${(e as Error).message}`;+ }+}++const providerIds = Object.keys(PROVIDERS).sort();++type ProviderTranslatePathEntry = {+ url: { stream: unknown; nonStream: unknown };+ headers: { apiKey: unknown; oauth: unknown; nonStream: unknown };+ format: unknown;+};++export function buildProviderTranslatePathSnapshot(): Record<+ string,+ ProviderTranslatePathEntry+> {+ const snapshot: Record<string, ProviderTranslatePathEntry> = {};+ for (const pid of providerIds) {+ const noAuth = Boolean((PROVIDERS as Record<string, { noAuth?: boolean }>)[pid]?.noAuth);+ const cred = noAuth ? {} : API_KEY_CRED;+ const credOauth = noAuth ? {} : OAUTH_CRED;+ snapshot[pid] = {+ url: {+ stream: safe(() => buildProviderUrl(pid, "test-model", true, {})),+ nonStream: safe(() => buildProviderUrl(pid, "test-model", false, {})),+ },+ headers: {+ apiKey: safe(() => sanitize(buildProviderHeaders(pid, cred, true))),+ oauth: safe(() => sanitize(buildProviderHeaders(pid, credOauth, true))),+ nonStream: safe(() => sanitize(buildProviderHeaders(pid, cred, false))),+ },+ format: safe(() => getTargetFormat(pid)),+ };+ }+ return snapshot;+}++test("GOLDEN provider.ts translate-path is stable across all providers", () => {+ const snapshot = buildProviderTranslatePathSnapshot();+ // Sanity: the snapshot must cover every registered provider.+ assert.equal(Object.keys(snapshot).length, providerIds.length);+ assert.ok(providerIds.length > 0, "expected at least one provider");+ goldenSnapshot("provider/translate-path", snapshot);+});++test("GOLDEN provider.ts translate-path snapshot is deterministic", () => {+ // The sanitizer must remove all run-to-run variance (github UUID, kimi device-id).+ const a = JSON.stringify(buildProviderTranslatePathSnapshot());+ const b = JSON.stringify(buildProviderTranslatePathSnapshot());+ assert.equal(a, b, "translate-path snapshot must be deterministic after sanitize");+});++test("GOLDEN guard catches translate-path drift", () => {+ // Prove the golden lock is a real regression guard: a mutated entry must be+ // detected by goldenSnapshot via the committed golden file. Uses an isolated+ // tmp dir so the real golden is never touched.+ const snapshot = buildProviderTranslatePathSnapshot();+ const firstId = providerIds[0];++ // Write a baseline golden into a tmp dir, then assert a mutated copy diverges.+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "provider-golden-"));+ try {+ process.env.UPDATE_GOLDEN = "1";+ goldenSnapshot("provider/translate-path", snapshot, tmpDir);+ delete process.env.UPDATE_GOLDEN;++ // Same value → passes.+ assert.doesNotThrow(() =>+ goldenSnapshot("provider/translate-path", snapshot, tmpDir)+ );++ // Mutated value → must throw (drift detected).+ const mutated = JSON.parse(JSON.stringify(snapshot)) as typeof snapshot;+ mutated[firstId].format = "DRIFTED-FORMAT";+ assert.throws(() =>+ goldenSnapshot("provider/translate-path", mutated, tmpDir)+ );+ } finally {+ delete process.env.UPDATE_GOLDEN;+ fs.rmSync(tmpDir, { recursive: true, force: true });+ }+});diff --git a/tests/unit/provider-validation-specialty.test.ts b/tests/unit/provider-validation-specialty.test.tsindex 51187247ea..b7fe234906 100644--- a/tests/unit/provider-validation-specialty.test.ts+++ b/tests/unit/provider-validation-specialty.test.ts@@ -2749,3 +2749,52 @@ test("isSecurityBlockError: a URL-guard block remains a security block", () => {});assert.equal(isSecurityBlockError(guardBlock), true);});++// ─── huggingface validator (whoami-v2 auth probe) ────────────────────────────+// Fine-grained HF Inference-Provider tokens are valid even when model/task+// endpoints reject them. The validator must probe whoami-v2 as a pure auth+// check: only 401/403 is invalid; any other non-OK status is transient.++test("huggingface validator accepts a token whoami-v2 recognizes", async () => {+ const calls: { url: string; headers: Record<string, string> }[] = [];+ globalThis.fetch = async (url, init = {}) => {+ calls.push({ url: String(url), headers: toPlainHeaders(init.headers) });+ return new Response(JSON.stringify({ name: "hf-user", auth: { type: "access_token" } }), {+ status: 200,+ });+ };++ const result = await validateProviderApiKey({ provider: "huggingface", apiKey: "hf_validtoken" });++ assert.equal(result.valid, true);+ assert.equal(result.error, null);+ assert.equal(result.method, "huggingface_whoami");+ assert.equal(calls.length, 1);+ assert.equal(calls[0].url, "https://huggingface.co/api/whoami-v2");+ assert.equal(calls[0].headers.Authorization, "Bearer hf_validtoken");+});++test("huggingface validator treats 401/403 as an invalid token", async () => {+ globalThis.fetch = async () => new Response(JSON.stringify({ error: "Unauthorized" }), { status: 401 });+ const unauthorized = await validateProviderApiKey({ provider: "huggingface", apiKey: "hf_bad" });+ assert.equal(unauthorized.valid, false);+ assert.equal(unauthorized.error, "Invalid API key");++ globalThis.fetch = async () => new Response(JSON.stringify({ error: "Forbidden" }), { status: 403 });+ const forbidden = await validateProviderApiKey({ provider: "huggingface", apiKey: "hf_bad" });+ assert.equal(forbidden.valid, false);+ assert.equal(forbidden.error, "Invalid API key");+});++test("huggingface validator does NOT mark a fine-grained token invalid on a non-auth status", async () => {+ // This is the false-negative the port fixes: a 503/404 from a model/task+ // probe used to read as "invalid key". whoami-v2 returning a non-auth,+ // non-OK status must surface as a transient error, never "Invalid API key".+ globalThis.fetch = async () => new Response("upstream down", { status: 503 });++ const result = await validateProviderApiKey({ provider: "huggingface", apiKey: "hf_finegrained" });++ assert.equal(result.valid, false);+ assert.notEqual(result.error, "Invalid API key");+ assert.match(result.error || "", /HuggingFace token check returned 503/);+});diff --git a/tests/unit/qoder-unwrap-error-envelope.test.ts b/tests/unit/qoder-unwrap-error-envelope.test.tsnew file mode 100644index 0000000000..dff9fcd4f9--- /dev/null+++ b/tests/unit/qoder-unwrap-error-envelope.test.ts@@ -0,0 +1,95 @@+import test from "node:test";+import assert from "node:assert/strict";++import { QoderExecutor, __test__ } from "../../open-sse/executors/qoder.ts";++const { unwrapQoderEnvelope } = __test__;++function sseResponse(body: string, status = 200): Response {+ return new Response(body, {+ status,+ headers: { "Content-Type": "text/event-stream" },+ });+}++test("unwrapQoderEnvelope: surfaces an embedded non-200 statusCodeValue as a real HTTP error", async () => {+ // Qoder wraps an upstream 429 inside a 200 SSE envelope. Before the fix this+ // passed straight through as a 200, so combo/account fallback never fired.+ const wrapped = sseResponse(+ 'data: {"statusCodeValue":429,"body":"rate limit exceeded"}\n\ndata: [DONE]\n\n'+ );++ const result = await unwrapQoderEnvelope(wrapped);++ assert.equal(result.status, 429, "embedded 429 must become a real HTTP 429");+ const payload = (await result.json()) as any;+ assert.match(payload.error.message, /qoder error 429/);+ assert.match(payload.error.message, /rate limit exceeded/);+});++test("unwrapQoderEnvelope: maps a sub-400 embedded status to 502", async () => {+ const wrapped = sseResponse('data: {"statusCodeValue":302,"body":"redirect"}\n\n');++ const result = await unwrapQoderEnvelope(wrapped);++ assert.equal(result.status, 502);+});++test("unwrapQoderEnvelope: classifies embedded 401 as an authentication_error", async () => {+ const wrapped = sseResponse('data: {"statusCodeValue":401,"body":"invalid token"}\n\n');++ const result = await unwrapQoderEnvelope(wrapped);++ assert.equal(result.status, 401);+ const payload = (await result.json()) as any;+ assert.equal(payload.error.type, "authentication_error");+});++test("unwrapQoderEnvelope: passes a successful stream through with the first chunk intact", async () => {+ const wrapped = sseResponse(+ 'data: {"choices":[{"delta":{"content":"O"}}]}\n\ndata: {"choices":[{"delta":{"content":"K"}}]}\n\ndata: [DONE]\n\n'+ );++ const result = await unwrapQoderEnvelope(wrapped);++ assert.equal(result.status, 200);+ const body = await result.text();+ // The first chunk must not be swallowed by the peek.+ assert.match(body, /"content":"O"/);+ assert.match(body, /"content":"K"/);+ assert.match(body, /\[DONE\]/);+});++test("unwrapQoderEnvelope: an empty stream becomes a 502 error", async () => {+ const result = await unwrapQoderEnvelope(sseResponse(""));+ assert.equal(result.status, 502);+});++test("unwrapQoderEnvelope: a non-ok response is returned unchanged", async () => {+ const errResp = sseResponse("nope", 500);+ const result = await unwrapQoderEnvelope(errResp);+ assert.equal(result, errResp);+});++test("QoderExecutor: stream call surfaces an embedded error envelope as a real HTTP status", async () => {+ const executor = new QoderExecutor();+ const originalFetch = globalThis.fetch;+ globalThis.fetch = async () =>+ sseResponse('data: {"statusCodeValue":429,"body":"quota exceeded"}\n\ndata: [DONE]\n\n');++ try {+ const { response } = await executor.execute({+ model: "qoder-rome-30ba3b",+ body: { messages: [{ role: "user", content: "hi" }] },+ stream: true,+ credentials: { apiKey: "pat_test" },+ });++ // Before the port this was a 200 — fallback could never trigger.+ assert.equal(response.status, 429);+ const payload = (await response.json()) as any;+ assert.match(payload.error.message, /qoder error 429/);+ } finally {+ globalThis.fetch = originalFetch;+ }+});diff --git a/tests/unit/resolve-bare-model-to-connection-default-474.test.ts b/tests/unit/resolve-bare-model-to-connection-default-474.test.tsnew file mode 100644index 0000000000..6433d3e278--- /dev/null+++ b/tests/unit/resolve-bare-model-to-connection-default-474.test.ts@@ -0,0 +1,43 @@+import { test } from "node:test";+import assert from "node:assert/strict";++import { resolveBareModelToConnectionDefault } from "@omniroute/open-sse/services/model.ts";++// #474 — When a bare model name (no "/") reaches the upstream call and the+// selected connection declares a defaultModel, the bare name must resolve to+// that real model ID. A "/"-qualified model name is an explicit provider/model+// choice and must always be left untouched.++test("bare model name resolves to the connection defaultModel", () => {+ // "auto" came from an alias; the connection's defaultModel is the concrete ID.+ const effective = resolveBareModelToConnectionDefault("auto", "auto", "gpt-4o-mini");+ assert.equal(effective, "gpt-4o-mini");+});++test('"/"-qualified model name is left untouched even when a defaultModel exists', () => {+ const effective = resolveBareModelToConnectionDefault(+ "openai/gpt-4o",+ "gpt-4o",+ "gpt-4o-mini"+ );+ assert.equal(effective, "gpt-4o");+});++test("bare model name without a connection defaultModel falls back to the resolved model", () => {+ assert.equal(resolveBareModelToConnectionDefault("auto", "auto", null), "auto");+ assert.equal(resolveBareModelToConnectionDefault("auto", "auto", undefined), "auto");+ assert.equal(resolveBareModelToConnectionDefault("auto", "auto", ""), "auto");+});++test("empty defaultModel string does not override the resolved model", () => {+ assert.equal(resolveBareModelToConnectionDefault("auto", "resolved-auto", ""), "resolved-auto");+});++test("null/undefined requested model strings are treated as non-bare (no override)", () => {+ assert.equal(resolveBareModelToConnectionDefault(null, "resolved", "default"), "resolved");+ assert.equal(resolveBareModelToConnectionDefault(undefined, "resolved", "default"), "resolved");+});++test("null resolved model with no defaultModel returns null", () => {+ assert.equal(resolveBareModelToConnectionDefault("auto", null, null), null);+});diff --git a/tests/unit/responses-nameless-hosted-tool-filter.test.ts b/tests/unit/responses-nameless-hosted-tool-filter.test.tsnew file mode 100644index 0000000000..fba04a5634--- /dev/null+++ b/tests/unit/responses-nameless-hosted-tool-filter.test.ts@@ -0,0 +1,66 @@+import test from "node:test";+import assert from "node:assert/strict";++// Regression for port-from-9router#222: the Responses API supports "hosted" tools+// that carry no explicit `name` field. The Responses->Chat catch-all branch emitted+// `name: toString(tool.name)`, and `toString(undefined)` returns "", producing an+// anonymous functionDeclaration. After the OpenAI->Gemini step Gemini rejected the+// whole request with a 400:+// "...function_declarations[N].name: Invalid function name."+// (OmniRoute already throws for *unknown* hosted tool types up front, but a+// whitelisted-type tool — function/custom/command — that arrives without a name+// still fell through the catch-all and produced `name: ""`.)+// Fix: skip any Responses tool that reaches the catch-all without a non-empty+// string name; named tools are unaffected.+const { openaiResponsesToOpenAIRequest } = await import(+ "../../open-sse/translator/request/openai-responses.ts"+);++test("#222: a Responses tool reaching the catch-all without a name is dropped, not emitted nameless", () => {+ const body = {+ input: [{ type: "message", role: "user", content: [{ type: "input_text", text: "hi" }] }],+ tools: [+ {+ // Named function tool — must survive.+ type: "function",+ name: "read_file",+ description: "Read a file",+ parameters: { type: "object", properties: { path: { type: "string" } } },+ },+ {+ // Whitelisted "custom" hosted tool with no `name` — passes the up-front+ // validation guard, then reaches the catch-all. Must be filtered out+ // rather than emitted with name: "".+ type: "custom",+ },+ ],+ };++ const out = openaiResponsesToOpenAIRequest("gemini-2.5-pro", body, false, {}) as {+ tools: { type: string; function: { name: string } }[];+ };++ // Only the named tool survives; the nameless hosted tool is gone.+ const names = out.tools.map((t) => t.function?.name).sort();+ assert.deepEqual(names, ["read_file"]);++ // No tool may carry an empty/undefined name — the exact bug Gemini rejected.+ assert.equal(+ out.tools.some((t) => !t.function?.name || t.function.name.trim() === ""),+ false,+ "no nameless functionDeclaration must be emitted"+ );+});++test("#222: a function-type Responses tool with a whitespace-only name is also dropped", () => {+ const body = {+ input: [{ type: "message", role: "user", content: [{ type: "input_text", text: "hi" }] }],+ tools: [{ type: "function", name: " " }],+ };++ const out = openaiResponsesToOpenAIRequest("gemini-2.5-pro", body, false, {}) as {+ tools: unknown[];+ };++ assert.equal(out.tools.length, 0, "a whitespace-only name yields no tools");+});diff --git a/tests/unit/responses-reasoning-close-before-message-466.test.ts b/tests/unit/responses-reasoning-close-before-message-466.test.tsnew file mode 100644index 0000000000..e277aec109--- /dev/null+++ b/tests/unit/responses-reasoning-close-before-message-466.test.ts@@ -0,0 +1,158 @@+import test from "node:test";+import assert from "node:assert/strict";++// Regression guard for the Responses-API streaming-protocol bug where native+// reasoning (`delta.reasoning_content`, no <think> tags) opened a reasoning+// item that was never closed before the message content, and the message+// reused the reasoning item's output_index — producing a protocol-invalid+// stream. After the fix, reasoning is closed at the top of the content/+// tool_calls handlers and the message is routed to `reasoningIndex + 1`.++const { createResponsesApiTransformStream } = await import(+ "../../open-sse/transformer/responsesTransformer.ts"+);+const { openaiToOpenAIResponsesResponse } = await import(+ "../../open-sse/translator/response/openai-responses.ts"+);+const { initState } = await import("../../open-sse/translator/index.ts");+const { FORMATS } = await import("../../open-sse/translator/formats.ts");++const encoder = new TextEncoder();+const decoder = new TextDecoder();++async function runTransformStream(chunks) {+ const stream = createResponsesApiTransformStream(null);+ const writer = stream.writable.getWriter();+ const reader = stream.readable.getReader();++ const output = [];+ const readerTask = (async () => {+ while (true) {+ const { value, done } = await reader.read();+ if (done) break;+ output.push(decoder.decode(value));+ }+ })();++ for (const chunk of chunks) {+ await writer.write(encoder.encode(chunk));+ }+ await writer.close();+ await readerTask;++ return output.join("");+}++function parseSseOutput(output) {+ return output+ .trim()+ .split("\n\n")+ .map((entry) => {+ const lines = entry.split("\n");+ const eventLine = lines.find((line) => line.startsWith("event: "));+ const dataLine = lines.find((line) => line.startsWith("data: "));+ return {+ event: eventLine ? eventLine.slice("event: ".length) : null,+ data: dataLine ? dataLine.slice("data: ".length) : null,+ };+ });+}++test("transformer: native reasoning is closed before message content and uses a distinct output_index", async () => {+ const output = await runTransformStream([+ 'data: {"id":"chatcmpl_1","choices":[{"index":0,"delta":{"reasoning_content":"thinking"}}]}\n\n',+ 'data: {"choices":[{"index":0,"delta":{"content":"answer"}}]}\n\n',+ 'data: {"choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}\n\n',+ ]);++ const events = parseSseOutput(output).map((e) => {+ let data = null;+ if (e.data && e.data !== "[DONE]") {+ try {+ data = JSON.parse(e.data);+ } catch {+ data = null;+ }+ }+ return { event: e.event, data };+ });++ // The reasoning item must be closed (output_item.done with a reasoning item)+ // BEFORE the first message output_item.added is emitted.+ const reasoningDoneIdx = events.findIndex(+ (e) => e.event === "response.output_item.done" && e.data?.item?.type === "reasoning"+ );+ const messageAddedIdx = events.findIndex(+ (e) => e.event === "response.output_item.added" && e.data?.item?.type === "message"+ );++ assert.ok(reasoningDoneIdx >= 0, "reasoning item must be closed");+ assert.ok(messageAddedIdx >= 0, "message item must be added");+ assert.ok(+ reasoningDoneIdx < messageAddedIdx,+ "reasoning must be closed before message content begins"+ );++ // Reasoning lives at output_index 0; the message must NOT reuse it.+ const reasoningIndex = events.find(+ (e) => e.event === "response.output_item.added" && e.data?.item?.type === "reasoning"+ ).data.output_index;+ const messageIndex = events[messageAddedIdx].data.output_index;++ assert.equal(reasoningIndex, 0);+ assert.equal(messageIndex, reasoningIndex + 1);++ // The completed snapshot should carry both items at distinct indices.+ const completed = events.find((e) => e.event === "response.completed").data.response;+ assert.equal(completed.output[0].type, "reasoning");+ assert.equal(completed.output[1].type, "message");+ assert.equal(completed.output[1].content[0].text, "answer");+});++test("translator: native reasoning is closed before message content and uses a distinct output_index", () => {+ const state = initState(FORMATS.OPENAI_RESPONSES);+ const events = [];+ const chunks = [+ {+ id: "chatcmpl-1",+ model: "gpt-4.1",+ choices: [{ index: 0, delta: { reasoning_content: "thinking" }, finish_reason: null }],+ },+ {+ id: "chatcmpl-1",+ model: "gpt-4.1",+ choices: [{ index: 0, delta: { content: "answer" }, finish_reason: null }],+ },+ {+ id: "chatcmpl-1",+ model: "gpt-4.1",+ choices: [{ index: 0, delta: {}, finish_reason: "stop" }],+ },+ ];+ for (const chunk of chunks) {+ const result = openaiToOpenAIResponsesResponse(chunk, state);+ if (result) events.push(...result);+ }++ const reasoningDoneIdx = events.findIndex(+ (e) => e.event === "response.output_item.done" && e.data?.item?.type === "reasoning"+ );+ const messageAddedIdx = events.findIndex(+ (e) => e.event === "response.output_item.added" && e.data?.item?.type === "message"+ );++ assert.ok(reasoningDoneIdx >= 0, "reasoning item must be closed");+ assert.ok(messageAddedIdx >= 0, "message item must be added");+ assert.ok(+ reasoningDoneIdx < messageAddedIdx,+ "reasoning must be closed before message content begins"+ );++ const reasoningIndex = events.find(+ (e) => e.event === "response.output_item.added" && e.data?.item?.type === "reasoning"+ ).data.output_index;+ const messageIndex = events[messageAddedIdx].data.output_index;++ assert.equal(reasoningIndex, 0);+ assert.equal(messageIndex, reasoningIndex + 1);+});diff --git a/tests/unit/responses-transformer-dense-output.test.ts b/tests/unit/responses-transformer-dense-output.test.tsnew file mode 100644index 0000000000..6b5944ff7f--- /dev/null+++ b/tests/unit/responses-transformer-dense-output.test.ts@@ -0,0 +1,129 @@+/**+ * Tests for dense, deterministic output ordering in response.completed.+ *+ * Port of upstream decolua/9router PR #721: "fix: suppress null Responses SSE frames+ * and preserve completed output". These tests verify that:+ * 1. response.completed.response.output is a dense array sorted by output_index+ * 2. normalizeOutputIndex handles non-numeric keys robustly (no NaN from parseInt)+ * 3. Function-call items at lower output_index appear before message items at higher+ * output_index in the final output array+ */++import test from "node:test";+import assert from "node:assert/strict";++const { createResponsesApiTransformStream } =+ await import("../../open-sse/transformer/responsesTransformer.ts");++const encoder = new TextEncoder();+const decoder = new TextDecoder();++async function runTransformStream(chunks) {+ const stream = createResponsesApiTransformStream();+ const writer = stream.writable.getWriter();+ const reader = stream.readable.getReader();++ const output = [];+ const readerTask = (async () => {+ while (true) {+ const { value, done } = await reader.read();+ if (done) break;+ output.push(decoder.decode(value));+ }+ })();++ for (const chunk of chunks) {+ await writer.write(encoder.encode(chunk));+ }+ await writer.close();+ await readerTask;++ return output.join("");+}++function parseSseOutput(output) {+ return output+ .trim()+ .split("\n\n")+ .map((entry) => {+ const lines = entry.split("\n");+ const eventLine = lines.find((line) => line.startsWith("event: "));+ const dataLine = lines.find((line) => line.startsWith("data: "));+ return {+ event: eventLine ? eventLine.slice("event: ".length) : null,+ data: dataLine ? dataLine.slice("data: ".length) : null,+ };+ });+}++function getCompleted(output) {+ const events = parseSseOutput(output);+ const completedEvent = events.find((e) => e.event === "response.completed");+ assert.ok(completedEvent, "response.completed event must be present");+ return JSON.parse(completedEvent.data).response;+}++test("response.completed output is sorted by output_index: function_call at index 0 appears before message at index 2", async () => {+ // function_call uses tool_calls[index: 0], message uses choice index 2.+ // Without dense ordering, messages (iterated from msgItemAdded dict) may appear+ // before function_calls regardless of their actual output_index.+ const output = await runTransformStream([+ // First chunk: tool call at output_index 0+ `data: {"id":"chatcmpl-order","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"id":"call_abc","function":{"name":"lookup","arguments":"{\\"q\\":\\"test\\"}"}}]}}]}\n\n`,+ // Second chunk: text content at output_index 2+ `data: {"id":"chatcmpl-order","choices":[{"index":2,"delta":{"content":"Hello"}}]}\n\n`,+ // Finish+ `data: {"id":"chatcmpl-order","choices":[{"index":2,"delta":{},"finish_reason":"stop"},{"index":0,"delta":{},"finish_reason":"tool_calls"}]}\n\n`,+ ]);++ const completed = getCompleted(output);++ assert.ok(Array.isArray(completed.output), "output must be an array");+ assert.ok(completed.output.length >= 2, "output must have at least 2 items");++ // The function_call (output_index 0) must come before the message (output_index 2)+ const types = completed.output.map((item) => item.type);+ assert.ok(+ types.indexOf("function_call") < types.indexOf("message"),+ `function_call (output_index 0) must appear before message (output_index 2), got order: ${types.join(", ")}`+ );++ const funcCall = completed.output.find((item) => item.type === "function_call");+ assert.equal(funcCall?.call_id, "call_abc");+ assert.equal(funcCall?.name, "lookup");++ const msg = completed.output.find((item) => item.type === "message");+ assert.equal(msg?.content?.[0]?.text, "Hello");+});++test("response.completed output includes all finalized items even when output is empty", async () => {+ // A finish_reason with no content should produce an empty output array, not undefined+ const output = await runTransformStream([+ `data: {"id":"chatcmpl-empty","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}\n\n`,+ ]);++ const completed = getCompleted(output);++ assert.ok(Array.isArray(completed.output), "output must be an array even when empty");+ assert.equal(completed.output.length, 0, "output must be empty when no items finalize");+});++test("response.completed output preserves dense ordering for function_call-only streams", async () => {+ // Two tool calls at different indexes — must appear in ascending output_index order+ const output = await runTransformStream([+ // call at index 3 first+ `data: {"id":"chatcmpl-multi-tool","choices":[{"index":0,"delta":{"tool_calls":[{"index":3,"id":"call_z","function":{"name":"zeta","arguments":"{}"}}]}}]}\n\n`,+ // call at index 1+ `data: {"id":"chatcmpl-multi-tool","choices":[{"index":0,"delta":{"tool_calls":[{"index":1,"id":"call_a","function":{"name":"alpha","arguments":"{}"}}]}}]}\n\n`,+ `data: {"id":"chatcmpl-multi-tool","choices":[{"index":0,"delta":{},"finish_reason":"tool_calls"}]}\n\n`,+ ]);++ const completed = getCompleted(output);++ assert.ok(Array.isArray(completed.output), "output must be an array");+ assert.equal(completed.output.length, 2);++ // Sorted by output_index: index 1 (alpha) before index 3 (zeta)+ assert.equal(completed.output[0].name, "alpha", "output_index 1 (alpha) must come first");+ assert.equal(completed.output[1].name, "zeta", "output_index 3 (zeta) must come second");+});diff --git a/tests/unit/responses-transformer.test.ts b/tests/unit/responses-transformer.test.tsindex 21d6949acc..9d2ab0ad24 100644--- a/tests/unit/responses-transformer.test.ts+++ b/tests/unit/responses-transformer.test.ts@@ -105,7 +105,7 @@ test("createResponsesApiTransformStream converts think tags into reasoning summasummary: [{ type: "summary_text", text: "planning" }],});assert.deepEqual(completed.output[1].content, [- { type: "output_text", annotations: [], text: "answer" },+ { type: "output_text", annotations: [], logprobs: [], text: "answer" },]);});diff --git a/tests/unit/responses-translation-fixes.test.ts b/tests/unit/responses-translation-fixes.test.tsindex a99ebf4d58..7d163f2673 100644--- a/tests/unit/responses-translation-fixes.test.ts+++ b/tests/unit/responses-translation-fixes.test.ts@@ -459,3 +459,57 @@ test("Chat→Responses streaming: multiple <think> tags in one chunk handled", (const combined = textDeltas.join("");assert.ok(!combined.includes("<think>"), `text should not contain <think> tag, got: ${combined}`);});++// Regression: a tool call was announced (response.output_item.added set currentToolCallId)+// but the stream ended before response.output_item.done could advance toolCallIndex. The+// terminal finish_reason must still be "tool_calls", not "stop", so OpenAI-compatible+// clients keep processing the tool result instead of stopping prematurely.+test("Responses→Chat streaming: flush finalizes tool_calls when currentToolCallId set but toolCallIndex==0", () => {+ const state = {+ started: true,+ chatId: "chatcmpl-x",+ created: 1_700_000_000,+ model: "gpt-4",+ toolCallIndex: 0,+ currentToolCallId: "call_abc",+ finishReasonSent: false,+ };++ const result = openaiResponsesToOpenAIResponse(null, state);+ assert.ok(result, "flush should emit a final chunk");+ assert.equal(result.choices[0].finish_reason, "tool_calls");+});++test("Responses→Chat streaming: response.completed finalizes tool_calls when currentToolCallId set but toolCallIndex==0", () => {+ const state = {+ started: true,+ chatId: "chatcmpl-y",+ created: 1_700_000_000,+ model: "gpt-4",+ toolCallIndex: 0,+ currentToolCallId: "call_def",+ finishReasonSent: false,+ };++ const chunk = { type: "response.completed", data: { response: {} } };+ const result = openaiResponsesToOpenAIResponse(chunk, state);+ assert.ok(result, "response.completed should emit a final chunk");+ assert.equal(result.choices[0].finish_reason, "tool_calls");+ assert.equal(state.finishReason, "tool_calls");+});++test("Responses→Chat streaming: flush finalizes stop when no tool call was emitted", () => {+ const state = {+ started: true,+ chatId: "chatcmpl-z",+ created: 1_700_000_000,+ model: "gpt-4",+ toolCallIndex: 0,+ currentToolCallId: null,+ finishReasonSent: false,+ };++ const result = openaiResponsesToOpenAIResponse(null, state);+ assert.ok(result, "flush should emit a final chunk");+ assert.equal(result.choices[0].finish_reason, "stop");+});diff --git a/tests/unit/runtime-deps-save-exact-no-prune.test.ts b/tests/unit/runtime-deps-save-exact-no-prune.test.tsnew file mode 100644index 0000000000..5cc5f9bd44--- /dev/null+++ b/tests/unit/runtime-deps-save-exact-no-prune.test.ts@@ -0,0 +1,88 @@+// Regression (port of decolua/9router#1606): the SQLite and tray runtime installers+// must persist their package to the user-writable runtime dir's package.json+// (`--save-exact`) instead of using `--no-save`. Both installers write to the SAME+// runtime dir (`~/.omniroute/runtime`), so a `--no-save` install marks the other's+// package as "extraneous" and a later sibling `npm install` prunes it — reproducing+// "No SQLite driver available" after a tray install removes the just-installed+// better-sqlite3. Saving each dep with an exact version keeps both.+//+// Instead of mocking child_process, we put a fake `npm` on PATH that records its+// arguments to a log file and exits 0. This exercises the real spawnSync/execSync+// code path with zero network use.+import test from "node:test";+import assert from "node:assert/strict";+import { mkdtempSync, rmSync, mkdirSync, writeFileSync, chmodSync, existsSync, readFileSync } from "node:fs";+import { join, delimiter } from "node:path";+import { tmpdir } from "node:os";++let tmpDir: string;+let binDir: string;+let logFile: string;+const original = {+ DATA_DIR: process.env.DATA_DIR,+ HOME: process.env.HOME,+ PATH: process.env.PATH,+};++function setup(): void {+ tmpDir = mkdtempSync(join(tmpdir(), "omniroute-runtime-deps-"));+ binDir = join(tmpDir, "bin");+ logFile = join(tmpDir, "npm-calls.log");+ mkdirSync(binDir, { recursive: true });+ // Fake npm: append its args to the log and succeed without doing anything.+ const npmStub = join(binDir, "npm");+ writeFileSync(npmStub, `#!/bin/sh\necho "$@" >> "${logFile}"\nexit 0\n`);+ chmodSync(npmStub, 0o755);++ // nativeDeps.mjs resolves the runtime dir from DATA_DIR; trayRuntime.ts from HOME.+ process.env.DATA_DIR = tmpDir;+ process.env.HOME = tmpDir;+ process.env.PATH = `${binDir}${delimiter}${original.PATH}`;+}++function teardown(): void {+ for (const [k, v] of Object.entries(original)) {+ if (v === undefined) delete process.env[k];+ else process.env[k] = v;+ }+ if (tmpDir) rmSync(tmpDir, { recursive: true, force: true });+}++function installLineFor(pkgPrefix: string): string | undefined {+ if (!existsSync(logFile)) return undefined;+ return readFileSync(logFile, "utf8")+ .split("\n")+ .find((line) => line.includes("install") && line.includes(pkgPrefix));+}++test("npmInstallRuntime saves better-sqlite3 with --save-exact (never --no-save)", async (t) => {+ if (process.platform === "win32") return; // sh stub is POSIX-only+ setup();+ t.after(teardown);++ const { npmInstallRuntime } = await import("../../bin/cli/runtime/nativeDeps.mjs");+ const ok = npmInstallRuntime(["[email protected]"], { silent: true });+ assert.equal(ok, true, "fake npm should exit 0");++ const line = installLineFor("better-sqlite3");+ assert.ok(line, "expected an npm install for better-sqlite3");+ assert.ok(!line!.includes("--no-save"), "must not use --no-save (prunes sibling runtime dep)");+ assert.ok(line!.includes("--save-exact"), "must persist with --save-exact");+});++test("installSystray saves systray2 with --save-exact (never --no-save)", async (t) => {+ if (process.platform === "win32") return; // loadSystray returns null on win32+ setup();+ t.after(teardown);++ // loadSystray() lazily installs systray2 (when not already present) then tries to+ // import it. The import fails against our fake npm (no real module), returning null —+ // but the fake npm has already recorded the install args, which is what we assert on.+ const { loadSystray } = await import("../../bin/cli/runtime/trayRuntime.ts");+ await loadSystray();++ const line = installLineFor("systray2");+ assert.ok(line, "expected an npm install for systray2");+ assert.ok(!line!.includes("--no-save"), "must not use --no-save (prunes sibling runtime dep)");+ assert.ok(line!.includes("--save-exact"), "must persist with --save-exact");+});diff --git a/tests/unit/service-token-refresh.test.ts b/tests/unit/service-token-refresh.test.tsindex f254d54e7d..42622907fe 100644--- a/tests/unit/service-token-refresh.test.ts+++ b/tests/unit/service-token-refresh.test.ts@@ -17,6 +17,32 @@ describe("tokenRefresh helpers", () => {assert.equal(mod.getRefreshLeadMs("unknown-provider"), mod.TOKEN_EXPIRY_BUFFER_MS);assert.equal(mod.getRefreshLeadMs(""), mod.TOKEN_EXPIRY_BUFFER_MS);});++ it("honors a positive per-connection refreshLeadMs override", () => {+ // Override beats both the provider default and the fallback buffer.+ assert.equal(mod.getRefreshLeadMs("codex", { refreshLeadMs: 90_000 }), 90_000);+ assert.equal(+ mod.getRefreshLeadMs("unknown-provider", { refreshLeadMs: 12_345 }),+ 12_345+ );+ });++ it("ignores invalid or non-positive override values", () => {+ // Falls through to provider default / buffer when the override is unusable.+ assert.equal(mod.getRefreshLeadMs("codex", null), 5 * 60 * 1000);+ assert.equal(mod.getRefreshLeadMs("codex", {}), 5 * 60 * 1000);+ assert.equal(mod.getRefreshLeadMs("codex", { refreshLeadMs: 0 }), 5 * 60 * 1000);+ assert.equal(mod.getRefreshLeadMs("codex", { refreshLeadMs: -1 }), 5 * 60 * 1000);+ assert.equal(+ mod.getRefreshLeadMs("codex", { refreshLeadMs: "60000" as unknown as number }),+ 5 * 60 * 1000+ );+ assert.equal(mod.getRefreshLeadMs("codex", { refreshLeadMs: NaN }), 5 * 60 * 1000);+ assert.equal(+ mod.getRefreshLeadMs("unknown-provider", { refreshLeadMs: -5 }),+ mod.TOKEN_EXPIRY_BUFFER_MS+ );+ });});describe("supportsTokenRefresh", () => {diff --git a/tests/unit/siliconflow-registry-models.test.ts b/tests/unit/siliconflow-registry-models.test.tsnew file mode 100644index 0000000000..02ed5dfe25--- /dev/null+++ b/tests/unit/siliconflow-registry-models.test.ts@@ -0,0 +1,61 @@+import test from "node:test";+import assert from "node:assert/strict";++import { siliconflowProvider } from "../../open-sse/config/providers/registry/siliconflow/index.ts";++test("siliconflow registry uses the .com baseUrl", () => {+ assert.ok(+ siliconflowProvider.baseUrl.startsWith("https://api.siliconflow.com/"),+ `expected .com baseUrl, got ${siliconflowProvider.baseUrl}`+ );+});++test("siliconflow registry includes the synced net-new model IDs", () => {+ const ids = new Set(siliconflowProvider.models.map((m) => m.id));++ // Net-new IDs introduced by the upstream model-list sync — each was MISSING+ // from OmniRoute's registry before the port (failing-before assertion).+ const expectedNewIds = [+ "zai-org/GLM-5.1",+ "zai-org/GLM-5",+ "moonshotai/Kimi-K2.6",+ "moonshotai/Kimi-K2-Thinking",+ "Qwen/Qwen3.6-35B-A3B",+ "Qwen/Qwen3.5-397B-A17B",+ "MiniMaxAI/MiniMax-M2.5",+ "MiniMaxAI/MiniMax-M2.1",+ "tencent/Hunyuan-A13B-Instruct",+ "google/gemma-4-31B-it",+ "inclusionAI/Ling-flash-2.0",+ "ByteDance-Seed/Seed-OSS-36B-Instruct",+ "openai/gpt-oss-20b",+ ];++ for (const id of expectedNewIds) {+ assert.ok(ids.has(id), `expected model id "${id}" to be present`);+ }+});++test("siliconflow registry preserves the pre-existing model IDs", () => {+ const ids = new Set(siliconflowProvider.models.map((m) => m.id));+ for (const id of [+ "deepseek-ai/DeepSeek-V3.2",+ "deepseek-ai/DeepSeek-R1",+ "zai-org/GLM-4.7",+ "moonshotai/Kimi-K2.5",+ "baidu/ERNIE-4.5-300B-A47B",+ ]) {+ assert.ok(ids.has(id), `expected pre-existing model id "${id}" to remain`);+ }+});++test("siliconflow registry has no duplicate model IDs", () => {+ const ids = siliconflowProvider.models.map((m) => m.id);+ const seen = new Set<string>();+ const duplicates: string[] = [];+ for (const id of ids) {+ if (seen.has(id)) duplicates.push(id);+ seen.add(id);+ }+ assert.deepEqual(duplicates, [], `duplicate model IDs found: ${duplicates.join(", ")}`);+});diff --git a/tests/unit/stream-handler.test.ts b/tests/unit/stream-handler.test.tsindex a0f0c223a2..789d685d55 100644--- a/tests/unit/stream-handler.test.ts+++ b/tests/unit/stream-handler.test.ts@@ -3,6 +3,7 @@ import assert from "node:assert/strict";import {createDisconnectAwareStream,+ createNoopAbortWritable,createStreamController,pipeWithDisconnect,} from "../../open-sse/utils/streamHandler.ts";@@ -283,6 +284,40 @@ test("createDisconnectAwareStream cancel propagates disconnect reason and abortsassert.ok(disconnectEvent.duration >= 0);});+test("createNoopAbortWritable: getWriter().abort() returns a resolved Promise (matches WritableStreamDefaultWriter contract)", async () => {+ // The mock writable that pipeWithDisconnect hands to createDisconnectAwareStream+ // is consumed only via its writer's abort() hook (in the cancel() path). The+ // native WritableStreamDefaultWriter.abort() returns Promise<void>; the mock+ // must match that contract so cancel/error handling can await it instead of+ // receiving `undefined`. Ported from decolua/9router@6b624af4.+ const writable = createNoopAbortWritable();+ const writer = writable.getWriter();++ const aborted = writer.abort();++ assert.ok(aborted instanceof Promise, "abort() must return a Promise, not undefined");+ // Awaiting must resolve cleanly to undefined (Promise<void>), never reject.+ assert.equal(await aborted, undefined);+});++test("createNoopAbortWritable: cancelling a stream wired through it awaits the abort promise without throwing", async () => {+ // End-to-end seam: the noop writable is what pipeWithDisconnect injects. Wire+ // it into createDisconnectAwareStream exactly as production does and drive the+ // cancel() path. With abort() returning undefined (the pre-fix shape) this+ // still completes, but a thenable abort keeps the cancel/error path clean.+ const transformStream = {+ readable: new ReadableStream({+ pull() {},+ cancel() {},+ }),+ writable: createNoopAbortWritable(),+ };++ const stream = createDisconnectAwareStream(transformStream, createStreamController());++ await assert.doesNotReject(stream.cancel("client-gone"));+});+test("createDisconnectAwareStream uses the default cancel reason when none is provided", async () => {let disconnectEvent = null;diff --git a/tests/unit/strip-reasoning-blobs-agentic-context-1599.test.ts b/tests/unit/strip-reasoning-blobs-agentic-context-1599.test.tsnew file mode 100644index 0000000000..f19a12f5f6--- /dev/null+++ b/tests/unit/strip-reasoning-blobs-agentic-context-1599.test.ts@@ -0,0 +1,81 @@+import test from "node:test";+import assert from "node:assert/strict";++import { stripStoredItemReferences } from "../../open-sse/executors/codex.ts";+import { filterToOpenAIFormat } from "../../open-sse/translator/helpers/openaiHelper.ts";++// Port of decolua/9router#1599 — strip reasoning blobs from agentic context to+// prevent O(n^2) token growth across turns.+//+// (1) codex.ts stripStoredItemReferences: object items of type "reasoning"+// (encrypted_content) are unusable with store=false (previous_response_id is+// deleted) and must be dropped from the Responses `input` array.+// (2) openaiHelper.ts filterToOpenAIFormat: assistant+tool_calls messages must+// have `reasoning_content` stripped instead of being returned as-is.++test("stripStoredItemReferences drops object items with type=reasoning", () => {+ const body: Record<string, unknown> = {+ input: [+ { type: "message", role: "user", content: [{ type: "input_text", text: "hi" }] },+ { id: "rs_abc123", type: "reasoning", summary: [{ text: "thinking..." }] },+ { type: "reasoning", encrypted_content: "blob" },+ {+ type: "function_call",+ id: "fc_xyz789",+ name: "search",+ arguments: "{}",+ call_id: "call_1",+ },+ ],+ };++ stripStoredItemReferences(body);++ const input = body.input as Array<Record<string, unknown>>;+ // Both reasoning items must be gone.+ assert.equal(+ input.some((it) => it && it.type === "reasoning"),+ false,+ "reasoning items must be stripped"+ );+ // Non-reasoning items survive (message + function_call), id is sanitized.+ assert.equal(input.length, 2);+ assert.equal(input[0].type, "message");+ assert.equal(input[1].type, "function_call");+ assert.equal(input[1].id, undefined, "fc_ server id stripped, item kept");+});++test("filterToOpenAIFormat strips reasoning_content from assistant+tool_calls messages", () => {+ const body = {+ messages: [+ {+ role: "assistant",+ reasoning_content: "long chain of thought that inflates context",+ tool_calls: [{ id: "call_1", type: "function", function: { name: "f", arguments: "{}" } }],+ },+ ],+ };++ const result = filterToOpenAIFormat(body) as { messages: Array<Record<string, unknown>> };+ const msg = result.messages[0];++ assert.equal(msg.reasoning_content, undefined, "reasoning_content must be dropped");+ assert.ok(Array.isArray(msg.tool_calls), "tool_calls preserved");+ assert.equal((msg.tool_calls as unknown[]).length, 1);+ assert.equal(msg.role, "assistant");+});++test("filterToOpenAIFormat keeps assistant+tool_calls untouched when no reasoning_content", () => {+ const body = {+ messages: [+ {+ role: "assistant",+ content: null,+ tool_calls: [{ id: "call_1", type: "function", function: { name: "f", arguments: "{}" } }],+ },+ ],+ };++ const result = filterToOpenAIFormat(body) as { messages: Array<Record<string, unknown>> };+ assert.deepEqual(result.messages[0], body.messages[0]);+});diff --git a/tests/unit/strip-reasoning-header.test.ts b/tests/unit/strip-reasoning-header.test.tsnew file mode 100644index 0000000000..7d5dea4e7c--- /dev/null+++ b/tests/unit/strip-reasoning-header.test.ts@@ -0,0 +1,124 @@+import test from "node:test";+import assert from "node:assert/strict";++// Port of decolua/9router#517: per-request opt-in via the+// `x-omniroute-strip-reasoning` header to unconditionally strip+// `reasoning_content` from non-streaming JSON responses. Some clients+// (Firecrawl AI SDK) have JSON parsers that break on this non-standard+// extension even when there is no visible content, so the default+// "keep reasoning-only messages" behavior is not sufficient.+const { isStripReasoningRequested, getHeaderValueCaseInsensitive } = await import(+ "../../open-sse/handlers/chatCore/headers.ts"+);+const { sanitizeOpenAIResponse } = await import(+ "../../open-sse/handlers/responseSanitizer.ts"+);++test("isStripReasoningRequested is true for truthy header values", () => {+ for (const v of ["true", "1", "yes", "TRUE", "Yes", " true "]) {+ assert.equal(+ isStripReasoningRequested({ "x-omniroute-strip-reasoning": v }),+ true,+ `expected true for ${JSON.stringify(v)}`+ );+ }+});++test("isStripReasoningRequested is case-insensitive on the header NAME", () => {+ assert.equal(isStripReasoningRequested({ "X-OmniRoute-Strip-Reasoning": "true" }), true);+});++test("isStripReasoningRequested works with a Headers instance", () => {+ const h = new Headers();+ h.set("x-omniroute-strip-reasoning", "1");+ assert.equal(isStripReasoningRequested(h), true);+});++test("isStripReasoningRequested is false when absent / empty / falsy", () => {+ assert.equal(isStripReasoningRequested(null), false);+ assert.equal(isStripReasoningRequested(undefined), false);+ assert.equal(isStripReasoningRequested({}), false);+ assert.equal(isStripReasoningRequested({ "x-omniroute-strip-reasoning": "" }), false);+ assert.equal(isStripReasoningRequested({ "x-omniroute-strip-reasoning": "false" }), false);+ assert.equal(isStripReasoningRequested({ "x-omniroute-strip-reasoning": "0" }), false);+ assert.equal(isStripReasoningRequested({ "x-omniroute-strip-reasoning": "no" }), false);+});++test("getHeaderValueCaseInsensitive still resolves the header (sanity)", () => {+ assert.equal(+ getHeaderValueCaseInsensitive(+ { "x-omniroute-strip-reasoning": "true" },+ "x-omniroute-strip-reasoning"+ ),+ "true"+ );+});++// Default behavior (regression guard): reasoning-only messages keep+// reasoning_content. This matches existing logic — non-streaming responses+// only drop reasoning_content when there is ALSO visible content.+test("default: reasoning-only message keeps reasoning_content", () => {+ const out = sanitizeOpenAIResponse({+ id: "chatcmpl-x",+ object: "chat.completion",+ created: 1,+ model: "deepseek-reasoner",+ choices: [+ {+ index: 0,+ message: { role: "assistant", content: "", reasoning_content: "internal thoughts" },+ finish_reason: "stop",+ },+ ],+ }) as { choices: Array<{ message: { reasoning_content?: string } }> };+ assert.equal(out.choices[0].message.reasoning_content, "internal thoughts");+});++// Opt-in port of PR#517: when stripReasoning=true, reasoning_content is+// always removed from the final non-streaming JSON, even on reasoning-only+// messages. Firecrawl AI SDK and similar JSON parsers cannot tolerate it.+test("stripReasoning=true: reasoning-only message has reasoning_content removed", () => {+ const out = sanitizeOpenAIResponse(+ {+ id: "chatcmpl-x",+ object: "chat.completion",+ created: 1,+ model: "deepseek-reasoner",+ choices: [+ {+ index: 0,+ message: { role: "assistant", content: "", reasoning_content: "internal thoughts" },+ finish_reason: "stop",+ },+ ],+ },+ { stripReasoning: true }+ ) as { choices: Array<{ message: Record<string, unknown> }> };+ assert.equal(out.choices[0].message.reasoning_content, undefined);+ assert.equal("reasoning_content" in out.choices[0].message, false);+});++test("stripReasoning=true: message with both content and reasoning_content has reasoning stripped", () => {+ const out = sanitizeOpenAIResponse(+ {+ id: "chatcmpl-x",+ object: "chat.completion",+ created: 1,+ model: "deepseek-v4",+ choices: [+ {+ index: 0,+ message: {+ role: "assistant",+ content: "visible answer",+ reasoning_content: "internal",+ },+ finish_reason: "stop",+ },+ ],+ },+ { stripReasoning: true }+ ) as { choices: Array<{ message: Record<string, unknown> }> };+ assert.equal(out.choices[0].message.reasoning_content, undefined);+ assert.equal(out.choices[0].message.content, "visible answer");+});diff --git a/tests/unit/t12-pricing-updates.test.ts b/tests/unit/t12-pricing-updates.test.tsindex 76594eef48..d8d5aca520 100644--- a/tests/unit/t12-pricing-updates.test.ts+++ b/tests/unit/t12-pricing-updates.test.ts@@ -42,6 +42,21 @@ test("T12: codex catalog includes GPT 5.5 variations", () => {assert.equal(codexModels.get("gpt-5.5-xhigh")?.targetFormat, "openai-responses");});+test("T12: pricing table includes MiniMax-M3 (canonical + lowercase alias)", () => {+ const pricing = getDefaultPricing();++ assert.ok(pricing.minimax["MiniMax-M3"], "missing minimax/MiniMax-M3");+ assert.ok(pricing.minimax["minimax-m3"], "missing minimax/minimax-m3 alias");++ for (const key of ["MiniMax-M3", "minimax-m3"]) {+ assert.equal(pricing.minimax[key].input, 0.5, `${key} input`);+ assert.equal(pricing.minimax[key].output, 2.0, `${key} output`);+ assert.equal(pricing.minimax[key].cached, 0.25, `${key} cached`);+ assert.equal(pricing.minimax[key].reasoning, 3.0, `${key} reasoning`);+ assert.equal(pricing.minimax[key].cache_creation, 0.5, `${key} cache_creation`);+ }+});+test("T12: minimax default model list starts with M3", () => {const minimaxModels = REGISTRY.minimax.models.map((m) => m.id);const minimaxCnModels = REGISTRY["minimax-cn"].models.map((m) => m.id);diff --git a/tests/unit/token-refresh-service.test.ts b/tests/unit/token-refresh-service.test.tsindex 1574a79626..8b2f3e09d0 100644--- a/tests/unit/token-refresh-service.test.ts+++ b/tests/unit/token-refresh-service.test.ts@@ -438,6 +438,37 @@ test("refreshCodexToken recognizes refresh_token_reused responses", async () =>);});+// Port from decolua/9router#1821 (sacwooky): a 401 from OpenAI's OAuth token+// endpoint means the refresh credential itself was rejected (e.g. rotated away+// or a payload whose error code we do not yet recognize). Retrying with the+// same refresh token will never succeed — surface re-auth, do not loop.+test("refreshCodexToken treats any 401 from the token endpoint as unrecoverable", async () => {+ const log = createLog();++ await withMockedFetch(+ async () =>+ textResponse(+ JSON.stringify({+ error: {+ // A payload variant whose code/type are NOT in the existing+ // unrecoverable set — only the 401 status proves the token is dead.+ message: "Could not validate your token. Please try signing in again.",+ type: "invalid_request_error",+ },+ }),+ 401+ ),+ async () => {+ const result = await refreshCodexToken("codex-refresh", log);+ assert.equal(+ result?.error,+ "unrecoverable_refresh_error",+ "401 from OpenAI token endpoint must surface re-auth instead of returning null (which triggers retry)"+ );+ }+ );+});+test("refreshKiroToken uses the AWS OIDC flow when client credentials are present", async () => {const log = createLog();const calls: any[] = [];diff --git a/tests/unit/tool-source-diagnostics.test.ts b/tests/unit/tool-source-diagnostics.test.tsnew file mode 100644index 0000000000..14e32f37bf--- /dev/null+++ b/tests/unit/tool-source-diagnostics.test.ts@@ -0,0 +1,62 @@+import test from "node:test";+import assert from "node:assert/strict";++import {+ getToolName,+ getToolSource,+ summarizeToolSources,+} from "../../open-sse/utils/toolSources.ts";++test("getToolName resolves across OpenAI / Claude / hosted shapes", () => {+ assert.equal(getToolName({ name: "search" }), "search");+ assert.equal(getToolName({ function: { name: "fn_call" } }), "fn_call");+ assert.equal(getToolName({ type: "web_search" }), "web_search");+ assert.equal(getToolName({}), "unknown");+ assert.equal(getToolName(null), "unknown");+ assert.equal(getToolName(undefined), "unknown");+ // top-level name wins over nested/type+ assert.equal(getToolName({ name: "top", function: { name: "nested" }, type: "x" }), "top");+});++test("getToolSource classifies MCP / hosted / client tools", () => {+ assert.equal(getToolSource("mcp__notion__create_page"), "mcp:notion");+ assert.equal(getToolSource("mcp__"), "mcp");+ assert.equal(getToolSource("web_search"), "hosted:web");+ assert.equal(getToolSource("web_fetch_url"), "hosted:web");+ assert.equal(getToolSource("computer_use"), "hosted:computer");+ assert.equal(getToolSource("str_replace_editor"), "hosted:computer");+ assert.equal(getToolSource("get_weather"), "client");+});++test("summarizeToolSources returns null for empty / non-array input", () => {+ assert.equal(summarizeToolSources(null), null);+ assert.equal(summarizeToolSources(undefined), null);+ assert.equal(summarizeToolSources([]), null);+ assert.equal(summarizeToolSources("nope"), null);+});++test("summarizeToolSources counts tools and groups by source", () => {+ const summary = summarizeToolSources([+ { name: "mcp__notion__create_page" },+ { name: "mcp__notion__search" },+ { type: "web_search" },+ { function: { name: "get_weather" } },+ ]);+ assert.ok(summary);+ assert.match(summary as string, /^4 tools \|/);+ assert.match(summary as string, /mcp:notion=2/);+ assert.match(summary as string, /hosted:web=1/);+ assert.match(summary as string, /client=1/);+ assert.match(summary as string, /names: mcp__notion__create_page, mcp__notion__search/);+});++test("summarizeToolSources truncates names beyond 80 and reports overflow", () => {+ const tools = Array.from({ length: 85 }, (_, i) => ({ name: `tool_${i}` }));+ const summary = summarizeToolSources(tools) as string;+ assert.match(summary, /^85 tools \|/);+ assert.match(summary, /client=85/);+ assert.match(summary, /\.\.\. \+5 more$/);+ // only the first 80 names should appear before the overflow marker+ assert.ok(summary.includes("tool_79"));+ assert.ok(!summary.includes("tool_80,"));+});diff --git a/tests/unit/translator-antigravity-to-openai.test.ts b/tests/unit/translator-antigravity-to-openai.test.tsindex 0886c131be..6012b0bb9a 100644--- a/tests/unit/translator-antigravity-to-openai.test.ts+++ b/tests/unit/translator-antigravity-to-openai.test.ts@@ -192,3 +192,132 @@ test("Antigravity -> OpenAI lowers schema types recursively", () => {},});});++test("Antigravity -> OpenAI strips enumDescriptions from tool schema (top-level + nested)", () => {+ const result = antigravityToOpenAIRequest(+ "gpt-4o",+ {+ request: {+ tools: [+ {+ functionDeclarations: [+ {+ name: "configure",+ parameters: {+ type: "OBJECT",+ enumDescriptions: { ROOT: "should be stripped" },+ properties: {+ mode: {+ type: "STRING",+ enum: ["fast", "slow"],+ enumDescriptions: { fast: "go fast", slow: "go slow" },+ },+ tags: {+ type: "ARRAY",+ items: {+ type: "STRING",+ enum: ["a", "b"],+ enumDescriptions: { a: "alpha", b: "beta" },+ },+ },+ },+ },+ },+ ],+ },+ ],+ },+ },+ false+ );++ const parameters = (result.tools[0].function as any).parameters;++ // enumDescriptions must be removed at every level of the schema tree...+ assert.equal("enumDescriptions" in parameters, false);+ assert.equal("enumDescriptions" in parameters.properties.mode, false);+ assert.equal("enumDescriptions" in parameters.properties.tags.items, false);++ // ...while leaving the rest of the schema (incl. enum values) intact.+ assert.deepEqual(parameters, {+ type: "object",+ properties: {+ mode: { type: "string", enum: ["fast", "slow"] },+ tags: {+ type: "array",+ items: { type: "string", enum: ["a", "b"] },+ },+ },+ });+});++test("Antigravity -> OpenAI preserves the required array on Draft 2020-12 tool schemas", () => {+ const result = antigravityToOpenAIRequest(+ "gpt-4o",+ {+ request: {+ tools: [+ {+ functionDeclarations: [+ {+ name: "create_file",+ parameters: {+ $schema: "https://json-schema.org/draft/2020-12/schema",+ type: "OBJECT",+ additionalProperties: false,+ title: "CreateFileArgs",+ $defs: { unused: { type: "STRING" } },+ properties: {+ path: { type: "STRING", pattern: "^/" },+ contents: { type: "STRING" },+ },+ required: ["path", "contents"],+ },+ },+ ],+ },+ ],+ },+ },+ false+ );++ const params = (result.tools[0].function as any).parameters;+ // The required array must survive so the model treats mandatory args as mandatory.+ assert.deepEqual(params.required, ["path", "contents"]);+ // Types are still lowered and Draft 2020-12 meta keywords are stripped.+ assert.equal(params.type, "object");+ assert.equal(params.properties.path.type, "string");+ assert.equal(params.$schema, undefined);+ assert.equal(params.$defs, undefined);+ assert.equal(params.additionalProperties, undefined);+ assert.equal(params.title, undefined);+});++test("Antigravity -> OpenAI drops required entries that no longer exist in properties", () => {+ const result = antigravityToOpenAIRequest(+ "gpt-4o",+ {+ request: {+ tools: [+ {+ functionDeclarations: [+ {+ name: "partial",+ parameters: {+ type: "OBJECT",+ properties: { kept: { type: "STRING" } },+ required: ["kept", "ghost"],+ },+ },+ ],+ },+ ],+ },+ },+ false+ );++ const params = (result.tools[0].function as any).parameters;+ assert.deepEqual(params.required, ["kept"]);+});diff --git a/tests/unit/translator-claude-to-openai-strip-billing-header.test.ts b/tests/unit/translator-claude-to-openai-strip-billing-header.test.tsnew file mode 100644index 0000000000..2d381c17f7--- /dev/null+++ b/tests/unit/translator-claude-to-openai-strip-billing-header.test.ts@@ -0,0 +1,80 @@+/**+ * Port of decolua/9router commit 0aaa5ab3:+ * The Anthropic upstream injects a dynamic `x-anthropic-billing-header: ...`+ * line at the top of the Claude system prompt for some routes. When we+ * translate Claude → OpenAI and forward to an OpenAI-compatible upstream,+ * that line ends up as part of the assistant's system message — which+ * (a) confuses non-Anthropic models and (b) keeps changing across requests+ * and so destroys prompt-cache hits.+ *+ * Strip a leading `x-anthropic-billing-header: <value>` line from each+ * system entry before assembling the OpenAI request.+ */++import test from "node:test";+import assert from "node:assert/strict";++const { claudeToOpenAIRequest } = await import(+ "../../open-sse/translator/request/claude-to-openai.ts"+);++test("Claude -> OpenAI strips x-anthropic-billing-header from array system entries", () => {+ const result = claudeToOpenAIRequest(+ "gpt-4o",+ {+ system: [+ { text: "x-anthropic-billing-header: abc123\nReal system rule A" },+ { text: "Real system rule B" },+ ],+ messages: [{ role: "user", content: [{ type: "text", text: "hi" }] }],+ },+ true+ ) as { messages: Array<{ role: string; content: string }> };++ const sys = result.messages.find((m) => m.role === "system");+ assert.ok(sys, "system message present");+ assert.equal(+ sys!.content.includes("x-anthropic-billing-header"),+ false,+ "billing header line must be stripped"+ );+ assert.equal(+ sys!.content.includes("Real system rule A"),+ true,+ "real rule must survive"+ );+ assert.equal(+ sys!.content.includes("Real system rule B"),+ true,+ "second block must survive"+ );+});++test("Claude -> OpenAI strips x-anthropic-billing-header from a string system field", () => {+ const result = claudeToOpenAIRequest(+ "gpt-4o",+ {+ system: "x-anthropic-billing-header: zzz\nFollow these rules.",+ messages: [{ role: "user", content: [{ type: "text", text: "hi" }] }],+ },+ true+ ) as { messages: Array<{ role: string; content: string }> };++ const sys = result.messages.find((m) => m.role === "system");+ assert.ok(sys, "system message present");+ assert.equal(sys!.content, "Follow these rules.");+});++test("Claude -> OpenAI leaves unrelated system content intact (no false positives)", () => {+ const result = claudeToOpenAIRequest(+ "gpt-4o",+ {+ system: "Normal system prompt with no billing header.",+ messages: [{ role: "user", content: [{ type: "text", text: "hi" }] }],+ },+ true+ ) as { messages: Array<{ role: string; content: string }> };++ const sys = result.messages.find((m) => m.role === "system");+ assert.equal(sys!.content, "Normal system prompt with no billing header.");+});diff --git a/tests/unit/translator-helper-tool-description-coercion.test.ts b/tests/unit/translator-helper-tool-description-coercion.test.tsnew file mode 100644index 0000000000..12e47f12ad--- /dev/null+++ b/tests/unit/translator-helper-tool-description-coercion.test.ts@@ -0,0 +1,58 @@+// Regression: tool descriptions must always be strings for strict upstream+// validation (e.g., NVIDIA NIM, Codex). Ports upstream PR decolua/9router#397+// (Ibrahim Ryan), restricted to the gap that still exists in OmniRoute —+// the two non-string-tolerant paths in openaiHelper.filterToOpenAIFormat+// (Claude-style and Gemini-style tool normalization). The other locations+// upstream-patched (claude-to-openai.ts, openai-responses.ts) already coerce+// via String/toString in OmniRoute.+import test from "node:test";+import assert from "node:assert/strict";++const openaiHelper = await import(+ "../../open-sse/translator/helpers/openaiHelper.ts"+);++test("filterToOpenAIFormat coerces non-string Claude-tool description to string", () => {+ const result = openaiHelper.filterToOpenAIFormat({+ messages: [{ role: "user", content: "hi" }],+ tools: [+ {+ name: "claude-tool",+ // Non-string truthy value — must NOT leak through to upstream.+ description: { invalid: "object" } as unknown as string,+ input_schema: { type: "object" },+ },+ ],+ });+ assert.equal(typeof result.tools[0].function.description, "string");+});++test("filterToOpenAIFormat coerces null/undefined Claude-tool description to empty string", () => {+ const result = openaiHelper.filterToOpenAIFormat({+ messages: [{ role: "user", content: "hi" }],+ tools: [+ { name: "t1", description: null as unknown as string, input_schema: {} },+ { name: "t2", description: undefined, input_schema: {} },+ ],+ });+ assert.equal(result.tools[0].function.description, "");+ assert.equal(result.tools[1].function.description, "");+});++test("filterToOpenAIFormat coerces non-string Gemini functionDeclarations description", () => {+ const result = openaiHelper.filterToOpenAIFormat({+ messages: [{ role: "user", content: "hi" }],+ tools: [+ {+ functionDeclarations: [+ {+ name: "gemini-tool",+ description: 12345 as unknown as string,+ parameters: { type: "object" },+ },+ ],+ },+ ],+ });+ assert.equal(typeof result.tools[0].function.description, "string");+});diff --git a/tests/unit/translator-openai-responses-custom-tool-1007.test.ts b/tests/unit/translator-openai-responses-custom-tool-1007.test.tsnew file mode 100644index 0000000000..dc21c8c934--- /dev/null+++ b/tests/unit/translator-openai-responses-custom-tool-1007.test.ts@@ -0,0 +1,163 @@+import test from "node:test";+import assert from "node:assert/strict";++const { openaiResponsesToOpenAIRequest } =+ await import("../../open-sse/translator/request/openai-responses.ts");+const { openaiToOpenAIResponsesResponse } =+ await import("../../open-sse/translator/response/openai-responses.ts");+const { initState } = await import("../../open-sse/translator/index.ts");+const { FORMATS } = await import("../../open-sse/translator/formats.ts");++function collectEvents(chunks) {+ const state = initState(FORMATS.OPENAI_RESPONSES);+ const events = [];+ for (const chunk of chunks) {+ const result = openaiToOpenAIResponsesResponse(chunk, state);+ if (result) events.push(...result);+ }+ return events;+}++// Request side: a Codex custom/freeform tool (type:"custom", no `parameters`) must be+// normalized to a { input: string } function schema — NOT an empty function schema.+test("Responses -> Chat: custom tool is normalized to a { input: string } function schema (#1007)", () => {+ const result = openaiResponsesToOpenAIRequest(+ "gpt-5.3-codex",+ {+ input: [{ type: "message", role: "user", content: [{ type: "input_text", text: "hi" }] }],+ tools: [+ {+ type: "custom",+ name: "apply_patch",+ description: "Apply a code patch",+ format: { type: "grammar", syntax: "lark", definition: "..." },+ },+ ],+ },+ false,+ {}+ );++ assert.equal(Array.isArray(result.tools), true);+ const tool = result.tools[0];+ assert.equal(tool.type, "function");+ assert.equal(tool.function.name, "apply_patch");+ // The regression: without normalization, parameters is undefined / empty and the model+ // invokes apply_patch with {}, breaking the Codex runtime.+ assert.deepEqual(tool.function.parameters, {+ type: "object",+ properties: { input: { type: "string" } },+ required: ["input"],+ additionalProperties: false,+ });+});++// Request side: custom_tool_call / custom_tool_call_output input items round-trip.+test("Responses -> Chat: custom_tool_call + output items map to tool_calls and tool role (#1007)", () => {+ const result = openaiResponsesToOpenAIRequest(+ "gpt-5.3-codex",+ {+ input: [+ { type: "message", role: "user", content: [{ type: "input_text", text: "patch it" }] },+ {+ type: "custom_tool_call",+ call_id: "call_patch_1",+ name: "apply_patch",+ input: "*** Begin Patch\n*** End Patch",+ },+ {+ type: "custom_tool_call_output",+ call_id: "call_patch_1",+ output: '{"output":"applied","metadata":{"ok":true}}',+ },+ ],+ },+ false,+ {}+ );++ const assistant = result.messages.find(+ (m) => m.role === "assistant" && Array.isArray(m.tool_calls)+ );+ assert.ok(assistant, "expected an assistant message carrying the custom tool call");+ const tc = assistant.tool_calls[0];+ assert.equal(tc.id, "call_patch_1");+ assert.equal(tc.type, "function");+ assert.equal(tc.function.name, "apply_patch");+ assert.deepEqual(JSON.parse(tc.function.arguments), {+ input: "*** Begin Patch\n*** End Patch",+ });++ const toolMsg = result.messages.find((m) => m.role === "tool");+ assert.ok(toolMsg, "expected a tool result message");+ assert.equal(toolMsg.tool_call_id, "call_patch_1");+ // JSON-wrapped {"output":...} is unwrapped to the plain string.+ assert.equal(toolMsg.content, "applied");+});++// Response side: an apply_patch tool call must stream as custom_tool_call_input.* events+// and the raw patch string is unwrapped from the {"input":"..."} JSON the model produced.+test("OpenAI -> Responses: apply_patch streams as custom_tool_call with raw input (#1007)", () => {+ const events = collectEvents([+ {+ id: "chatcmpl-1",+ model: "gpt-5.3-codex",+ choices: [+ {+ index: 0,+ delta: {+ tool_calls: [+ {+ index: 0,+ id: "call_1",+ type: "function",+ function: { name: "apply_patch", arguments: '{"input":"PATCH' },+ },+ ],+ },+ finish_reason: null,+ },+ ],+ },+ {+ id: "chatcmpl-1",+ model: "gpt-5.3-codex",+ choices: [+ {+ index: 0,+ delta: { tool_calls: [{ index: 0, function: { arguments: '_BODY"}' } }] },+ finish_reason: "tool_calls",+ },+ ],+ },+ ]);++ const added = events.find((e) => e.event === "response.output_item.added");+ assert.ok(added);+ assert.equal(added.data.item.type, "custom_tool_call");+ assert.equal(added.data.item.name, "apply_patch");++ assert.ok(+ events.some((e) => e.event === "response.custom_tool_call_input.delta"),+ "expected a custom_tool_call_input.delta event"+ );+ // No function_call_arguments.* events should leak for a custom tool.+ assert.ok(!events.some((e) => e.event === "response.function_call_arguments.delta"));+ assert.ok(!events.some((e) => e.event === "response.function_call_arguments.done"));++ const inputDone = events.find((e) => e.event === "response.custom_tool_call_input.done");+ assert.ok(inputDone);+ assert.equal(inputDone.data.input, "PATCH_BODY");++ const itemDone = events.find(+ (e) => e.event === "response.output_item.done" && e.data.item.type === "custom_tool_call"+ );+ assert.ok(itemDone);+ assert.equal(itemDone.data.item.input, "PATCH_BODY");++ const completed = events.find((e) => e.event === "response.completed");+ assert.ok(completed);+ const customItem = completed.data.response.output.find((o) => o.type === "custom_tool_call");+ assert.ok(customItem, "final snapshot should carry the custom_tool_call item");+ assert.equal(customItem.input, "PATCH_BODY");+});diff --git a/tests/unit/translator-openai-responses-req.test.ts b/tests/unit/translator-openai-responses-req.test.tsindex b20ac64bb0..8b0f74f0ce 100644--- a/tests/unit/translator-openai-responses-req.test.ts+++ b/tests/unit/translator-openai-responses-req.test.ts@@ -623,7 +623,10 @@ test("Chat -> Responses prefers max_completion_tokens over max_tokens when bothassert.equal((result as any).max_completion_tokens, undefined);});-test("Responses -> Chat drops `reasoning` and does not synthesize reasoning_effort without Copilot marker", () => {+test("Responses -> Chat drops `reasoning` and promotes effort to reasoning_effort even without Copilot marker", () => {+ // Updated per upstream PR decolua/9router#1817 (ryanngit): the OpenAI-native+ // `reasoning_effort` hint is always preserved across the Responses -> Chat+ // hop; only the Copilot-specific `summary` -> Claude marker stays gated.const result = openaiResponsesToOpenAIRequest("claude-opus-4-7",{@@ -635,7 +638,7 @@ test("Responses -> Chat drops `reasoning` and does not synthesize reasoning_effo) as Record<string, unknown>;assert.equal(result.reasoning, undefined);- assert.equal(result.reasoning_effort, undefined);+ assert.equal(result.reasoning_effort, "high");});test("Responses -> Chat promotes reasoning.effort to reasoning_effort when _copilotClient is set", () => {@@ -1044,3 +1047,50 @@ test("Responses -> Chat: a valid function_call/output pair is preserved (issue #assert.ok(toolMsg, "matching tool result must be preserved");assert.equal(toolMsg.tool_call_id, "c1");});++// --- AI SDK image content part (#1330) ---+test("Chat -> Responses converts AI SDK image content part to input_image", () => {+ // AI SDK emits image parts as { type: "image", image: "data:...;base64,..." }+ // rather than the OpenAI { type: "image_url", image_url: { url } } shape. The+ // Responses translator must forward them as input_image (#1330).+ const imageUrl = "data:image/png;base64,iVBORw0KGgo=";+ const result = openaiToOpenAIResponsesRequest(+ "gpt-5.2",+ {+ messages: [+ {+ role: "user",+ content: [+ { type: "text", text: "Describe this image" },+ { type: "image", image: imageUrl, detail: "high" },+ ],+ },+ ],+ },+ true,+ {}+ ) as Record<string, unknown>;++ const input = result.input as any[];+ assert.deepEqual(input[0].content, [+ { type: "input_text", text: "Describe this image" },+ { type: "input_image", image_url: imageUrl, detail: "high" },+ ]);+});++test("Chat -> Responses defaults AI SDK image detail to auto", () => {+ const imageUrl = "data:image/jpeg;base64,/9j/4AAQ=";+ const result = openaiToOpenAIResponsesRequest(+ "gpt-5.2",+ { messages: [{ role: "user", content: [{ type: "image", image: imageUrl }] }] },+ true,+ {}+ ) as Record<string, unknown>;++ const input = result.input as any[];+ assert.deepEqual(input[0].content[0], {+ type: "input_image",+ image_url: imageUrl,+ detail: "auto",+ });+});diff --git a/tests/unit/translator-openai-to-kiro.test.ts b/tests/unit/translator-openai-to-kiro.test.tsindex 4ed7067f3c..66fc91dc96 100644--- a/tests/unit/translator-openai-to-kiro.test.ts+++ b/tests/unit/translator-openai-to-kiro.test.ts@@ -915,3 +915,84 @@ test("OpenAI -> Kiro serializes non-string role:tool content to non-empty text (assert.notEqual(text, "", "non-string tool content must not collapse to empty string");assert.match(text, /entry A/, "serialized content preserves the structured text blocks");});++// Only Claude models support images in Kiro. Non-Claude Kiro models+// (deepseek-3.2, minimax-m2.5, glm-5, qwen3-coder-next, auto-kiro) must NOT+// receive image attachments — attaching them is wrong for those models.+const PNG_DATA_URL = "data:image/png;base64,aGVsbG8=";++function buildImageRequest(model: string) {+ return buildKiroPayload(+ model,+ {+ messages: [+ {+ role: "user",+ content: [+ { type: "text", text: "Describe this picture" },+ { type: "image_url", image_url: { url: PNG_DATA_URL } },+ { type: "image", source: { type: "base64", media_type: "image/png", data: "aGk=" } },+ { type: "image", image: PNG_DATA_URL },+ ],+ },+ ],+ },+ false,+ null+ );+}++test("OpenAI -> Kiro attaches images for Claude models", () => {+ const result = buildImageRequest("claude-sonnet-4.6");+ const images = result.conversationState.currentMessage.userInputMessage.images;+ assert.ok(Array.isArray(images), "Claude models must keep image attachments");+ // Three image blocks (image_url + Anthropic base64 + AI SDK-style) → 3 entries+ assert.equal(images.length, 3, "all three supported image part shapes are attached");+ assert.equal(images[0].format, "png");+ assert.ok(images[0].source.bytes, "image bytes are preserved for Claude");+});++test("OpenAI -> Kiro drops images for non-Claude models (deepseek)", () => {+ const result = buildImageRequest("deepseek-3.2");+ const images = result.conversationState.currentMessage.userInputMessage.images;+ assert.ok(+ images === undefined || images.length === 0,+ `non-Claude Kiro models must NOT receive image attachments, got: ${JSON.stringify(images)}`+ );+ // The accompanying text must still survive.+ assert.match(+ result.conversationState.currentMessage.userInputMessage.content,+ /Describe this picture/,+ "text content is preserved even when images are dropped"+ );+});++test("OpenAI -> Kiro drops images for non-Claude models (glm / auto-kiro)", () => {+ for (const model of ["glm-5", "minimax-m2.5", "qwen3-coder-next", "auto-kiro"]) {+ const result = buildImageRequest(model);+ const images = result.conversationState.currentMessage.userInputMessage.images;+ assert.ok(+ images === undefined || images.length === 0,+ `${model} must NOT receive image attachments, got: ${JSON.stringify(images)}`+ );+ }+});++test("buildKiroPayload rejects the Anthropic-only [1m] context suffix before Bedrock", () => {+ const body = { messages: [{ role: "user", content: "Hello" }] };++ assert.throws(+ () => buildKiroPayload("claude-opus-4.7-thinking-agentic[1m]", body, true, {}),+ /\[1m\]' suffix is not supported by Kiro upstream/,+ "kr/* model ids carrying [1m] must be rejected, not forwarded to AWS Bedrock"+ );+});++test("buildKiroPayload accepts kr/* model ids without the [1m] suffix", () => {+ const body = { messages: [{ role: "user", content: "Hello" }] };++ assert.doesNotThrow(+ () => buildKiroPayload("claude-sonnet-4.5", body, true, {}),+ "model ids without [1m] must continue to build normally"+ );+});diff --git a/tests/unit/ui/compatible-provider-apikey-setup.test.tsx b/tests/unit/ui/compatible-provider-apikey-setup.test.tsxnew file mode 100644index 0000000000..720950ee02--- /dev/null+++ b/tests/unit/ui/compatible-provider-apikey-setup.test.tsx@@ -0,0 +1,129 @@+// @vitest-environment jsdom+/**+ * Port of upstream decolua/9router PR #925.+ *+ * Bug: For openai-compatible / anthropic-compatible providers, the AddApiKeyModal+ * had no "Default Model" input and the saved payload omitted `defaultModel`, so the+ * created connection persisted with `defaultModel = null` and was effectively+ * unusable (no model to bind requests to). The fix adds a required Default Model+ * field for compatible providers and threads it through the save payload.+ *+ * Two TDD tests:+ * 1) Compatible provider: the "Default Model" input is rendered and its value+ * is forwarded as `defaultModel` in the onSave payload.+ * 2) Non-compatible (first-party) provider: the field is NOT rendered, and+ * `defaultModel` stays undefined in the payload (no regression for the+ * existing first-party flow).+ */+import React, { act } from "react";+import { createRoot } from "react-dom/client";+import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";++vi.mock("next-intl", () => ({+ useTranslations: () => (key: string) => key,+}));++const { default: AddApiKeyModal } = await import(+ "../../../src/app/(dashboard)/dashboard/providers/[id]/components/modals/AddApiKeyModal"+);++const DEFAULT_MODEL_INPUT_SELECTOR = 'input[data-testid="compat-default-model-input"]';++const containers: Array<{ root: ReturnType<typeof createRoot>; el: HTMLDivElement }> = [];++function render(props: Record<string, unknown>) {+ const el = document.createElement("div");+ document.body.appendChild(el);+ const root = createRoot(el);+ act(() => {+ root.render(+ <AddApiKeyModal+ isOpen+ onSave={async () => undefined}+ onClose={() => {}}+ {...(props as any)}+ />+ );+ });+ containers.push({ root, el });+ return el;+}++function setInputValue(input: HTMLInputElement, value: string) {+ const setter = Object.getOwnPropertyDescriptor(+ window.HTMLInputElement.prototype,+ "value"+ )!.set!;+ act(() => {+ setter.call(input, value);+ input.dispatchEvent(new Event("input", { bubbles: true }));+ });+}++async function waitFor(fn: () => boolean, timeoutMs = 2000) {+ const start = Date.now();+ while (!fn()) {+ if (Date.now() - start > timeoutMs) throw new Error("waitFor timed out");+ await new Promise((r) => setTimeout(r, 20));+ }+}++beforeEach(() => {+ vi.clearAllMocks();+ vi.stubGlobal(+ "fetch",+ vi.fn(() =>+ Promise.resolve({ ok: true, json: () => Promise.resolve({ valid: true }) } as Response)+ )+ );+});++afterEach(() => {+ for (const { root, el } of containers.splice(0)) {+ act(() => root.unmount());+ el.remove();+ }+ vi.unstubAllGlobals();+});++describe("AddApiKeyModal — compatible provider default-model field (PR #925)", () => {+ it("renders the Default Model input only when the provider is compatible", () => {+ const compatEl = render({+ provider: "openai-compatible:my-node",+ providerName: "My OpenAI Compatible",+ isCompatible: true,+ });+ expect(compatEl.querySelector(DEFAULT_MODEL_INPUT_SELECTOR)).toBeTruthy();++ const nonCompatEl = render({ provider: "openai", providerName: "OpenAI" });+ expect(nonCompatEl.querySelector(DEFAULT_MODEL_INPUT_SELECTOR)).toBeNull();+ });++ it("threads defaultModel from the form into the save payload for compatible providers", async () => {+ const onSave = vi.fn().mockResolvedValue(undefined);+ const el = render({+ provider: "openai-compatible:my-node",+ providerName: "My OpenAI Compatible",+ isCompatible: true,+ onSave,+ });++ const nameInput = el.querySelector<HTMLInputElement>('input[placeholder="productionKey"]')!;+ const apiKeyInput = el.querySelector<HTMLInputElement>('input[type="password"]')!;+ const defaultModelInput = el.querySelector<HTMLInputElement>(DEFAULT_MODEL_INPUT_SELECTOR)!;+ setInputValue(nameInput, "My Connection");+ setInputValue(apiKeyInput, "sk-test-key");+ setInputValue(defaultModelInput, "gpt-4o-mini");++ const saveBtn = Array.from(el.querySelectorAll("button")).find(+ (b) => b.textContent?.trim() === "save"+ )!;+ act(() => {+ saveBtn.dispatchEvent(new MouseEvent("click", { bubbles: true }));+ });++ await waitFor(() => onSave.mock.calls.length > 0);+ const payload = onSave.mock.calls[0][0];+ expect(payload.defaultModel).toBe("gpt-4o-mini");+ });+});diff --git a/tests/unit/usage-extractor.test.ts b/tests/unit/usage-extractor.test.tsindex 6c7bdf5273..84d330e757 100644--- a/tests/unit/usage-extractor.test.ts+++ b/tests/unit/usage-extractor.test.ts@@ -332,3 +332,88 @@ test("extractUsage reads flat cached_tokens and reasoning_tokens from streamingassert.equal(usage.cached_tokens, 192);assert.equal(usage.reasoning_tokens, 49);});++// ── Ollama raw NDJSON streaming usage ──+// Ollama sends a final NDJSON line { done: true, prompt_eval_count, eval_count }+// (raw from the provider, before any OpenAI translation). Without a dedicated+// branch, extractUsage returns null and Ollama streaming usage is dropped.++test("extractUsage reads Ollama raw NDJSON final chunk (done + prompt_eval_count/eval_count)", () => {+ const usage = extractUsage({+ model: "llama3.1",+ done: true,+ prompt_eval_count: 26,+ eval_count: 298,+ });++ assert.ok(usage, "expected usage to be extracted from the Ollama final chunk");+ assert.equal(usage.prompt_tokens, 26);+ assert.equal(usage.completion_tokens, 298);+ assert.equal(usage.total_tokens, 324);+});++test("extractUsage defaults missing Ollama eval counts to zero", () => {+ const usage = extractUsage({+ model: "llama3.1",+ done: true,+ prompt_eval_count: 12,+ });++ assert.ok(usage, "expected usage to be extracted even with only prompt_eval_count");+ assert.equal(usage.prompt_tokens, 12);+ assert.equal(usage.completion_tokens, 0);+ assert.equal(usage.total_tokens, 12);+});++test("extractUsage ignores non-final Ollama NDJSON chunks (done=false)", () => {+ const usage = extractUsage({+ model: "llama3.1",+ done: false,+ response: "partial",+ });++ assert.equal(usage, null);+});++// ── Antigravity (Gemini) streaming usageMetadata tests ──++test("extractUsage reads top-level Gemini usageMetadata from a streaming chunk", () => {+ const usage = extractUsage({+ usageMetadata: {+ promptTokenCount: 120,+ candidatesTokenCount: 60,+ totalTokenCount: 180,+ cachedContentTokenCount: 30,+ thoughtsTokenCount: 12,+ },+ });++ assert.equal(usage.prompt_tokens, 120);+ assert.equal(usage.completion_tokens, 60);+ assert.equal(usage.total_tokens, 180);+ assert.equal(usage.cached_tokens, 30);+ assert.equal(usage.reasoning_tokens, 12);+});++test("extractUsage reads Antigravity usageMetadata wrapped inside a response envelope", () => {+ // Antigravity (AG MITM) shapes usage as { response: { usageMetadata: {...} } }.+ // Without the response.usageMetadata fallback, token usage is silently dropped.+ const usage = extractUsage({+ response: {+ usageMetadata: {+ promptTokenCount: 200,+ candidatesTokenCount: 75,+ totalTokenCount: 275,+ cachedContentTokenCount: 40,+ thoughtsTokenCount: 18,+ },+ },+ });++ assert.notEqual(usage, null);+ assert.equal(usage.prompt_tokens, 200);+ assert.equal(usage.completion_tokens, 75);+ assert.equal(usage.total_tokens, 275);+ assert.equal(usage.cached_tokens, 40);+ assert.equal(usage.reasoning_tokens, 18);+});diff --git a/tests/unit/xai-translators.test.ts b/tests/unit/xai-translators.test.tsnew file mode 100644index 0000000000..56ed994cd0--- /dev/null+++ b/tests/unit/xai-translators.test.ts@@ -0,0 +1,490 @@+/**+ * Unit tests — xAI thinking patcher + inbound translators+ *+ * Ported from upstream decolua/9router tests/unit/xai-thinking.test.js+ * and expanded with coverage for claude/gemini/openai-chat/openai-responses translators.+ *+ * Runner: node --import tsx/esm --test tests/unit/xai-translators.test.ts+ */+import test from "node:test";+import assert from "node:assert/strict";++const { budgetToEffort, applyThinking } = await import(+ "../../src/lib/providers/xai/thinking.ts"+);+const { chatRequestToXaiResponses, xaiCompletedToChatJson } = await import(+ "../../src/lib/providers/xai/translators/openai-chat.ts"+);+const {+ openaiResponsesRequestToXai,+ xaiCompletedToOpenaiResponses,+ xaiSseEventToOpenaiResponses,+} = await import("../../src/lib/providers/xai/translators/openai-responses.ts");+const { claudeRequestToXaiResponses, xaiCompletedToClaudeJson } = await import(+ "../../src/lib/providers/xai/translators/claude.ts"+);+const { geminiRequestToXaiResponses, xaiCompletedToGeminiJson } = await import(+ "../../src/lib/providers/xai/translators/gemini.ts"+);++// ─── budgetToEffort ──────────────────────────────────────────────────────────++test("budgetToEffort: maps 0 / negative / NaN to undefined", () => {+ assert.equal(budgetToEffort(0), undefined);+ assert.equal(budgetToEffort(-100), undefined);+ assert.equal(budgetToEffort(Number.NaN), undefined);+ assert.equal(budgetToEffort(Number.POSITIVE_INFINITY), undefined);+});++test("budgetToEffort: maps 1–3999 to low", () => {+ assert.equal(budgetToEffort(1), "low");+ assert.equal(budgetToEffort(3999), "low");+});++test("budgetToEffort: maps 4000–15999 to medium", () => {+ assert.equal(budgetToEffort(4000), "medium");+ assert.equal(budgetToEffort(15999), "medium");+});++test("budgetToEffort: maps 16000+ to high", () => {+ assert.equal(budgetToEffort(16000), "high");+ assert.equal(budgetToEffort(64000), "high");+});++// ─── applyThinking ───────────────────────────────────────────────────────────++test("applyThinking: returns clone untouched when nothing matches", () => {+ const req = { model: "grok-4", input: [] };+ const out = applyThinking(req);+ assert.deepStrictEqual(out, req);+ assert.notStrictEqual(out, req); // must be a new object+});++test("applyThinking: honors xAI-native reasoning.effort verbatim", () => {+ const req = { reasoning: { effort: "high" }, foo: 1 };+ const out = applyThinking(req as Parameters<typeof applyThinking>[0]);+ assert.deepStrictEqual(out.reasoning, { effort: "high" });+ assert.equal((out as Record<string, unknown>).foo, 1);+});++test("applyThinking: rewrites OpenAI Chat reasoning_effort into reasoning.effort", () => {+ const req = { reasoning_effort: "medium" };+ const out = applyThinking(req);+ assert.deepStrictEqual(out.reasoning, { effort: "medium" });+ assert.equal(out.reasoning_effort, undefined);+});++test("applyThinking: ignores invalid reasoning_effort values", () => {+ const req = { reasoning_effort: "ultra" };+ const out = applyThinking(req);+ assert.equal(out.reasoning, undefined);+});++test("applyThinking: maps Anthropic thinking enabled with budget_tokens", () => {+ const req = { thinking: { type: "enabled", budget_tokens: 20000 } };+ const out = applyThinking(req);+ assert.deepStrictEqual(out.reasoning, { effort: "high" });+ assert.equal(out.thinking, undefined);+});++test("applyThinking: defaults Anthropic thinking enabled without budget_tokens to medium", () => {+ const req = { thinking: { type: "enabled" } };+ const out = applyThinking(req);+ assert.deepStrictEqual(out.reasoning, { effort: "medium" });+});++test("applyThinking: strips Anthropic thinking type=disabled without setting reasoning", () => {+ const req = { thinking: { type: "disabled" } };+ const out = applyThinking(req);+ assert.equal(out.reasoning, undefined);+ assert.equal(out.thinking, undefined);+});++test("applyThinking: maps Gemini thinkingConfig.thinkingBudget", () => {+ const req = { thinkingConfig: { thinkingBudget: 5000 } };+ const out = applyThinking(req);+ assert.deepStrictEqual(out.reasoning, { effort: "medium" });+ assert.equal(out.thinkingConfig, undefined);+});++test("applyThinking: strips Gemini thinkingConfig with budget=0 without setting reasoning", () => {+ const req = { thinkingConfig: { thinkingBudget: 0 } };+ const out = applyThinking(req);+ assert.equal(out.reasoning, undefined);+ assert.equal(out.thinkingConfig, undefined);+});++test("applyThinking: applies defaultEffort when nothing else is provided", () => {+ const out = applyThinking({}, { defaultEffort: "low" });+ assert.deepStrictEqual(out.reasoning, { effort: "low" });+});++// ─── chatRequestToXaiResponses ────────────────────────────────────────────────++test("chatRequestToXaiResponses: converts system message to instructions", () => {+ const req = {+ model: "grok-4",+ messages: [+ { role: "system", content: "You are a helpful assistant." },+ { role: "user", content: "Hello" },+ ],+ };+ const out = chatRequestToXaiResponses(req);+ assert.equal(out.instructions, "You are a helpful assistant.");+ assert.equal(out.input.length, 1);+ assert.equal((out.input[0] as Record<string, unknown>).role, "user");+});++test("chatRequestToXaiResponses: converts tool message to function_call_output", () => {+ const req = {+ model: "grok-4",+ messages: [+ { role: "tool", content: "result text", tool_call_id: "call_abc" },+ ],+ };+ const out = chatRequestToXaiResponses(req);+ assert.equal(out.input[0].type, "function_call_output");+ assert.equal(out.input[0].call_id, "call_abc");+ assert.equal(out.input[0].output, "result text");+});++test("chatRequestToXaiResponses: promotes reasoning_effort to reasoning field", () => {+ const req = { model: "grok-4", messages: [], reasoning_effort: "high" };+ const out = chatRequestToXaiResponses(req);+ assert.deepStrictEqual(out.reasoning, { effort: "high" });+});++test("chatRequestToXaiResponses: maps max_tokens to max_output_tokens", () => {+ const req = { model: "grok-4", messages: [], max_tokens: 512 };+ const out = chatRequestToXaiResponses(req);+ assert.equal(out.max_output_tokens, 512);+});++// ─── xaiCompletedToChatJson ──────────────────────────────────────────────────++test("xaiCompletedToChatJson: extracts output_text content into message", () => {+ const completed = {+ id: "resp_1",+ model: "grok-4",+ output: [+ {+ type: "message",+ content: [{ type: "output_text", text: "Hello!" }],+ },+ ],+ };+ const result = xaiCompletedToChatJson(completed) as Record<string, unknown>;+ const choices = result.choices as Array<Record<string, unknown>>;+ assert.equal(choices[0].finish_reason, "stop");+ const message = choices[0].message as Record<string, unknown>;+ assert.equal(message.content, "Hello!");+});++test("xaiCompletedToChatJson: maps function_call to tool_calls with finish_reason=tool_calls", () => {+ const completed = {+ id: "resp_2",+ model: "grok-4",+ output: [+ {+ type: "function_call",+ call_id: "call_1",+ name: "get_weather",+ arguments: '{"location":"London"}',+ },+ ],+ };+ const result = xaiCompletedToChatJson(completed) as Record<string, unknown>;+ const choices = result.choices as Array<Record<string, unknown>>;+ assert.equal(choices[0].finish_reason, "tool_calls");+ const message = choices[0].message as Record<string, unknown>;+ const toolCalls = message.tool_calls as Array<Record<string, unknown>>;+ assert.equal(toolCalls.length, 1);+ assert.equal(toolCalls[0].id, "call_1");+ const fn = toolCalls[0].function as Record<string, unknown>;+ assert.equal(fn.name, "get_weather");+});++// ─── openaiResponsesRequestToXai ─────────────────────────────────────────────++test("openaiResponsesRequestToXai: drops service_tier", () => {+ const req = { model: "grok-4", input: [], service_tier: "default" };+ const out = openaiResponsesRequestToXai(req);+ assert.equal("service_tier" in out, false);+});++test("openaiResponsesRequestToXai: preserves other fields verbatim", () => {+ const req = { model: "grok-4", input: [{ role: "user", content: "hi" }] };+ const out = openaiResponsesRequestToXai(req);+ assert.deepStrictEqual(out.input, req.input);+});++// ─── xaiCompletedToOpenaiResponses ───────────────────────────────────────────++test("xaiCompletedToOpenaiResponses: normalizes object + status fields", () => {+ const completed = { id: "r1", model: "grok-4", output: [] };+ const out = xaiCompletedToOpenaiResponses(completed);+ assert.equal(out.object, "response");+ assert.equal(out.status, "completed");+});++test("xaiCompletedToOpenaiResponses: preserves existing object/status", () => {+ const completed = { id: "r1", object: "custom", status: "in_progress" };+ const out = xaiCompletedToOpenaiResponses(completed);+ assert.equal(out.object, "custom");+ assert.equal(out.status, "in_progress");+});++// ─── xaiSseEventToOpenaiResponses ────────────────────────────────────────────++test("xaiSseEventToOpenaiResponses: drops annotation.added event", () => {+ const ev = {+ event: "response.output_text.annotation.added",+ data: '{"text":"foo"}',+ };+ const result = xaiSseEventToOpenaiResponses(ev);+ assert.equal(result, null);+});++test("xaiSseEventToOpenaiResponses: passes through other events unchanged", () => {+ const ev = { event: "response.output_text.delta", data: '{"delta":"hi"}' };+ const result = xaiSseEventToOpenaiResponses(ev);+ assert.deepStrictEqual(result, ev);+});++// ─── claudeRequestToXaiResponses ─────────────────────────────────────────────++test("claudeRequestToXaiResponses: translates system string to instructions", () => {+ const req = {+ model: "grok-4",+ system: "Be helpful",+ messages: [{ role: "user" as const, content: "Hi" }],+ };+ const out = claudeRequestToXaiResponses(req);+ assert.equal(out.instructions, "Be helpful");+});++test("claudeRequestToXaiResponses: converts text content to input_text block", () => {+ const req = {+ model: "grok-4",+ messages: [{ role: "user" as const, content: "Hello" }],+ };+ const out = claudeRequestToXaiResponses(req);+ assert.equal(out.input.length, 1);+ const inputItem = out.input[0] as Record<string, unknown>;+ const content = inputItem.content as Array<Record<string, unknown>>;+ assert.equal(content[0].type, "input_text");+ assert.equal(content[0].text, "Hello");+});++test("claudeRequestToXaiResponses: extracts tool_result to function_call_output", () => {+ const req = {+ model: "grok-4",+ messages: [+ {+ role: "user" as const,+ content: [+ {+ type: "tool_result",+ tool_use_id: "tu_123",+ content: "result data",+ },+ ],+ },+ ],+ };+ const out = claudeRequestToXaiResponses(req);+ const item = out.input[0] as Record<string, unknown>;+ assert.equal(item.type, "function_call_output");+ assert.equal(item.call_id, "tu_123");+ assert.equal(item.output, "result data");+});++test("claudeRequestToXaiResponses: translates tools from Anthropic to xAI function shape", () => {+ const req = {+ model: "grok-4",+ messages: [],+ tools: [+ {+ name: "search",+ description: "Search the web",+ input_schema: { type: "object", properties: {} },+ },+ ],+ };+ const out = claudeRequestToXaiResponses(req);+ assert.ok(Array.isArray(out.tools));+ const tool = (out.tools as Array<Record<string, unknown>>)[0];+ assert.equal(tool.type, "function");+ const fn = tool.function as Record<string, unknown>;+ assert.equal(fn.name, "search");+});++test("claudeRequestToXaiResponses: maps thinking.enabled with budget to reasoning", () => {+ const req = {+ model: "grok-4",+ messages: [],+ thinking: { type: "enabled", budget_tokens: 8000 },+ };+ const out = claudeRequestToXaiResponses(req);+ assert.deepStrictEqual(out.reasoning, { effort: "medium" });+});++// ─── xaiCompletedToClaudeJson ─────────────────────────────────────────────────++test("xaiCompletedToClaudeJson: converts output_text to text content block", () => {+ const completed = {+ id: "r1",+ model: "grok-4",+ output: [+ {+ type: "message",+ content: [{ type: "output_text", text: "Hello!" }],+ },+ ],+ };+ const result = xaiCompletedToClaudeJson(completed) as Record<string, unknown>;+ assert.equal(result.role, "assistant");+ assert.equal(result.stop_reason, "end_turn");+ const content = result.content as Array<Record<string, unknown>>;+ assert.equal(content[0].type, "text");+ assert.equal(content[0].text, "Hello!");+});++test("xaiCompletedToClaudeJson: converts function_call to tool_use block", () => {+ const completed = {+ id: "r2",+ model: "grok-4",+ output: [+ {+ type: "function_call",+ call_id: "c1",+ name: "lookup",+ arguments: '{"q":"test"}',+ },+ ],+ };+ const result = xaiCompletedToClaudeJson(completed) as Record<string, unknown>;+ assert.equal(result.stop_reason, "tool_use");+ const content = result.content as Array<Record<string, unknown>>;+ assert.equal(content[0].type, "tool_use");+ assert.equal(content[0].name, "lookup");+});++// ─── geminiRequestToXaiResponses ─────────────────────────────────────────────++test("geminiRequestToXaiResponses: converts text parts to input_text blocks", () => {+ const req = {+ contents: [{ role: "user", parts: [{ text: "Hello" }] }],+ };+ const out = geminiRequestToXaiResponses(req, "grok-4");+ assert.equal(out.model, "grok-4");+ const item = out.input[0] as Record<string, unknown>;+ const content = item.content as Array<Record<string, unknown>>;+ assert.equal(content[0].type, "input_text");+ assert.equal(content[0].text, "Hello");+});++test("geminiRequestToXaiResponses: maps systemInstruction to instructions", () => {+ const req = {+ contents: [],+ systemInstruction: { parts: [{ text: "Be helpful" }] },+ };+ const out = geminiRequestToXaiResponses(req);+ assert.equal(out.instructions, "Be helpful");+});++test("geminiRequestToXaiResponses: converts functionDeclarations to xAI tools", () => {+ const req = {+ contents: [],+ tools: [+ {+ functionDeclarations: [+ {+ name: "search",+ description: "Search the web",+ parameters: { type: "object" },+ },+ ],+ },+ ],+ };+ const out = geminiRequestToXaiResponses(req);+ assert.ok(Array.isArray(out.tools));+ const tool = (out.tools as Array<Record<string, unknown>>)[0];+ assert.equal(tool.type, "function");+ const fn = tool.function as Record<string, unknown>;+ assert.equal(fn.name, "search");+});++test("geminiRequestToXaiResponses: maps thinkingBudget to reasoning.effort", () => {+ const req = {+ contents: [],+ generationConfig: { thinkingConfig: { thinkingBudget: 20000 } },+ };+ const out = geminiRequestToXaiResponses(req);+ assert.deepStrictEqual(out.reasoning, { effort: "high" });+});++test("geminiRequestToXaiResponses: converts model role to assistant", () => {+ const req = {+ contents: [{ role: "model", parts: [{ text: "Hi" }] }],+ };+ const out = geminiRequestToXaiResponses(req);+ const item = out.input[0] as Record<string, unknown>;+ assert.equal(item.role, "assistant");+});++// ─── xaiCompletedToGeminiJson ────────────────────────────────────────────────++test("xaiCompletedToGeminiJson: converts output_text to Gemini candidate text part", () => {+ const completed = {+ id: "r1",+ model: "grok-4",+ output: [+ {+ type: "message",+ content: [{ type: "output_text", text: "Hello Gemini!" }],+ },+ ],+ };+ const result = xaiCompletedToGeminiJson(completed) as Record<string, unknown>;+ const candidates = result.candidates as Array<Record<string, unknown>>;+ const content = candidates[0].content as Record<string, unknown>;+ const parts = content.parts as Array<Record<string, unknown>>;+ assert.equal(parts[0].text, "Hello Gemini!");+ assert.equal(candidates[0].finishReason, "STOP");+});++test("xaiCompletedToGeminiJson: converts function_call to functionCall part", () => {+ const completed = {+ id: "r2",+ model: "grok-4",+ output: [+ {+ type: "function_call",+ name: "lookup",+ arguments: '{"q":"test"}',+ },+ ],+ };+ const result = xaiCompletedToGeminiJson(completed) as Record<string, unknown>;+ const candidates = result.candidates as Array<Record<string, unknown>>;+ const content = candidates[0].content as Record<string, unknown>;+ const parts = content.parts as Array<Record<string, unknown>>;+ const fc = parts[0].functionCall as Record<string, unknown>;+ assert.equal(fc.name, "lookup");+ assert.deepStrictEqual(fc.args, { q: "test" });+});++test("xaiCompletedToGeminiJson: maps usage to usageMetadata", () => {+ const completed = {+ model: "grok-4",+ output: [],+ usage: { input_tokens: 10, output_tokens: 20 },+ };+ const result = xaiCompletedToGeminiJson(completed) as Record<string, unknown>;+ const meta = result.usageMetadata as Record<string, unknown>;+ assert.equal(meta.promptTokenCount, 10);+ assert.equal(meta.candidatesTokenCount, 20);+ assert.equal(meta.totalTokenCount, 30);+});