@opencode-ai/ai 0.0.0-next-17239 → 0.0.0-next-17250

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.
Files changed (176) hide show
  1. package/dist/cache-policy.d.ts +1 -1
  2. package/dist/cache-policy.js +2 -2
  3. package/dist/image-client.d.ts +3 -3
  4. package/dist/image-client.js +1 -1
  5. package/dist/image.d.ts +2 -2
  6. package/dist/image.js +2 -2
  7. package/dist/index.d.ts +18 -18
  8. package/dist/index.js +12 -12
  9. package/dist/llm.d.ts +8 -8
  10. package/dist/llm.js +3 -3
  11. package/dist/protocols/anthropic-messages.d.ts +7 -7
  12. package/dist/protocols/anthropic-messages.js +13 -13
  13. package/dist/protocols/bedrock-converse.d.ts +10 -10
  14. package/dist/protocols/bedrock-converse.js +14 -14
  15. package/dist/protocols/bedrock-event-stream.d.ts +2 -2
  16. package/dist/protocols/bedrock-event-stream.js +3 -3
  17. package/dist/protocols/gemini.d.ts +6 -6
  18. package/dist/protocols/gemini.js +11 -11
  19. package/dist/protocols/google-images.d.ts +3 -3
  20. package/dist/protocols/google-images.js +5 -5
  21. package/dist/protocols/index.d.ts +9 -9
  22. package/dist/protocols/index.js +9 -9
  23. package/dist/protocols/open-responses.d.ts +7 -7
  24. package/dist/protocols/open-responses.js +10 -10
  25. package/dist/protocols/openai-chat.d.ts +7 -7
  26. package/dist/protocols/openai-chat.js +13 -13
  27. package/dist/protocols/openai-compatible-chat.d.ts +3 -3
  28. package/dist/protocols/openai-compatible-chat.js +5 -5
  29. package/dist/protocols/openai-compatible-responses.d.ts +3 -3
  30. package/dist/protocols/openai-compatible-responses.js +4 -4
  31. package/dist/protocols/openai-images.d.ts +3 -3
  32. package/dist/protocols/openai-images.js +6 -6
  33. package/dist/protocols/openai-responses.d.ts +7 -7
  34. package/dist/protocols/openai-responses.js +12 -12
  35. package/dist/protocols/shared.d.ts +7 -7
  36. package/dist/protocols/shared.js +3 -3
  37. package/dist/protocols/utils/bedrock-auth.d.ts +2 -2
  38. package/dist/protocols/utils/bedrock-auth.js +3 -3
  39. package/dist/protocols/utils/bedrock-cache.d.ts +4 -4
  40. package/dist/protocols/utils/bedrock-cache.js +2 -2
  41. package/dist/protocols/utils/bedrock-media.d.ts +2 -2
  42. package/dist/protocols/utils/bedrock-media.js +2 -2
  43. package/dist/protocols/utils/gemini-tool-schema.d.ts +1 -1
  44. package/dist/protocols/utils/gemini-tool-schema.js +2 -2
  45. package/dist/protocols/utils/image-input.d.ts +2 -2
  46. package/dist/protocols/utils/image-input.js +1 -1
  47. package/dist/protocols/utils/lifecycle.d.ts +2 -2
  48. package/dist/protocols/utils/lifecycle.js +2 -2
  49. package/dist/protocols/utils/open-responses-options.d.ts +2 -2
  50. package/dist/protocols/utils/open-responses-options.js +2 -2
  51. package/dist/protocols/utils/openai-options.d.ts +3 -3
  52. package/dist/protocols/utils/openai-options.js +3 -3
  53. package/dist/protocols/utils/tool-schema.d.ts +1 -1
  54. package/dist/protocols/utils/tool-schema.js +2 -2
  55. package/dist/protocols/utils/tool-stream.d.ts +9 -9
  56. package/dist/protocols/utils/tool-stream.js +3 -3
  57. package/dist/protocols/xai-images.d.ts +3 -3
  58. package/dist/protocols/xai-images.js +5 -5
  59. package/dist/protocols/zai-images.d.ts +3 -3
  60. package/dist/protocols/zai-images.js +5 -5
  61. package/dist/protocols.d.ts +1 -1
  62. package/dist/protocols.js +1 -1
  63. package/dist/provider-error.d.ts +1 -1
  64. package/dist/provider-error.js +1 -1
  65. package/dist/provider-package.d.ts +2 -2
  66. package/dist/provider-package.js +1 -1
  67. package/dist/provider.d.ts +2 -2
  68. package/dist/provider.js +1 -1
  69. package/dist/providers/amazon-bedrock/mantle/chat.d.ts +2 -2
  70. package/dist/providers/amazon-bedrock/mantle/chat.js +1 -1
  71. package/dist/providers/amazon-bedrock/mantle/responses.d.ts +2 -2
  72. package/dist/providers/amazon-bedrock/mantle/responses.js +1 -1
  73. package/dist/providers/amazon-bedrock/mantle.d.ts +2 -2
  74. package/dist/providers/amazon-bedrock/mantle.js +1 -1
  75. package/dist/providers/amazon-bedrock-mantle.d.ts +17 -17
  76. package/dist/providers/amazon-bedrock-mantle.js +6 -6
  77. package/dist/providers/amazon-bedrock.d.ts +9 -9
  78. package/dist/providers/amazon-bedrock.js +3 -3
  79. package/dist/providers/anthropic-compatible.d.ts +10 -10
  80. package/dist/providers/anthropic-compatible.js +4 -4
  81. package/dist/providers/anthropic.d.ts +10 -10
  82. package/dist/providers/anthropic.js +4 -4
  83. package/dist/providers/azure/chat.d.ts +2 -2
  84. package/dist/providers/azure/chat.js +1 -1
  85. package/dist/providers/azure/responses.d.ts +2 -2
  86. package/dist/providers/azure/responses.js +1 -1
  87. package/dist/providers/azure.d.ts +14 -14
  88. package/dist/providers/azure.js +7 -7
  89. package/dist/providers/cloudflare.d.ts +12 -12
  90. package/dist/providers/cloudflare.js +4 -4
  91. package/dist/providers/google-vertex/chat.d.ts +2 -2
  92. package/dist/providers/google-vertex/chat.js +1 -1
  93. package/dist/providers/google-vertex/gemini.d.ts +2 -2
  94. package/dist/providers/google-vertex/gemini.js +1 -1
  95. package/dist/providers/google-vertex/messages.d.ts +2 -2
  96. package/dist/providers/google-vertex/messages.js +1 -1
  97. package/dist/providers/google-vertex/responses.d.ts +2 -2
  98. package/dist/providers/google-vertex/responses.js +1 -1
  99. package/dist/providers/google-vertex-chat.d.ts +9 -9
  100. package/dist/providers/google-vertex-chat.js +3 -3
  101. package/dist/providers/google-vertex-messages.d.ts +8 -8
  102. package/dist/providers/google-vertex-messages.js +8 -8
  103. package/dist/providers/google-vertex-responses.d.ts +9 -9
  104. package/dist/providers/google-vertex-responses.js +3 -3
  105. package/dist/providers/google-vertex-shared.d.ts +2 -2
  106. package/dist/providers/google-vertex-shared.js +2 -2
  107. package/dist/providers/google-vertex.d.ts +8 -8
  108. package/dist/providers/google-vertex.js +7 -7
  109. package/dist/providers/google.d.ts +15 -15
  110. package/dist/providers/google.js +4 -4
  111. package/dist/providers/index.d.ts +18 -18
  112. package/dist/providers/index.js +18 -18
  113. package/dist/providers/open-responses-options.d.ts +3 -3
  114. package/dist/providers/open-responses-options.js +1 -1
  115. package/dist/providers/openai/chat.d.ts +2 -2
  116. package/dist/providers/openai/chat.js +1 -1
  117. package/dist/providers/openai/responses.d.ts +2 -2
  118. package/dist/providers/openai/responses.js +1 -1
  119. package/dist/providers/openai-compatible/responses.d.ts +1 -1
  120. package/dist/providers/openai-compatible/responses.js +1 -1
  121. package/dist/providers/openai-compatible-responses.d.ts +10 -10
  122. package/dist/providers/openai-compatible-responses.js +3 -3
  123. package/dist/providers/openai-compatible.d.ts +16 -16
  124. package/dist/providers/openai-compatible.js +4 -4
  125. package/dist/providers/openai-options.d.ts +4 -4
  126. package/dist/providers/openai-options.js +2 -2
  127. package/dist/providers/openai.d.ts +30 -30
  128. package/dist/providers/openai.js +6 -6
  129. package/dist/providers/openrouter.d.ts +11 -11
  130. package/dist/providers/openrouter.js +10 -10
  131. package/dist/providers/xai.d.ts +23 -23
  132. package/dist/providers/xai.js +9 -9
  133. package/dist/providers/zai.d.ts +7 -7
  134. package/dist/providers/zai.js +3 -3
  135. package/dist/providers.d.ts +1 -1
  136. package/dist/providers.js +1 -1
  137. package/dist/route/auth-options.d.ts +2 -2
  138. package/dist/route/auth-options.js +2 -2
  139. package/dist/route/auth.d.ts +2 -2
  140. package/dist/route/auth.js +2 -2
  141. package/dist/route/client.d.ts +11 -11
  142. package/dist/route/client.js +9 -9
  143. package/dist/route/endpoint.d.ts +2 -2
  144. package/dist/route/endpoint.js +2 -2
  145. package/dist/route/executor.d.ts +3 -3
  146. package/dist/route/executor.js +3 -3
  147. package/dist/route/framing.d.ts +2 -2
  148. package/dist/route/framing.js +2 -2
  149. package/dist/route/index.d.ts +16 -16
  150. package/dist/route/index.js +9 -9
  151. package/dist/route/protocol.d.ts +2 -2
  152. package/dist/route/protocol.js +1 -1
  153. package/dist/route/transport/http.d.ts +3 -3
  154. package/dist/route/transport/http.js +5 -5
  155. package/dist/route/transport/index.d.ts +8 -8
  156. package/dist/route/transport/index.js +4 -4
  157. package/dist/route/transport/websocket.d.ts +2 -2
  158. package/dist/route/transport/websocket.js +2 -2
  159. package/dist/route.d.ts +1 -1
  160. package/dist/route.js +1 -1
  161. package/dist/schema/errors.js +1 -1
  162. package/dist/schema/events.d.ts +2 -2
  163. package/dist/schema/events.js +3 -3
  164. package/dist/schema/index.d.ts +5 -5
  165. package/dist/schema/index.js +5 -5
  166. package/dist/schema/messages.d.ts +3 -3
  167. package/dist/schema/messages.js +3 -3
  168. package/dist/schema/options.d.ts +2 -2
  169. package/dist/schema/options.js +2 -2
  170. package/dist/testing.d.ts +20 -20
  171. package/dist/testing.js +3 -3
  172. package/dist/tool-runtime.d.ts +2 -2
  173. package/dist/tool-runtime.js +2 -2
  174. package/dist/tool.d.ts +3 -3
  175. package/dist/tool.js +2 -2
  176. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
- import { Route } from "../route/client";
2
- import { Endpoint } from "../route/endpoint";
3
- import { Framing } from "../route/framing";
4
- import * as OpenAIChat from "./openai-chat";
1
+ import { Route } from "../route/client.js";
2
+ import { Endpoint } from "../route/endpoint.js";
3
+ import { Framing } from "../route/framing.js";
4
+ import * as OpenAIChat from "./openai-chat.js";
5
5
  const ADAPTER = "openai-compatible-chat";
6
6
  /**
7
7
  * Route for non-OpenAI providers that expose an OpenAI Chat-compatible
@@ -17,4 +17,4 @@ export const route = Route.make({
17
17
  endpoint: Endpoint.path("/chat/completions"),
18
18
  framing: Framing.sse,
19
19
  });
20
- export * as OpenAICompatibleChat from "./openai-compatible-chat";
20
+ export * as OpenAICompatibleChat from "./openai-compatible-chat.js";
@@ -1,4 +1,4 @@
1
- import { Route, type RouteRoutedLanguageModelInput } from "../route/client";
1
+ import { Route, type RouteRoutedLanguageModelInput } from "../route/client.js";
2
2
  export type OpenAICompatibleResponsesLanguageModelInput = RouteRoutedLanguageModelInput;
3
3
  /**
4
4
  * Deployment adapter for providers that expose an Open Responses-compatible
@@ -92,5 +92,5 @@ export declare const route: Route<{
92
92
  readonly prompt_cache_key?: string | undefined;
93
93
  readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
94
94
  readonly max_output_tokens?: number | undefined;
95
- }, import("../route/transport/http").HttpPrepared<string>>;
96
- export * as OpenAICompatibleResponses from "./openai-compatible-responses";
95
+ }, import("../route/transport/http.js").HttpPrepared<string>>;
96
+ export * as OpenAICompatibleResponses from "./openai-compatible-responses.js";
@@ -1,6 +1,6 @@
1
- import { Route } from "../route/client";
2
- import { Endpoint } from "../route/endpoint";
3
- import { OpenResponses } from "./open-responses";
1
+ import { Route } from "../route/client.js";
2
+ import { Endpoint } from "../route/endpoint.js";
3
+ import { OpenResponses } from "./open-responses.js";
4
4
  const ADAPTER = "openai-compatible-responses";
5
5
  /**
6
6
  * Deployment adapter for providers that expose an Open Responses-compatible
@@ -14,4 +14,4 @@ export const route = Route.make({
14
14
  endpoint: Endpoint.path(OpenResponses.PATH),
15
15
  transport: OpenResponses.httpTransport,
16
16
  });
17
- export * as OpenAICompatibleResponses from "./openai-compatible-responses";
17
+ export * as OpenAICompatibleResponses from "./openai-compatible-responses.js";
@@ -1,6 +1,6 @@
1
- import { ImageModel, type ImageInput } from "../image";
2
- import { type Definition as AuthDefinition } from "../route/auth";
3
- import { type HttpOptions } from "../schema";
1
+ import { ImageModel, type ImageInput } from "../image.js";
2
+ import { type Definition as AuthDefinition } from "../route/auth.js";
3
+ import { type HttpOptions } from "../schema/index.js";
4
4
  export declare const DEFAULT_BASE_URL = "https://api.openai.com/v1";
5
5
  export declare const PATH = "/images/generations";
6
6
  export declare const EDIT_PATH = "/images/edits";
@@ -1,11 +1,11 @@
1
1
  import { Effect, Encoding, Schema } from "effect";
2
2
  import { Headers, HttpClientRequest, HttpClientResponse } from "effect/unstable/http";
3
- import { ImageModel, GeneratedImage, ImageResponse, } from "../image";
4
- import { Auth } from "../route/auth";
5
- import { InvalidProviderOutputReason, AIError, Usage, mergeHttpOptions, mergeJsonRecords, } from "../schema";
6
- import { ProviderShared } from "./shared";
7
- import { ImageInputs } from "./utils/image-input";
8
- import { OpenAIImage } from "./utils/openai-image";
3
+ import { ImageModel, GeneratedImage, ImageResponse, } from "../image.js";
4
+ import { Auth } from "../route/auth.js";
5
+ import { InvalidProviderOutputReason, AIError, Usage, mergeHttpOptions, mergeJsonRecords, } from "../schema/index.js";
6
+ import { ProviderShared } from "./shared.js";
7
+ import { ImageInputs } from "./utils/image-input.js";
8
+ import { OpenAIImage } from "./utils/openai-image.js";
9
9
  const ADAPTER = "openai-images";
10
10
  export const DEFAULT_BASE_URL = "https://api.openai.com/v1";
11
11
  export const PATH = "/images/generations";
@@ -1,8 +1,8 @@
1
1
  import { Schema } from "effect";
2
- import { Route } from "../route/client";
3
- import { Protocol } from "../route/protocol";
4
- import { HttpTransport } from "../route/transport";
5
- import { OpenResponses } from "./open-responses";
2
+ import { Route } from "../route/client.js";
3
+ import { Protocol } from "../route/protocol.js";
4
+ import { HttpTransport } from "../route/transport/index.js";
5
+ import { OpenResponses } from "./open-responses.js";
6
6
  export declare const DEFAULT_BASE_URL = "https://api.openai.com/v1";
7
7
  export declare const PATH = "/responses";
8
8
  declare const OpenAIResponsesBody: Schema.Struct<{
@@ -481,7 +481,7 @@ export declare const route: Route<{
481
481
  readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
482
482
  readonly max_output_tokens?: number | undefined;
483
483
  }, HttpTransport.HttpPrepared<string>>;
484
- export declare const webSocketTransport: import("../route/transport/websocket").JsonTransport<{
484
+ export declare const webSocketTransport: import("../route/transport/websocket.js").JsonTransport<{
485
485
  readonly input: readonly ({
486
486
  readonly type: "reasoning";
487
487
  readonly summary: readonly {
@@ -801,5 +801,5 @@ export declare const webSocketRoute: Route<{
801
801
  readonly prompt_cache_key?: string | undefined;
802
802
  readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
803
803
  readonly max_output_tokens?: number | undefined;
804
- }, import("../route/transport/websocket").JsonPrepared>;
805
- export * as OpenAIResponses from "./openai-responses";
804
+ }, import("../route/transport/websocket.js").JsonPrepared>;
805
+ export * as OpenAIResponses from "./openai-responses.js";
@@ -1,15 +1,15 @@
1
1
  import { Effect, Encoding, Schema } from "effect";
2
- import { Route } from "../route/client";
3
- import { Auth } from "../route/auth";
4
- import { Endpoint } from "../route/endpoint";
5
- import { Protocol } from "../route/protocol";
6
- import { HttpTransport, WebSocketTransport } from "../route/transport";
7
- import { LLMEvent, LLMRequest } from "../schema";
8
- import { OpenResponses } from "./open-responses";
9
- import { optionalArray, ProviderShared } from "./shared";
10
- import { Lifecycle } from "./utils/lifecycle";
11
- import { OpenAIImage } from "./utils/openai-image";
12
- import { ToolSchemaProjection } from "./utils/tool-schema";
2
+ import { Route } from "../route/client.js";
3
+ import { Auth } from "../route/auth.js";
4
+ import { Endpoint } from "../route/endpoint.js";
5
+ import { Protocol } from "../route/protocol.js";
6
+ import { HttpTransport, WebSocketTransport } from "../route/transport/index.js";
7
+ import { LLMEvent, LLMRequest } from "../schema/index.js";
8
+ import { OpenResponses } from "./open-responses.js";
9
+ import { optionalArray, ProviderShared } from "./shared.js";
10
+ import { Lifecycle } from "./utils/lifecycle.js";
11
+ import { OpenAIImage } from "./utils/openai-image.js";
12
+ import { ToolSchemaProjection } from "./utils/tool-schema.js";
13
13
  const ADAPTER = "openai-responses";
14
14
  const NAME = "OpenAI Responses";
15
15
  export const DEFAULT_BASE_URL = "https://api.openai.com/v1";
@@ -219,4 +219,4 @@ export const webSocketRoute = Route.make({
219
219
  transport: webSocketTransport,
220
220
  defaults: { providerOptions: { openai: { store: false } } },
221
221
  });
222
- export * as OpenAIResponses from "./openai-responses";
222
+ export * as OpenAIResponses from "./openai-responses.js";
@@ -2,8 +2,8 @@ import { Buffer } from "node:buffer";
2
2
  import { Tool } from "@opencode-ai/schema/tool";
3
3
  import { Effect, Schema, Stream } from "effect";
4
4
  import { Headers, HttpClientRequest } from "effect/unstable/http";
5
- import { AIError, type ContentPart, type LLMRequest, type ToolResultPart } from "../schema";
6
- import { isRecord } from "../utils/record";
5
+ import { AIError, type ContentPart, type LLMRequest, type ToolResultPart } from "../schema/index.js";
6
+ import { isRecord } from "../utils/record.js";
7
7
  export { isRecord };
8
8
  export declare const Json: Schema.fromJsonString<Schema.Unknown>;
9
9
  export declare const decodeJson: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => unknown;
@@ -80,13 +80,13 @@ export declare const wrapSystemUpdate: (parts: ReadonlyArray<{
80
80
  * raw retrieved, tool, or web content into privileged updates: keep untrusted
81
81
  * data in ordinary user/tool messages instead.
82
82
  */
83
- export declare const systemUpdateText: (route: string, message: import("..").Message) => Effect.Effect<{
83
+ export declare const systemUpdateText: (route: string, message: import("../schema/messages.js").Message) => Effect.Effect<{
84
84
  readonly type: "text";
85
85
  readonly text: string;
86
86
  readonly metadata?: {
87
87
  readonly [x: string]: unknown;
88
88
  } | undefined;
89
- readonly cache?: import("..").CacheHint | undefined;
89
+ readonly cache?: import("../schema/options.js").CacheHint | undefined;
90
90
  readonly providerMetadata?: {
91
91
  readonly [x: string]: {
92
92
  readonly [x: string]: unknown;
@@ -94,10 +94,10 @@ export declare const systemUpdateText: (route: string, message: import("..").Mes
94
94
  } | undefined;
95
95
  }[], AIError, never>;
96
96
  /** Lower an unsupported privileged update into visible, in-order user text. */
97
- export declare const wrappedSystemUpdate: (route: string, message: import("..").Message) => Effect.Effect<{
97
+ export declare const wrappedSystemUpdate: (route: string, message: import("../schema/messages.js").Message) => Effect.Effect<{
98
98
  type: "text";
99
99
  text: string;
100
- cache: import("..").CacheHint | undefined;
100
+ cache: import("../schema/options.js").CacheHint | undefined;
101
101
  }, AIError, never>;
102
102
  /**
103
103
  * Parse the streamed JSON input of a tool call. Treats an empty string as
@@ -191,4 +191,4 @@ export declare const jsonPost: (input: {
191
191
  readonly body: string;
192
192
  readonly headers?: Headers.Input;
193
193
  }) => HttpClientRequest.HttpClientRequest;
194
- export * as ProviderShared from "./shared";
194
+ export * as ProviderShared from "./shared.js";
@@ -3,8 +3,8 @@ import { Tool } from "@opencode-ai/schema/tool";
3
3
  import { Effect, Schema, Stream } from "effect";
4
4
  import * as Sse from "effect/unstable/encoding/Sse";
5
5
  import { Headers, HttpClientRequest } from "effect/unstable/http";
6
- import { InvalidProviderOutputReason, InvalidRequestReason, AIError, } from "../schema";
7
- import { isRecord } from "../utils/record";
6
+ import { InvalidProviderOutputReason, InvalidRequestReason, AIError, } from "../schema/index.js";
7
+ import { isRecord } from "../utils/record.js";
8
8
  export { isRecord };
9
9
  export const Json = Schema.fromJsonString(Schema.Unknown);
10
10
  export const decodeJson = Schema.decodeUnknownSync(Json);
@@ -235,4 +235,4 @@ export const validateWith = (decode) => (payload) => decode(payload).pipe(Effect
235
235
  * `Schema.encodeSync(payload)` and `ProviderShared.encodeJson(payload)`.
236
236
  */
237
237
  export const jsonPost = (input) => HttpClientRequest.post(input.url).pipe(HttpClientRequest.setHeaders(Headers.set(Headers.fromInput(input.headers), "content-type", "application/json")), HttpClientRequest.bodyText(input.body, "application/json"));
238
- export * as ProviderShared from "./shared";
238
+ export * as ProviderShared from "./shared.js";
@@ -1,4 +1,4 @@
1
- import { Auth } from "../../route/auth";
1
+ import { Auth } from "../../route/auth.js";
2
2
  /**
3
3
  * AWS credentials for SigV4 signing. Bedrock also supports Bearer API key auth,
4
4
  * which provider facades configure as route auth instead of SigV4. STS-vended
@@ -18,4 +18,4 @@ export declare const sigV4: (credentials: Credentials | undefined, options?: {
18
18
  }) => Auth.Definition;
19
19
  /** Bedrock route auth defaults to SigV4 and expects credentials from route configuration. */
20
20
  export declare const auth: Auth.Definition;
21
- export * as BedrockAuth from "./bedrock-auth";
21
+ export * as BedrockAuth from "./bedrock-auth.js";
@@ -1,8 +1,8 @@
1
1
  import { AwsV4Signer } from "aws4fetch";
2
2
  import { Effect } from "effect";
3
3
  import { Headers } from "effect/unstable/http";
4
- import { Auth } from "../../route/auth";
5
- import { ProviderShared } from "../shared";
4
+ import { Auth } from "../../route/auth.js";
5
+ import { ProviderShared } from "../shared.js";
6
6
  const signRequest = (input) => Effect.tryPromise({
7
7
  try: async () => {
8
8
  const signed = await new AwsV4Signer({
@@ -40,4 +40,4 @@ export const sigV4 = (credentials, options = {}) => Auth.custom((input) => {
40
40
  });
41
41
  /** Bedrock route auth defaults to SigV4 and expects credentials from route configuration. */
42
42
  export const auth = sigV4(undefined);
43
- export * as BedrockAuth from "./bedrock-auth";
43
+ export * as BedrockAuth from "./bedrock-auth.js";
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
- import type { CacheHint } from "../../schema";
3
- import { type Breakpoints } from "./cache";
2
+ import type { CacheHint } from "../../schema/index.js";
3
+ import { type Breakpoints } from "./cache.js";
4
4
  export declare const CachePointBlock: Schema.Struct<{
5
5
  readonly cachePoint: Schema.Struct<{
6
6
  readonly type: Schema.tag<"default">;
@@ -9,7 +9,7 @@ export declare const CachePointBlock: Schema.Struct<{
9
9
  }>;
10
10
  export type CachePointBlock = Schema.Schema.Type<typeof CachePointBlock>;
11
11
  export declare const BEDROCK_BREAKPOINT_CAP = 4;
12
- export type { Breakpoints } from "./cache";
12
+ export type { Breakpoints } from "./cache.js";
13
13
  export declare const breakpoints: () => Breakpoints;
14
14
  export declare const block: (breakpoints: Breakpoints, cache: CacheHint | undefined) => CachePointBlock | undefined;
15
- export * as BedrockCache from "./bedrock-cache";
15
+ export * as BedrockCache from "./bedrock-cache.js";
@@ -1,5 +1,5 @@
1
1
  import { Schema } from "effect";
2
- import { newBreakpoints, ttlBucket } from "./cache";
2
+ import { newBreakpoints, ttlBucket } from "./cache.js";
3
3
  // Bedrock cache markers are positional: emit a `cachePoint` block immediately
4
4
  // after the content the caller wants treated as a cacheable prefix. Bedrock
5
5
  // accepts optional `ttl: "5m" | "1h"` on cachePoint, mirroring Anthropic.
@@ -26,4 +26,4 @@ export const block = (breakpoints, cache) => {
26
26
  breakpoints.remaining -= 1;
27
27
  return ttlBucket(cache.ttlSeconds) === "1h" ? DEFAULT_1H : DEFAULT_5M;
28
28
  };
29
- export * as BedrockCache from "./bedrock-cache";
29
+ export * as BedrockCache from "./bedrock-cache.js";
@@ -45,5 +45,5 @@ export declare const lower: (part: {
45
45
  bytes: string;
46
46
  };
47
47
  };
48
- }, import("../..").AIError, never>;
49
- export * as BedrockMedia from "./bedrock-media";
48
+ }, import("../../schema/errors.js").AIError, never>;
49
+ export * as BedrockMedia from "./bedrock-media.js";
@@ -1,5 +1,5 @@
1
1
  import { Effect, Schema } from "effect";
2
- import { ProviderShared } from "../shared";
2
+ import { ProviderShared } from "../shared.js";
3
3
  // Bedrock Converse accepts image `format` as the file extension and
4
4
  // `source.bytes` as base64 in the JSON wire format.
5
5
  export const ImageFormat = Schema.Literals(["png", "jpeg", "gif", "webp"]);
@@ -67,4 +67,4 @@ export const lower = Effect.fn("BedrockMedia.lower")(function* (part) {
67
67
  }
68
68
  return yield* ProviderShared.invalidRequest(`Bedrock Converse does not support media type ${part.mediaType}`);
69
69
  });
70
- export * as BedrockMedia from "./bedrock-media";
70
+ export * as BedrockMedia from "./bedrock-media.js";
@@ -1,2 +1,2 @@
1
1
  export declare const convert: (schema: unknown) => Record<string, unknown> | undefined;
2
- export * as GeminiToolSchema from "./gemini-tool-schema";
2
+ export * as GeminiToolSchema from "./gemini-tool-schema.js";
@@ -1,4 +1,4 @@
1
- import { isRecord } from "../../utils/record";
1
+ import { isRecord } from "../../utils/record.js";
2
2
  // Gemini accepts a JSON Schema-like dialect for tool parameters, but rejects a
3
3
  // handful of common JSON Schema shapes. Keep this projection isolated so the
4
4
  // Gemini protocol file still reads like the other protocol modules.
@@ -100,4 +100,4 @@ const projectNode = (schema, nested = false) => {
100
100
  return flattenedAnyOf ? { ...result, ...flattenedAnyOf } : result;
101
101
  };
102
102
  export const convert = (schema) => projectNode(sanitizeNode(schema));
103
- export * as GeminiToolSchema from "./gemini-tool-schema";
103
+ export * as GeminiToolSchema from "./gemini-tool-schema.js";
@@ -1,6 +1,6 @@
1
1
  import { Effect } from "effect";
2
- import type { ImageInput } from "../../image";
3
- import { AIError } from "../../schema";
2
+ import type { ImageInput } from "../../image.js";
3
+ import { AIError } from "../../schema/index.js";
4
4
  export declare const dataUrl: (input: Extract<ImageInput, {
5
5
  readonly type: "bytes";
6
6
  }>) => string;
@@ -1,5 +1,5 @@
1
1
  import { Effect, Encoding } from "effect";
2
- import { InvalidRequestReason, AIError } from "../../schema";
2
+ import { InvalidRequestReason, AIError } from "../../schema/index.js";
3
3
  const invalid = (module, message) => new AIError({
4
4
  module,
5
5
  method: "generate",
@@ -1,4 +1,4 @@
1
- import { LLMEvent, type FinishReasonDetails, type ProviderMetadata, type Usage } from "../../schema";
1
+ import { LLMEvent, type FinishReasonDetails, type ProviderMetadata, type Usage } from "../../schema/index.js";
2
2
  export interface State {
3
3
  readonly stepStarted: boolean;
4
4
  readonly text: ReadonlySet<string>;
@@ -17,4 +17,4 @@ export declare const finish: (state: State, events: LLMEvent[], input: {
17
17
  readonly usage?: Usage;
18
18
  readonly providerMetadata?: ProviderMetadata;
19
19
  }) => State;
20
- export * as Lifecycle from "./lifecycle";
20
+ export * as Lifecycle from "./lifecycle.js";
@@ -1,4 +1,4 @@
1
- import { LLMEvent } from "../../schema";
1
+ import { LLMEvent } from "../../schema/index.js";
2
2
  export const initial = () => ({ stepStarted: false, text: new Set(), reasoning: new Set() });
3
3
  export const stepStart = (state, events) => {
4
4
  if (state.stepStarted)
@@ -65,4 +65,4 @@ export const finish = (state, events, input) => {
65
65
  }), LLMEvent.finish(input));
66
66
  return { ...stepped, stepStarted: false };
67
67
  };
68
- export * as Lifecycle from "./lifecycle";
68
+ export * as Lifecycle from "./lifecycle.js";
@@ -1,5 +1,5 @@
1
1
  import { Schema } from "effect";
2
- import { TextVerbosity, type LLMRequest } from "../../schema";
2
+ import { TextVerbosity, type LLMRequest } from "../../schema/index.js";
3
3
  export declare const ResponseIncludables: readonly ["file_search_call.results", "web_search_call.results", "web_search_call.action.sources", "message.input_image.image_url", "computer_call_output.output.image_url", "code_interpreter_call.outputs", "reasoning.encrypted_content", "message.output_text.logprobs"];
4
4
  export type ResponseIncludable = (typeof ResponseIncludables)[number];
5
5
  export declare const ServiceTiers: readonly ["auto", "default", "flex", "priority"];
@@ -18,4 +18,4 @@ export interface Resolved {
18
18
  readonly serviceTier?: ServiceTier;
19
19
  }
20
20
  export declare const resolve: (request: LLMRequest) => Resolved;
21
- export * as OpenResponsesOptions from "./open-responses-options";
21
+ export * as OpenResponsesOptions from "./open-responses-options.js";
@@ -1,5 +1,5 @@
1
1
  import { Schema } from "effect";
2
- import { TextVerbosity } from "../../schema";
2
+ import { TextVerbosity } from "../../schema/index.js";
3
3
  export const ResponseIncludables = [
4
4
  "file_search_call.results",
5
5
  "web_search_call.results",
@@ -38,4 +38,4 @@ export const resolve = (request) => {
38
38
  serviceTier: isServiceTier(input?.serviceTier) ? input.serviceTier : undefined,
39
39
  };
40
40
  };
41
- export * as OpenResponsesOptions from "./open-responses-options";
41
+ export * as OpenResponsesOptions from "./open-responses-options.js";
@@ -1,4 +1,4 @@
1
- import { OpenResponsesOptions } from "./open-responses-options";
1
+ import { OpenResponsesOptions } from "./open-responses-options.js";
2
2
  export declare const OpenAIReasoningEfforts: readonly ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
3
3
  export type OpenAIReasoningEffort = string;
4
4
  export declare const OpenAIResponseIncludables: readonly ["file_search_call.results", "web_search_call.results", "web_search_call.action.sources", "message.input_image.image_url", "computer_call_output.output.image_url", "code_interpreter_call.outputs", "reasoning.encrypted_content", "message.output_text.logprobs"];
@@ -10,5 +10,5 @@ export declare const OpenAITextVerbosity: import("effect/Schema").Literals<reado
10
10
  export declare const OpenAIResponseIncludable: import("effect/Schema").Literals<readonly ["file_search_call.results", "web_search_call.results", "web_search_call.action.sources", "message.input_image.image_url", "computer_call_output.output.image_url", "code_interpreter_call.outputs", "reasoning.encrypted_content", "message.output_text.logprobs"]>;
11
11
  export declare const OpenAIServiceTier: import("effect/Schema").Literals<readonly ["auto", "default", "flex", "priority"]>;
12
12
  export declare const isReasoningEffort: (effort: unknown) => effort is OpenAIReasoningEffort;
13
- export declare const resolve: (request: import("../..").LLMRequest) => OpenResponsesOptions.Resolved;
14
- export * as OpenAIOptions from "./openai-options";
13
+ export declare const resolve: (request: import("../../schema/messages.js").LLMRequest) => OpenResponsesOptions.Resolved;
14
+ export * as OpenAIOptions from "./openai-options.js";
@@ -1,5 +1,5 @@
1
- import { ReasoningEfforts } from "../../schema";
2
- import { OpenResponsesOptions } from "./open-responses-options";
1
+ import { ReasoningEfforts } from "../../schema/index.js";
2
+ import { OpenResponsesOptions } from "./open-responses-options.js";
3
3
  export const OpenAIReasoningEfforts = ReasoningEfforts;
4
4
  // Mirrors OpenAI's `ResponseIncludable` union from the official SDK. Keep this
5
5
  // in lockstep with `openai-node/src/resources/responses/responses.ts`.
@@ -11,4 +11,4 @@ export const OpenAIResponseIncludable = OpenResponsesOptions.ResponseIncludableS
11
11
  export const OpenAIServiceTier = OpenResponsesOptions.ServiceTierSchema;
12
12
  export const isReasoningEffort = (effort) => typeof effort === "string";
13
13
  export const resolve = OpenResponsesOptions.resolve;
14
- export * as OpenAIOptions from "./openai-options";
14
+ export * as OpenAIOptions from "./openai-options.js";
@@ -1,4 +1,4 @@
1
- import type { JsonSchema, LanguageModelToolSchemaCompatibility } from "../../schema";
1
+ import type { JsonSchema, LanguageModelToolSchemaCompatibility } from "../../schema/index.js";
2
2
  export declare const ToolSchemaProjection: {
3
3
  readonly gemini: (schema: JsonSchema) => JsonSchema;
4
4
  readonly modelCompatibility: (schema: JsonSchema, compatibility: LanguageModelToolSchemaCompatibility | undefined) => JsonSchema;
@@ -1,5 +1,5 @@
1
- import { isRecord } from "../../utils/record";
2
- import { GeminiToolSchema } from "./gemini-tool-schema";
1
+ import { isRecord } from "../../utils/record.js";
2
+ import { GeminiToolSchema } from "./gemini-tool-schema.js";
3
3
  const removeNullSchemas = (value) => {
4
4
  if (Array.isArray(value))
5
5
  return value.map(removeNullSchemas);
@@ -1,6 +1,6 @@
1
1
  import { Effect } from "effect";
2
- import { AIError, LLMEvent, type ProviderMetadata } from "../../schema";
3
- import { type ToolAccumulator } from "../shared";
2
+ import { AIError, LLMEvent, type ProviderMetadata } from "../../schema/index.js";
3
+ import { type ToolAccumulator } from "../shared.js";
4
4
  type StreamKey = string | number;
5
5
  /**
6
6
  * One pending streamed tool call. Providers emit the tool identity and JSON
@@ -229,7 +229,7 @@ export declare const finish: <K extends StreamKey>(route: string, tools: State<K
229
229
  readonly [x: string]: unknown;
230
230
  };
231
231
  } | undefined;
232
- readonly usage?: import("../..").Usage | undefined;
232
+ readonly usage?: import("../../schema/events.js").Usage | undefined;
233
233
  } | {
234
234
  readonly type: "finish";
235
235
  readonly reason: {
@@ -241,7 +241,7 @@ export declare const finish: <K extends StreamKey>(route: string, tools: State<K
241
241
  readonly [x: string]: unknown;
242
242
  };
243
243
  } | undefined;
244
- readonly usage?: import("../..").Usage | undefined;
244
+ readonly usage?: import("../../schema/events.js").Usage | undefined;
245
245
  } | {
246
246
  readonly type: "provider-error";
247
247
  readonly message: string;
@@ -422,7 +422,7 @@ export declare const finishWithInput: <K extends StreamKey>(route: string, tools
422
422
  readonly [x: string]: unknown;
423
423
  };
424
424
  } | undefined;
425
- readonly usage?: import("../..").Usage | undefined;
425
+ readonly usage?: import("../../schema/events.js").Usage | undefined;
426
426
  } | {
427
427
  readonly type: "finish";
428
428
  readonly reason: {
@@ -434,7 +434,7 @@ export declare const finishWithInput: <K extends StreamKey>(route: string, tools
434
434
  readonly [x: string]: unknown;
435
435
  };
436
436
  } | undefined;
437
- readonly usage?: import("../..").Usage | undefined;
437
+ readonly usage?: import("../../schema/events.js").Usage | undefined;
438
438
  } | {
439
439
  readonly type: "provider-error";
440
440
  readonly message: string;
@@ -612,7 +612,7 @@ export declare const finishAll: <K extends StreamKey>(route: string, tools: Stat
612
612
  readonly [x: string]: unknown;
613
613
  };
614
614
  } | undefined;
615
- readonly usage?: import("../..").Usage | undefined;
615
+ readonly usage?: import("../../schema/events.js").Usage | undefined;
616
616
  } | {
617
617
  readonly type: "finish";
618
618
  readonly reason: {
@@ -624,7 +624,7 @@ export declare const finishAll: <K extends StreamKey>(route: string, tools: Stat
624
624
  readonly [x: string]: unknown;
625
625
  };
626
626
  } | undefined;
627
- readonly usage?: import("../..").Usage | undefined;
627
+ readonly usage?: import("../../schema/events.js").Usage | undefined;
628
628
  } | {
629
629
  readonly type: "provider-error";
630
630
  readonly message: string;
@@ -636,4 +636,4 @@ export declare const finishAll: <K extends StreamKey>(route: string, tools: Stat
636
636
  readonly classification?: "context-overflow" | "payload-too-large" | undefined;
637
637
  })[];
638
638
  }, AIError, never>;
639
- export * as ToolStream from "./tool-stream";
639
+ export * as ToolStream from "./tool-stream.js";
@@ -1,6 +1,6 @@
1
1
  import { Effect } from "effect";
2
- import { AIError, LLMEvent } from "../../schema";
3
- import { eventError, parseToolInput } from "../shared";
2
+ import { AIError, LLMEvent } from "../../schema/index.js";
3
+ import { eventError, parseToolInput } from "../shared.js";
4
4
  /** Create empty accumulator state for one provider stream. */
5
5
  export const empty = () => ({});
6
6
  const withTool = (tools, key, tool) => {
@@ -138,4 +138,4 @@ export const finishAll = (route, tools) => Effect.gen(function* () {
138
138
  events: yield* Effect.forEach(pending, (tool) => toolCall(route, tool).pipe(Effect.map((event) => finishEvents(tool, event)))).pipe(Effect.map((events) => events.flat())),
139
139
  };
140
140
  });
141
- export * as ToolStream from "./tool-stream";
141
+ export * as ToolStream from "./tool-stream.js";
@@ -1,6 +1,6 @@
1
- import { ImageModel } from "../image";
2
- import { type Definition as AuthDefinition } from "../route/auth";
3
- import { type HttpOptions } from "../schema";
1
+ import { ImageModel } from "../image.js";
2
+ import { type Definition as AuthDefinition } from "../route/auth.js";
3
+ import { type HttpOptions } from "../schema/index.js";
4
4
  export declare const DEFAULT_BASE_URL = "https://api.x.ai/v1";
5
5
  export declare const PATH = "/images/generations";
6
6
  export declare const EDIT_PATH = "/images/edits";
@@ -1,10 +1,10 @@
1
1
  import { Effect, Encoding, Schema } from "effect";
2
2
  import { Headers, HttpClientRequest } from "effect/unstable/http";
3
- import { GeneratedImage, ImageModel, ImageResponse } from "../image";
4
- import { Auth } from "../route/auth";
5
- import { InvalidProviderOutputReason, AIError, Usage, mergeHttpOptions, mergeJsonRecords, } from "../schema";
6
- import { ProviderShared, optionalNull } from "./shared";
7
- import { ImageInputs } from "./utils/image-input";
3
+ import { GeneratedImage, ImageModel, ImageResponse } from "../image.js";
4
+ import { Auth } from "../route/auth.js";
5
+ import { InvalidProviderOutputReason, AIError, Usage, mergeHttpOptions, mergeJsonRecords, } from "../schema/index.js";
6
+ import { ProviderShared, optionalNull } from "./shared.js";
7
+ import { ImageInputs } from "./utils/image-input.js";
8
8
  const ADAPTER = "xai-images";
9
9
  export const DEFAULT_BASE_URL = "https://api.x.ai/v1";
10
10
  export const PATH = "/images/generations";
@@ -1,6 +1,6 @@
1
- import { ImageModel } from "../image";
2
- import { type Definition as AuthDefinition } from "../route/auth";
3
- import { type HttpOptions } from "../schema";
1
+ import { ImageModel } from "../image.js";
2
+ import { type Definition as AuthDefinition } from "../route/auth.js";
3
+ import { type HttpOptions } from "../schema/index.js";
4
4
  export declare const DEFAULT_BASE_URL = "https://api.z.ai/api/paas/v4";
5
5
  export declare const PATH = "/images/generations";
6
6
  export type ZAIImageString<Known extends string> = Known | (string & {});
@@ -1,10 +1,10 @@
1
1
  import { Effect, Schema } from "effect";
2
2
  import { Headers, HttpClientRequest } from "effect/unstable/http";
3
- import { GeneratedImage, ImageModel, ImageResponse } from "../image";
4
- import { Auth } from "../route/auth";
5
- import { InvalidProviderOutputReason, AIError, mergeHttpOptions, mergeJsonRecords } from "../schema";
6
- import { ProviderShared } from "./shared";
7
- import { ImageInputs } from "./utils/image-input";
3
+ import { GeneratedImage, ImageModel, ImageResponse } from "../image.js";
4
+ import { Auth } from "../route/auth.js";
5
+ import { InvalidProviderOutputReason, AIError, mergeHttpOptions, mergeJsonRecords, } from "../schema/index.js";
6
+ import { ProviderShared } from "./shared.js";
7
+ import { ImageInputs } from "./utils/image-input.js";
8
8
  const ADAPTER = "zai-images";
9
9
  export const DEFAULT_BASE_URL = "https://api.z.ai/api/paas/v4";
10
10
  export const PATH = "/images/generations";
@@ -1 +1 @@
1
- export * from "./protocols/index";
1
+ export * from "./protocols/index.js";
package/dist/protocols.js CHANGED
@@ -1 +1 @@
1
- export * from "./protocols/index";
1
+ export * from "./protocols/index.js";
@@ -1,4 +1,4 @@
1
- import { AIError, type HttpContext, type HttpRateLimitDetails, type ProviderMetadata } from "./schema";
1
+ import { AIError, type HttpContext, type HttpRateLimitDetails, type ProviderMetadata } from "./schema/index.js";
2
2
  export declare const isContextOverflow: (message: string) => boolean;
3
3
  export declare const isPayloadTooLarge: (message: string) => boolean;
4
4
  export declare const isContextOverflowFailure: (failure: unknown) => boolean;
@@ -1,5 +1,5 @@
1
1
  import { Option, Schema } from "effect";
2
- import { AuthenticationReason, ContentPolicyReason, InvalidRequestReason, AIError, ProviderErrorEvent, ProviderInternalReason, QuotaExceededReason, RateLimitReason, UnknownProviderReason, } from "./schema";
2
+ import { AuthenticationReason, ContentPolicyReason, InvalidRequestReason, AIError, ProviderErrorEvent, ProviderInternalReason, QuotaExceededReason, RateLimitReason, UnknownProviderReason, } from "./schema/index.js";
3
3
  const patterns = [
4
4
  /prompt is too long/i,
5
5
  /input is too long for requested model/i,
@@ -1,4 +1,4 @@
1
- import type { LanguageModel, ProviderOptions } from "./schema";
1
+ import type { LanguageModel, ProviderOptions } from "./schema/index.js";
2
2
  export interface Settings extends Readonly<Record<string, unknown>> {
3
3
  readonly baseURL?: string;
4
4
  readonly headers?: Readonly<Record<string, string>>;
@@ -12,4 +12,4 @@ export interface Settings extends Readonly<Record<string, unknown>> {
12
12
  export interface Definition<ProviderSettings extends Settings = Settings, Options extends ProviderOptions = ProviderOptions> {
13
13
  readonly model: (modelID: string, settings: ProviderSettings) => LanguageModel<Options>;
14
14
  }
15
- export * as ProviderPackage from "./provider-package";
15
+ export * as ProviderPackage from "./provider-package.js";
@@ -1 +1 @@
1
- export * as ProviderPackage from "./provider-package";
1
+ export * as ProviderPackage from "./provider-package.js";