@wengine-ai/llms 2.3.2405 → 2.3.2407
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 +172 -172
- package/dist/cjs/server.cjs.map +4 -4
- package/dist/clients/adapters.d.ts +1 -1
- package/dist/esm/server.mjs +171 -171
- package/dist/esm/server.mjs.map +4 -4
- package/dist/index.html +19 -19
- package/dist/transformer/defaultthinking.transformer.d.ts +38 -12
- package/dist/types/llm.d.ts +1 -1
- package/dist/utils/thinking.d.ts +22 -0
- package/dist/utils/zcode-session-project.d.ts +7 -0
- package/package.json +2 -2
|
@@ -1,7 +1,24 @@
|
|
|
1
|
-
import { UnifiedChatRequest } from "../types/llm";
|
|
1
|
+
import { UnifiedChatRequest, ThinkLevel } from "../types/llm";
|
|
2
2
|
import { Transformer, TransformerOptions } from "../types/transformer";
|
|
3
|
-
export type DefaultThinkingLevel = "none" | "low" | "medium" | "high";
|
|
3
|
+
export type DefaultThinkingLevel = "none" | "low" | "medium" | "high" | "max";
|
|
4
4
|
type EndpointKind = "anthropic" | "responses" | "chat";
|
|
5
|
+
/**
|
|
6
|
+
* Extra spellings of the standard levels, kept so configs written before the
|
|
7
|
+
* ladder grew a "max" tier (and provider docs that name their tiers
|
|
8
|
+
* differently) still resolve: GLM publishes minimal|light|low → low and
|
|
9
|
+
* xhigh|max|ultra → max.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ALIAS_LEVELS: Record<string, ThinkLevel>;
|
|
12
|
+
/**
|
|
13
|
+
* Parse the configured level. Accepted forms:
|
|
14
|
+
* - "none" | "low" | "medium" | "high" | "max" — the standard enum
|
|
15
|
+
* - a positive integer (or its decimal string form) — custom token budget
|
|
16
|
+
* - any other non-empty string — provider-specific level passed through
|
|
17
|
+
* verbatim (e.g. "off"); only meaningful on OpenAI-style endpoints, which
|
|
18
|
+
* accept free-form effort values
|
|
19
|
+
* Empty/unparsable input parses as undefined (no injection).
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseThinkingLevel(raw: unknown): DefaultThinkingLevel | number | string | undefined;
|
|
5
22
|
/**
|
|
6
23
|
* Resolve the provider's upstream endpoint kind from its base URL so the
|
|
7
24
|
* default thinking level can be expressed in the endpoint's native parameter.
|
|
@@ -17,18 +34,27 @@ export declare function sniffEndpointKind(baseUrl?: string): EndpointKind;
|
|
|
17
34
|
* directly as `["defaultthinking", { "level": "high" }]` in a transformer
|
|
18
35
|
* `use` list.
|
|
19
36
|
*
|
|
20
|
-
* The
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
37
|
+
* The value is one of "low" | "medium" | "high" | "max", a custom token budget
|
|
38
|
+
* (number or numeric string), or a provider-specific effort string passed
|
|
39
|
+
* through verbatim. Conversion per endpoint kind:
|
|
40
|
+
* - Anthropic /v1/messages: unified `reasoning` — levels ride the effort enum
|
|
41
|
+
* (`output_config.effort`, which is what current Anthropic models and
|
|
42
|
+
* Anthropic-compatible providers such as GLM actually read) with a matching
|
|
43
|
+
* thinking budget; a custom budget flows into `reasoning.max_tokens` (kept
|
|
44
|
+
* as the exact budget by convertToAnthropic, raised to Anthropic's 1024
|
|
45
|
+
* minimum); known aliases (min|minimal|light→low, xhigh|maximum|ultra→max)
|
|
46
|
+
* resolve to their level; any other string is skipped (no string form
|
|
47
|
+
* exists).
|
|
48
|
+
* - OpenAI /v1/responses: unified `reasoning` mapped to `reasoning.effort` —
|
|
49
|
+
* custom budgets collapse to the closest effort enum, free-form strings
|
|
50
|
+
* pass through.
|
|
51
|
+
* - OpenAI-compatible /v1/chat/completions: `reasoning_effort` — same enum
|
|
52
|
+
* mapping for budgets, verbatim passthrough for free-form strings.
|
|
27
53
|
*
|
|
28
54
|
* Client intent always wins: any defined `request.reasoning` — including an
|
|
29
|
-
* explicit disabled — skips injection entirely.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
55
|
+
* explicit disabled — skips injection entirely. "none" (or an unparsable
|
|
56
|
+
* value) is a no-op, so the field can stay set in config while effectively
|
|
57
|
+
* off.
|
|
32
58
|
*/
|
|
33
59
|
export declare class DefaultThinkingTransformer implements Transformer {
|
|
34
60
|
private readonly options?;
|
package/dist/types/llm.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export interface UnifiedTool {
|
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
export type ThinkLevel = "none" | "low" | "medium" | "high";
|
|
69
|
+
export type ThinkLevel = "none" | "low" | "medium" | "high" | "max";
|
|
70
70
|
export interface UnifiedChatRequest {
|
|
71
71
|
messages: UnifiedMessage[];
|
|
72
72
|
model: string;
|
package/dist/utils/thinking.d.ts
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
1
|
import { ThinkLevel } from "../types/llm";
|
|
2
2
|
export declare const getThinkLevel: (thinking_budget: number) => ThinkLevel;
|
|
3
3
|
export declare const getThinkBudget: (level: ThinkLevel) => number;
|
|
4
|
+
/**
|
|
5
|
+
* Effort values safe to send as an explicit Anthropic `output_config.effort`.
|
|
6
|
+
*
|
|
7
|
+
* "max" is deliberately absent: upstream it is model-gated (only the newest
|
|
8
|
+
* Opus exposes it), while the providers that do accept it — GLM and other
|
|
9
|
+
* Anthropic-compatible endpoints — already resolve a bare enabled thinking
|
|
10
|
+
* block to their own max tier. Sending it would risk a 400 without buying
|
|
11
|
+
* anything, so max rides on the thinking budget instead.
|
|
12
|
+
*/
|
|
13
|
+
export declare const ANTHROPIC_EFFORT_LEVELS: ThinkLevel[];
|
|
14
|
+
/**
|
|
15
|
+
* Alias table for effort values seen in the wild, normalized onto the unified
|
|
16
|
+
* ladder. Mirrors what Anthropic-compatible providers publish (GLM documents
|
|
17
|
+
* minimal|light|low → low, medium|high → high, xhigh|max|ultra → max).
|
|
18
|
+
*/
|
|
19
|
+
export declare const EFFORT_ALIASES: Record<string, ThinkLevel>;
|
|
20
|
+
/**
|
|
21
|
+
* Normalize a client- or config-supplied effort value onto the unified ladder.
|
|
22
|
+
* Unknown strings return undefined so callers can keep them verbatim on
|
|
23
|
+
* endpoints that accept free-form values (OpenAI-style `reasoning_effort`).
|
|
24
|
+
*/
|
|
25
|
+
export declare const normalizeEffort: (raw: unknown) => ThinkLevel | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the workspace a ZCode session ran in, as an absolute normalized path.
|
|
3
|
+
* Returns null — never throws — when ZCode is not installed, the store predates
|
|
4
|
+
* v2, or the session is unknown, leaving routing to fall back to the global
|
|
5
|
+
* Router.
|
|
6
|
+
*/
|
|
7
|
+
export declare function findZcodeWorkspacePath(sessionId: string): Promise<string | null>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wengine-ai/llms",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2407",
|
|
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.2407",
|
|
56
56
|
"adm-zip": "^0.5.16",
|
|
57
57
|
"better-sqlite3": "^12.10.0",
|
|
58
58
|
"rotating-file-stream": "^3.2.7"
|