@wengine-ai/llms 2.3.2431 → 2.3.2433

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.
@@ -105,6 +105,14 @@ export interface ManagedProbeInput {
105
105
  /** Per-attempt config; the core sets `TIMEOUT` so a probe cannot outlive its budget. */
106
106
  config: any;
107
107
  }
108
+ /** Optional request identity for model-scoped subscription limits. */
109
+ export interface ManagedRequestContext {
110
+ model?: string;
111
+ provider?: LLMProvider;
112
+ /** Stable per-attempt identity owned by the core. Plugins may attach private
113
+ * state through a WeakMap without sharing credentials with the host. */
114
+ requestState?: object;
115
+ }
108
116
  /**
109
117
  * Managed-subscription semantics for one provider family. Everything the data
110
118
  * plane needs to talk to a subscription upstream without the core knowing it:
@@ -115,7 +123,10 @@ export interface ManagedRuntime {
115
123
  name: string;
116
124
  isManaged(provider: LLMProvider): boolean;
117
125
  /** Circuit breaker before any network touch (Gemini lesson: must run BEFORE token refresh). */
118
- ensureUsable?(): Promise<void>;
126
+ ensureUsable?(context?: ManagedRequestContext): Promise<void>;
127
+ /** Opt into independent recovery per model; a successful sibling probe
128
+ * must not recover a different quota pool. Omitted preserves account probes. */
129
+ modelScopedRecovery?: boolean;
119
130
  /** Lock the upstream: mutate config.url / redirect / dispatcher. Runs once per attempt. */
120
131
  lockUpstream?(config: any, provider: LLMProvider): Promise<void>;
121
132
  /**
@@ -139,7 +150,7 @@ export interface ManagedRuntime {
139
150
  */
140
151
  classifyError?(status: number, body: unknown, systemText: string): PluginClassifiedError | null;
141
152
  /** Persist a classified error (cooldown, lastError). Must never throw into the response path. */
142
- noteUpstreamError?(info: PluginClassifiedError): Promise<void>;
153
+ noteUpstreamError?(info: PluginClassifiedError, context?: ManagedRequestContext): Promise<void>;
143
154
  /**
144
155
  * Generic HTTP-200 hidden-error-envelope detector. When present, the core
145
156
  * runs it against every parsed JSON 200 body and throws through the shared
@@ -174,7 +185,7 @@ export interface ManagedRuntime {
174
185
  * every real request already performs — so plugins that only implement the
175
186
  * circuit breaker still work.
176
187
  */
177
- probeAccountState?(): Promise<ManagedProbeVerdict>;
188
+ probeAccountState?(context?: ManagedRequestContext): Promise<ManagedProbeVerdict>;
178
189
  /**
179
190
  * Optional runtime-owned liveness probe (level 2).
180
191
  *
@@ -32,4 +32,24 @@ export interface QuotaAdapter {
32
32
  * an unauthenticated NotLogined response is never mined for quota.
33
33
  */
34
34
  export declare function parseAliyunTokenPlanUsage(payload: any): ProviderQuotaResult | null;
35
+ /**
36
+ * Volcengine OpenAPI V4-variant request signing. This is NOT standard AWS
37
+ * SigV4: the algorithm tag is "HMAC-SHA256" (no AWS4 prefix), the credential
38
+ * scope terminates with "request" (not "aws4_request"), kDate is
39
+ * HMAC(secretKey, YYYYMMDD) with no prefix on the secret, and SignedHeaders
40
+ * uses the fixed order host;x-date;x-content-sha256;content-type (the order
41
+ * only needs to be self-consistent between CanonicalHeaders and SignedHeaders).
42
+ * Returns the headers the caller must attach to the request.
43
+ */
44
+ export declare function volcengineSigV4Sign(options: {
45
+ accessKey: string;
46
+ secretKey: string;
47
+ method: string;
48
+ url: URL;
49
+ body: string;
50
+ region: string;
51
+ service: string;
52
+ /** UTC timestamp in YYYYMMDDTHHMMSSZ format (the X-Date header value) */
53
+ xDate: string;
54
+ }): Record<string, string>;
35
55
  export declare function getQuotaAdapter(baseUrl: string): QuotaAdapter | null;
@@ -181,6 +181,12 @@ export interface LLMProvider {
181
181
  * back to the legacy cs-data.qianwenai.com endpoint on failure.
182
182
  */
183
183
  quotaSecToken?: string;
184
+ /** Optional Volcengine account Access Key ID for the Ark Coding Plan usage
185
+ * OpenAPI (control plane, AK/SK auth only — the inference apiKey cannot query it) */
186
+ quotaAccessKey?: string;
187
+ /** Optional Volcengine account Secret Access Key paired with quotaAccessKey.
188
+ * Never projected into desktop DTOs, logs, or error messages. */
189
+ quotaSecretKey?: string;
184
190
  transformer?: {
185
191
  [key: string]: {
186
192
  use?: Transformer[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wengine-ai/llms",
3
- "version": "2.3.2431",
3
+ "version": "2.3.2433",
4
4
  "description": "A universal LLM API transformation server",
5
5
  "main": "dist/cjs/server.cjs",
6
6
  "module": "dist/esm/server.mjs",
@@ -53,7 +53,7 @@
53
53
  "@fastify/static": "^8.2.0",
54
54
  "@google/genai": "^1.7.0",
55
55
  "@huggingface/tokenizers": "^0.0.6",
56
- "@wengine-ai/claude-code-router-shared": "^2.3.2431",
56
+ "@wengine-ai/claude-code-router-shared": "^2.3.2433",
57
57
  "adm-zip": "^0.5.16",
58
58
  "better-sqlite3": "^12.10.0",
59
59
  "dotenv": "^16.5.0",