vern-llm 3.0.0 → 3.1.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.
@@ -1,10 +1,13 @@
1
- //#region src/types/errors.d.ts
2
1
  type LLMErrorType = 'timeout' | 'api' | 'network' | 'parse' | 'validation' | 'invalid_params' | 'rate_limited' | 'quota_exceeded' | 'circuit_open' | 'fallback_exhausted' | 'aborted' | 'unknown';
3
2
  /**
4
3
  * Machine readable detail within a `type`, for when `type` alone is too coarse to act on. Optional:
5
4
  * errors from before a code existed omit it.
6
5
  */
7
- type LLMErrorCode = 'unknown_tool' | 'duplicate_tool_call_id' | 'tool_choice_none_violated' | 'unexpected_tool_calls' | 'unsupported_capability' | 'duplicate_tool_names' | 'unknown_tool_choice' | 'duplicate_tool_result_ids' | 'unknown_tool_result_ids' | 'missing_tool_results' | 'invalid_context' | 'unknown_target' | 'no_eligible_targets' | 'middleware_threw' | 'rate_limit_queue_full' | 'rate_limit_queue_timeout' | 'rate_limit_capacity_exceeded' | 'provider_rate_limited' | 'retry_budget_exhausted' | 'request_timeout' | 'idle_timeout' | 'reader_stall_timeout' | 'middleware_timeout' | 'deadline_exceeded' | 'authentication' | 'authorization' | 'not_found' | 'payload_too_large' | 'server_error' | 'empty_response' | 'connection_failed' | 'circuit_cooling_down' | 'circuit_trial_in_flight' | 'fallback_exhausted' | 'tool_arguments_parse_failed' | 'stream_frame_invalid' | 'response_truncated' | 'soft_failure_detected';
6
+ type LLMErrorCode = 'unknown_tool' | 'duplicate_tool_call_id' | 'tool_choice_none_violated' | 'unexpected_tool_calls' | 'unsupported_capability' | 'duplicate_tool_names' | 'unknown_tool_choice' | 'duplicate_tool_result_ids' | 'unknown_tool_result_ids' | 'missing_tool_results' | 'invalid_context' | 'unknown_target' | 'no_eligible_targets' | 'middleware_threw' | 'policy_denied' |
7
+ /** A middleware refused the call, or the answer it got, because of its content. Not retried, no fallback. */
8
+ 'content_blocked' |
9
+ /** The provider declined the call with no content. Not retried, no fallback by default. */
10
+ 'model_refused' | 'budget_exceeded' | 'rate_limit_queue_full' | 'rate_limit_queue_timeout' | 'rate_limit_capacity_exceeded' | 'provider_rate_limited' | 'retry_budget_exhausted' | 'request_timeout' | 'idle_timeout' | 'reader_stall_timeout' | 'middleware_timeout' | 'deadline_exceeded' | 'authentication' | 'authorization' | 'not_found' | 'payload_too_large' | 'server_error' | 'empty_response' | 'connection_failed' | 'circuit_cooling_down' | 'circuit_trial_in_flight' | 'fallback_exhausted' | 'tool_arguments_parse_failed' | 'stream_frame_invalid' | 'response_truncated' | 'soft_failure_detected';
8
11
  /** One tool call's contract failure, used to report every bad call in a response at once. */
9
12
  interface ToolIssue {
10
13
  name: string;
@@ -148,8 +151,6 @@ declare function hasIssues<C extends keyof LLMErrorIssuesByCode>(err: LLMError,
148
151
  code: C;
149
152
  issues: LLMErrorIssuesByCode[C];
150
153
  };
151
- //#endregion
152
- //#region src/logger.d.ts
153
154
  interface Logger {
154
155
  debug(message: string): void;
155
156
  warn(message: string): void;
@@ -166,8 +167,6 @@ declare class ConsoleLogger implements Logger {
166
167
  warn(message: string): void;
167
168
  error(message: string, meta?: Record<string, unknown>): void;
168
169
  }
169
- //#endregion
170
- //#region src/types/usage.d.ts
171
170
  type ReserveUsage = (params: {
172
171
  coalesced: boolean;
173
172
  signal?: AbortSignal;
@@ -210,6 +209,12 @@ interface TokenUsage {
210
209
  cacheWriteTokens?: number;
211
210
  /** `cacheWriteTokens` by the provider's TTL label. `undefined` when not split. */
212
211
  cacheWriteTokensByTtl?: Readonly<Record<string, number>>;
212
+ /**
213
+ * What the provider says this call cost, in USD, when its response carries it (OpenRouter's
214
+ * `usage.cost`, or a `fromFetch` mapper's `costUsd`). `undefined` when it doesn't. It is the
215
+ * provider's own figure, so it wins over any price you compute from the token counts.
216
+ */
217
+ costUsd?: number;
213
218
  requestId: string;
214
219
  model: string;
215
220
  /**
@@ -231,8 +236,6 @@ type OnUsage = (usage: TokenUsage) => void;
231
236
  * transport failures, which have no usage to report.
232
237
  */
233
238
  type OnUsageFailure = (usage: TokenUsage, error: LLMError) => void;
234
- //#endregion
235
- //#region src/types/events.d.ts
236
239
  /**
237
240
  * Reports what happened during a call. Fire and forget, mirroring
238
241
  * `onUsage`: the return value is never read and a throwing handler cannot
@@ -251,6 +254,8 @@ type VernLLMEvent = {
251
254
  retryAfterHonored: boolean;
252
255
  error: LLMError;
253
256
  context?: CallContext;
257
+ /** Absent for the main chain, 1 and up for chains started with `next.again()`. */
258
+ chain?: number;
254
259
  } | {
255
260
  kind: 'circuit_state';
256
261
  provider: string;
@@ -263,6 +268,8 @@ type VernLLMEvent = {
263
268
  to: CircuitState;
264
269
  consecutiveFailures: number;
265
270
  context?: CallContext;
271
+ /** Absent for the main chain, 1 and up for chains started with `next.again()`. */
272
+ chain?: number;
266
273
  } | {
267
274
  kind: 'fallback';
268
275
  requestId: string;
@@ -278,6 +285,8 @@ type VernLLMEvent = {
278
285
  /** Time spent on `from`, including its own retries, before giving up. */
279
286
  elapsedMs: number;
280
287
  context?: CallContext;
288
+ /** Absent for the main chain, 1 and up for chains started with `next.again()`. */
289
+ chain?: number;
281
290
  } | {
282
291
  kind: 'rate_limited';
283
292
  requestId: string;
@@ -289,6 +298,8 @@ type VernLLMEvent = {
289
298
  /** Which configured bucket was blocking this attempt just before it cleared. */
290
299
  reason: 'concurrency' | 'rpm' | 'tpm';
291
300
  context?: CallContext;
301
+ /** Absent for the main chain, 1 and up for chains started with `next.again()`. */
302
+ chain?: number;
292
303
  } | {
293
304
  kind: 'middleware';
294
305
  requestId: string;
@@ -298,6 +309,8 @@ type VernLLMEvent = {
298
309
  /** For `hook: 'transform'` only: which top-level fields the merged patch touched. */
299
310
  patchedFields?: string[];
300
311
  context?: CallContext;
312
+ /** Absent for the main chain, 1 and up for chains started with `next.again()`. */
313
+ chain?: number;
301
314
  } | {
302
315
  /**
303
316
  * Reported once a call fully succeeds. Same data `VernLLMOptions.onUsage`
@@ -308,6 +321,8 @@ type VernLLMEvent = {
308
321
  requestId: string;
309
322
  usage: TokenUsage;
310
323
  context?: CallContext;
324
+ /** Absent for the main chain, 1 and up for chains started with `next.again()`. */
325
+ chain?: number;
311
326
  } | {
312
327
  /**
313
328
  * A response carried usage and post-processing then failed. Once per such attempt;
@@ -318,6 +333,8 @@ type VernLLMEvent = {
318
333
  usage: TokenUsage;
319
334
  error: LLMError;
320
335
  context?: CallContext;
336
+ /** Absent for the main chain, 1 and up for chains started with `next.again()`. */
337
+ chain?: number;
321
338
  } | {
322
339
  /** Reported by a middleware through `ctx.emit`. */
323
340
  kind: 'custom';
@@ -328,10 +345,10 @@ type VernLLMEvent = {
328
345
  source: string;
329
346
  data?: JsonValue;
330
347
  context?: CallContext;
348
+ /** Absent for the main chain, 1 and up for chains started with `next.again()`. */
349
+ chain?: number;
331
350
  };
332
351
  type OnEvent = (event: VernLLMEvent) => void;
333
- //#endregion
334
- //#region src/types/middleware.d.ts
335
352
  /** Capabilities of the target a middleware hook is currently looking at. */
336
353
  interface MiddlewareCapabilities {
337
354
  /**
@@ -422,6 +439,14 @@ interface MiddlewareContextBase {
422
439
  emit(name: string, data?: JsonValue): void;
423
440
  /** The call's `context`, frozen. `undefined` when none was given. */
424
441
  context: CallContext | undefined;
442
+ /** Whether the call asked for a stream. */
443
+ streaming?: boolean;
444
+ /** The call's own `targets`, when it passed one. The order a caller chose by hand. */
445
+ callTargets?: readonly string[];
446
+ /** When the call's `deadlineMs` runs out, as epoch milliseconds. Absent without a deadline. */
447
+ deadlineAt?: number;
448
+ /** Absent for the main chain, 1 and up for chains started with `next.again()`. */
449
+ chain?: number;
425
450
  }
426
451
  /**
427
452
  * The `ctx` for `transform` and every attempt scoped event. Built once a target is selected, so
@@ -518,12 +543,35 @@ interface WireCallRequestPatch {
518
543
  addTools?: WireTool[];
519
544
  }
520
545
  /**
521
- * The settled outcome of one logical call, from `wrap`'s `next()`. `meta` is `undefined` only on a
522
- * cache hit.
546
+ * The settled outcome of one logical call, from `wrap`'s `next()`. `meta` is `undefined` on a
547
+ * cache hit, and on a streamed `cachedCall` join, which returns before the shared call has answered.
523
548
  */
524
549
  interface CallResult<T = unknown> {
525
550
  value: T;
526
551
  meta?: CallMeta;
552
+ /**
553
+ * Set only by `cachedCall()` when no call of its own ran: `'hit'` served a stored value,
554
+ * `'join'` shared another caller's in flight call. Unlike `meta` it is known when `next()`
555
+ * returns, for streams too.
556
+ */
557
+ cache?: 'hit' | 'join';
558
+ }
559
+ /** Options for `wrap`'s `next()` and `next.again()`. */
560
+ interface WrapNextOptions {
561
+ /** Reorders or drops targets by name, never adds one. */
562
+ targets?: readonly string[];
563
+ }
564
+ /** `wrap`'s `next`. Calling it runs everything inside this `wrap` once; later calls return the same result. */
565
+ interface WrapNext {
566
+ (options?: WrapNextOptions): Promise<CallResult>;
567
+ /**
568
+ * Runs everything inside this `wrap` again as a separate chain, at the same time as other chains
569
+ * or after them. Set only for entries with `reruns: true`, and not after 4 per call. Inside
570
+ * `cachedCall()` it's a fresh call for this caller: no cache read or joining, and its answer is
571
+ * cached. Return a chain's result unchanged: when the `wrap` settles, every chain whose result it
572
+ * didn't return is cancelled.
573
+ */
574
+ readonly again?: (options?: WrapNextOptions) => Promise<CallResult>;
527
575
  }
528
576
  /**
529
577
  * One entry in `VernLLMOptions.middleware`. Every hook is optional. See the middleware docs for how
@@ -570,9 +618,12 @@ interface VernLLMMiddleware {
570
618
  * primary and the order so far (`ctx.targets`); read `next()`'s `CallResult.meta` for what
571
619
  * happened. `next({ targets })` reorders or drops targets by name, never adds one.
572
620
  */
573
- wrap?: (request: Readonly<WireCallRequest>, next: (options?: {
574
- targets?: readonly string[];
575
- }) => Promise<CallResult>, ctx: PreDispatchContext) => Promise<CallResult>;
621
+ wrap?: (request: Readonly<WireCallRequest>, next: WrapNext, ctx: PreDispatchContext) => Promise<CallResult>;
622
+ /**
623
+ * Gives this entry's `wrap` `next.again()`, and cancels every chain it starts but doesn't return,
624
+ * when it settles. Off by default; entries without it run exactly as before.
625
+ */
626
+ reruns?: boolean;
576
627
  /**
577
628
  * Wraps one attempt's provider request, after the limiter and every `transform`. `request` is
578
629
  * exactly what the adapter gets. Runs per attempt, nested in `wrap` order.
@@ -586,8 +637,6 @@ interface VernLLMMiddleware {
586
637
  /** Observes the same events reported on `VernLLMOptions.onEvent`, filtered by this middleware's own `enabled`. Called from both stages; narrow on `ctx.stage` before reading stage-specific fields. */
587
638
  onEvent?: (event: VernLLMEvent, ctx: MiddlewareContext) => void;
588
639
  }
589
- //#endregion
590
- //#region src/circuitBreaker.d.ts
591
640
  /** The call this mutation happened as part of, forwarded to `onStateChange` untouched. */
592
641
  interface CircuitBreakerCallContext {
593
642
  requestId: string;
@@ -804,54 +853,14 @@ declare class CircuitBreaker implements CircuitBreakerAdapter {
804
853
  /** Once every admitted trial has reported in, closes or reopens based on `halfOpenSuccessRatio`. */
805
854
  private settleTrialIfComplete;
806
855
  }
807
- //#endregion
808
- //#region src/internal/retryBudget.d.ts
809
- /**
810
- * `windowMs` and `minCalls` work as in `RollingTripping`: `minCalls` keeps a cold start from
811
- * tripping. `retryRatio` is the largest share of calls in the window that may be retries. Invalid
812
- * values throw `RangeError` at construction.
813
- */
814
- interface RetryBudgetOptions {
815
- windowMs: number;
816
- minCalls: number;
817
- retryRatio: number;
818
- }
819
- /**
820
- * Caps the share of a target's recent traffic that may be retries. The breaker asks whether the
821
- * provider is healthy; this asks whether retrying is still worth the capacity it costs.
822
- */
823
- declare class RetryBudget {
824
- private readonly options;
825
- private readonly ratio;
826
- constructor(options: RetryBudgetOptions);
827
- /**
828
- * Throws `LLMError('retry_budget_exhausted')` once at least `minCalls`
829
- * calls have landed in the trailing `windowMs` and the retry ratio
830
- * among them has reached `retryRatio`. A no-op otherwise.
831
- */
832
- assertAvailable(): void;
833
- /** Records one attempt. `isRetry` is false for a call's first attempt, true for every attempt after it. */
834
- recordAttempt(isRetry: boolean): void;
835
- /** Current traffic and retry ratio in the trailing window. */
836
- getSnapshot(): {
837
- attempts: number;
838
- retryRatio: number;
839
- };
840
- }
841
- //#endregion
842
- //#region src/internal/utils/circuit-breaker/circuitBreakerAdapter.utils.d.ts
843
856
  /** The `circuitBreaker` option union, shared by `VernLLMOptions` and `buildCircuitBreaker`. */
844
857
  type CircuitBreakerOption = boolean | CircuitBreakerOptions | CircuitBreakerAdapter;
845
- //#endregion
846
- //#region src/internal/utils/rate-limit/rateLimitHint.utils.d.ts
847
858
  /** A normalized read of a provider's rate limit headers. */
848
859
  interface ProviderRateLimitHint {
849
860
  remainingRequests?: number;
850
861
  limitRequests?: number;
851
862
  resetAfterMs?: number;
852
863
  }
853
- //#endregion
854
- //#region src/rateLimit.d.ts
855
864
  /** The request shape sent to `LLMClient['chat']['completions']['create']`, used for token estimation. */
856
865
  type WireRequest = Parameters<LLMClient['chat']['completions']['create']>[0];
857
866
  /** Which configured bucket is currently blocking a call. */
@@ -1019,12 +1028,63 @@ declare class RateLimiter implements RateLimiterAdapter {
1019
1028
  */
1020
1029
  getState(): RateLimitState;
1021
1030
  }
1022
- //#endregion
1023
- //#region src/internal/utils/rate-limit/rateLimitAdapter.utils.d.ts
1024
1031
  /** Not exported. Internal shorthand only, so this union isn't duplicated between the public option fields and `buildRateLimit`'s own signature. */
1025
1032
  type RateLimitOption = RateLimitOptions | RateLimiterAdapter;
1026
- //#endregion
1027
- //#region src/types/fallback.d.ts
1033
+ /**
1034
+ * `windowMs` and `minCalls` work as in `RollingTripping`: `minCalls` keeps a cold start from
1035
+ * tripping. `retryRatio` is the largest share of calls in the window that may be retries. Invalid
1036
+ * values throw `RangeError` at construction.
1037
+ */
1038
+ interface RetryBudgetOptions {
1039
+ windowMs: number;
1040
+ minCalls: number;
1041
+ retryRatio: number;
1042
+ }
1043
+ /** Traffic and retry ratio in a budget's trailing window. */
1044
+ interface RetryBudgetSnapshot {
1045
+ attempts: number;
1046
+ retryRatio: number;
1047
+ }
1048
+ /**
1049
+ * What `retryBudget` accepts in place of options, e.g. a budget shared across processes. Both
1050
+ * required methods run on the call path and are synchronous: keep remote state in a local copy.
1051
+ */
1052
+ interface RetryBudgetAdapter {
1053
+ /**
1054
+ * Throws an `LLMError` when no retry may run, normally `type: 'rate_limited'` with
1055
+ * `code: 'retry_budget_exhausted'`. Anything else it throws is logged and the retry goes ahead.
1056
+ */
1057
+ assertAvailable(): void;
1058
+ /** `isRetry` is false for a call's first attempt. Fire and forget: a returned rejection is logged. */
1059
+ recordAttempt(isRetry: boolean): void;
1060
+ /** Read by `VernLLM.getRetryBudgetState()`. */
1061
+ getSnapshot?(): RetryBudgetSnapshot;
1062
+ /** Live counterpart of `getSnapshot`, read by `VernLLM.readRetryBudgetState()`. */
1063
+ readState?(): Promise<RetryBudgetSnapshot>;
1064
+ /** Receives the instance's `Logger` once, when `VernLLM` wires this adapter in. */
1065
+ setLogger?(logger: Logger): void;
1066
+ }
1067
+ /**
1068
+ * Caps the share of a target's recent traffic that may be retries. The breaker asks whether the
1069
+ * provider is healthy; this asks whether retrying is still worth the capacity it costs.
1070
+ */
1071
+ declare class RetryBudget implements RetryBudgetAdapter {
1072
+ private readonly options;
1073
+ private readonly ratio;
1074
+ constructor(options: RetryBudgetOptions);
1075
+ /**
1076
+ * Throws `LLMError('retry_budget_exhausted')` once at least `minCalls`
1077
+ * calls have landed in the trailing `windowMs` and the retry ratio
1078
+ * among them has reached `retryRatio`. A no-op otherwise.
1079
+ */
1080
+ assertAvailable(): void;
1081
+ /** Records one attempt. `isRetry` is false for a call's first attempt, true for every attempt after it. */
1082
+ recordAttempt(isRetry: boolean): void;
1083
+ /** Current traffic and retry ratio in the trailing window. */
1084
+ getSnapshot(): RetryBudgetSnapshot;
1085
+ }
1086
+ /** What `retryBudget` accepts: options for the built in budget, or an adapter. */
1087
+ type RetryBudgetOption = RetryBudgetOptions | RetryBudgetAdapter;
1028
1088
  /**
1029
1089
  * A provider tried after the primary fails, in the order given. Omitted overrides fall back to the
1030
1090
  * instance's options, except `circuitBreaker`, `rateLimit` and `retryBudget`, which are never
@@ -1051,7 +1111,7 @@ interface FallbackTarget {
1051
1111
  /** This target's own rate limiter, independent of every other target's. Not inherited from the parent's `rateLimit`. */
1052
1112
  rateLimit?: RateLimitOption;
1053
1113
  /** This target's own retry budget, independent of every other target's. Not inherited from the parent's `retryBudget`. */
1054
- retryBudget?: RetryBudgetOptions;
1114
+ retryBudget?: RetryBudgetOption;
1055
1115
  /**
1056
1116
  * Reclassifies a successful result from this target as a failure. Inherits the instance's
1057
1117
  * `detectSoftFailure` when omitted.
@@ -1063,6 +1123,11 @@ interface FallbackTarget {
1063
1123
  * who wants provider identity on the same line as the result doesn't need
1064
1124
  * to read it back out of `onUsage`.
1065
1125
  */
1126
+ /**
1127
+ * Why the answering target stopped. Adapters map their provider's reason onto these. `'other'`
1128
+ * is any reason with no match here.
1129
+ */
1130
+ type FinishReason = 'stop' | 'length' | 'tool_calls' | 'refusal' | 'guardrail' | 'content_filter' | 'other';
1066
1131
  interface CallMeta {
1067
1132
  provider: string;
1068
1133
  model: string;
@@ -1073,6 +1138,13 @@ interface CallMeta {
1073
1138
  attempts: number;
1074
1139
  /** Position of the answering target in the order tried, 0 based. */
1075
1140
  position: number;
1141
+ /** Absent for the main chain, 1 and up for chains started with `next.again()`. */
1142
+ chain?: number;
1143
+ /**
1144
+ * Why the answering target stopped, when its adapter reports it. For a stream it is set once
1145
+ * `finalResult` resolves. Absent on a cache hit.
1146
+ */
1147
+ finishReason?: FinishReason;
1076
1148
  }
1077
1149
  /** One configured target, as a middleware sees it in `ctx.targets`. */
1078
1150
  interface TargetInfo {
@@ -1154,8 +1226,6 @@ declare function isFallbackExhaustedError(err: unknown): err is FallbackExhauste
1154
1226
  declare function metaRef(): {
1155
1227
  current?: CallMeta;
1156
1228
  };
1157
- //#endregion
1158
- //#region src/types/schema.d.ts
1159
1229
  /**
1160
1230
  * Minimal structural type for a Zod-like schema, so this package doesnt need
1161
1231
  * a hard dependency on a specific Zod major version. Any object exposing
@@ -1185,8 +1255,6 @@ interface JsonSchemaSpec {
1185
1255
  strict?: boolean;
1186
1256
  description?: string;
1187
1257
  }
1188
- //#endregion
1189
- //#region src/types/tools.d.ts
1190
1258
  /**
1191
1259
  * Describes a capability the model may request, not the capability
1192
1260
  * itself. VernLLM transports this to the provider and parses what comes
@@ -1266,8 +1334,6 @@ declare function isToolCallResult<Tools extends readonly ToolDefinition[] | unde
1266
1334
  type ToolChoice = 'auto' | 'none' | 'required' | {
1267
1335
  name: string;
1268
1336
  };
1269
- //#endregion
1270
- //#region src/types/call.d.ts
1271
1337
  /**
1272
1338
  * Any valid JSON value: a primitive, `null`, or a JSON array/object made
1273
1339
  * of the same. This is what `call()` returns when `jsonMode: true`.
@@ -1542,8 +1608,6 @@ interface SoftFailureMeta {
1542
1608
  * refusal answers that parse fine.
1543
1609
  */
1544
1610
  type DetectSoftFailure<T = unknown> = (result: T | CallWithToolsResult<T>, meta: SoftFailureMeta) => LLMErrorCode | undefined;
1545
- //#endregion
1546
- //#region src/types/stream.d.ts
1547
1611
  /** One incremental unit of a streaming response, as delivered to the caller. */
1548
1612
  type StreamChunk = {
1549
1613
  type: 'text-delta';
@@ -1632,6 +1696,8 @@ type WireStreamChunk = {
1632
1696
  /** Writes by TTL label, e.g. `{ '5m': 1200, '1h': 800 }`. */
1633
1697
  cache_write_tokens_by_ttl?: Record<string, number>;
1634
1698
  };
1699
+ /** What the provider billed for the call, in USD. OpenRouter reports it as `usage.cost`. */
1700
+ cost?: number;
1635
1701
  };
1636
1702
  } | {
1637
1703
  /** A provider keep-alive with no content. Resets the idle timeout; never reaches callers. */
@@ -1643,6 +1709,14 @@ type WireStreamChunk = {
1643
1709
  */
1644
1710
  type: 'rate_limit_hint';
1645
1711
  hint: ProviderRateLimitHint;
1712
+ } | {
1713
+ /** The provider declined. Never reaches callers: with no content, the call fails as `model_refused`. */
1714
+ type: 'refusal';
1715
+ delta?: string;
1716
+ } | {
1717
+ /** Why generation stopped, as the provider spells it. Never reaches callers; core maps it onto `FinishReason`. */
1718
+ type: 'finish';
1719
+ reason: string;
1646
1720
  } | {
1647
1721
  /**
1648
1722
  * One complete reasoning block, yielded once it has fully arrived.
@@ -1708,8 +1782,6 @@ type CachedStreamJsonModeEnabledCallParams = CachedCallInput & {
1708
1782
  schema?: never;
1709
1783
  };
1710
1784
  };
1711
- //#endregion
1712
- //#region src/types/client.d.ts
1713
1785
  /** A tool call as it appears on the wire, OpenAI's `function`-wrapped shape. */
1714
1786
  interface WireToolCall {
1715
1787
  id: string;
@@ -1833,10 +1905,13 @@ interface LLMClient {
1833
1905
  tool_calls?: WireToolCall[];
1834
1906
  /** Reasoning blocks the model produced, in order. Only Claude adapters report them. */
1835
1907
  thinking?: ThinkingBlock[];
1908
+ /** Set when the provider declined. With no content or tool calls, fails as `model_refused`. */
1909
+ refusal?: string | null;
1836
1910
  };
1837
1911
  /**
1838
- * Why generation stopped, in OpenAI's terms. Only `'length'` is read: output that then
1839
- * fails to parse becomes the retryable `response_truncated`. Optional.
1912
+ * Why generation stopped, in OpenAI's terms. Reported as `CallMeta.finishReason`, and
1913
+ * `'length'` also turns output that fails to parse into the retryable
1914
+ * `response_truncated`. Optional.
1840
1915
  */
1841
1916
  finish_reason?: string | null;
1842
1917
  }>;
@@ -1854,6 +1929,8 @@ interface LLMClient {
1854
1929
  /** Writes by TTL label, e.g. `{ '5m': 1200, '1h': 800 }`. */
1855
1930
  cache_write_tokens_by_ttl?: Record<string, number>;
1856
1931
  };
1932
+ /** What the provider billed for the call, in USD. OpenRouter reports it as `usage.cost`. */
1933
+ cost?: number;
1857
1934
  };
1858
1935
  }>;
1859
1936
  /**
@@ -1866,6 +1943,5 @@ interface LLMClient {
1866
1943
  };
1867
1944
  };
1868
1945
  }
1869
- //#endregion
1870
- export { SchemaLike as $, createStateKey as $t, ConditionalToolCallParams as A, ConsecutiveTripping as At, ThinkingBlock as B, MiddlewareRef as Bt, CachedConditionalToolCallParams as C, hasIssues as Cn, RetryBudgetOptions as Ct, CallContext as D, CircuitBreakerOptions as Dt, CachedToolCallParams as E, CircuitBreakerCallContext as Et, JsonModeDisabledCallParams as F, AttemptContext as Ft, ToolCall as G, RequiredMiddlewareRef as Gt, ToolsDisabledCallParams as H, MiddlewareStateEntry as Ht, JsonModeEnabledCallParams as I, CallResult as It, ToolDefinition as J, WireCallRequestPatch as Jt, ToolCallResult as K, VernLLMMiddleware as Kt, JsonValue as L, MiddlewareCapabilities as Lt, ConversationTurn as M, ExponentialBackoffOptions as Mt, DetectSoftFailure as N, RollingTripping as Nt, CallParams as O, CircuitBreakerStateChangeHandler as Ot, ImageBlock as P, TrippingPolicy as Pt, JsonSchemaSpec as Q, createMiddlewareStateBag as Qt, LLMRequestShape as R, MiddlewareContext as Rt, CachedConditionalStringToolCallParams as S, UnsupportedCapabilityIssue as Sn, RetryBudget as St, CachedJsonModeEnabledCallParams as T, CircuitBreakerAdapter as Tt, CallWithToolsResult as U, MiddlewareStateKey as Ut, ToolEnabledCallParams as V, MiddlewareStateBag as Vt, ContentResult as W, PreDispatchContext as Wt, defineTool as X, WireTool as Xt, ToolResult as Y, WireResponseFormat as Yt, isToolCallResult as Z, createMiddlewareRef as Zt, StreamJsonModeEnabledCallParams as _, LLMErrorType as _n, RateLimiter as _t, WireToolChoice as a, OnUsageFailure as an, FallbackOnContext as at, AssistantContent as b, ToolIssue as bn, ProviderRateLimitHint as bt, CachedStreamConditionalToolCallParams as c, TokenUsage as cn, TargetInfo as ct, CachedStreamToolCallParams as d, DuplicateToolNamesIssue as dn, metaRef as dt, requireRef as en, CallMeta as et, StreamCallResult as f, HistoryToolResultIssue as fn, RateLimitOption as ft, StreamJsonModeDisabledCallParams as g, LLMErrorSnapshot as gn, RateLimitState as gt, StreamEnabledCallParams as h, LLMErrorIssuesByCode as hn, RateLimitReason as ht, WireToolCall as i, OnUsage as in, FallbackOn as it, ContentBlock as j, CooldownBackoff as jt, ConditionalStringToolCallParams as k, CircuitState as kt, CachedStreamJsonModeDisabledCallParams as l, ConsoleLogger as ln, defaultFallbackOn as lt, StreamConditionalStringToolCallParams as m, LLMErrorCode as mn, RateLimitOptions as mt, LLMClient as n, OnEvent as nn, FallbackAttempt as nt, CachedStreamCallParams as o, RefundUsage as on, FallbackTarget as ot, StreamChunk as p, LLMError as pn, RateLimitAcquireResult as pt, ToolChoice as q, WireCallRequest as qt, WireMessage as r, VernLLMEvent as rn, FallbackExhaustedError as rt, CachedStreamConditionalStringToolCallParams as s, ReserveUsage as sn, TargetCircuitState as st, AdapterInfo as t, stateEntry as tn, CircuitTarget as tt, CachedStreamJsonModeEnabledCallParams as u, Logger as un, isFallbackExhaustedError as ut, WireStreamChunk as v, LLMRequestSnapshot as vn, RateLimiterAdapter as vt, CachedJsonModeDisabledCallParams as w, isLLMError as wn, CircuitBreaker as wt, CachedCallParams as x, UnknownToolChoiceIssue as xn, CircuitBreakerOption as xt, isStreamResult as y, RetryAttempt as yn, WireRequest as yt, TextBlock as z, MiddlewareContextBase as zt };
1871
- //# sourceMappingURL=client-HWxkwVvj.d.cts.map
1946
+ export { SchemaLike as $, WireResponseFormat as $t, ConditionalToolCallParams as A, isLLMError as An, CircuitBreakerCallContext as At, ThinkingBlock as B, CallResult as Bt, CachedConditionalToolCallParams as C, LLMErrorType as Cn, RateLimiter as Ct, CallContext as D, UnknownToolChoiceIssue as Dn, CircuitBreakerOption as Dt, CachedToolCallParams as E, ToolIssue as En, ProviderRateLimitHint as Et, JsonModeDisabledCallParams as F, CooldownBackoff as Ft, ToolCall as G, MiddlewareStateBag as Gt, ToolsDisabledCallParams as H, MiddlewareContext as Ht, JsonModeEnabledCallParams as I, ExponentialBackoffOptions as It, ToolDefinition as J, PreDispatchContext as Jt, ToolCallResult as K, MiddlewareStateEntry as Kt, JsonValue as L, RollingTripping as Lt, ConversationTurn as M, CircuitBreakerStateChangeHandler as Mt, DetectSoftFailure as N, CircuitState as Nt, CallParams as O, UnsupportedCapabilityIssue as On, CircuitBreaker as Ot, ImageBlock as P, ConsecutiveTripping as Pt, JsonSchemaSpec as Q, WireCallRequestPatch as Qt, LLMRequestShape as R, TrippingPolicy as Rt, CachedConditionalStringToolCallParams as S, LLMErrorSnapshot as Sn, RateLimitState as St, CachedJsonModeEnabledCallParams as T, RetryAttempt as Tn, WireRequest as Tt, CallWithToolsResult as U, MiddlewareContextBase as Ut, ToolEnabledCallParams as V, MiddlewareCapabilities as Vt, ContentResult as W, MiddlewareRef as Wt, defineTool as X, VernLLMMiddleware as Xt, ToolResult as Y, RequiredMiddlewareRef as Yt, isToolCallResult as Z, WireCallRequest as Zt, StreamJsonModeEnabledCallParams as _, DuplicateToolNamesIssue as _n, RetryBudgetSnapshot as _t, WireToolChoice as a, createStateKey as an, FallbackOnContext as at, AssistantContent as b, LLMErrorCode as bn, RateLimitOptions as bt, CachedStreamConditionalToolCallParams as c, OnEvent as cn, TargetCircuitState as ct, CachedStreamToolCallParams as d, OnUsageFailure as dn, isFallbackExhaustedError as dt, WireTool as en, CallMeta as et, StreamCallResult as f, RefundUsage as fn, metaRef as ft, StreamJsonModeDisabledCallParams as g, Logger as gn, RetryBudgetOptions as gt, StreamEnabledCallParams as h, ConsoleLogger as hn, RetryBudgetAdapter as ht, WireToolCall as i, createMiddlewareStateBag as in, FallbackOn as it, ContentBlock as j, CircuitBreakerOptions as jt, ConditionalStringToolCallParams as k, hasIssues as kn, CircuitBreakerAdapter as kt, CachedStreamJsonModeDisabledCallParams as l, VernLLMEvent as ln, TargetInfo as lt, StreamConditionalStringToolCallParams as m, TokenUsage as mn, RetryBudget as mt, LLMClient as n, WrapNextOptions as nn, FallbackAttempt as nt, CachedStreamCallParams as o, requireRef as on, FallbackTarget as ot, StreamChunk as p, ReserveUsage as pn, RetryBudgetOption as pt, ToolChoice as q, MiddlewareStateKey as qt, WireMessage as r, createMiddlewareRef as rn, FallbackExhaustedError as rt, CachedStreamConditionalStringToolCallParams as s, stateEntry as sn, FinishReason as st, AdapterInfo as t, WrapNext as tn, CircuitTarget as tt, CachedStreamJsonModeEnabledCallParams as u, OnUsage as un, defaultFallbackOn as ut, WireStreamChunk as v, HistoryToolResultIssue as vn, RateLimitOption as vt, CachedJsonModeDisabledCallParams as w, LLMRequestSnapshot as wn, RateLimiterAdapter as wt, CachedCallParams as x, LLMErrorIssuesByCode as xn, RateLimitReason as xt, isStreamResult as y, LLMError as yn, RateLimitAcquireResult as yt, TextBlock as z, AttemptContext as zt };
1947
+ //# sourceMappingURL=client-D4eRQMgc.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-D4eRQMgc.d.cts","names":[],"sources":["../src/types/errors.ts","../src/logger.ts","../src/types/usage.ts","../src/types/events.ts","../src/types/middleware.ts","../src/circuitBreaker.ts","../src/internal/utils/circuit-breaker/circuitBreakerAdapter.utils.ts","../src/internal/utils/rate-limit/rateLimitHint.utils.ts","../src/rateLimit.ts","../src/internal/utils/rate-limit/rateLimitAdapter.utils.ts","../src/retryBudget.ts","../src/internal/utils/retry-budget/retryBudgetAdapter.utils.ts","../src/types/fallback.ts","../src/types/schema.ts","../src/types/tools.ts","../src/types/call.ts","../src/types/stream.ts","../src/types/client.ts"],"mappings":"A,KAAY;;;;;KAkBA;;;;;;UA+OK;EACf;EACA;EACA,MAAM;EACN;;;;;;UAOe;EACf;;;;;;UAOe;EACf;EACA;;;;;;;UAQe;EACf;EACA;;;;;;UAOe;EACf;;;;;;;UAQe;EACf,cAAc;EACd,wBAAwB;EACxB,sBAAsB;EACtB,qBAAqB;EACrB,2BAA2B;EAC3B,yBAAyB;EACzB,sBAAsB;EACtB,wBAAwB;;;;;;UAOT;EACf;EACA,MAAM;EACN;EACA;EACA;EACA,OAAO;;EAEP;;EAEA,WAAW;;;;;;UAOI;;EAEf;;EAEA;;EAEA;;EAEA,UAAU;;EAEV;;;UAwBe;EACf;EACA,OAAO;;EAEP,UAAU;;;UAIK;EACf;EACA;EACA;EACA;;EAEA,OAAO;;EAEP,WAAW;;cAGA,iBAAiB;EAYnB,MAAM;EAXR;EACA;EACA;EACA;;EAEA,OAAO;;EAEP,WAAW;E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