@adia-ai/llm 0.8.4 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/CHANGELOG.md +10 -2
  2. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,9 +1,17 @@
1
1
  # Changelog
2
2
 
3
- ## [Unreleased]
3
+ ## [0.8.5] — 2026-07-17
4
+
5
+ ### Added
6
+ - **Gemini production passthrough** (`server.js`, operator ruling 2026-07-17): exe.dev's LLM gateway carries anthropic/openai/fireworks only, so an explicitly selected gemini model on `ui-kit.exe.xyz` had no server path. `server.js` gains a narrow gemini-only passthrough at `/api/llm/gemini/*` — forwards verbatim to `generativelanguage.googleapis.com` with the server-side `GEMINI_API_KEY` injected (the browser's sentinel header is discarded; path allowlisted, not an open proxy; SSE relayed with the same reader pattern as `handleChat`). `deploy/Caddyfile` + `infra/caddy/llm-gateway.snippet` route `/api/llm/gemini/*` to `server.js` ordered before the gateway handle.
7
+
8
+ ### Fixed
9
+ - **Gemini passthrough hardening per review**: per-IP sliding-window rate limit (30 req / 5 min, unbounded-map guarded) bounds worst-case quota burn under the same no-auth public-demo trust model as the existing `/api/chat` smart proxy; 1 MB body cap returns 413 while accumulating, not after; path allowlist tightened to real Gemini API prefixes (`/v1`, `/v1beta` — `/^\/v\d/` previously accepted arbitrary versions); client disconnect now aborts the upstream call via `AbortController` hooked to `req` close before the body read, combined with the existing 120s timeout via `AbortSignal.any` (previously attached post-fetch, SSE branch only, so a vanished client kept work alive until timeout).
10
+
11
+ ## [0.8.4] — 2026-07-16
4
12
 
5
13
  ### Fixed
6
- - **The model id decides the provider** (`createAdapter({ model })`): provider resolution was env-key detection only (or hardcoded `anthropic` on production browser hosts), so every non-default model was POSTed to the wrong provider's API and 404'd — only Claude models could generate in a browser. Precedence is now `opts.provider` → the model id (new export `detectProviderFromModel` in `adapters/index`) → `LLM_PROVIDER` env → env-key detection.
14
+ - **The model id decides the provider** (`src/llm-bridge.ts`, `src/adapters/index.ts` + built `llm-bridge.js`/`adapters/`): provider resolution was env-key detection only (or hardcoded `anthropic` on production browser hosts), so every non-default model was POSTed to the wrong provider's API and 404'd — only Claude models could generate in a browser. Precedence is now `opts.provider` → the model id (new export `detectProviderFromModel` in `adapters/index`) → `LLM_PROVIDER` env → env-key detection.
7
15
  - **Passthrough proxying preserves the upstream URL path + query**: `passthroughRequest` overwrote the whole URL with the static `proxyUrl`, dropping gemini's `models/<model>:<action>?alt=sse` routing — every gemini passthrough call hit the proxy root. The proxy prefix now joins `buildRequest()`'s own path/query; legacy full-path proxyUrls (`/api/llm/anthropic/v1/messages`) reduce to the identical final URL. `resolveBaseUrl` entries are provider prefixes (`gemini: /api/llm/gemini`; Vite gains the route, `google` kept as a legacy alias).
8
16
  - **`google` → `gemini` provider aliasing** (gh#268 L-1): `provider: 'google'` and `GOOGLE_API_KEY` auto-detection produced an always-throwing bridge (`Unknown provider "google"`); both canonicalize to the registry key `gemini` now. `GEMINI_API_KEY` is canonical.
9
17
  - **Gemini `stopReason` raw pass-through** (gh#268 L-2, invariant 1): `parseResponse`/`parseStream` forwarded a hardcoded `'end'`, hiding truncation from the downstream detector; `finishReason` (`MAX_TOKENS` / `SAFETY` / …) passes through raw, `'end'` only when absent.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adia-ai/llm",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
4
4
  "description": "Provider-agnostic LLM client \u2014 anthropic / openai / gemini adapters with a unified chat() + streamChat() facade. Used by AdiaUI's chat-shell and the A2UI generation pipeline; works in browser (with proxyUrl) and Node.",
5
5
  "type": "module",
6
6
  "exports": {