@wengine-ai/llms 2.3.2431 → 2.3.2432

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
  *
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.2432",
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.2432",
57
57
  "adm-zip": "^0.5.16",
58
58
  "better-sqlite3": "^12.10.0",
59
59
  "dotenv": "^16.5.0",