@effect/ai-openrouter 4.0.0-beta.7 → 4.0.0-beta.70

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,11 +1,33 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * The `OpenRouterClient` module provides an Effect service for calling
3
+ * OpenRouter's chat completions API. It wraps the generated OpenRouter HTTP
4
+ * client with Effect-native constructors, layers, typed errors, and streaming
5
+ * support.
6
+ *
7
+ * **Common tasks**
8
+ *
9
+ * - Build a client from explicit options with {@link make}
10
+ * - Provide the client to an application with {@link layer} or {@link layerConfig}
11
+ * - Create non-streaming chat completions with {@link Service.createChatCompletion}
12
+ * - Create server-sent event chat completion streams with
13
+ * {@link Service.createChatCompletionStream}
14
+ * - Customize authentication, base URL, OpenRouter ranking headers, or the
15
+ * underlying HTTP client through {@link Options}
16
+ *
17
+ * **Gotchas**
18
+ *
19
+ * - Streaming requests are sent directly to `/chat/completions` with `stream`
20
+ * and `stream_options.include_usage` enabled by this module.
21
+ * - OpenRouter API failures, HTTP client failures, and schema decoding failures
22
+ * are mapped into `AiError` values for the exported service methods.
23
+ *
24
+ * @since 4.0.0
3
25
  */
4
26
  import type * as Config from "effect/Config";
27
+ import * as Context from "effect/Context";
5
28
  import * as Effect from "effect/Effect";
6
29
  import * as Layer from "effect/Layer";
7
30
  import type * as Redacted from "effect/Redacted";
8
- import * as ServiceMap from "effect/ServiceMap";
9
31
  import * as Stream from "effect/Stream";
10
32
  import type * as AiError from "effect/unstable/ai/AiError";
11
33
  import * as HttpClient from "effect/unstable/http/HttpClient";
@@ -14,11 +36,13 @@ import * as Generated from "./Generated.ts";
14
36
  /**
15
37
  * The OpenRouter client service interface.
16
38
  *
39
+ * **Details**
40
+ *
17
41
  * Provides methods for interacting with OpenRouter's Chat Completions API,
18
42
  * including both synchronous and streaming message creation.
19
43
  *
20
- * @since 1.0.0
21
44
  * @category models
45
+ * @since 4.0.0
22
46
  */
23
47
  export interface Service {
24
48
  readonly client: Generated.OpenRouterClient;
@@ -32,24 +56,31 @@ export interface Service {
32
56
  ], AiError.AiError>;
33
57
  }
34
58
  /**
35
- * @since 1.0.0
36
- * @category Models
59
+ * Decoded `data` payload from an OpenRouter chat completion streaming chunk.
60
+ *
61
+ * **Details**
62
+ *
63
+ * The payload contains streamed choices, model metadata, optional usage, and may
64
+ * include an OpenRouter error object for a streamed response.
65
+ *
66
+ * @category models
67
+ * @since 4.0.0
37
68
  */
38
69
  export type ChatStreamingResponseChunkData = typeof Generated.ChatStreamingResponseChunk.fields.data.Type;
39
- declare const OpenRouterClient_base: ServiceMap.ServiceClass<OpenRouterClient, "@effect/ai-openrouter/OpenRouterClient", Service>;
70
+ declare const OpenRouterClient_base: Context.ServiceClass<OpenRouterClient, "@effect/ai-openrouter/OpenRouterClient", Service>;
40
71
  /**
41
72
  * Service identifier for the OpenRouter client.
42
73
  *
43
- * @since 1.0.0
44
- * @category service
74
+ * @category services
75
+ * @since 4.0.0
45
76
  */
46
77
  export declare class OpenRouterClient extends OpenRouterClient_base {
47
78
  }
48
79
  /**
49
80
  * Configuration options for creating an OpenRouter client.
50
81
  *
51
- * @since 1.0.0
52
82
  * @category models
83
+ * @since 4.0.0
53
84
  */
54
85
  export type Options = {
55
86
  readonly apiKey?: Redacted.Redacted<string> | undefined;
@@ -65,6 +96,8 @@ export type Options = {
65
96
  /**
66
97
  * Optional transformer for the underlying HTTP client.
67
98
  *
99
+ * **When to use**
100
+ *
68
101
  * Use this to add middleware, logging, or custom request/response handling.
69
102
  */
70
103
  readonly transformClient?: ((client: HttpClient.HttpClient) => HttpClient.HttpClient) | undefined;
@@ -72,29 +105,29 @@ export type Options = {
72
105
  /**
73
106
  * Creates an OpenRouter client service with the given options.
74
107
  *
75
- * @since 1.0.0
76
108
  * @category constructors
109
+ * @since 4.0.0
77
110
  */
78
111
  export declare const make: (options: Options) => Effect.Effect<Service, never, HttpClient.HttpClient>;
79
112
  /**
80
113
  * Creates a layer for the OpenRouter client with the given options.
81
114
  *
82
- * @since 1.0.0
83
115
  * @category layers
116
+ * @since 4.0.0
84
117
  */
85
118
  export declare const layer: (options: Options) => Layer.Layer<OpenRouterClient, never, HttpClient.HttpClient>;
86
119
  /**
87
120
  * Creates a layer for the OpenRouter client, loading the requisite
88
121
  * configuration via Effect's `Config` module.
89
122
  *
90
- * @since 1.0.0
91
123
  * @category layers
124
+ * @since 4.0.0
92
125
  */
93
126
  export declare const layerConfig: (options?: {
94
127
  /**
95
128
  * The config value to load for the API key.
96
129
  */
97
- readonly apiKey?: Config.Config<Redacted.Redacted<string>> | undefined;
130
+ readonly apiKey?: Config.Config<Redacted.Redacted<string> | undefined> | undefined;
98
131
  /**
99
132
  * The config value to load for the API URL.
100
133
  */
@@ -1 +1 @@
1
- {"version":3,"file":"OpenRouterClient.d.ts","sourceRoot":"","sources":["../src/OpenRouterClient.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAEhD,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,OAAO,MAAM,4BAA4B,CAAA;AAG1D,OAAO,KAAK,UAAU,MAAM,iCAAiC,CAAA;AAE7D,OAAO,KAAK,KAAK,kBAAkB,MAAM,yCAAyC,CAAA;AAClF,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAQ3C;;;;;;;;GAQG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,gBAAgB,CAAA;IAE3C,QAAQ,CAAC,oBAAoB,EAAE,CAC7B,OAAO,EAAE,OAAO,SAAS,CAAC,oBAAoB,C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AAU,CAAC,UAAU,KAAK,UAAU,CAAC,UAAU,CAAC,GAAG,SAAS,CAAA;CAClG,KAAG,KAAK,CAAC,KAAK,CAAC,gBAAgB,EAAE,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,UAAU,CAwBxE,CAAA"}
@@ -1,9 +1,9 @@
1
+ import * as Context from "effect/Context";
1
2
  import * as Effect from "effect/Effect";
2
3
  import { identity } from "effect/Function";
3
4
  import * as Layer from "effect/Layer";
4
5
  import * as Predicate from "effect/Predicate";
5
6
  import * as Schema from "effect/Schema";
6
- import * as ServiceMap from "effect/ServiceMap";
7
7
  import * as Stream from "effect/Stream";
8
8
  import * as Sse from "effect/unstable/encoding/Sse";
9
9
  import * as HttpBody from "effect/unstable/http/HttpBody";
@@ -18,22 +18,22 @@ import { OpenRouterConfig } from "./OpenRouterConfig.js";
18
18
  /**
19
19
  * Service identifier for the OpenRouter client.
20
20
  *
21
- * @since 1.0.0
22
- * @category service
21
+ * @category services
22
+ * @since 4.0.0
23
23
  */
24
- export class OpenRouterClient extends /*#__PURE__*/ServiceMap.Service()("@effect/ai-openrouter/OpenRouterClient") {}
24
+ export class OpenRouterClient extends /*#__PURE__*/Context.Service()("@effect/ai-openrouter/OpenRouterClient") {}
25
25
  // =============================================================================
26
26
  // Constructor
27
27
  // =============================================================================
28
28
  /**
29
29
  * Creates an OpenRouter client service with the given options.
30
30
  *
31
- * @since 1.0.0
32
31
  * @category constructors
32
+ * @since 4.0.0
33
33
  */
34
34
  export const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
35
35
  const baseClient = yield* HttpClient.HttpClient;
36
- const httpClient = baseClient.pipe(HttpClient.mapRequest(request => request.pipe(HttpClientRequest.prependUrl(options.apiUrl ?? "https://openrouter.ai/api/v1"), options.apiKey ? HttpClientRequest.bearerToken(options.apiKey) : identity, options.siteReferrer ? HttpClientRequest.setHeader("HTTP-Referrer", options.siteReferrer) : identity, options.siteTitle ? HttpClientRequest.setHeader("X-Title", options.siteTitle) : identity, HttpClientRequest.acceptJson)), options.transformClient ?? identity);
36
+ const httpClient = baseClient.pipe(HttpClient.mapRequest(request => request.pipe(HttpClientRequest.prependUrl(options.apiUrl ?? "https://openrouter.ai/api/v1"), options.apiKey ? HttpClientRequest.bearerToken(options.apiKey) : identity, options.siteReferrer ? HttpClientRequest.setHeader("HTTP-Referer", options.siteReferrer) : identity, options.siteTitle ? HttpClientRequest.setHeader("X-Title", options.siteTitle) : identity, HttpClientRequest.acceptJson)), options.transformClient ?? identity);
37
37
  const httpClientOk = HttpClient.filterStatusOk(httpClient);
38
38
  const client = Generated.make(httpClient, {
39
39
  transformClient: Effect.fnUntraced(function* (client) {
@@ -87,16 +87,16 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
87
87
  /**
88
88
  * Creates a layer for the OpenRouter client with the given options.
89
89
  *
90
- * @since 1.0.0
91
90
  * @category layers
91
+ * @since 4.0.0
92
92
  */
93
93
  export const layer = options => Layer.effect(OpenRouterClient, make(options));
94
94
  /**
95
95
  * Creates a layer for the OpenRouter client, loading the requisite
96
96
  * configuration via Effect's `Config` module.
97
97
  *
98
- * @since 1.0.0
99
98
  * @category layers
99
+ * @since 4.0.0
100
100
  */
101
101
  export const layerConfig = options => Layer.effect(OpenRouterClient, Effect.gen(function* () {
102
102
  const apiKey = Predicate.isNotUndefined(options?.apiKey) ? yield* options.apiKey : undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"OpenRouterClient.js","names":["Effect","identity","Layer","Predicate","Schema","ServiceMap","Stream","Sse","HttpBody","HttpClient","HttpClientRequest","Generated","Errors","OpenRouterConfig","OpenRouterClient","Service","make","fnUntraced","options","baseClient","httpClient","pipe","mapRequest","request","prependUrl","apiUrl","apiKey","bearerToken","siteReferrer","setHeader","siteTitle","acceptJson","transformClient","httpClientOk","filterStatusOk","client","config","getOrUndefined","isNotUndefined","createChatCompletion","payload","sendChatCompletionRequest","includeResponse","catchTags","SendChatCompletionRequest400","error","fail","mapClientError","SendChatCompletionRequest401","SendChatCompletionRequest429","SendChatCompletionRequest500","HttpClientError","mapHttpClientError","SchemaError","mapSchemaError","buildChatCompletionStream","response","stream","decodeText","pipeThroughChannel","decode","mapEffect","event","decodeChatCompletionSseData","data","takeWhile","Retry","die","fromEffect","createChatCompletionStream","execute","post","body","jsonUnsafe","stream_options","include_usage","map","catchTag","of","layer","effect","layerConfig","gen","undefined","ChatStreamingResponseChunkDataFromString","fromJsonString","ChatStreamingResponseChunk","fields","decodeChatStreamingResponseChunkData","decodeUnknownEffect","succeed"],"sources":["../src/OpenRouterClient.ts"],"sourcesContent":[null],"mappings":"AAIA,OAAO,KAAKA,MAAM,MAAM,eAAe;AACvC,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,SAAS,MAAM,kBAAkB;AAE7C,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,UAAU,MAAM,mBAAmB;AAC/C,OAAO,KAAKC,MAAM,MAAM,eAAe;AAEvC,OAAO,KAAKC,GAAG,MAAM,8BAA8B;AACnD,OAAO,KAAKC,QAAQ,MAAM,+BAA+B;AACzD,OAAO,KAAKC,UAAU,MAAM,iCAAiC;AAC7D,OAAO,KAAKC,iBAAiB,MAAM,wCAAwC;AAE3E,OAAO,KAAKC,SAAS,MAAM,gBAAgB;AAC3C,OAAO,KAAKC,MAAM,MAAM,sBAAsB;AAC9C,SAASC,gBAAgB,QAAQ,uBAAuB;AA0CxD;AACA;AACA;AAEA;;;;;;AAMA,OAAM,MAAOC,gBAAiB,sBAAQT,UAAU,CAACU,OAAO,EAGrD,CAAC,wCAAwC,CAAC;AAmC7C;AACA;AACA;AAEA;;;;;;AAMA,OAAO,MAAMC,IAAI,gBAAGhB,MAAM,CAACiB,UAAU,CACnC,WAAUC,OAAgB;EACxB,MAAMC,UAAU,GAAG,OAAOV,UAAU,CAACA,UAAU;EAE/C,MAAMW,UAAU,GAAGD,UAAU,CA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D,MAAM,GAAGtB,SAAS,CAACmC,cAAc,CAACpB,OAAO,EAAEO,MAAM,CAAC,GACpD,OAAOP,OAAO,CAACO,MAAM,GACrB0D,SAAS;EACb,MAAMvD,YAAY,GAAGzB,SAAS,CAACmC,cAAc,CAACpB,OAAO,EAAEU,YAAY,CAAC,GAChE,OAAOV,OAAO,CAACU,YAAY,GAC3BuD,SAAS;EACb,MAAMrD,SAAS,GAAG3B,SAAS,CAACmC,cAAc,CAACpB,OAAO,EAAEY,SAAS,CAAC,GAC1D,OAAOZ,OAAO,CAACY,SAAS,GACxBqD,SAAS;EACb,OAAO,OAAOnE,IAAI,CAAC;IACjBU,MAAM;IACND,MAAM;IACNG,YAAY;IACZE,SAAS;IACTE,eAAe,EAAEd,OAAO,EAAEc;GAC3B,CAAC;AACJ,CAAC,CAAC,CACH;AAEH;AACA;AACA;AAEA,MAAMoD,wCAAwC,gBAAGhF,MAAM,CAACiF,cAAc,CAAC1E,SAAS,CAAC2E,0BAA0B,CAACC,MAAM,CAACvB,IAAI,CAAC;AACxH,MAAMwB,oCAAoC,gBAAGpF,MAAM,CAACqF,mBAAmB,CAACL,wCAAwC,CAAC;AAEjH,MAAMrB,2BAA2B,GAC/BC,IAAY,IAEZA,IAAI,KAAK,QAAQ,GACbhE,MAAM,CAAC0F,OAAO,CAAC1B,IAAI,CAAC,GACpBwB,oCAAoC,CAACxB,IAAI,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"OpenRouterClient.js","names":["Context","Effect","identity","Layer","Predicate","Schema","Stream","Sse","HttpBody","HttpClient","HttpClientRequest","Generated","Errors","OpenRouterConfig","OpenRouterClient","Service","make","fnUntraced","options","baseClient","httpClient","pipe","mapRequest","request","prependUrl","apiUrl","apiKey","bearerToken","siteReferrer","setHeader","siteTitle","acceptJson","transformClient","httpClientOk","filterStatusOk","client","config","getOrUndefined","isNotUndefined","createChatCompletion","payload","sendChatCompletionRequest","includeResponse","catchTags","SendChatCompletionRequest400","error","fail","mapClientError","SendChatCompletionRequest401","SendChatCompletionRequest429","SendChatCompletionRequest500","HttpClientError","mapHttpClientError","SchemaError","mapSchemaError","buildChatCompletionStream","response","stream","decodeText","pipeThroughChannel","decode","mapEffect","event","decodeChatCompletionSseData","data","takeWhile","Retry","die","fromEffect","createChatCompletionStream","execute","post","body","jsonUnsafe","stream_options","include_usage","map","catchTag","of","layer","effect","layerConfig","gen","undefined","ChatStreamingResponseChunkDataFromString","fromJsonString","ChatStreamingResponseChunk","fields","decodeChatStreamingResponseChunkData","decodeUnknownEffect","succeed"],"sources":["../src/OpenRouterClient.ts"],"sourcesContent":[null],"mappings":"AA0BA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,SAAS,MAAM,kBAAkB;AAE7C,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,MAAM,MAAM,eAAe;AAEvC,OAAO,KAAKC,GAAG,MAAM,8BAA8B;AACnD,OAAO,KAAKC,QAAQ,MAAM,+BAA+B;AACzD,OAAO,KAAKC,UAAU,MAAM,iCAAiC;AAC7D,OAAO,KAAKC,iBAAiB,MAAM,wCAAwC;AAE3E,OAAO,KAAKC,SAAS,MAAM,gBAAgB;AAC3C,OAAO,KAAKC,MAAM,MAAM,sBAAsB;AAC9C,SAASC,gBAAgB,QAAQ,uBAAuB;AAmDxD;AACA;AACA;AAEA;;;;;;AAMA,OAAM,MAAOC,gBAAiB,sBAAQd,OAAO,CAACe,OAAO,EAGlD,CAAC,wCAAwC,CAAC;AAqC7C;AACA;AACA;AAEA;;;;;;AAMA,OAAO,MAAMC,IAAI,gBAAGf,MAAM,CAACgB,UAAU,CACnC,WAAUC,OAAgB;EACxB,MAAMC,UAAU,GAAG,OAAOV,UAAU,CAACA,UAAU;EAE/C,MAAMW,UAAU,GAAGD,UAA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MAAM1D,MAAM,GAAGrB,SAAS,CAACkC,cAAc,CAACpB,OAAO,EAAEO,MAAM,CAAC,GACpD,OAAOP,OAAO,CAACO,MAAM,GACrB0D,SAAS;EACb,MAAMvD,YAAY,GAAGxB,SAAS,CAACkC,cAAc,CAACpB,OAAO,EAAEU,YAAY,CAAC,GAChE,OAAOV,OAAO,CAACU,YAAY,GAC3BuD,SAAS;EACb,MAAMrD,SAAS,GAAG1B,SAAS,CAACkC,cAAc,CAACpB,OAAO,EAAEY,SAAS,CAAC,GAC1D,OAAOZ,OAAO,CAACY,SAAS,GACxBqD,SAAS;EACb,OAAO,OAAOnE,IAAI,CAAC;IACjBU,MAAM;IACND,MAAM;IACNG,YAAY;IACZE,SAAS;IACTE,eAAe,EAAEd,OAAO,EAAEc;GAC3B,CAAC;AACJ,CAAC,CAAC,CACH;AAEH;AACA;AACA;AAEA,MAAMoD,wCAAwC,gBAAG/E,MAAM,CAACgF,cAAc,CAAC1E,SAAS,CAAC2E,0BAA0B,CAACC,MAAM,CAACvB,IAAI,CAAC;AACxH,MAAMwB,oCAAoC,gBAAGnF,MAAM,CAACoF,mBAAmB,CAACL,wCAAwC,CAAC;AAEjH,MAAMrB,2BAA2B,GAC/BC,IAAY,IAEZA,IAAI,KAAK,QAAQ,GACb/D,MAAM,CAACyF,OAAO,CAAC1B,IAAI,CAAC,GACpBwB,oCAAoC,CAACxB,IAAI,CAAC","ignoreList":[]}
@@ -1,45 +1,82 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * The `OpenRouterConfig` module provides contextual configuration for the
3
+ * OpenRouter provider integration. It is used to customize the HTTP client that
4
+ * backs OpenRouter requests without rebuilding the provider layer itself.
5
+ *
6
+ * Use {@link withClientTransform} when a single effect, workflow, or scoped
7
+ * portion of an application needs to add cross-cutting HTTP client behavior
8
+ * such as request logging, retries, proxy routing, additional headers, or test
9
+ * doubles. The configuration is read from the current Effect context, so the
10
+ * transform only applies where the returned effect is run with that context.
11
+ *
12
+ * **Gotchas**
13
+ *
14
+ * - Each call to {@link withClientTransform} replaces the current client
15
+ * transform for the provided effect; compose transforms manually when both
16
+ * behaviors should apply.
17
+ * - The transform receives and returns an `HttpClient`, so it should preserve
18
+ * the OpenRouter client contract while adding behavior around it.
19
+ *
20
+ * @since 4.0.0
3
21
  */
22
+ import * as Context from "effect/Context";
4
23
  import * as Effect from "effect/Effect";
5
- import * as ServiceMap from "effect/ServiceMap";
6
24
  import type { HttpClient } from "effect/unstable/http/HttpClient";
7
- declare const OpenRouterConfig_base: ServiceMap.ServiceClass<OpenRouterConfig, "@effect/ai-openrouter/OpenRouterConfig", OpenRouterConfig.Service>;
25
+ declare const OpenRouterConfig_base: Context.ServiceClass<OpenRouterConfig, "@effect/ai-openrouter/OpenRouterConfig", OpenRouterConfig.Service>;
8
26
  /**
9
- * @since 1.0.0
27
+ * Context service carrying scoped OpenRouter provider configuration for client
28
+ * operations.
29
+ *
10
30
  * @category services
31
+ * @since 4.0.0
11
32
  */
12
33
  export declare class OpenRouterConfig extends OpenRouterConfig_base {
13
34
  /**
14
- * @since 1.0.0
35
+ * Gets the configured OpenRouter service from the current context when present.
36
+ *
37
+ * @since 4.0.0
15
38
  */
16
39
  static readonly getOrUndefined: Effect.Effect<typeof OpenRouterConfig.Service | undefined>;
17
40
  }
18
41
  /**
19
- * @since 1.0.0
42
+ * Types associated with the `OpenRouterConfig` context service.
43
+ *
44
+ * @since 4.0.0
20
45
  */
21
46
  export declare namespace OpenRouterConfig {
22
47
  /**
23
- * @since 1.0.0
48
+ * Configuration values read by OpenRouter provider operations when resolving
49
+ * the generated HTTP client.
50
+ *
24
51
  * @category models
52
+ * @since 4.0.0
25
53
  */
26
54
  interface Service {
27
55
  readonly transformClient?: ((client: HttpClient) => HttpClient) | undefined;
28
56
  }
29
57
  }
30
58
  /**
31
- * @since 1.0.0
59
+ * Provides a scoped transform for the OpenRouter HTTP client used by provider
60
+ * operations.
61
+ *
32
62
  * @category configuration
63
+ * @since 4.0.0
33
64
  */
34
65
  export declare const withClientTransform: {
35
66
  /**
36
- * @since 1.0.0
67
+ * Provides a scoped transform for the OpenRouter HTTP client used by provider
68
+ * operations.
69
+ *
37
70
  * @category configuration
71
+ * @since 4.0.0
38
72
  */
39
73
  (transform: (client: HttpClient) => HttpClient): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
40
74
  /**
41
- * @since 1.0.0
75
+ * Provides a scoped transform for the OpenRouter HTTP client used by provider
76
+ * operations.
77
+ *
42
78
  * @category configuration
79
+ * @since 4.0.0
43
80
  */
44
81
  <A, E, R>(self: Effect.Effect<A, E, R>, transform: (client: HttpClient) => HttpClient): Effect.Effect<A, E, R>;
45
82
  };
@@ -1 +1 @@
1
- {"version":3,"file":"OpenRouterConfig.d.ts","sourceRoot":"","sources":["../src/OpenRouterConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;;AAEjE;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,qBAGO;IAC3C;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,gBAAgB,CAAC,OAAO,GAAG,SAAS,CAAC,CAGzF;CACF;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,gBAAgB,CAAC;IACxC;;;OAGG;IACH,UAAiB,OAAO;QACtB,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,UAAU,KAAK,UAAU,CAAC,GAAG,SAAS,CAAA;KAC5E;CACF;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE;IAChC;;;OAGG;IACH,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,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,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAClH;;;;;;OAMG;IACH,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACN,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC5B,SAAS,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,UAAU,GAC5C,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;CA4B1B,CAAA"}
@@ -1,22 +1,48 @@
1
1
  /**
2
- * @since 1.0.0
2
+ * The `OpenRouterConfig` module provides contextual configuration for the
3
+ * OpenRouter provider integration. It is used to customize the HTTP client that
4
+ * backs OpenRouter requests without rebuilding the provider layer itself.
5
+ *
6
+ * Use {@link withClientTransform} when a single effect, workflow, or scoped
7
+ * portion of an application needs to add cross-cutting HTTP client behavior
8
+ * such as request logging, retries, proxy routing, additional headers, or test
9
+ * doubles. The configuration is read from the current Effect context, so the
10
+ * transform only applies where the returned effect is run with that context.
11
+ *
12
+ * **Gotchas**
13
+ *
14
+ * - Each call to {@link withClientTransform} replaces the current client
15
+ * transform for the provided effect; compose transforms manually when both
16
+ * behaviors should apply.
17
+ * - The transform receives and returns an `HttpClient`, so it should preserve
18
+ * the OpenRouter client contract while adding behavior around it.
19
+ *
20
+ * @since 4.0.0
3
21
  */
22
+ import * as Context from "effect/Context";
4
23
  import * as Effect from "effect/Effect";
5
24
  import { dual } from "effect/Function";
6
- import * as ServiceMap from "effect/ServiceMap";
7
25
  /**
8
- * @since 1.0.0
26
+ * Context service carrying scoped OpenRouter provider configuration for client
27
+ * operations.
28
+ *
9
29
  * @category services
30
+ * @since 4.0.0
10
31
  */
11
- export class OpenRouterConfig extends /*#__PURE__*/ServiceMap.Service()("@effect/ai-openrouter/OpenRouterConfig") {
32
+ export class OpenRouterConfig extends /*#__PURE__*/Context.Service()("@effect/ai-openrouter/OpenRouterConfig") {
12
33
  /**
13
- * @since 1.0.0
34
+ * Gets the configured OpenRouter service from the current context when present.
35
+ *
36
+ * @since 4.0.0
14
37
  */
15
- static getOrUndefined = /*#__PURE__*/Effect.map(/*#__PURE__*/Effect.services(), services => services.mapUnsafe.get(OpenRouterConfig.key));
38
+ static getOrUndefined = /*#__PURE__*/Effect.map(/*#__PURE__*/Effect.context(), services => services.mapUnsafe.get(OpenRouterConfig.key));
16
39
  }
17
40
  /**
18
- * @since 1.0.0
41
+ * Provides a scoped transform for the OpenRouter HTTP client used by provider
42
+ * operations.
43
+ *
19
44
  * @category configuration
45
+ * @since 4.0.0
20
46
  */
21
47
  export const withClientTransform = /*#__PURE__*/dual(2, (self, transformClient) => Effect.flatMap(OpenRouterConfig.getOrUndefined, config => Effect.provideService(self, OpenRouterConfig, {
22
48
  ...config,
@@ -1 +1 @@
1
- {"version":3,"file":"OpenRouterConfig.js","names":["Effect","dual","ServiceMap","OpenRouterConfig","Service","getOrUndefined","map","services","mapUnsafe","get","key","withClientTransform","self","transformClient","flatMap","config","provideService"],"sources":["../src/OpenRouterConfig.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,MAAM,MAAM,eAAe;AACvC,SAASC,IAAI,QAAQ,iBAAiB;AACtC,OAAO,KAAKC,UAAU,MAAM,mBAAmB;AAG/C;;;;AAIA,OAAM,MAAOC,gBAAiB,sBAAQD,UAAU,CAACE,OAAO,EAGrD,CAAC,wCAAwC,CAAC;EAC3C;;;EAGA,OAAgBC,cAAc,gBAA+DL,MAAM,CAACM,GAAG,cACrGN,MAAM,CAACO,QAAQ,EAAS,EACvBA,QAAQ,IAAKA,QAAQ,CAACC,SAAS,CAACC,GAAG,CAACN,gBAAgB,CAACO,GAAG,CAAC,CAC3D;;AAgBH;;;;AAIA,OAAO,MAAMC,mBAAmB,gBAc5BV,IAAI,CAeN,CAAC,EACD,CAACW,IAAI,EAAEC,eAAe,KACpBb,MAAM,CAACc,OAAO,CACZX,gBAAgB,CAACE,cAAc,EAC9BU,MAAM,IAAKf,MAAM,CAACgB,cAAc,CAACJ,IAAI,EAAET,gBAAgB,EAAE;EAAE,GAAGY,MAAM;EAAEF;AAAe,CAAE,CAAC,CAC1F,CACJ","ignoreList":[]}
1
+ {"version":3,"file":"OpenRouterConfig.js","names":["Context","Effect","dual","OpenRouterConfig","Service","getOrUndefined","map","context","services","mapUnsafe","get","key","withClientTransform","self","transformClient","flatMap","config","provideService"],"sources":["../src/OpenRouterConfig.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;AAqBA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,SAASC,IAAI,QAAQ,iBAAiB;AAGtC;;;;;;;AAOA,OAAM,MAAOC,gBAAiB,sBAAQH,OAAO,CAACI,OAAO,EAGlD,CAAC,wCAAwC,CAAC;EAC3C;;;;;EAKA,OAAgBC,cAAc,gBAA+DJ,MAAM,CAACK,GAAG,cACrGL,MAAM,CAACM,OAAO,EAAS,EACtBC,QAAQ,IAAKA,QAAQ,CAACC,SAAS,CAACC,GAAG,CAACP,gBAAgB,CAACQ,GAAG,CAAC,CAC3D;;AAqBH;;;;;;;AAOA,OAAO,MAAMC,mBAAmB,gBAoB5BV,IAAI,CAqBN,CAAC,EACD,CAACW,IAAI,EAAEC,eAAe,KACpBb,MAAM,CAACc,OAAO,CACZZ,gBAAgB,CAACE,cAAc,EAC9BW,MAAM,IAAKf,MAAM,CAACgB,cAAc,CAACJ,IAAI,EAAEV,gBAAgB,EAAE;EAAE,GAAGa,MAAM;EAAEF;AAAe,CAAE,CAAC,CAC1F,CACJ","ignoreList":[]}
@@ -4,13 +4,13 @@
4
4
  * Provides OpenRouter-specific metadata fields for AI error types through
5
5
  * module augmentation, enabling typed access to OpenRouter error details.
6
6
  *
7
- * @since 1.0.0
7
+ * @since 4.0.0
8
8
  */
9
9
  /**
10
10
  * OpenRouter-specific error metadata fields.
11
11
  *
12
- * @since 1.0.0
13
12
  * @category models
13
+ * @since 4.0.0
14
14
  */
15
15
  export type OpenRouterErrorMetadata = {
16
16
  /**
@@ -29,8 +29,8 @@ export type OpenRouterErrorMetadata = {
29
29
  /**
30
30
  * OpenRouter-specific rate limit metadata fields.
31
31
  *
32
- * @since 1.0.0
33
32
  * @category models
33
+ * @since 4.0.0
34
34
  */
35
35
  export type OpenRouterRateLimitMetadata = OpenRouterErrorMetadata & {
36
36
  readonly limit: string | null;
@@ -39,45 +39,176 @@ export type OpenRouterRateLimitMetadata = OpenRouterErrorMetadata & {
39
39
  readonly resetTokens: string | null;
40
40
  };
41
41
  declare module "effect/unstable/ai/AiError" {
42
- interface RateLimitError {
43
- readonly metadata: {
44
- readonly openrouter?: OpenRouterRateLimitMetadata | null;
45
- };
42
+ /**
43
+ * OpenRouter metadata attached to `RateLimitError` values.
44
+ *
45
+ * **Details**
46
+ *
47
+ * Captures OpenRouter error details together with rate limit header
48
+ * information from responses where the provider rejected the request because
49
+ * a limit was reached.
50
+ *
51
+ * @category configuration
52
+ * @since 4.0.0
53
+ */
54
+ interface RateLimitErrorMetadata {
55
+ /**
56
+ * OpenRouter-specific details for the rate limit response.
57
+ */
58
+ readonly openrouter?: OpenRouterRateLimitMetadata | null;
46
59
  }
47
- interface QuotaExhaustedError {
48
- readonly metadata: {
49
- readonly openrouter?: OpenRouterErrorMetadata | null;
50
- };
60
+ /**
61
+ * OpenRouter metadata attached to `QuotaExhaustedError` values.
62
+ *
63
+ * **Details**
64
+ *
65
+ * Preserves provider error details for failures caused by exhausted account,
66
+ * billing, or usage quota.
67
+ *
68
+ * @category configuration
69
+ * @since 4.0.0
70
+ */
71
+ interface QuotaExhaustedErrorMetadata {
72
+ /**
73
+ * OpenRouter-specific details for the quota exhaustion response.
74
+ */
75
+ readonly openrouter?: OpenRouterErrorMetadata | null;
51
76
  }
52
- interface AuthenticationError {
53
- readonly metadata: {
54
- readonly openrouter?: OpenRouterErrorMetadata | null;
55
- };
77
+ /**
78
+ * OpenRouter metadata attached to `AuthenticationError` values.
79
+ *
80
+ * **Details**
81
+ *
82
+ * Preserves provider error details for failed API key, authorization, or
83
+ * permission checks.
84
+ *
85
+ * @category configuration
86
+ * @since 4.0.0
87
+ */
88
+ interface AuthenticationErrorMetadata {
89
+ /**
90
+ * OpenRouter-specific details for the authentication failure.
91
+ */
92
+ readonly openrouter?: OpenRouterErrorMetadata | null;
93
+ }
94
+ /**
95
+ * OpenRouter metadata attached to `ContentPolicyError` values.
96
+ *
97
+ * **Details**
98
+ *
99
+ * Preserves provider error details when OpenRouter rejects input or output
100
+ * because it violates a content policy.
101
+ *
102
+ * @category configuration
103
+ * @since 4.0.0
104
+ */
105
+ interface ContentPolicyErrorMetadata {
106
+ /**
107
+ * OpenRouter-specific details for the content policy response.
108
+ */
109
+ readonly openrouter?: OpenRouterErrorMetadata | null;
110
+ }
111
+ /**
112
+ * OpenRouter metadata attached to `InvalidRequestError` values.
113
+ *
114
+ * **Details**
115
+ *
116
+ * Preserves provider error details for malformed requests, unsupported
117
+ * parameters, or other request validation failures reported by OpenRouter.
118
+ *
119
+ * @category configuration
120
+ * @since 4.0.0
121
+ */
122
+ interface InvalidRequestErrorMetadata {
123
+ /**
124
+ * OpenRouter-specific details for the invalid request response.
125
+ */
126
+ readonly openrouter?: OpenRouterErrorMetadata | null;
56
127
  }
57
- interface ContentPolicyError {
58
- readonly metadata: {
59
- readonly openrouter?: OpenRouterErrorMetadata | null;
60
- };
128
+ /**
129
+ * OpenRouter metadata attached to `InternalProviderError` values.
130
+ *
131
+ * **Details**
132
+ *
133
+ * Preserves provider error details for OpenRouter-side failures such as
134
+ * transient server errors or overload responses.
135
+ *
136
+ * @category configuration
137
+ * @since 4.0.0
138
+ */
139
+ interface InternalProviderErrorMetadata {
140
+ /**
141
+ * OpenRouter-specific details for the internal provider response.
142
+ */
143
+ readonly openrouter?: OpenRouterErrorMetadata | null;
61
144
  }
62
- interface InvalidRequestError {
63
- readonly metadata: {
64
- readonly openrouter?: OpenRouterErrorMetadata | null;
65
- };
145
+ /**
146
+ * OpenRouter metadata attached to `InvalidOutputError` values.
147
+ *
148
+ * **Details**
149
+ *
150
+ * Preserves provider error details when an OpenRouter response cannot be
151
+ * parsed or validated as the expected output.
152
+ *
153
+ * @category configuration
154
+ * @since 4.0.0
155
+ */
156
+ interface InvalidOutputErrorMetadata {
157
+ /**
158
+ * OpenRouter-specific details for the invalid output response.
159
+ */
160
+ readonly openrouter?: OpenRouterErrorMetadata | null;
66
161
  }
67
- interface InternalProviderError {
68
- readonly metadata: {
69
- readonly openrouter?: OpenRouterErrorMetadata | null;
70
- };
162
+ /**
163
+ * OpenRouter metadata attached to `StructuredOutputError` values.
164
+ *
165
+ * **Details**
166
+ *
167
+ * Preserves provider error details when OpenRouter returns content that does
168
+ * not satisfy the requested structured output schema.
169
+ *
170
+ * @category configuration
171
+ * @since 4.0.0
172
+ */
173
+ interface StructuredOutputErrorMetadata {
174
+ /**
175
+ * OpenRouter-specific details for the structured output failure.
176
+ */
177
+ readonly openrouter?: OpenRouterErrorMetadata | null;
71
178
  }
72
- interface InvalidOutputError {
73
- readonly metadata: {
74
- readonly openrouter?: OpenRouterErrorMetadata | null;
75
- };
179
+ /**
180
+ * OpenRouter metadata attached to `UnsupportedSchemaError` values.
181
+ *
182
+ * **Details**
183
+ *
184
+ * Preserves provider error details when an unsupported schema failure is
185
+ * associated with an OpenRouter response.
186
+ *
187
+ * @category configuration
188
+ * @since 4.0.0
189
+ */
190
+ interface UnsupportedSchemaErrorMetadata {
191
+ /**
192
+ * OpenRouter-specific details for the unsupported schema failure.
193
+ */
194
+ readonly openrouter?: OpenRouterErrorMetadata | null;
76
195
  }
77
- interface UnknownError {
78
- readonly metadata: {
79
- readonly openrouter?: OpenRouterErrorMetadata | null;
80
- };
196
+ /**
197
+ * OpenRouter metadata attached to `UnknownError` values.
198
+ *
199
+ * **Details**
200
+ *
201
+ * Preserves provider error details for OpenRouter failures that do not map
202
+ * cleanly to a more specific AI error category.
203
+ *
204
+ * @category configuration
205
+ * @since 4.0.0
206
+ */
207
+ interface UnknownErrorMetadata {
208
+ /**
209
+ * OpenRouter-specific details for the unclassified provider failure.
210
+ */
211
+ readonly openrouter?: OpenRouterErrorMetadata | null;
81
212
  }
82
213
  }
83
214
  //# sourceMappingURL=OpenRouterError.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OpenRouterError.d.ts","sourceRoot":"","sources":["../src/OpenRouterError.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;IAC1C;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAClC,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG,uBAAuB,GAAG;IAClE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CACpC,CAAA;AAED,OAAO,QAAQ,4BAA4B,CAAC;IAC1C,UAAiB,cAAc;QAC7B,QAAQ,CAAC,QAAQ,EAAE;YACjB,QAAQ,CAAC,UAAU,CAAC,EAAE,2BAA2B,GAAG,IAAI,CAAA;SACzD,CAAA;KACF;IAED,UAAiB,mBAAmB;QAClC,QAAQ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