@effect/ai-openrouter 4.0.0-beta.9 → 4.0.0-beta.91

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/src/index.ts CHANGED
@@ -1,35 +1,30 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * @since 4.0.0
3
3
  */
4
4
 
5
5
  // @barrel: Auto-generated exports. Do not edit manually.
6
6
 
7
7
  /**
8
- * @since 1.0.0
8
+ * @since 4.0.0
9
9
  */
10
10
  export * as Generated from "./Generated.ts"
11
11
 
12
12
  /**
13
- * @since 1.0.0
13
+ * @since 4.0.0
14
14
  */
15
15
  export * as OpenRouterClient from "./OpenRouterClient.ts"
16
16
 
17
17
  /**
18
- * @since 1.0.0
18
+ * @since 4.0.0
19
19
  */
20
20
  export * as OpenRouterConfig from "./OpenRouterConfig.ts"
21
21
 
22
22
  /**
23
- * OpenRouter error metadata augmentation.
24
- *
25
- * Provides OpenRouter-specific metadata fields for AI error types through
26
- * module augmentation, enabling typed access to OpenRouter error details.
27
- *
28
- * @since 1.0.0
23
+ * @since 4.0.0
29
24
  */
30
25
  export * as OpenRouterError from "./OpenRouterError.ts"
31
26
 
32
27
  /**
33
- * @since 1.0.0
28
+ * @since 4.0.0
34
29
  */
35
30
  export * as OpenRouterLanguageModel from "./OpenRouterLanguageModel.ts"
@@ -192,12 +192,14 @@ export const parseRateLimitHeaders = (headers: Record<string, string>) => {
192
192
  let retryAfter: Duration.Duration | undefined
193
193
  if (Predicate.isNotUndefined(retryAfterRaw)) {
194
194
  const parsed = Number.parse(retryAfterRaw)
195
- if (Predicate.isNotUndefined(parsed)) {
196
- retryAfter = Duration.seconds(parsed)
195
+ if (Option.isSome(parsed)) {
196
+ retryAfter = Duration.seconds(parsed.value)
197
197
  }
198
198
  }
199
199
  const remainingRaw = headers["x-ratelimit-remaining-requests"]
200
- const remaining = Predicate.isNotUndefined(remainingRaw) ? Number.parse(remainingRaw) ?? null : null
200
+ const remaining = Predicate.isNotUndefined(remainingRaw)
201
+ ? Option.getOrNull(Number.parse(remainingRaw))
202
+ : null
201
203
  return {
202
204
  retryAfter,
203
205
  limit: headers["x-ratelimit-limit-requests"] ?? null,
@@ -218,7 +220,7 @@ export const buildHttpRequestDetails = (
218
220
  method: request.method,
219
221
  url: request.url,
220
222
  urlParams: Array.from(request.urlParams),
221
- hash: request.hash,
223
+ hash: Option.getOrUndefined(request.hash),
222
224
  headers: Redactable.redact(request.headers) as Record<string, string>
223
225
  })
224
226
 
@@ -41,7 +41,6 @@ export class ReasoningDetailsDuplicateTracker {
41
41
  /**
42
42
  * Attempts to track a detail.
43
43
  *
44
- * @returns `true` if this is a NEW detail (not seen before and has valid key),
45
44
  * or `false` if it was skipped (no valid key) or already seen (duplicate).
46
45
  */
47
46
  upsert(detail: ReasoningDetails[number]): boolean {