llm-relay 0.77.0 → 0.78.0
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/dist/accounting-store-schema.js +5 -6
- package/dist/accounting-store-schema.js.map +1 -1
- package/dist/accounting-store.d.ts +10 -0
- package/dist/accounting-store.js +60 -6
- package/dist/accounting-store.js.map +1 -1
- package/dist/backend/envelope-validator.d.ts +1 -1
- package/dist/backend/envelope-validator.js +89 -52
- package/dist/backend/envelope-validator.js.map +1 -1
- package/dist/backend/health-prober.js +3 -1
- package/dist/backend/health-prober.js.map +1 -1
- package/dist/backend.d.ts +48 -0
- package/dist/backend.js +831 -7
- package/dist/backend.js.map +1 -1
- package/dist/candidate-runner.d.ts +135 -50
- package/dist/candidate-runner.js +160 -55
- package/dist/candidate-runner.js.map +1 -1
- package/dist/cli.d.ts +24 -2
- package/dist/cli.js +122 -20
- package/dist/cli.js.map +1 -1
- package/dist/config/routing-parser.d.ts +13 -8
- package/dist/config/routing-parser.js +369 -183
- package/dist/config/routing-parser.js.map +1 -1
- package/dist/config-types.d.ts +202 -0
- package/dist/config-types.js +2 -0
- package/dist/config-types.js.map +1 -1
- package/dist/config.d.ts +45 -1
- package/dist/config.js +87 -22
- package/dist/config.js.map +1 -1
- package/dist/dashboard-contract.d.ts +38 -0
- package/dist/dashboard-contract.js +19 -3
- package/dist/dashboard-contract.js.map +1 -1
- package/dist/dispatch-lane-stats.d.ts +33 -4
- package/dist/dispatch-lane-stats.js +65 -16
- package/dist/dispatch-lane-stats.js.map +1 -1
- package/dist/dispatch.d.ts +9 -0
- package/dist/dispatch.js +36 -4
- package/dist/dispatch.js.map +1 -1
- package/dist/key-checker.d.ts +21 -1
- package/dist/key-checker.js +38 -12
- package/dist/key-checker.js.map +1 -1
- package/dist/lane-affinity.d.ts +94 -1
- package/dist/lane-affinity.js +52 -4
- package/dist/lane-affinity.js.map +1 -1
- package/dist/mcp/lane-runner.d.ts +69 -16
- package/dist/mcp/lane-runner.js +30 -1
- package/dist/mcp/lane-runner.js.map +1 -1
- package/dist/mcp/server.d.ts +39 -4
- package/dist/mcp/server.js +70 -13
- package/dist/mcp/server.js.map +1 -1
- package/dist/openai-request.d.ts +21 -0
- package/dist/openai-request.js +1 -1
- package/dist/openai-request.js.map +1 -1
- package/dist/ping/cadence.js +9 -1
- package/dist/ping/cadence.js.map +1 -1
- package/dist/ping/probe-cache.d.ts +13 -0
- package/dist/ping/probe-cache.js +12 -0
- package/dist/ping/probe-cache.js.map +1 -1
- package/dist/responses-request.d.ts +20 -0
- package/dist/responses-request.js +7 -7
- package/dist/responses-request.js.map +1 -1
- package/dist/routes/admin.d.ts +8 -1
- package/dist/routes/admin.js +42 -6
- package/dist/routes/admin.js.map +1 -1
- package/dist/routes/messages.d.ts +1 -0
- package/dist/routes/messages.js +13 -8
- package/dist/routes/messages.js.map +1 -1
- package/dist/routes/openai-front.js +20 -7
- package/dist/routes/openai-front.js.map +1 -1
- package/dist/server.d.ts +9 -1
- package/dist/server.js +21 -3
- package/dist/server.js.map +1 -1
- package/dist/setup-claude.d.ts +2 -2
- package/dist/setup-claude.js +9 -7
- package/dist/setup-claude.js.map +1 -1
- package/dist/stream-pipeline.d.ts +116 -0
- package/dist/stream-pipeline.js +151 -0
- package/dist/stream-pipeline.js.map +1 -1
- package/dist/target-facts.d.ts +5 -4
- package/dist/target-facts.js +5 -0
- package/dist/target-facts.js.map +1 -1
- package/dist/telemetry.d.ts +15 -2
- package/dist/telemetry.js +4 -1
- package/dist/telemetry.js.map +1 -1
- package/dist/tier-data.d.ts +22 -0
- package/dist/tier-data.js +12 -2
- package/dist/tier-data.js.map +1 -1
- package/package.json +2 -1
- package/skills/llm-relay/SKILL.md +8 -3
- package/skills/llm-relay/references/dispatch-lanes.md +2 -1
- package/skills/llm-relay/references/operations.md +1 -1
package/dist/backend.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import type { ResolvedAttempt } from "./resolved-attempt.js";
|
|
|
11
11
|
import { type DialectRefusalSignal } from "./tool-dialects.js";
|
|
12
12
|
import { type RecoveredOpenAiChatProcessor } from "./openai-dialect.js";
|
|
13
13
|
import { type UsageAccumulator } from "./usage-observer.js";
|
|
14
|
+
import type { ThoughtSignatureMode, ToolCallIdMode } from "./config-types.js";
|
|
14
15
|
/**
|
|
15
16
|
* A tool-call envelope was present in the response text but could not be parsed — truncated, or a
|
|
16
17
|
* dialect variant we do not model. Distinct from a mapper defect: the relay's translation is fine,
|
|
@@ -137,6 +138,21 @@ export declare const QUOTA_DEMOTED_HEADER = "x-llm-relay-quota-demoted";
|
|
|
137
138
|
* Nothing secret, no credential values.
|
|
138
139
|
*/
|
|
139
140
|
export declare const LATENCY_DEMOTED_HEADER = "x-llm-relay-latency-demoted";
|
|
141
|
+
/**
|
|
142
|
+
* The serving candidate was placed by the PROBATION band: a free deployment with fewer than
|
|
143
|
+
* `minSamples` served-request samples that the relay deliberately put first to gather data on
|
|
144
|
+
* it (`routing.probation`, default ON).
|
|
145
|
+
*
|
|
146
|
+
* Fourth member of the `DEGRADED_HEADER` family, and it exists for the same reason: an
|
|
147
|
+
* automatic reorder is acceptable only because it is announced. Unlike its three siblings it
|
|
148
|
+
* does not state that the first choice was displaced — the probation member usually IS the
|
|
149
|
+
* first choice — but that the answer came from a deployment with almost no served-traffic
|
|
150
|
+
* evidence behind it.
|
|
151
|
+
*
|
|
152
|
+
* Value is one bounded line, e.g. `opencode/muse-spark-1.3-contributor-free (0 of 5 request
|
|
153
|
+
* samples)` — the spec and the sample count behind the banding. Nothing secret.
|
|
154
|
+
*/
|
|
155
|
+
export declare const PROBATION_HEADER = "x-llm-relay-probation";
|
|
140
156
|
/**
|
|
141
157
|
* A HEDGE ran: a slow in-flight attempt had the next candidate started beside it, rather than
|
|
142
158
|
* after it. Fourth member of the `DEGRADED_HEADER` family, and the announcement half of the
|
|
@@ -287,6 +303,26 @@ export interface FetchBackendArgs {
|
|
|
287
303
|
signal: AbortSignal;
|
|
288
304
|
onEgress?: OnEgress;
|
|
289
305
|
}
|
|
306
|
+
export interface AnthropicToOpenAiResponsesOptions {
|
|
307
|
+
/** The resolved deployment's model id. Absent => no `model` key, same convention as `openai-request.ts`. */
|
|
308
|
+
model?: string | undefined;
|
|
309
|
+
/** Whether THIS hop streams — a relay decision, not the caller's. Falls back to the body. */
|
|
310
|
+
stream?: boolean | undefined;
|
|
311
|
+
/** Same resolved mode `anthropicRequestToOpenAi` receives; see that module for the provenance. */
|
|
312
|
+
toolCallIds?: ToolCallIdMode | undefined;
|
|
313
|
+
onToolCallIdsRewritten?: ((count: number) => void) | undefined;
|
|
314
|
+
thoughtSignature?: ThoughtSignatureMode | undefined;
|
|
315
|
+
onThoughtSignatureSentinels?: ((count: number) => void) | undefined;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Translate one Anthropic Messages request body into an OpenAI Responses request body.
|
|
319
|
+
*
|
|
320
|
+
* Item order is preserved exactly. Unknown top-level fields are not forwarded — a translation
|
|
321
|
+
* between two contracts, not a passthrough, the same rule `anthropicRequestToOpenAi` states.
|
|
322
|
+
*
|
|
323
|
+
* @throws {RequestMappingError} for a block or declaration that cannot be represented.
|
|
324
|
+
*/
|
|
325
|
+
export declare function anthropicRequestToOpenAiResponses(reqJson: unknown, opts?: AnthropicToOpenAiResponsesOptions): Record<string, unknown>;
|
|
290
326
|
/**
|
|
291
327
|
* Perform one upstream inference call against the resolved attempt.
|
|
292
328
|
*
|
|
@@ -363,6 +399,18 @@ export interface FetchOpenAiFrontArgs {
|
|
|
363
399
|
processRecoveredChat?: RecoveredOpenAiChatProcessor;
|
|
364
400
|
usage?: UsageAccumulator;
|
|
365
401
|
onEgress?: OnEgress;
|
|
402
|
+
/**
|
|
403
|
+
* Catalog max-output lookup for the Responses front's `anthropic`-kind fallback (2026-09-09).
|
|
404
|
+
* Anthropic's Messages API REQUIRES `max_tokens`, and `openaiResponsesRequestToAnthropic` no
|
|
405
|
+
* longer invents a value when the caller stated none (see that module's header) — so a
|
|
406
|
+
* passthrough target still needs one resolved, and the catalog's published figure is the
|
|
407
|
+
* second-strongest evidence after the deployment's own learned `max-output` fact. Optional:
|
|
408
|
+
* absent (or a provider/model the catalog holds nothing for) falls straight through to
|
|
409
|
+
* `DEFAULT_RESPONSES_MAX_TOKENS`.
|
|
410
|
+
*/
|
|
411
|
+
catalogLimits?: (provider: string, model: string) => {
|
|
412
|
+
maxOutputTokens: number | null;
|
|
413
|
+
} | null | undefined;
|
|
366
414
|
}
|
|
367
415
|
/**
|
|
368
416
|
* OpenAI-compatible FRONT: an OpenAI Chat Completions or Responses request comes in, its
|