@wengine-ai/llms 2.3.2395 → 2.3.2396
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.
- package/README.md +2 -2
- package/dist/cjs/server.cjs +64 -64
- package/dist/cjs/server.cjs.map +4 -4
- package/dist/esm/server.mjs +65 -65
- package/dist/esm/server.mjs.map +4 -4
- package/dist/index.html +21 -21
- package/dist/transformer/opencode.transformer.d.ts +2 -0
- package/dist/transformer/response-body.d.ts +27 -0
- package/package.json +2 -2
|
@@ -19,6 +19,8 @@ import { Transformer, TransformerOptions } from "../types/transformer";
|
|
|
19
19
|
* versions stripped them on the assumption the backend ignored the field.
|
|
20
20
|
* - Cleans Anthropic-specific image_url media_type fields that GLM
|
|
21
21
|
* does not understand.
|
|
22
|
+
* - Replays Claude Code thinking blocks as reasoning_content (including the
|
|
23
|
+
* signature) so multi-turn thinking requests remain valid and cacheable.
|
|
22
24
|
* - Converts reasoning_content in streaming/non-streaming responses to the
|
|
23
25
|
* thinking format expected by Claude Code.
|
|
24
26
|
* - Replaces purely-numeric tool_call IDs with UUID-based IDs to avoid
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers for safely consuming upstream response bodies.
|
|
3
|
+
*
|
|
4
|
+
* Some providers (e.g. OpenRouter) occasionally return SSE comment lines
|
|
5
|
+
* (like ": OPENROUTER PROCESSING") or plain-text error payloads with an
|
|
6
|
+
* `application/json` Content-Type. A bare `response.json()` then throws an
|
|
7
|
+
* opaque SyntaxError ("Unexpected token ':' ... is not valid JSON") that
|
|
8
|
+
* gives no hint about what the upstream actually said. These helpers parse
|
|
9
|
+
* leniently and surface the raw body in the error instead.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Parse a Response body as JSON, tolerating leading/trailing whitespace and
|
|
13
|
+
* BOM. On failure, throw an Error whose message includes a truncated preview
|
|
14
|
+
* of the raw body so logs show what the upstream actually returned.
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseResponseJson(response: Response): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* Parse text as JSON after stripping BOM and surrounding whitespace
|
|
19
|
+
* (some providers pad JSON responses with whitespace keep-alives).
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseJsonText(text: string, status?: number): any;
|
|
22
|
+
/**
|
|
23
|
+
* Detect whether a response actually carries an SSE stream, regardless of
|
|
24
|
+
* what the client requested. Used to decide streaming vs JSON handling based
|
|
25
|
+
* on the upstream response rather than the request body.
|
|
26
|
+
*/
|
|
27
|
+
export declare function isEventStreamResponse(response: Response): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wengine-ai/llms",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2396",
|
|
4
4
|
"description": "A universal LLM API transformation server",
|
|
5
5
|
"main": "dist/cjs/server.cjs",
|
|
6
6
|
"module": "dist/esm/server.mjs",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"uuid": "^11.1.0",
|
|
53
53
|
"@fastify/multipart": "^9.0.0",
|
|
54
54
|
"@fastify/static": "^8.2.0",
|
|
55
|
-
"@wengine-ai/claude-code-router-shared": "^2.3.
|
|
55
|
+
"@wengine-ai/claude-code-router-shared": "^2.3.2396",
|
|
56
56
|
"adm-zip": "^0.5.16",
|
|
57
57
|
"better-sqlite3": "^12.10.0",
|
|
58
58
|
"rotating-file-stream": "^3.2.7"
|