diff --git a/bun.lock b/bun.lock index 12b5771fa7..c475b0c427 100644 --- a/bun.lock +++ b/bun.lock @@ -1081,8 +1081,9 @@ "@tanstack/virtual-core@3.17.3": "patches/@tanstack%2Fvirtual-core@3.17.3.patch", "@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch", "@ai-sdk/mistral@3.0.51": "patches/@ai-sdk%2Fmistral@3.0.51.patch", - "@npmcli/agent@4.0.2": "patches/@npmcli%2Fagent@4.0.2.patch", + "@ff-labs/fff-bun@0.10.1": "patches/@ff-labs%2Ffff-bun@0.10.1.patch", "@silvia-odwyer/photon-node@0.3.4": "patches/@silvia-odwyer%2Fphoton-node@0.3.4.patch", + "@npmcli/agent@4.0.2": "patches/@npmcli%2Fagent@4.0.2.patch", "solid-js@1.9.10": "patches/solid-js@1.9.10.patch", "@ai-sdk/google@3.0.73": "patches/@ai-sdk%2Fgoogle@3.0.73.patch", "@dnd-kit/dom@0.5.0": "patches/@dnd-kit%2Fdom@0.5.0.patch", diff --git a/package.json b/package.json index e5698fca30..23c5416f1a 100644 --- a/package.json +++ b/package.json @@ -171,6 +171,7 @@ "@pierre/trees@1.0.0-beta.4": "patches/@pierre%2Ftrees@1.0.0-beta.4.patch", "@modelcontextprotocol/sdk@1.29.0": "patches/@modelcontextprotocol%2Fsdk@1.29.0.patch", "effect@4.0.0-beta.101": "patches/effect@4.0.0-beta.101.patch", - "@tanstack/virtual-core@3.17.3": "patches/@tanstack%2Fvirtual-core@3.17.3.patch" + "@tanstack/virtual-core@3.17.3": "patches/@tanstack%2Fvirtual-core@3.17.3.patch", + "@ff-labs/fff-bun@0.10.1": "patches/@ff-labs%2Ffff-bun@0.10.1.patch" } } diff --git a/packages/ai/src/cache-policy.ts b/packages/ai/src/cache-policy.ts index 7f4dc9c5d9..f6eb1b1025 100644 --- a/packages/ai/src/cache-policy.ts +++ b/packages/ai/src/cache-policy.ts @@ -10,8 +10,8 @@ // // Manual `cache: CacheHint` placements on individual parts are preserved and // count against the four-breakpoint budget; auto only fills remaining slots. -import { CacheHint, type CachePolicy, type CachePolicyObject } from "./schema/options" -import { LLMRequest, Message, ToolDefinition, type ContentPart } from "./schema/messages" +import { CacheHint, type CachePolicy, type CachePolicyObject } from "./schema/options.js" +import { LLMRequest, Message, ToolDefinition, type ContentPart } from "./schema/messages.js" const AUTO: CachePolicyObject = { tools: true, diff --git a/packages/ai/src/image-client.ts b/packages/ai/src/image-client.ts index 9c5f67066d..ea09825399 100644 --- a/packages/ai/src/image-client.ts +++ b/packages/ai/src/image-client.ts @@ -1,7 +1,7 @@ import { Context, Effect, Layer } from "effect" -import { RequestExecutor } from "./route/executor" -import type { ImageOptions, ImageRequest, ImageRequestFor, ImageResponse } from "./image" -import type { AIError } from "./schema" +import { RequestExecutor } from "./route/executor.js" +import type { ImageOptions, ImageRequest, ImageRequestFor, ImageResponse } from "./image.js" +import type { AIError } from "./schema/index.js" export type Execute = RequestExecutor.Interface["execute"] diff --git a/packages/ai/src/image.ts b/packages/ai/src/image.ts index cb2e9310e6..640565b518 100644 --- a/packages/ai/src/image.ts +++ b/packages/ai/src/image.ts @@ -1,6 +1,6 @@ import { Effect, Schema } from "effect" -import { HttpOptions, InvalidRequestReason, AIError, ModelID, ProviderID, ProviderMetadata, Usage } from "./schema" -import { ImageClient, Service, type Execute as ImageExecute } from "./image-client" +import { HttpOptions, InvalidRequestReason, AIError, ModelID, ProviderID, ProviderMetadata, Usage } from "./schema/index.js" +import { ImageClient, Service, type Execute as ImageExecute } from "./image-client.js" export interface ImageRoute { readonly id: string diff --git a/packages/ai/src/index.ts b/packages/ai/src/index.ts index 1962ea9ff5..606caead46 100644 --- a/packages/ai/src/index.ts +++ b/packages/ai/src/index.ts @@ -1,22 +1,22 @@ -export { LLMClient } from "./route/client" -export { ImageClient } from "./image-client" -export { Auth } from "./route/auth" -export { Provider } from "./provider" -export { ProviderPackage } from "./provider-package" -export { isContextOverflow, isContextOverflowFailure } from "./provider-error" +export { LLMClient } from "./route/client.js" +export { ImageClient } from "./image-client.js" +export { Auth } from "./route/auth.js" +export { Provider } from "./provider.js" +export { ProviderPackage } from "./provider-package.js" +export { isContextOverflow, isContextOverflowFailure } from "./provider-error.js" export type { RouteLanguageModelInput, RouteRoutedLanguageModelInput, Interface as LLMClientShape, Service as LLMClientService, -} from "./route/client" -export * from "./schema" -export { GeneratedImage, ImageInput, ImageInputSchema, ImageModel, ImageRequest, ImageResponse } from "./image" -export type { ImageModelOptions, ImageOptions, ImageRequestFor, ImageRequestInput, ImageRoute } from "./image" -export { Image } from "./image" -export { Tool, ToolFailure, toDefinitions } from "./tool" -export { ToolRuntime } from "./tool-runtime" -export type { DispatchResult as ToolDispatchResult, ToolSettlement } from "./tool-runtime" +} from "./route/client.js" +export * from "./schema/index.js" +export { GeneratedImage, ImageInput, ImageInputSchema, ImageModel, ImageRequest, ImageResponse } from "./image.js" +export type { ImageModelOptions, ImageOptions, ImageRequestFor, ImageRequestInput, ImageRoute } from "./image.js" +export { Image } from "./image.js" +export { Tool, ToolFailure, toDefinitions } from "./tool.js" +export { ToolRuntime } from "./tool-runtime.js" +export type { DispatchResult as ToolDispatchResult, ToolSettlement } from "./tool-runtime.js" export type { AnyExecutableTool, AnyTool, @@ -29,11 +29,11 @@ export type { Tools, ToolSchema, ToolToModelOutput, -} from "./tool" -export * as LLM from "./llm" +} from "./tool.js" +export * as LLM from "./llm.js" export type { Definition as ProviderDefinition, LanguageModelFactory as ProviderLanguageModelFactory, LanguageModelOptions as ProviderLanguageModelOptions, -} from "./provider" -export type { Definition as ProviderPackageDefinition, Settings as ProviderPackageSettings } from "./provider-package" +} from "./provider.js" +export type { Definition as ProviderPackageDefinition, Settings as ProviderPackageSettings } from "./provider-package.js" diff --git a/packages/ai/src/llm.ts b/packages/ai/src/llm.ts index 9d1af143ae..b64e1b80f4 100644 --- a/packages/ai/src/llm.ts +++ b/packages/ai/src/llm.ts @@ -1,5 +1,5 @@ import { Effect, JsonSchema, Schema } from "effect" -import { LLMClient, Service } from "./route/client" +import { LLMClient, Service } from "./route/client.js" import { GenerationOptions, HttpOptions, @@ -15,8 +15,8 @@ import { ToolDefinition, type ContentPart, type LanguageModelProviderOptions, -} from "./schema" -import { make as makeTool, toDefinitions, type ToolSchema } from "./tool" +} from "./schema/index.js" +import { make as makeTool, toDefinitions, type ToolSchema } from "./tool.js" /** Input accepted by `LLM.request`, normalized into the canonical `LLMRequest` class. */ export type RequestInput = Omit< diff --git a/packages/ai/src/protocols.ts b/packages/ai/src/protocols.ts index 96aa6ee43d..2e07102e73 100644 --- a/packages/ai/src/protocols.ts +++ b/packages/ai/src/protocols.ts @@ -1 +1 @@ -export * from "./protocols/index" +export * from "./protocols/index.js" diff --git a/packages/ai/src/protocols/anthropic-messages.ts b/packages/ai/src/protocols/anthropic-messages.ts index 8d0e6e599d..7539e54d09 100644 --- a/packages/ai/src/protocols/anthropic-messages.ts +++ b/packages/ai/src/protocols/anthropic-messages.ts @@ -1,10 +1,10 @@ import { Effect, Schema } from "effect" import { Tool } from "@opencode-ai/schema/tool" -import { Route } from "../route/client" -import { Auth } from "../route/auth" -import { Endpoint } from "../route/endpoint" -import { Framing } from "../route/framing" -import { Protocol } from "../route/protocol" +import { Route } from "../route/client.js" +import { Auth } from "../route/auth.js" +import { Endpoint } from "../route/endpoint.js" +import { Framing } from "../route/framing.js" +import { Protocol } from "../route/protocol.js" import { AIError, LLMEvent, @@ -21,13 +21,13 @@ import { type ToolCallPart, type ToolDefinition, type ToolResultPart, -} from "../schema" -import { JsonObject, optionalArray, optionalNull, ProviderShared } from "./shared" -import { classifyProviderFailure } from "../provider-error" -import * as Cache from "./utils/cache" -import { Lifecycle } from "./utils/lifecycle" -import { ToolSchemaProjection } from "./utils/tool-schema" -import { ToolStream } from "./utils/tool-stream" +} from "../schema/index.js" +import { JsonObject, optionalArray, optionalNull, ProviderShared } from "./shared.js" +import { classifyProviderFailure } from "../provider-error.js" +import * as Cache from "./utils/cache.js" +import { Lifecycle } from "./utils/lifecycle.js" +import { ToolSchemaProjection } from "./utils/tool-schema.js" +import { ToolStream } from "./utils/tool-stream.js" const ADAPTER = "anthropic-messages" const MEDIA_MIMES = new Set([...ProviderShared.IMAGE_MIMES, ...ProviderShared.PDF_MIMES]) @@ -1029,4 +1029,4 @@ export const route = Route.make({ headers: () => ({ "anthropic-version": "2023-06-01" }), }) -export * as AnthropicMessages from "./anthropic-messages" +export * as AnthropicMessages from "./anthropic-messages.js" diff --git a/packages/ai/src/protocols/bedrock-converse.ts b/packages/ai/src/protocols/bedrock-converse.ts index 438f006bae..efe3a3ba5d 100644 --- a/packages/ai/src/protocols/bedrock-converse.ts +++ b/packages/ai/src/protocols/bedrock-converse.ts @@ -1,7 +1,7 @@ import { Effect, Schema } from "effect" -import { Route } from "../route/client" -import { Endpoint } from "../route/endpoint" -import { Protocol } from "../route/protocol" +import { Route } from "../route/client.js" +import { Endpoint } from "../route/endpoint.js" +import { Protocol } from "../route/protocol.js" import { AIError, LLMEvent, @@ -17,20 +17,20 @@ import { type ToolCallPart, type ToolDefinition, type ToolResultPart, -} from "../schema" -import { BedrockEventStream } from "./bedrock-event-stream" -import { classifyProviderFailure } from "../provider-error" -import { JsonObject, optionalArray, ProviderShared } from "./shared" -import { BedrockAuth } from "./utils/bedrock-auth" -import { BedrockCache } from "./utils/bedrock-cache" -import { BedrockMedia } from "./utils/bedrock-media" -import { Lifecycle } from "./utils/lifecycle" -import { ToolSchemaProjection } from "./utils/tool-schema" -import { ToolStream } from "./utils/tool-stream" +} from "../schema/index.js" +import { BedrockEventStream } from "./bedrock-event-stream.js" +import { classifyProviderFailure } from "../provider-error.js" +import { JsonObject, optionalArray, ProviderShared } from "./shared.js" +import { BedrockAuth } from "./utils/bedrock-auth.js" +import { BedrockCache } from "./utils/bedrock-cache.js" +import { BedrockMedia } from "./utils/bedrock-media.js" +import { Lifecycle } from "./utils/lifecycle.js" +import { ToolSchemaProjection } from "./utils/tool-schema.js" +import { ToolStream } from "./utils/tool-stream.js" const ADAPTER = "bedrock-converse" -export type { Credentials as BedrockCredentials } from "./utils/bedrock-auth" +export type { Credentials as BedrockCredentials } from "./utils/bedrock-auth.js" // ============================================================================= // Request Body Schema @@ -737,4 +737,4 @@ export const route = Route.make({ export const sigV4Auth = BedrockAuth.sigV4 -export * as BedrockConverse from "./bedrock-converse" +export * as BedrockConverse from "./bedrock-converse.js" diff --git a/packages/ai/src/protocols/bedrock-event-stream.ts b/packages/ai/src/protocols/bedrock-event-stream.ts index 6d5b58ad8e..782a1b77ca 100644 --- a/packages/ai/src/protocols/bedrock-event-stream.ts +++ b/packages/ai/src/protocols/bedrock-event-stream.ts @@ -1,8 +1,8 @@ import { EventStreamCodec } from "@smithy/eventstream-codec" import { fromUtf8, toUtf8 } from "@smithy/util-utf8" import { Effect, Stream } from "effect" -import { Framing } from "../route/framing" -import { ProviderShared } from "./shared" +import { Framing } from "../route/framing.js" +import { ProviderShared } from "./shared.js" // Bedrock streams responses using the AWS event stream binary protocol — each // frame is `[length:4][headers-length:4][prelude-crc:4][headers][payload][crc:4]`. @@ -98,4 +98,4 @@ export const framing = (route: string): Framing.Definition => ({ frame: (bytes) => bytes.pipe(Stream.mapAccumEffect(() => initialFrameBuffer, consumeFrames(route))), }) -export * as BedrockEventStream from "./bedrock-event-stream" +export * as BedrockEventStream from "./bedrock-event-stream.js" diff --git a/packages/ai/src/protocols/gemini.ts b/packages/ai/src/protocols/gemini.ts index b84bb16fa2..428f674b71 100644 --- a/packages/ai/src/protocols/gemini.ts +++ b/packages/ai/src/protocols/gemini.ts @@ -1,10 +1,10 @@ import { Effect, Schema } from "effect" import { Tool } from "@opencode-ai/schema/tool" -import { Route } from "../route/client" -import { Auth } from "../route/auth" -import { Endpoint } from "../route/endpoint" -import { Framing } from "../route/framing" -import { Protocol } from "../route/protocol" +import { Route } from "../route/client.js" +import { Auth } from "../route/auth.js" +import { Endpoint } from "../route/endpoint.js" +import { Framing } from "../route/framing.js" +import { Protocol } from "../route/protocol.js" import { LLMEvent, Usage, @@ -17,11 +17,11 @@ import { type TextPart, type ToolCallPart, type ToolDefinition, -} from "../schema" -import { JsonObject, optionalArray, ProviderShared } from "./shared" -import { GeminiToolSchema } from "./utils/gemini-tool-schema" -import { Lifecycle } from "./utils/lifecycle" -import { ToolSchemaProjection } from "./utils/tool-schema" +} from "../schema/index.js" +import { JsonObject, optionalArray, ProviderShared } from "./shared.js" +import { GeminiToolSchema } from "./utils/gemini-tool-schema.js" +import { Lifecycle } from "./utils/lifecycle.js" +import { ToolSchemaProjection } from "./utils/tool-schema.js" const ADAPTER = "gemini" const MEDIA_MIMES = new Set(ProviderShared.MEDIA_MIMES) @@ -643,4 +643,4 @@ export const route = Route.make({ framing: Framing.sse, }) -export * as Gemini from "./gemini" +export * as Gemini from "./gemini.js" diff --git a/packages/ai/src/protocols/google-images.ts b/packages/ai/src/protocols/google-images.ts index bad287d0f8..2182935da4 100644 --- a/packages/ai/src/protocols/google-images.ts +++ b/packages/ai/src/protocols/google-images.ts @@ -7,8 +7,8 @@ import { type ImageInput, type ImageRequestFor, type ImageRoute, -} from "../image" -import { Auth, type Definition as AuthDefinition } from "../route/auth" +} from "../image.js" +import { Auth, type Definition as AuthDefinition } from "../route/auth.js" import { InvalidProviderOutputReason, AIError, @@ -17,9 +17,9 @@ import { mergeJsonRecords, type HttpOptions, type ProviderMetadata, -} from "../schema" -import { ProviderShared } from "./shared" -import { ImageInputs } from "./utils/image-input" +} from "../schema/index.js" +import { ProviderShared } from "./shared.js" +import { ImageInputs } from "./utils/image-input.js" const ADAPTER = "google-images" export const DEFAULT_BASE_URL = "https://generativelanguage.googleapis.com/v1beta" diff --git a/packages/ai/src/protocols/index.ts b/packages/ai/src/protocols/index.ts index b677e1a599..d68650330b 100644 --- a/packages/ai/src/protocols/index.ts +++ b/packages/ai/src/protocols/index.ts @@ -1,9 +1,9 @@ -export * as AnthropicMessages from "./anthropic-messages" -export * as BedrockConverse from "./bedrock-converse" -export * as Gemini from "./gemini" -export * as OpenAIChat from "./openai-chat" -export * as OpenAIImages from "./openai-images" -export * as OpenAICompatibleChat from "./openai-compatible-chat" -export * as OpenAICompatibleResponses from "./openai-compatible-responses" -export * as OpenAIResponses from "./openai-responses" -export * as OpenResponses from "./open-responses" +export * as AnthropicMessages from "./anthropic-messages.js" +export * as BedrockConverse from "./bedrock-converse.js" +export * as Gemini from "./gemini.js" +export * as OpenAIChat from "./openai-chat.js" +export * as OpenAIImages from "./openai-images.js" +export * as OpenAICompatibleChat from "./openai-compatible-chat.js" +export * as OpenAICompatibleResponses from "./openai-compatible-responses.js" +export * as OpenAIResponses from "./openai-responses.js" +export * as OpenResponses from "./open-responses.js" diff --git a/packages/ai/src/protocols/open-responses.ts b/packages/ai/src/protocols/open-responses.ts index d6c99cd7a4..c898d96e4c 100644 --- a/packages/ai/src/protocols/open-responses.ts +++ b/packages/ai/src/protocols/open-responses.ts @@ -1,7 +1,7 @@ import { Effect, Schema } from "effect" import type { Content } from "@opencode-ai/schema/tool" -import { HttpTransport } from "../route/transport" -import { Protocol } from "../route/protocol" +import { HttpTransport } from "../route/transport/index.js" +import { Protocol } from "../route/protocol.js" import { AIError, LLMEvent, @@ -16,13 +16,13 @@ import { type ToolCallPart, type ToolDefinition, type ToolResultPart, -} from "../schema" -import { JsonObject, optionalArray, optionalNull, ProviderShared } from "./shared" -import { classifyProviderFailure } from "../provider-error" -import { OpenResponsesOptions } from "./utils/open-responses-options" -import { Lifecycle } from "./utils/lifecycle" -import { ToolSchemaProjection } from "./utils/tool-schema" -import { ToolStream } from "./utils/tool-stream" +} from "../schema/index.js" +import { JsonObject, optionalArray, optionalNull, ProviderShared } from "./shared.js" +import { classifyProviderFailure } from "../provider-error.js" +import { OpenResponsesOptions } from "./utils/open-responses-options.js" +import { Lifecycle } from "./utils/lifecycle.js" +import { ToolSchemaProjection } from "./utils/tool-schema.js" +import { ToolStream } from "./utils/tool-stream.js" const ADAPTER = "open-responses" const NAME = "Open Responses" @@ -1061,4 +1061,4 @@ export const protocol = Protocol.make({ export const httpTransport = HttpTransport.sseJson.with() -export * as OpenResponses from "./open-responses" +export * as OpenResponses from "./open-responses.js" diff --git a/packages/ai/src/protocols/openai-chat.ts b/packages/ai/src/protocols/openai-chat.ts index 69ae01cd3b..da9cd7e762 100644 --- a/packages/ai/src/protocols/openai-chat.ts +++ b/packages/ai/src/protocols/openai-chat.ts @@ -1,10 +1,10 @@ import { Effect, Schema } from "effect" import { Tool } from "@opencode-ai/schema/tool" -import { Route } from "../route/client" -import { Auth } from "../route/auth" -import { Endpoint } from "../route/endpoint" -import { HttpTransport } from "../route/transport" -import { Protocol } from "../route/protocol" +import { Route } from "../route/client.js" +import { Auth } from "../route/auth.js" +import { Endpoint } from "../route/endpoint.js" +import { HttpTransport } from "../route/transport/index.js" +import { Protocol } from "../route/protocol.js" import { AIError, LLMEvent, @@ -19,13 +19,13 @@ import { type TextPart, type ToolCallPart, type ToolDefinition, -} from "../schema" -import { classifyProviderFailure } from "../provider-error" -import { isRecord, JsonObject, optionalArray, optionalNull, ProviderShared } from "./shared" -import { OpenAIOptions } from "./utils/openai-options" -import { Lifecycle } from "./utils/lifecycle" -import { ToolSchemaProjection } from "./utils/tool-schema" -import { ToolStream } from "./utils/tool-stream" +} from "../schema/index.js" +import { classifyProviderFailure } from "../provider-error.js" +import { isRecord, JsonObject, optionalArray, optionalNull, ProviderShared } from "./shared.js" +import { OpenAIOptions } from "./utils/openai-options.js" +import { Lifecycle } from "./utils/lifecycle.js" +import { ToolSchemaProjection } from "./utils/tool-schema.js" +import { ToolStream } from "./utils/tool-stream.js" const ADAPTER = "openai-chat" const IMAGE_MIMES = new Set(ProviderShared.IMAGE_MIMES) @@ -884,4 +884,4 @@ export const route = Route.make({ transport: httpTransport, }) -export * as OpenAIChat from "./openai-chat" +export * as OpenAIChat from "./openai-chat.js" diff --git a/packages/ai/src/protocols/openai-compatible-chat.ts b/packages/ai/src/protocols/openai-compatible-chat.ts index dff4e21a58..d992b3f9ed 100644 --- a/packages/ai/src/protocols/openai-compatible-chat.ts +++ b/packages/ai/src/protocols/openai-compatible-chat.ts @@ -1,7 +1,7 @@ -import { Route, type RouteRoutedLanguageModelInput } from "../route/client" -import { Endpoint } from "../route/endpoint" -import { Framing } from "../route/framing" -import * as OpenAIChat from "./openai-chat" +import { Route, type RouteRoutedLanguageModelInput } from "../route/client.js" +import { Endpoint } from "../route/endpoint.js" +import { Framing } from "../route/framing.js" +import * as OpenAIChat from "./openai-chat.js" const ADAPTER = "openai-compatible-chat" @@ -22,4 +22,4 @@ export const route = Route.make({ framing: Framing.sse, }) -export * as OpenAICompatibleChat from "./openai-compatible-chat" +export * as OpenAICompatibleChat from "./openai-compatible-chat.js" diff --git a/packages/ai/src/protocols/openai-compatible-responses.ts b/packages/ai/src/protocols/openai-compatible-responses.ts index a2b0bedfa5..2bd8bf0eaa 100644 --- a/packages/ai/src/protocols/openai-compatible-responses.ts +++ b/packages/ai/src/protocols/openai-compatible-responses.ts @@ -1,6 +1,6 @@ -import { Route, type RouteRoutedLanguageModelInput } from "../route/client" -import { Endpoint } from "../route/endpoint" -import { OpenResponses } from "./open-responses" +import { Route, type RouteRoutedLanguageModelInput } from "../route/client.js" +import { Endpoint } from "../route/endpoint.js" +import { OpenResponses } from "./open-responses.js" const ADAPTER = "openai-compatible-responses" @@ -19,4 +19,4 @@ export const route = Route.make({ transport: OpenResponses.httpTransport, }) -export * as OpenAICompatibleResponses from "./openai-compatible-responses" +export * as OpenAICompatibleResponses from "./openai-compatible-responses.js" diff --git a/packages/ai/src/protocols/openai-images.ts b/packages/ai/src/protocols/openai-images.ts index 2cf70bfa2a..feae659c96 100644 --- a/packages/ai/src/protocols/openai-images.ts +++ b/packages/ai/src/protocols/openai-images.ts @@ -7,8 +7,8 @@ import { type ImageInput, type ImageRequestFor, type ImageRoute, -} from "../image" -import { Auth, type Definition as AuthDefinition } from "../route/auth" +} from "../image.js" +import { Auth, type Definition as AuthDefinition } from "../route/auth.js" import { InvalidProviderOutputReason, AIError, @@ -16,10 +16,10 @@ import { mergeHttpOptions, mergeJsonRecords, type HttpOptions, -} from "../schema" -import { ProviderShared } from "./shared" -import { ImageInputs } from "./utils/image-input" -import { OpenAIImage } from "./utils/openai-image" +} from "../schema/index.js" +import { ProviderShared } from "./shared.js" +import { ImageInputs } from "./utils/image-input.js" +import { OpenAIImage } from "./utils/openai-image.js" const ADAPTER = "openai-images" export const DEFAULT_BASE_URL = "https://api.openai.com/v1" diff --git a/packages/ai/src/protocols/openai-responses.ts b/packages/ai/src/protocols/openai-responses.ts index 43237e89f6..72b5b14639 100644 --- a/packages/ai/src/protocols/openai-responses.ts +++ b/packages/ai/src/protocols/openai-responses.ts @@ -1,15 +1,15 @@ import { Effect, Encoding, Schema } from "effect" -import { Route } from "../route/client" -import { Auth } from "../route/auth" -import { Endpoint } from "../route/endpoint" -import { Protocol } from "../route/protocol" -import { HttpTransport, WebSocketTransport } from "../route/transport" -import { LLMEvent, LLMRequest, type JsonSchema, type ToolDefinition } from "../schema" -import { OpenResponses } from "./open-responses" -import { optionalArray, ProviderShared } from "./shared" -import { Lifecycle } from "./utils/lifecycle" -import { OpenAIImage } from "./utils/openai-image" -import { ToolSchemaProjection } from "./utils/tool-schema" +import { Route } from "../route/client.js" +import { Auth } from "../route/auth.js" +import { Endpoint } from "../route/endpoint.js" +import { Protocol } from "../route/protocol.js" +import { HttpTransport, WebSocketTransport } from "../route/transport/index.js" +import { LLMEvent, LLMRequest, type JsonSchema, type ToolDefinition } from "../schema/index.js" +import { OpenResponses } from "./open-responses.js" +import { optionalArray, ProviderShared } from "./shared.js" +import { Lifecycle } from "./utils/lifecycle.js" +import { OpenAIImage } from "./utils/openai-image.js" +import { ToolSchemaProjection } from "./utils/tool-schema.js" const ADAPTER = "openai-responses" const NAME = "OpenAI Responses" @@ -290,4 +290,4 @@ export const webSocketRoute = Route.make({ defaults: { providerOptions: { openai: { store: false } } }, }) -export * as OpenAIResponses from "./openai-responses" +export * as OpenAIResponses from "./openai-responses.js" diff --git a/packages/ai/src/protocols/shared.ts b/packages/ai/src/protocols/shared.ts index 6dc24481dc..07178c4ff5 100644 --- a/packages/ai/src/protocols/shared.ts +++ b/packages/ai/src/protocols/shared.ts @@ -12,8 +12,8 @@ import { type MediaPart, type TextPart, type ToolResultPart, -} from "../schema" -import { isRecord } from "../utils/record" +} from "../schema/index.js" +import { isRecord } from "../utils/record.js" export { isRecord } export const Json = Schema.fromJsonString(Schema.Unknown) @@ -324,4 +324,4 @@ export const jsonPost = (input: { readonly url: string; readonly body: string; r HttpClientRequest.bodyText(input.body, "application/json"), ) -export * as ProviderShared from "./shared" +export * as ProviderShared from "./shared.js" diff --git a/packages/ai/src/protocols/utils/bedrock-auth.ts b/packages/ai/src/protocols/utils/bedrock-auth.ts index c322e4b9ee..f198fdd308 100644 --- a/packages/ai/src/protocols/utils/bedrock-auth.ts +++ b/packages/ai/src/protocols/utils/bedrock-auth.ts @@ -1,8 +1,8 @@ import { AwsV4Signer } from "aws4fetch" import { Effect } from "effect" import { Headers } from "effect/unstable/http" -import { Auth, type AuthInput } from "../../route/auth" -import { ProviderShared } from "../shared" +import { Auth, type AuthInput } from "../../route/auth.js" +import { ProviderShared } from "../shared.js" /** * AWS credentials for SigV4 signing. Bedrock also supports Bearer API key auth, @@ -74,4 +74,4 @@ export const sigV4 = ( /** Bedrock route auth defaults to SigV4 and expects credentials from route configuration. */ export const auth = sigV4(undefined) -export * as BedrockAuth from "./bedrock-auth" +export * as BedrockAuth from "./bedrock-auth.js" diff --git a/packages/ai/src/protocols/utils/bedrock-cache.ts b/packages/ai/src/protocols/utils/bedrock-cache.ts index fab4d07b5c..a995582687 100644 --- a/packages/ai/src/protocols/utils/bedrock-cache.ts +++ b/packages/ai/src/protocols/utils/bedrock-cache.ts @@ -1,6 +1,6 @@ import { Schema } from "effect" -import type { CacheHint } from "../../schema" -import { newBreakpoints, ttlBucket, type Breakpoints } from "./cache" +import type { CacheHint } from "../../schema/index.js" +import { newBreakpoints, ttlBucket, type Breakpoints } from "./cache.js" // Bedrock cache markers are positional: emit a `cachePoint` block immediately // after the content the caller wants treated as a cacheable prefix. Bedrock @@ -18,7 +18,7 @@ export type CachePointBlock = Schema.Schema.Type // budget is respected across `system`, `messages`, and `tools`. export const BEDROCK_BREAKPOINT_CAP = 4 -export type { Breakpoints } from "./cache" +export type { Breakpoints } from "./cache.js" export const breakpoints = () => newBreakpoints(BEDROCK_BREAKPOINT_CAP) const DEFAULT_5M: CachePointBlock = { cachePoint: { type: "default" } } @@ -34,4 +34,4 @@ export const block = (breakpoints: Breakpoints, cache: CacheHint | undefined): C return ttlBucket(cache.ttlSeconds) === "1h" ? DEFAULT_1H : DEFAULT_5M } -export * as BedrockCache from "./bedrock-cache" +export * as BedrockCache from "./bedrock-cache.js" diff --git a/packages/ai/src/protocols/utils/bedrock-media.ts b/packages/ai/src/protocols/utils/bedrock-media.ts index 6a12966b7b..136b764938 100644 --- a/packages/ai/src/protocols/utils/bedrock-media.ts +++ b/packages/ai/src/protocols/utils/bedrock-media.ts @@ -1,6 +1,6 @@ import { Effect, Schema } from "effect" -import type { MediaPart } from "../../schema" -import { ProviderShared } from "../shared" +import type { MediaPart } from "../../schema/index.js" +import { ProviderShared } from "../shared.js" // Bedrock Converse accepts image `format` as the file extension and // `source.bytes` as base64 in the JSON wire format. @@ -89,4 +89,4 @@ export const lower = Effect.fn("BedrockMedia.lower")(function* (part: MediaPart) return yield* ProviderShared.invalidRequest(`Bedrock Converse does not support media type ${part.mediaType}`) }) -export * as BedrockMedia from "./bedrock-media" +export * as BedrockMedia from "./bedrock-media.js" diff --git a/packages/ai/src/protocols/utils/gemini-tool-schema.ts b/packages/ai/src/protocols/utils/gemini-tool-schema.ts index 991dfdfbf9..b3c94de121 100644 --- a/packages/ai/src/protocols/utils/gemini-tool-schema.ts +++ b/packages/ai/src/protocols/utils/gemini-tool-schema.ts @@ -1,4 +1,4 @@ -import { isRecord } from "../../utils/record" +import { isRecord } from "../../utils/record.js" // Gemini accepts a JSON Schema-like dialect for tool parameters, but rejects a // handful of common JSON Schema shapes. Keep this projection isolated so the @@ -116,4 +116,4 @@ const projectNode = (schema: unknown, nested = false): Record | export const convert = (schema: unknown) => projectNode(sanitizeNode(schema)) -export * as GeminiToolSchema from "./gemini-tool-schema" +export * as GeminiToolSchema from "./gemini-tool-schema.js" diff --git a/packages/ai/src/protocols/utils/image-input.ts b/packages/ai/src/protocols/utils/image-input.ts index 4f45868a0d..7376699d2a 100644 --- a/packages/ai/src/protocols/utils/image-input.ts +++ b/packages/ai/src/protocols/utils/image-input.ts @@ -1,6 +1,6 @@ import { Effect, Encoding } from "effect" -import type { ImageInput } from "../../image" -import { InvalidRequestReason, AIError } from "../../schema" +import type { ImageInput } from "../../image.js" +import { InvalidRequestReason, AIError } from "../../schema/index.js" const invalid = (module: string, message: string) => new AIError({ diff --git a/packages/ai/src/protocols/utils/lifecycle.ts b/packages/ai/src/protocols/utils/lifecycle.ts index 1ee8b608f6..f415e895ea 100644 --- a/packages/ai/src/protocols/utils/lifecycle.ts +++ b/packages/ai/src/protocols/utils/lifecycle.ts @@ -1,4 +1,4 @@ -import { LLMEvent, type FinishReasonDetails, type ProviderMetadata, type Usage } from "../../schema" +import { LLMEvent, type FinishReasonDetails, type ProviderMetadata, type Usage } from "../../schema/index.js" export interface State { readonly stepStarted: boolean @@ -102,4 +102,4 @@ export const finish = ( return { ...stepped, stepStarted: false } } -export * as Lifecycle from "./lifecycle" +export * as Lifecycle from "./lifecycle.js" diff --git a/packages/ai/src/protocols/utils/open-responses-options.ts b/packages/ai/src/protocols/utils/open-responses-options.ts index 38a0e7063f..834606817e 100644 --- a/packages/ai/src/protocols/utils/open-responses-options.ts +++ b/packages/ai/src/protocols/utils/open-responses-options.ts @@ -1,5 +1,5 @@ import { Schema } from "effect" -import { TextVerbosity, type LLMRequest } from "../../schema" +import { TextVerbosity, type LLMRequest } from "../../schema/index.js" export const ResponseIncludables = [ "file_search_call.results", @@ -60,4 +60,4 @@ export const resolve = (request: LLMRequest): Resolved => { } } -export * as OpenResponsesOptions from "./open-responses-options" +export * as OpenResponsesOptions from "./open-responses-options.js" diff --git a/packages/ai/src/protocols/utils/openai-options.ts b/packages/ai/src/protocols/utils/openai-options.ts index fc95e6a362..7e3e02fb54 100644 --- a/packages/ai/src/protocols/utils/openai-options.ts +++ b/packages/ai/src/protocols/utils/openai-options.ts @@ -1,5 +1,5 @@ -import { ReasoningEfforts } from "../../schema" -import { OpenResponsesOptions } from "./open-responses-options" +import { ReasoningEfforts } from "../../schema/index.js" +import { OpenResponsesOptions } from "./open-responses-options.js" export const OpenAIReasoningEfforts = ReasoningEfforts export type OpenAIReasoningEffort = string @@ -20,4 +20,4 @@ export const isReasoningEffort = (effort: unknown): effort is OpenAIReasoningEff export const resolve = OpenResponsesOptions.resolve -export * as OpenAIOptions from "./openai-options" +export * as OpenAIOptions from "./openai-options.js" diff --git a/packages/ai/src/protocols/utils/tool-schema.ts b/packages/ai/src/protocols/utils/tool-schema.ts index 75025187ca..3abf9b0d5c 100644 --- a/packages/ai/src/protocols/utils/tool-schema.ts +++ b/packages/ai/src/protocols/utils/tool-schema.ts @@ -1,6 +1,6 @@ -import type { JsonSchema, LanguageModelToolSchemaCompatibility } from "../../schema" -import { isRecord } from "../../utils/record" -import { GeminiToolSchema } from "./gemini-tool-schema" +import type { JsonSchema, LanguageModelToolSchemaCompatibility } from "../../schema/index.js" +import { isRecord } from "../../utils/record.js" +import { GeminiToolSchema } from "./gemini-tool-schema.js" const removeNullSchemas = (value: unknown): unknown => { if (Array.isArray(value)) return value.map(removeNullSchemas) diff --git a/packages/ai/src/protocols/utils/tool-stream.ts b/packages/ai/src/protocols/utils/tool-stream.ts index aeb6b5573d..80bd829b5c 100644 --- a/packages/ai/src/protocols/utils/tool-stream.ts +++ b/packages/ai/src/protocols/utils/tool-stream.ts @@ -1,6 +1,6 @@ import { Effect } from "effect" -import { AIError, LLMEvent, type ProviderMetadata, type ToolCall, type ToolInputError } from "../../schema" -import { eventError, parseToolInput, type ToolAccumulator } from "../shared" +import { AIError, LLMEvent, type ProviderMetadata, type ToolCall, type ToolInputError } from "../../schema/index.js" +import { eventError, parseToolInput, type ToolAccumulator } from "../shared.js" type StreamKey = string | number @@ -223,4 +223,4 @@ export const finishAll = (route: string, tools: State) = } }) -export * as ToolStream from "./tool-stream" +export * as ToolStream from "./tool-stream.js" diff --git a/packages/ai/src/protocols/xai-images.ts b/packages/ai/src/protocols/xai-images.ts index 2350ffde94..cc432a158d 100644 --- a/packages/ai/src/protocols/xai-images.ts +++ b/packages/ai/src/protocols/xai-images.ts @@ -1,7 +1,7 @@ import { Effect, Encoding, Schema } from "effect" import { Headers, HttpClientRequest } from "effect/unstable/http" -import { GeneratedImage, ImageModel, ImageResponse, type ImageRequestFor, type ImageRoute } from "../image" -import { Auth, type Definition as AuthDefinition } from "../route/auth" +import { GeneratedImage, ImageModel, ImageResponse, type ImageRequestFor, type ImageRoute } from "../image.js" +import { Auth, type Definition as AuthDefinition } from "../route/auth.js" import { InvalidProviderOutputReason, AIError, @@ -9,9 +9,9 @@ import { mergeHttpOptions, mergeJsonRecords, type HttpOptions, -} from "../schema" -import { ProviderShared, optionalNull } from "./shared" -import { ImageInputs } from "./utils/image-input" +} from "../schema/index.js" +import { ProviderShared, optionalNull } from "./shared.js" +import { ImageInputs } from "./utils/image-input.js" const ADAPTER = "xai-images" export const DEFAULT_BASE_URL = "https://api.x.ai/v1" diff --git a/packages/ai/src/protocols/zai-images.ts b/packages/ai/src/protocols/zai-images.ts index 6d3b510323..2eb55ef0e0 100644 --- a/packages/ai/src/protocols/zai-images.ts +++ b/packages/ai/src/protocols/zai-images.ts @@ -1,10 +1,10 @@ import { Effect, Schema } from "effect" import { Headers, HttpClientRequest } from "effect/unstable/http" -import { GeneratedImage, ImageModel, ImageResponse, type ImageRequestFor, type ImageRoute } from "../image" -import { Auth, type Definition as AuthDefinition } from "../route/auth" -import { InvalidProviderOutputReason, AIError, mergeHttpOptions, mergeJsonRecords, type HttpOptions } from "../schema" -import { ProviderShared } from "./shared" -import { ImageInputs } from "./utils/image-input" +import { GeneratedImage, ImageModel, ImageResponse, type ImageRequestFor, type ImageRoute } from "../image.js" +import { Auth, type Definition as AuthDefinition } from "../route/auth.js" +import { InvalidProviderOutputReason, AIError, mergeHttpOptions, mergeJsonRecords, type HttpOptions } from "../schema/index.js" +import { ProviderShared } from "./shared.js" +import { ImageInputs } from "./utils/image-input.js" const ADAPTER = "zai-images" export const DEFAULT_BASE_URL = "https://api.z.ai/api/paas/v4" diff --git a/packages/ai/src/provider-error.ts b/packages/ai/src/provider-error.ts index 3429000712..ed8976788f 100644 --- a/packages/ai/src/provider-error.ts +++ b/packages/ai/src/provider-error.ts @@ -12,7 +12,7 @@ import { type HttpContext, type HttpRateLimitDetails, type ProviderMetadata, -} from "./schema" +} from "./schema/index.js" const patterns = [ /prompt is too long/i, diff --git a/packages/ai/src/provider-package.ts b/packages/ai/src/provider-package.ts index 3d47cd48c1..359d6ca480 100644 --- a/packages/ai/src/provider-package.ts +++ b/packages/ai/src/provider-package.ts @@ -1,4 +1,4 @@ -import type { LanguageModel, ProviderOptions } from "./schema" +import type { LanguageModel, ProviderOptions } from "./schema/index.js" export interface Settings extends Readonly> { readonly baseURL?: string @@ -18,4 +18,4 @@ export interface Definition< readonly model: (modelID: string, settings: ProviderSettings) => LanguageModel } -export * as ProviderPackage from "./provider-package" +export * as ProviderPackage from "./provider-package.js" diff --git a/packages/ai/src/provider.ts b/packages/ai/src/provider.ts index 6ff1f58c19..265896cbcf 100644 --- a/packages/ai/src/provider.ts +++ b/packages/ai/src/provider.ts @@ -1,4 +1,4 @@ -import type { LanguageModel, ModelID, ProviderID } from "./schema" +import type { LanguageModel, ModelID, ProviderID } from "./schema/index.js" export type LanguageModelOptions = Pick @@ -33,4 +33,4 @@ export const make = ( definition: NoExtraFields, ) => definition -export * as Provider from "./provider" +export * as Provider from "./provider.js" diff --git a/packages/ai/src/providers.ts b/packages/ai/src/providers.ts index e43654f054..0016cf669e 100644 --- a/packages/ai/src/providers.ts +++ b/packages/ai/src/providers.ts @@ -1 +1 @@ -export * from "./providers/index" +export * from "./providers/index.js" diff --git a/packages/ai/src/providers/amazon-bedrock-mantle.ts b/packages/ai/src/providers/amazon-bedrock-mantle.ts index 4e9e88eeca..30738c2698 100644 --- a/packages/ai/src/providers/amazon-bedrock-mantle.ts +++ b/packages/ai/src/providers/amazon-bedrock-mantle.ts @@ -1,11 +1,11 @@ -import { Auth } from "../route/auth" -import type { Route as RouteDef, RouteDefaultsInput } from "../route/client" -import type { ProviderPackage } from "../provider-package" -import { OpenAIChat } from "../protocols/openai-chat" -import { OpenAIResponses } from "../protocols/openai-responses" -import { BedrockAuth, type Credentials } from "../protocols/utils/bedrock-auth" -import { ProviderID, type ModelID } from "../schema" -import { withOpenAIOptions, type OpenAIProviderOptionsInput } from "./openai-options" +import { Auth } from "../route/auth.js" +import type { Route as RouteDef, RouteDefaultsInput } from "../route/client.js" +import type { ProviderPackage } from "../provider-package.js" +import { OpenAIChat } from "../protocols/openai-chat.js" +import { OpenAIResponses } from "../protocols/openai-responses.js" +import { BedrockAuth, type Credentials } from "../protocols/utils/bedrock-auth.js" +import { ProviderID, type ModelID } from "../schema/index.js" +import { withOpenAIOptions, type OpenAIProviderOptionsInput } from "./openai-options.js" export const id = ProviderID.make("amazon-bedrock") diff --git a/packages/ai/src/providers/amazon-bedrock.ts b/packages/ai/src/providers/amazon-bedrock.ts index 4e5040c9ec..7cbd4d7656 100644 --- a/packages/ai/src/providers/amazon-bedrock.ts +++ b/packages/ai/src/providers/amazon-bedrock.ts @@ -1,9 +1,9 @@ -import type { RouteDefaultsInput } from "../route/client" -import { Auth } from "../route/auth" -import type { ProviderPackage } from "../provider-package" -import { ProviderID, type ModelID } from "../schema" -import * as BedrockConverse from "../protocols/bedrock-converse" -import type { BedrockCredentials } from "../protocols/bedrock-converse" +import type { RouteDefaultsInput } from "../route/client.js" +import { Auth } from "../route/auth.js" +import type { ProviderPackage } from "../provider-package.js" +import { ProviderID, type ModelID } from "../schema/index.js" +import * as BedrockConverse from "../protocols/bedrock-converse.js" +import type { BedrockCredentials } from "../protocols/bedrock-converse.js" export const id = ProviderID.make("amazon-bedrock") diff --git a/packages/ai/src/providers/amazon-bedrock/mantle.ts b/packages/ai/src/providers/amazon-bedrock/mantle.ts index 5aecf50d13..9916ebe87d 100644 --- a/packages/ai/src/providers/amazon-bedrock/mantle.ts +++ b/packages/ai/src/providers/amazon-bedrock/mantle.ts @@ -1,2 +1,2 @@ -export { chatModel as model } from "../amazon-bedrock-mantle" -export type { Settings } from "../amazon-bedrock-mantle" +export { chatModel as model } from "../amazon-bedrock-mantle.js" +export type { Settings } from "../amazon-bedrock-mantle.js" diff --git a/packages/ai/src/providers/amazon-bedrock/mantle/chat.ts b/packages/ai/src/providers/amazon-bedrock/mantle/chat.ts index 4eaddf792c..abeed60697 100644 --- a/packages/ai/src/providers/amazon-bedrock/mantle/chat.ts +++ b/packages/ai/src/providers/amazon-bedrock/mantle/chat.ts @@ -1,2 +1,2 @@ -export { chatModel as model } from "../../amazon-bedrock-mantle" -export type { Settings } from "../../amazon-bedrock-mantle" +export { chatModel as model } from "../../amazon-bedrock-mantle.js" +export type { Settings } from "../../amazon-bedrock-mantle.js" diff --git a/packages/ai/src/providers/amazon-bedrock/mantle/responses.ts b/packages/ai/src/providers/amazon-bedrock/mantle/responses.ts index 4f1a4f0c42..1495c3d1e7 100644 --- a/packages/ai/src/providers/amazon-bedrock/mantle/responses.ts +++ b/packages/ai/src/providers/amazon-bedrock/mantle/responses.ts @@ -1,2 +1,2 @@ -export { responsesModel as model } from "../../amazon-bedrock-mantle" -export type { Settings } from "../../amazon-bedrock-mantle" +export { responsesModel as model } from "../../amazon-bedrock-mantle.js" +export type { Settings } from "../../amazon-bedrock-mantle.js" diff --git a/packages/ai/src/providers/anthropic-compatible.ts b/packages/ai/src/providers/anthropic-compatible.ts index 93d1bac048..28743b1af5 100644 --- a/packages/ai/src/providers/anthropic-compatible.ts +++ b/packages/ai/src/providers/anthropic-compatible.ts @@ -1,9 +1,9 @@ -import type { ProviderPackage } from "../provider-package" -import { AnthropicMessages } from "../protocols/anthropic-messages" -import { Auth } from "../route/auth" -import type { ProviderAuthOption } from "../route/auth-options" -import type { RouteDefaultsInput } from "../route/client" -import { ProviderID, type ModelID } from "../schema" +import type { ProviderPackage } from "../provider-package.js" +import { AnthropicMessages } from "../protocols/anthropic-messages.js" +import { Auth } from "../route/auth.js" +import type { ProviderAuthOption } from "../route/auth-options.js" +import type { RouteDefaultsInput } from "../route/client.js" +import { ProviderID, type ModelID } from "../schema/index.js" export type AnthropicOptionsInput = AnthropicMessages.OptionsInput export type AnthropicProviderOptionsInput = AnthropicMessages.ProviderOptionsInput @@ -74,4 +74,4 @@ export const model: ProviderPackage.Definition { return adc(project) } -export * as GoogleVertexShared from "./google-vertex-shared" +export * as GoogleVertexShared from "./google-vertex-shared.js" diff --git a/packages/ai/src/providers/google-vertex.ts b/packages/ai/src/providers/google-vertex.ts index 78037a2828..4180412d86 100644 --- a/packages/ai/src/providers/google-vertex.ts +++ b/packages/ai/src/providers/google-vertex.ts @@ -1,11 +1,11 @@ -import type { ProviderPackage } from "../provider-package" -import { Gemini } from "../protocols/gemini" -import { Auth } from "../route/auth" -import { Route, type RouteDefaultsInput } from "../route/client" -import { Endpoint } from "../route/endpoint" -import { Framing } from "../route/framing" -import { ProviderID, type ModelID } from "../schema" -import { GoogleVertexShared } from "./google-vertex-shared" +import type { ProviderPackage } from "../provider-package.js" +import { Gemini } from "../protocols/gemini.js" +import { Auth } from "../route/auth.js" +import { Route, type RouteDefaultsInput } from "../route/client.js" +import { Endpoint } from "../route/endpoint.js" +import { Framing } from "../route/framing.js" +import { ProviderID, type ModelID } from "../schema/index.js" +import { GoogleVertexShared } from "./google-vertex-shared.js" export type GeminiOptionsInput = Gemini.OptionsInput export type GeminiProviderOptionsInput = Gemini.ProviderOptionsInput diff --git a/packages/ai/src/providers/google-vertex/chat.ts b/packages/ai/src/providers/google-vertex/chat.ts index 085e5e1a28..5ef11cb0e1 100644 --- a/packages/ai/src/providers/google-vertex/chat.ts +++ b/packages/ai/src/providers/google-vertex/chat.ts @@ -1,2 +1,2 @@ -export { model } from "../google-vertex-chat" -export type { Settings } from "../google-vertex-chat" +export { model } from "../google-vertex-chat.js" +export type { Settings } from "../google-vertex-chat.js" diff --git a/packages/ai/src/providers/google-vertex/gemini.ts b/packages/ai/src/providers/google-vertex/gemini.ts index d48c493513..66a8ae6604 100644 --- a/packages/ai/src/providers/google-vertex/gemini.ts +++ b/packages/ai/src/providers/google-vertex/gemini.ts @@ -1,2 +1,2 @@ -export { model } from "../google-vertex" -export type { Settings } from "../google-vertex" +export { model } from "../google-vertex.js" +export type { Settings } from "../google-vertex.js" diff --git a/packages/ai/src/providers/google-vertex/messages.ts b/packages/ai/src/providers/google-vertex/messages.ts index 0ef1b3a427..a9ee13ed48 100644 --- a/packages/ai/src/providers/google-vertex/messages.ts +++ b/packages/ai/src/providers/google-vertex/messages.ts @@ -1,2 +1,2 @@ -export { model } from "../google-vertex-messages" -export type { Settings } from "../google-vertex-messages" +export { model } from "../google-vertex-messages.js" +export type { Settings } from "../google-vertex-messages.js" diff --git a/packages/ai/src/providers/google-vertex/responses.ts b/packages/ai/src/providers/google-vertex/responses.ts index 9ed9fd99db..5e8e49af54 100644 --- a/packages/ai/src/providers/google-vertex/responses.ts +++ b/packages/ai/src/providers/google-vertex/responses.ts @@ -1,2 +1,2 @@ -export { model } from "../google-vertex-responses" -export type { Settings } from "../google-vertex-responses" +export { model } from "../google-vertex-responses.js" +export type { Settings } from "../google-vertex-responses.js" diff --git a/packages/ai/src/providers/google.ts b/packages/ai/src/providers/google.ts index 89da1a923a..3482ee6370 100644 --- a/packages/ai/src/providers/google.ts +++ b/packages/ai/src/providers/google.ts @@ -1,12 +1,12 @@ -import type { RouteDefaultsInput } from "../route/client" -import { Auth } from "../route/auth" -import type { ProviderAuthOption } from "../route/auth-options" -import type { ProviderPackage } from "../provider-package" -import { HttpOptions, ProviderID, mergeHttpOptions, type ModelID } from "../schema" -import { Gemini } from "../protocols/gemini" -import { GoogleImages } from "../protocols/google-images" +import type { RouteDefaultsInput } from "../route/client.js" +import { Auth } from "../route/auth.js" +import type { ProviderAuthOption } from "../route/auth-options.js" +import type { ProviderPackage } from "../provider-package.js" +import { HttpOptions, ProviderID, mergeHttpOptions, type ModelID } from "../schema/index.js" +import { Gemini } from "../protocols/gemini.js" +import { GoogleImages } from "../protocols/google-images.js" -export type { GoogleImageOptions } from "../protocols/google-images" +export type { GoogleImageOptions } from "../protocols/google-images.js" export type GeminiOptionsInput = Gemini.OptionsInput export type GeminiProviderOptionsInput = Gemini.ProviderOptionsInput diff --git a/packages/ai/src/providers/index.ts b/packages/ai/src/providers/index.ts index e530fefc52..46f7ec7f0f 100644 --- a/packages/ai/src/providers/index.ts +++ b/packages/ai/src/providers/index.ts @@ -1,18 +1,18 @@ -export * as Anthropic from "./anthropic" -export * as AnthropicCompatible from "./anthropic-compatible" -export * as AmazonBedrock from "./amazon-bedrock" -export * as AmazonBedrockMantle from "./amazon-bedrock-mantle" -export * as Azure from "./azure" -export * as Cloudflare from "./cloudflare" -export { CloudflareAIGateway, CloudflareWorkersAI } from "./cloudflare" -export * as Google from "./google" -export * as GoogleVertex from "./google-vertex" -export * as GoogleVertexChat from "./google-vertex-chat" -export * as GoogleVertexMessages from "./google-vertex-messages" -export * as GoogleVertexResponses from "./google-vertex-responses" -export * as OpenAI from "./openai" -export * as OpenAICompatible from "./openai-compatible" -export * as OpenAICompatibleResponses from "./openai-compatible-responses" -export * as OpenRouter from "./openrouter" -export * as XAI from "./xai" -export * as ZAI from "./zai" +export * as Anthropic from "./anthropic.js" +export * as AnthropicCompatible from "./anthropic-compatible.js" +export * as AmazonBedrock from "./amazon-bedrock.js" +export * as AmazonBedrockMantle from "./amazon-bedrock-mantle.js" +export * as Azure from "./azure.js" +export * as Cloudflare from "./cloudflare.js" +export { CloudflareAIGateway, CloudflareWorkersAI } from "./cloudflare.js" +export * as Google from "./google.js" +export * as GoogleVertex from "./google-vertex.js" +export * as GoogleVertexChat from "./google-vertex-chat.js" +export * as GoogleVertexMessages from "./google-vertex-messages.js" +export * as GoogleVertexResponses from "./google-vertex-responses.js" +export * as OpenAI from "./openai.js" +export * as OpenAICompatible from "./openai-compatible.js" +export * as OpenAICompatibleResponses from "./openai-compatible-responses.js" +export * as OpenRouter from "./openrouter.js" +export * as XAI from "./xai.js" +export * as ZAI from "./zai.js" diff --git a/packages/ai/src/providers/open-responses-options.ts b/packages/ai/src/providers/open-responses-options.ts index b0194da2a4..7f8cff95d2 100644 --- a/packages/ai/src/providers/open-responses-options.ts +++ b/packages/ai/src/providers/open-responses-options.ts @@ -1,5 +1,5 @@ -import type { ResponseIncludable, ServiceTier } from "../protocols/utils/open-responses-options" -import type { ProviderOptions, ReasoningEffort, TextVerbosity } from "../schema" +import type { ResponseIncludable, ServiceTier } from "../protocols/utils/open-responses-options.js" +import type { ProviderOptions, ReasoningEffort, TextVerbosity } from "../schema/index.js" export interface OpenResponsesOptionsInput { readonly [key: string]: unknown @@ -16,4 +16,4 @@ export type OpenResponsesProviderOptionsInput = ProviderOptions & { readonly openresponses?: OpenResponsesOptionsInput } -export * as OpenResponsesProviderOptions from "./open-responses-options" +export * as OpenResponsesProviderOptions from "./open-responses-options.js" diff --git a/packages/ai/src/providers/openai-compatible-responses.ts b/packages/ai/src/providers/openai-compatible-responses.ts index fe2fc49bc5..16b12908f3 100644 --- a/packages/ai/src/providers/openai-compatible-responses.ts +++ b/packages/ai/src/providers/openai-compatible-responses.ts @@ -1,11 +1,11 @@ -import type { ProviderPackage } from "../provider-package" -import { OpenAICompatibleResponses } from "../protocols/openai-compatible-responses" -import { AuthOptions, type ProviderAuthOption } from "../route/auth-options" -import type { RouteDefaultsInput } from "../route/client" -import { ProviderID, type ModelID } from "../schema" -import type { OpenResponsesProviderOptionsInput } from "./open-responses-options" +import type { ProviderPackage } from "../provider-package.js" +import { OpenAICompatibleResponses } from "../protocols/openai-compatible-responses.js" +import { AuthOptions, type ProviderAuthOption } from "../route/auth-options.js" +import type { RouteDefaultsInput } from "../route/client.js" +import { ProviderID, type ModelID } from "../schema/index.js" +import type { OpenResponsesProviderOptionsInput } from "./open-responses-options.js" -export type { OpenResponsesOptionsInput, OpenResponsesProviderOptionsInput } from "./open-responses-options" +export type { OpenResponsesOptionsInput, OpenResponsesProviderOptionsInput } from "./open-responses-options.js" export const id = ProviderID.make("openai-compatible") diff --git a/packages/ai/src/providers/openai-compatible.ts b/packages/ai/src/providers/openai-compatible.ts index e4e1be32fc..cf0b5a8eba 100644 --- a/packages/ai/src/providers/openai-compatible.ts +++ b/packages/ai/src/providers/openai-compatible.ts @@ -1,10 +1,10 @@ -import { ProviderID, type ModelID } from "../schema" -import * as OpenAICompatibleChat from "../protocols/openai-compatible-chat" -import type { RouteDefaultsInput } from "../route/client" -import { AuthOptions, type ProviderAuthOption } from "../route/auth-options" -import type { ProviderPackage } from "../provider-package" -import { profiles, type OpenAICompatibleProfile } from "./openai-compatible-profile" -import type { OpenAIProviderOptionsInput } from "./openai-options" +import { ProviderID, type ModelID } from "../schema/index.js" +import * as OpenAICompatibleChat from "../protocols/openai-compatible-chat.js" +import type { RouteDefaultsInput } from "../route/client.js" +import { AuthOptions, type ProviderAuthOption } from "../route/auth-options.js" +import type { ProviderPackage } from "../provider-package.js" +import { profiles, type OpenAICompatibleProfile } from "./openai-compatible-profile.js" +import type { OpenAIProviderOptionsInput } from "./openai-options.js" export const id = ProviderID.make("openai-compatible") diff --git a/packages/ai/src/providers/openai-compatible/responses.ts b/packages/ai/src/providers/openai-compatible/responses.ts index 03404ca68b..7cd0143864 100644 --- a/packages/ai/src/providers/openai-compatible/responses.ts +++ b/packages/ai/src/providers/openai-compatible/responses.ts @@ -1 +1 @@ -export * from "../openai-compatible-responses" +export * from "../openai-compatible-responses.js" diff --git a/packages/ai/src/providers/openai-options.ts b/packages/ai/src/providers/openai-options.ts index c2336b5968..5f97772fa2 100644 --- a/packages/ai/src/providers/openai-options.ts +++ b/packages/ai/src/providers/openai-options.ts @@ -1,8 +1,8 @@ -import type { ProviderOptions } from "../schema" -import { mergeProviderOptions } from "../schema" -import type { OpenResponsesOptionsInput } from "./open-responses-options" +import type { ProviderOptions } from "../schema/index.js" +import { mergeProviderOptions } from "../schema/index.js" +import type { OpenResponsesOptionsInput } from "./open-responses-options.js" -export type { OpenAIResponseIncludable, OpenAIServiceTier } from "../protocols/utils/openai-options" +export type { OpenAIResponseIncludable, OpenAIServiceTier } from "../protocols/utils/openai-options.js" export type OpenAIOptionsInput = OpenResponsesOptionsInput @@ -67,4 +67,4 @@ export const withOpenAIOptions = & { readonly http?: HttpOptions.Input } -export type { ZAIImageOptions } from "../protocols/zai-images" +export type { ZAIImageOptions } from "../protocols/zai-images.js" const auth = (options: ProviderAuthOption<"optional">) => AuthOptions.bearer(options, "ZAI_API_KEY") diff --git a/packages/ai/src/route.ts b/packages/ai/src/route.ts index e76b133a7a..010ba2b178 100644 --- a/packages/ai/src/route.ts +++ b/packages/ai/src/route.ts @@ -1 +1 @@ -export * from "./route/index" +export * from "./route/index.js" diff --git a/packages/ai/src/route/auth-options.ts b/packages/ai/src/route/auth-options.ts index d1005351f8..473c405b34 100644 --- a/packages/ai/src/route/auth-options.ts +++ b/packages/ai/src/route/auth-options.ts @@ -1,5 +1,5 @@ import type { Config, Redacted } from "effect" -import { Auth } from "./auth" +import { Auth } from "./auth.js" export type ApiKeyMode = "optional" | "required" @@ -61,4 +61,4 @@ export const bearer = ( .bearer() } -export * as AuthOptions from "./auth-options" +export * as AuthOptions from "./auth-options.js" diff --git a/packages/ai/src/route/auth.ts b/packages/ai/src/route/auth.ts index ff8231b35a..1eaff8d662 100644 --- a/packages/ai/src/route/auth.ts +++ b/packages/ai/src/route/auth.ts @@ -1,6 +1,6 @@ import { Config, Effect, Redacted } from "effect" import { Headers } from "effect/unstable/http" -import { AuthenticationReason, InvalidRequestReason, AIError, type HttpOptions } from "../schema" +import { AuthenticationReason, InvalidRequestReason, AIError, type HttpOptions } from "../schema/index.js" export class MissingCredentialError extends Error { readonly _tag = "MissingCredentialError" @@ -153,4 +153,4 @@ export const toEffect = (authInput: AuthInput): Effect.Effect => input.apply(authInput).pipe(Effect.mapError(toAIError)) -export * as Auth from "./auth" +export * as Auth from "./auth.js" diff --git a/packages/ai/src/route/client.ts b/packages/ai/src/route/client.ts index 3b6fc9cf32..56795c3bc0 100644 --- a/packages/ai/src/route/client.ts +++ b/packages/ai/src/route/client.ts @@ -1,16 +1,16 @@ import { Cause, Context, Effect, Layer, Schema, Stream } from "effect" import * as Option from "effect/Option" -import { Auth } from "./auth" -import { Endpoint, type EndpointPatch } from "./endpoint" -import { RequestExecutor } from "./executor" -import { Framing } from "./framing" -import { HttpTransport } from "./transport" -import type { HttpMiddleware, Transport, TransportRuntime } from "./transport" -import { WebSocketExecutor } from "./transport" -import type { Protocol } from "./protocol" -import { applyCachePolicy } from "../cache-policy" -import * as ProviderShared from "../protocols/shared" -import type { ProtocolID, ProviderOptions } from "../schema" +import { Auth } from "./auth.js" +import { Endpoint, type EndpointPatch } from "./endpoint.js" +import { RequestExecutor } from "./executor.js" +import { Framing } from "./framing.js" +import { HttpTransport } from "./transport/index.js" +import type { HttpMiddleware, Transport, TransportRuntime } from "./transport/index.js" +import { WebSocketExecutor } from "./transport/index.js" +import type { Protocol } from "./protocol.js" +import { applyCachePolicy } from "../cache-policy.js" +import * as ProviderShared from "../protocols/shared.js" +import type { ProtocolID, ProviderOptions } from "../schema/index.js" import { AIError, GenerationOptions, @@ -25,7 +25,7 @@ import { mergeGenerationOptions, mergeHttpOptions, mergeProviderOptions, -} from "../schema" +} from "../schema/index.js" export interface RouteBody { /** Schema for the validated provider-native body sent as the JSON request. */ diff --git a/packages/ai/src/route/endpoint.ts b/packages/ai/src/route/endpoint.ts index 2b2077907d..f1cf2364f8 100644 --- a/packages/ai/src/route/endpoint.ts +++ b/packages/ai/src/route/endpoint.ts @@ -1,5 +1,5 @@ -import type { LLMRequest } from "../schema" -import * as ProviderShared from "../protocols/shared" +import type { LLMRequest } from "../schema/index.js" +import * as ProviderShared from "../protocols/shared.js" export interface EndpointInput { readonly request: LLMRequest @@ -53,4 +53,4 @@ export const render = (endpoint: Definition, input: EndpointInput = Layer.e export const fetchLayer = layer.pipe(Layer.provide(FetchHttpClient.layer)) -export * as RequestExecutor from "./executor" +export * as RequestExecutor from "./executor.js" diff --git a/packages/ai/src/route/framing.ts b/packages/ai/src/route/framing.ts index 95e12b73fb..799618a04a 100644 --- a/packages/ai/src/route/framing.ts +++ b/packages/ai/src/route/framing.ts @@ -1,6 +1,6 @@ import type { Stream } from "effect" -import * as ProviderShared from "../protocols/shared" -import type { AIError } from "../schema" +import * as ProviderShared from "../protocols/shared.js" +import type { AIError } from "../schema/index.js" /** * Decode a streaming HTTP response body into provider-protocol frames. @@ -24,4 +24,4 @@ export interface Definition { /** Server-Sent Events framing. Used by every JSON-streaming HTTP provider. */ export const sse: Definition = { id: "sse", frame: ProviderShared.sseFraming } -export * as Framing from "./framing" +export * as Framing from "./framing.js" diff --git a/packages/ai/src/route/index.ts b/packages/ai/src/route/index.ts index eb9f1759c5..182699db34 100644 --- a/packages/ai/src/route/index.ts +++ b/packages/ai/src/route/index.ts @@ -1,4 +1,4 @@ -export { Route, LLMClient } from "./client" +export { Route, LLMClient } from "./client.js" export type { Route as RouteShape, RouteLanguageModelInput, @@ -9,18 +9,18 @@ export type { Interface as LLMClientShape, Service as LLMClientService, StreamOptions, -} from "./client" -export * from "./executor" -export { Auth } from "./auth" -export { AuthOptions } from "./auth-options" -export { Endpoint } from "./endpoint" -export { Framing } from "./framing" -export { Protocol } from "./protocol" -export { HttpTransport, WebSocketExecutor, WebSocketTransport } from "./transport" -export * as Transport from "./transport" -export type { Definition as AuthShape, AuthInput, Credential, CredentialError } from "./auth" -export type { ApiKeyMode, AuthOverride, ProviderAuthOption } from "./auth-options" -export type { Definition as EndpointFn, EndpointInput } from "./endpoint" -export type { Definition as FramingDef } from "./framing" -export type { Protocol as ProtocolDef } from "./protocol" -export type { HttpHandler, HttpMiddleware, Transport as TransportDef, TransportRuntime } from "./transport" +} from "./client.js" +export * from "./executor.js" +export { Auth } from "./auth.js" +export { AuthOptions } from "./auth-options.js" +export { Endpoint } from "./endpoint.js" +export { Framing } from "./framing.js" +export { Protocol } from "./protocol.js" +export { HttpTransport, WebSocketExecutor, WebSocketTransport } from "./transport/index.js" +export * as Transport from "./transport/index.js" +export type { Definition as AuthShape, AuthInput, Credential, CredentialError } from "./auth.js" +export type { ApiKeyMode, AuthOverride, ProviderAuthOption } from "./auth-options.js" +export type { Definition as EndpointFn, EndpointInput } from "./endpoint.js" +export type { Definition as FramingDef } from "./framing.js" +export type { Protocol as ProtocolDef } from "./protocol.js" +export type { HttpHandler, HttpMiddleware, Transport as TransportDef, TransportRuntime } from "./transport/index.js" diff --git a/packages/ai/src/route/protocol.ts b/packages/ai/src/route/protocol.ts index 77cc268443..40632e0b01 100644 --- a/packages/ai/src/route/protocol.ts +++ b/packages/ai/src/route/protocol.ts @@ -1,5 +1,5 @@ import { Schema, type Effect } from "effect" -import type { AIError, LLMEvent, LLMRequest, ProtocolID } from "../schema" +import type { AIError, LLMEvent, LLMRequest, ProtocolID } from "../schema/index.js" /** * The semantic API contract of one model server family. @@ -82,4 +82,4 @@ export const make = ( export const jsonEvent = (schema: S) => Schema.fromJsonString(schema) -export * as Protocol from "./protocol" +export * as Protocol from "./protocol.js" diff --git a/packages/ai/src/route/transport/http.ts b/packages/ai/src/route/transport/http.ts index 223afb353c..12482f3918 100644 --- a/packages/ai/src/route/transport/http.ts +++ b/packages/ai/src/route/transport/http.ts @@ -1,11 +1,11 @@ import { Effect, Stream } from "effect" import { Headers, HttpClientRequest } from "effect/unstable/http" -import { Auth } from "../auth" -import { render as renderEndpoint } from "../endpoint" -import { Framing } from "../framing" -import type { HttpMiddleware, Transport, TransportPrepareInput } from "./index" -import * as ProviderShared from "../../protocols/shared" -import { mergeJsonRecords, type LLMRequest } from "../../schema" +import { Auth } from "../auth.js" +import { render as renderEndpoint } from "../endpoint.js" +import { Framing } from "../framing.js" +import type { HttpMiddleware, Transport, TransportPrepareInput } from "./index.js" +import * as ProviderShared from "../../protocols/shared.js" +import { mergeJsonRecords, type LLMRequest } from "../../schema/index.js" export type JsonRequestInput = TransportPrepareInput diff --git a/packages/ai/src/route/transport/index.ts b/packages/ai/src/route/transport/index.ts index c74e578e8b..199fac7dd2 100644 --- a/packages/ai/src/route/transport/index.ts +++ b/packages/ai/src/route/transport/index.ts @@ -1,9 +1,9 @@ import type { Effect, Stream } from "effect" -import { Endpoint } from "../endpoint" -import { Auth } from "../auth" -import type { HttpMiddleware, Interface as RequestExecutorInterface } from "../executor" -import type { Interface as WebSocketExecutorInterface } from "./websocket" -import type { AIError, LLMRequest } from "../../schema" +import { Endpoint } from "../endpoint.js" +import { Auth } from "../auth.js" +import type { HttpMiddleware, Interface as RequestExecutorInterface } from "../executor.js" +import type { Interface as WebSocketExecutorInterface } from "./websocket.js" +import type { AIError, LLMRequest } from "../../schema/index.js" export interface TransportRuntime { readonly http: RequestExecutorInterface @@ -26,6 +26,6 @@ export interface TransportPrepareInput { readonly middleware?: HttpMiddleware } -export * as HttpTransport from "./http" -export type { HttpHandler, HttpMiddleware } from "../executor" -export { WebSocketExecutor, WebSocketTransport } from "./websocket" +export * as HttpTransport from "./http.js" +export type { HttpHandler, HttpMiddleware } from "../executor.js" +export { WebSocketExecutor, WebSocketTransport } from "./websocket.js" diff --git a/packages/ai/src/route/transport/websocket.ts b/packages/ai/src/route/transport/websocket.ts index ec02d2dcf4..0198deb5c6 100644 --- a/packages/ai/src/route/transport/websocket.ts +++ b/packages/ai/src/route/transport/websocket.ts @@ -1,8 +1,8 @@ import { Cause, Context, Effect, Layer, Queue, Stream } from "effect" import { Headers } from "effect/unstable/http" -import { AIError, TransportReason } from "../../schema" -import * as HttpTransport from "./http" -import type { Transport } from "./index" +import { AIError, TransportReason } from "../../schema/index.js" +import * as HttpTransport from "./http.js" +import type { Transport } from "./index.js" export interface WebSocketRequest { readonly url: string diff --git a/packages/ai/src/schema/errors.ts b/packages/ai/src/schema/errors.ts index 4c239a9966..0c201450fd 100644 --- a/packages/ai/src/schema/errors.ts +++ b/packages/ai/src/schema/errors.ts @@ -1,6 +1,6 @@ import { Schema } from "effect" import { Tool } from "@opencode-ai/schema/tool" -import { ModelID, ProviderID, ProviderMetadata, RouteID } from "./ids" +import { ModelID, ProviderID, ProviderMetadata, RouteID } from "./ids.js" export const ProviderFailureClassification = Schema.Literals(["context-overflow", "payload-too-large"]) export type ProviderFailureClassification = typeof ProviderFailureClassification.Type diff --git a/packages/ai/src/schema/events.ts b/packages/ai/src/schema/events.ts index 49e9f334a8..8bcab7cb5e 100644 --- a/packages/ai/src/schema/events.ts +++ b/packages/ai/src/schema/events.ts @@ -1,7 +1,7 @@ import { Schema } from "effect" -import { ContentBlockID, FinishReason, ProviderMetadata, ToolCallID } from "./ids" -import { Message, ToolCallPart, ToolOutput, ToolResultPart, ToolResultValue, type ContentPart } from "./messages" -import { ProviderFailureClassification } from "./errors" +import { ContentBlockID, FinishReason, ProviderMetadata, ToolCallID } from "./ids.js" +import { Message, ToolCallPart, ToolOutput, ToolResultPart, ToolResultValue, type ContentPart } from "./messages.js" +import { ProviderFailureClassification } from "./errors.js" /** * Token usage reported by an LLM provider. diff --git a/packages/ai/src/schema/index.ts b/packages/ai/src/schema/index.ts index 0c0fede8fa..6c8e5611eb 100644 --- a/packages/ai/src/schema/index.ts +++ b/packages/ai/src/schema/index.ts @@ -1,5 +1,5 @@ -export * from "./ids" -export * from "./options" -export * from "./messages" -export * from "./events" -export * from "./errors" +export * from "./ids.js" +export * from "./options.js" +export * from "./messages.js" +export * from "./events.js" +export * from "./errors.js" diff --git a/packages/ai/src/schema/messages.ts b/packages/ai/src/schema/messages.ts index 103b018ad2..0e551a9a50 100644 --- a/packages/ai/src/schema/messages.ts +++ b/packages/ai/src/schema/messages.ts @@ -1,8 +1,8 @@ import { Schema } from "effect" import { Tool } from "@opencode-ai/schema/tool" -import { JsonSchema, MessageRole, ProviderMetadata } from "./ids" -import { CacheHint, CachePolicy, GenerationOptions, HttpOptions, LanguageModelSchema, ProviderOptions } from "./options" -import { isRecord } from "../utils/record" +import { JsonSchema, MessageRole, ProviderMetadata } from "./ids.js" +import { CacheHint, CachePolicy, GenerationOptions, HttpOptions, LanguageModelSchema, ProviderOptions } from "./options.js" +import { isRecord } from "../utils/record.js" const systemPartSchema = Schema.Struct({ type: Schema.Literal("text"), diff --git a/packages/ai/src/schema/options.ts b/packages/ai/src/schema/options.ts index e692309799..8529276daf 100644 --- a/packages/ai/src/schema/options.ts +++ b/packages/ai/src/schema/options.ts @@ -1,7 +1,7 @@ import { Schema } from "effect" -import { JsonSchema, ModelID, ProviderID } from "./ids" -import type { AnyRoute } from "../route/client" -import { isRecord } from "../utils/record" +import { JsonSchema, ModelID, ProviderID } from "./ids.js" +import type { AnyRoute } from "../route/client.js" +import { isRecord } from "../utils/record.js" export const mergeJsonRecords = ( ...items: ReadonlyArray | undefined> diff --git a/packages/ai/src/testing.ts b/packages/ai/src/testing.ts index 475569a24e..3ccafe9c61 100644 --- a/packages/ai/src/testing.ts +++ b/packages/ai/src/testing.ts @@ -1,6 +1,6 @@ -export * as TestLLM from "./testing" +export * as TestLLM from "./testing.js" -import { LLMClient, type Interface as LLMClientShape } from "./route/client" +import { LLMClient, type Interface as LLMClientShape } from "./route/client.js" import { LLMEvent, LLMResponse, @@ -8,7 +8,7 @@ import { type AIError, type LLMRequest, type UsageInput, -} from "./schema" +} from "./schema/index.js" import { Context, Deferred, Effect, Latch, Layer, Queue, Scope, Stream } from "effect" export type Response = readonly LLMEvent[] | Stream.Stream diff --git a/packages/ai/src/tool-runtime.ts b/packages/ai/src/tool-runtime.ts index 71958977cb..852e485c9f 100644 --- a/packages/ai/src/tool-runtime.ts +++ b/packages/ai/src/tool-runtime.ts @@ -7,8 +7,8 @@ import { ToolResultValue, type ToolOutput as ToolOutputType, type ToolResultValue as ToolResultValueType, -} from "./schema" -import { type AnyTool, type Tools } from "./tool" +} from "./schema/index.js" +import { type AnyTool, type Tools } from "./tool.js" export interface ToolSettlement { readonly result: ToolResultValueType diff --git a/packages/ai/src/tool.ts b/packages/ai/src/tool.ts index 1a5b7aeb7f..c171ad33fd 100644 --- a/packages/ai/src/tool.ts +++ b/packages/ai/src/tool.ts @@ -1,7 +1,7 @@ import { Effect, JsonSchema, Schema } from "effect" import { Tool } from "@opencode-ai/schema/tool" -import type { ToolCallPart, ToolDefinition as ToolDefinitionClass, ToolOutput as ToolOutputType } from "./schema" -import { ToolDefinition, ToolFailure, ToolOutput } from "./schema" +import type { ToolCallPart, ToolDefinition as ToolDefinitionClass, ToolOutput as ToolOutputType } from "./schema/index.js" +import { ToolDefinition, ToolFailure, ToolOutput } from "./schema/index.js" /** * Schema constraint for tool parameters / success values: no decoding or @@ -245,4 +245,4 @@ const project = ( export { ToolFailure } -export * as Tool from "./tool" +export * as Tool from "./tool.js" diff --git a/packages/ai/test/adapter.test.ts b/packages/ai/test/adapter.test.ts index 3ac7cfbb8d..f9602e4d00 100644 --- a/packages/ai/test/adapter.test.ts +++ b/packages/ai/test/adapter.test.ts @@ -1,11 +1,11 @@ import { describe, expect } from "bun:test" import { Effect, Schema, Stream } from "effect" -import { LLM, LLMRequest, LLMResponse } from "../src" -import { Route, Endpoint, LLMClient, Protocol, type FramingDef } from "../src/route" -import { compileRequest } from "../src/route/client" -import { LanguageModel } from "../src/schema" -import { testEffect } from "./lib/effect" -import { dynamicResponse } from "./lib/http" +import { LLM, LLMRequest, LLMResponse } from "../src/index.js" +import { Route, Endpoint, LLMClient, Protocol, type FramingDef } from "../src/route.js" +import { compileRequest } from "../src/route/client.js" +import { LanguageModel } from "../src/schema/index.js" +import { testEffect } from "./lib/effect.js" +import { dynamicResponse } from "./lib/http.js" const updateModel = (model: LanguageModel, patch: Partial) => LanguageModel.update(model, patch) diff --git a/packages/ai/test/auth-options.types.ts b/packages/ai/test/auth-options.types.ts index 9a75be2d47..b11a87e024 100644 --- a/packages/ai/test/auth-options.types.ts +++ b/packages/ai/test/auth-options.types.ts @@ -1,21 +1,21 @@ import { Config } from "effect" -import { Auth } from "../src/route" -import type { LanguageModelFactory } from "../src/route/auth-options" -import * as OpenAIChat from "../src/protocols/openai-chat" -import * as AmazonBedrock from "../src/providers/amazon-bedrock" -import * as Anthropic from "../src/providers/anthropic" -import * as AnthropicCompatible from "../src/providers/anthropic-compatible" -import * as Azure from "../src/providers/azure" -import * as Cloudflare from "../src/providers/cloudflare" -import * as Google from "../src/providers/google" -import * as GoogleVertex from "../src/providers/google-vertex" -import * as GoogleVertexChat from "../src/providers/google-vertex-chat" -import * as GoogleVertexMessages from "../src/providers/google-vertex-messages" -import * as GoogleVertexResponses from "../src/providers/google-vertex-responses" -import * as OpenAI from "../src/providers/openai" -import * as OpenAICompatible from "../src/providers/openai-compatible" -import * as OpenRouter from "../src/providers/openrouter" -import * as XAI from "../src/providers/xai" +import { Auth } from "../src/route.js" +import type { LanguageModelFactory } from "../src/route/auth-options.js" +import * as OpenAIChat from "../src/protocols/openai-chat.js" +import * as AmazonBedrock from "../src/providers/amazon-bedrock.js" +import * as Anthropic from "../src/providers/anthropic.js" +import * as AnthropicCompatible from "../src/providers/anthropic-compatible.js" +import * as Azure from "../src/providers/azure.js" +import * as Cloudflare from "../src/providers/cloudflare.js" +import * as Google from "../src/providers/google.js" +import * as GoogleVertex from "../src/providers/google-vertex.js" +import * as GoogleVertexChat from "../src/providers/google-vertex-chat.js" +import * as GoogleVertexMessages from "../src/providers/google-vertex-messages.js" +import * as GoogleVertexResponses from "../src/providers/google-vertex-responses.js" +import * as OpenAI from "../src/providers/openai.js" +import * as OpenAICompatible from "../src/providers/openai-compatible.js" +import * as OpenRouter from "../src/providers/openrouter.js" +import * as XAI from "../src/providers/xai.js" type BaseOptions = { readonly baseURL?: string diff --git a/packages/ai/test/auth.test.ts b/packages/ai/test/auth.test.ts index 548613ccfd..5732ab798d 100644 --- a/packages/ai/test/auth.test.ts +++ b/packages/ai/test/auth.test.ts @@ -1,11 +1,11 @@ import { describe, expect } from "bun:test" import { ConfigProvider, Effect } from "effect" import { Headers } from "effect/unstable/http" -import { LLM } from "../src" -import { Auth } from "../src/route/auth" -import * as OpenAIChat from "../src/protocols/openai-chat" -import { LanguageModel } from "../src/schema" -import { it } from "./lib/effect" +import { LLM } from "../src/index.js" +import { Auth } from "../src/route/auth.js" +import * as OpenAIChat from "../src/protocols/openai-chat.js" +import { LanguageModel } from "../src/schema/index.js" +import { it } from "./lib/effect.js" const request = LLM.request({ id: "req_auth", diff --git a/packages/ai/test/cache-policy.test.ts b/packages/ai/test/cache-policy.test.ts index a862b8b65d..378fa901ed 100644 --- a/packages/ai/test/cache-policy.test.ts +++ b/packages/ai/test/cache-policy.test.ts @@ -1,14 +1,14 @@ import { describe, expect, test } from "bun:test" import { Effect } from "effect" -import { CacheHint, LLM, Message } from "../src" -import { Auth } from "../src/route" -import { compileRequest } from "../src/route/client" -import { AmazonBedrock } from "../src/providers" -import * as AnthropicMessages from "../src/protocols/anthropic-messages" -import * as Gemini from "../src/protocols/gemini" -import * as OpenAIChat from "../src/protocols/openai-chat" -import { applyCachePolicy } from "../src/cache-policy" -import { it } from "./lib/effect" +import { CacheHint, LLM, Message } from "../src/index.js" +import { Auth } from "../src/route.js" +import { compileRequest } from "../src/route/client.js" +import { AmazonBedrock } from "../src/providers.js" +import * as AnthropicMessages from "../src/protocols/anthropic-messages.js" +import * as Gemini from "../src/protocols/gemini.js" +import * as OpenAIChat from "../src/protocols/openai-chat.js" +import { applyCachePolicy } from "../src/cache-policy.js" +import { it } from "./lib/effect.js" const anthropicModel = AnthropicMessages.route .with({ endpoint: { baseURL: "https://api.anthropic.test/v1/" }, auth: Auth.header("x-api-key", "test") }) diff --git a/packages/ai/test/compile.test.ts b/packages/ai/test/compile.test.ts index 0f1260873e..c7aeebf16c 100644 --- a/packages/ai/test/compile.test.ts +++ b/packages/ai/test/compile.test.ts @@ -1,14 +1,14 @@ import { describe, expect, test } from "bun:test" import { Effect, Ref, Schema } from "effect" import { HttpClientRequest, HttpClientResponse } from "effect/unstable/http" -import { LLM, mergeProviderOptions } from "../src" -import { AnthropicMessages, OpenAIChat } from "../src/protocols" -import { Auth, LLMClient } from "../src/route" -import { compileRequest } from "../src/route/client" -import { it } from "./lib/effect" -import { dynamicResponse } from "./lib/http" -import { deltaChunk } from "./lib/openai-chunks" -import { sseEvents } from "./lib/sse" +import { LLM, mergeProviderOptions } from "../src/index.js" +import { AnthropicMessages, OpenAIChat } from "../src/protocols.js" +import { Auth, LLMClient } from "../src/route.js" +import { compileRequest } from "../src/route/client.js" +import { it } from "./lib/effect.js" +import { dynamicResponse } from "./lib/http.js" +import { deltaChunk } from "./lib/openai-chunks.js" +import { sseEvents } from "./lib/sse.js" const TargetJson = Schema.fromJsonString(Schema.Unknown) const decodeJson = Schema.decodeUnknownSync(TargetJson) diff --git a/packages/ai/test/continuation-scenarios.ts b/packages/ai/test/continuation-scenarios.ts index b0f1bfb967..c752d9d4bb 100644 --- a/packages/ai/test/continuation-scenarios.ts +++ b/packages/ai/test/continuation-scenarios.ts @@ -6,7 +6,7 @@ import { ToolResultPart, type ContentPart, type LanguageModel, -} from "../src" +} from "../src/index.js" export const basicContinuation = ["system", "user-text", "assistant-text", "user-follow-up"] as const export const toolContinuation = ["tool-call", "tool-result"] as const diff --git a/packages/ai/test/endpoint.test.ts b/packages/ai/test/endpoint.test.ts index 98de4afd23..034342ca29 100644 --- a/packages/ai/test/endpoint.test.ts +++ b/packages/ai/test/endpoint.test.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from "bun:test" -import { LLM } from "../src" -import * as OpenAIChat from "../src/protocols/openai-chat" -import { Endpoint } from "../src/route" -import { LanguageModel } from "../src/schema" +import { LLM } from "../src/index.js" +import * as OpenAIChat from "../src/protocols/openai-chat.js" +import { Endpoint } from "../src/route.js" +import { LanguageModel } from "../src/schema/index.js" const request = () => LLM.request({ diff --git a/packages/ai/test/executor.test.ts b/packages/ai/test/executor.test.ts index b4e5fe62b8..1d3353e44b 100644 --- a/packages/ai/test/executor.test.ts +++ b/packages/ai/test/executor.test.ts @@ -1,13 +1,13 @@ import { describe, expect } from "bun:test" import { Effect, Layer, Ref } from "effect" import { Headers, HttpClient, HttpClientRequest, HttpClientResponse } from "effect/unstable/http" -import { LLM, AIError } from "../src" -import { LLMClient, RequestExecutor } from "../src/route" -import * as OpenAIChat from "../src/protocols/openai-chat" -import { dynamicResponse } from "./lib/http" -import { deltaChunk } from "./lib/openai-chunks" -import { sseRaw } from "./lib/sse" -import { it } from "./lib/effect" +import { LLM, AIError } from "../src/index.js" +import { LLMClient, RequestExecutor } from "../src/route.js" +import * as OpenAIChat from "../src/protocols/openai-chat.js" +import { dynamicResponse } from "./lib/http.js" +import { deltaChunk } from "./lib/openai-chunks.js" +import { sseRaw } from "./lib/sse.js" +import { it } from "./lib/effect.js" const request = HttpClientRequest.post("https://provider.test/v1/chat?api_key=secret&key=secret&debug=1").pipe( HttpClientRequest.setHeaders(Headers.fromInput({ authorization: "Bearer secret", "x-safe": "visible" })), diff --git a/packages/ai/test/generate-object.test.ts b/packages/ai/test/generate-object.test.ts index 9606f58f98..d29725e715 100644 --- a/packages/ai/test/generate-object.test.ts +++ b/packages/ai/test/generate-object.test.ts @@ -1,13 +1,13 @@ import { describe, expect, test } from "bun:test" import { Effect, Schema } from "effect" -import { LLM } from "../src" -import * as OpenAIChat from "../src/protocols/openai-chat" -import { Auth } from "../src/route" -import { Tool, toDefinitions } from "../src/tool" -import { it } from "./lib/effect" -import { dynamicResponse } from "./lib/http" -import { finishChunk, toolCallChunk } from "./lib/openai-chunks" -import { sseEvents } from "./lib/sse" +import { LLM } from "../src/index.js" +import * as OpenAIChat from "../src/protocols/openai-chat.js" +import { Auth } from "../src/route.js" +import { Tool, toDefinitions } from "../src/tool.js" +import { it } from "./lib/effect.js" +import { dynamicResponse } from "./lib/http.js" +import { finishChunk, toolCallChunk } from "./lib/openai-chunks.js" +import { sseEvents } from "./lib/sse.js" type OpenAIChatBody = { readonly tool_choice?: unknown diff --git a/packages/ai/test/image.test.ts b/packages/ai/test/image.test.ts index 37a315e2d2..7ad810e3ea 100644 --- a/packages/ai/test/image.test.ts +++ b/packages/ai/test/image.test.ts @@ -1,10 +1,10 @@ import { describe, expect } from "bun:test" import { Effect, Layer } from "effect" import { HttpClientRequest } from "effect/unstable/http" -import { Image, ImageClient, ImageInput } from "../src" -import { Google, OpenAI, XAI, ZAI } from "../src/providers" -import { it } from "./lib/effect" -import { dynamicResponse } from "./lib/http" +import { Image, ImageClient, ImageInput } from "../src/index.js" +import { Google, OpenAI, XAI, ZAI } from "../src/providers.js" +import { it } from "./lib/effect.js" +import { dynamicResponse } from "./lib/http.js" describe("Image", () => { it.effect("generates images through the OpenAI Images API", () => diff --git a/packages/ai/test/image.types.ts b/packages/ai/test/image.types.ts index 3823cb3962..28ebbd5456 100644 --- a/packages/ai/test/image.types.ts +++ b/packages/ai/test/image.types.ts @@ -8,9 +8,9 @@ import { type ImageOptions, type ImageRequestFor, type ImageRoute, -} from "../src" -import type { Service } from "../src/image-client" -import { Google, OpenAI, XAI, ZAI } from "../src/providers" +} from "../src/index.js" +import type { Service } from "../src/image-client.js" +import { Google, OpenAI, XAI, ZAI } from "../src/providers.js" type Requirements = T extends Effect.Effect ? R : never type Equal = [A, B] extends [B, A] ? true : false diff --git a/packages/ai/test/lib/http.ts b/packages/ai/test/lib/http.ts index f6c600555b..e53794aa87 100644 --- a/packages/ai/test/lib/http.ts +++ b/packages/ai/test/lib/http.ts @@ -1,9 +1,9 @@ import { Effect, Layer, Ref } from "effect" import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/unstable/http" -import { LLMClient, RequestExecutor, WebSocketExecutor } from "../../src/route" -import type { Service as LLMClientService } from "../../src/route/client" -import type { Service as RequestExecutorService } from "../../src/route/executor" -import type { Service as WebSocketExecutorService } from "../../src/route/transport/websocket" +import { LLMClient, RequestExecutor, WebSocketExecutor } from "../../src/route.js" +import type { Service as LLMClientService } from "../../src/route/client.js" +import type { Service as RequestExecutorService } from "../../src/route/executor.js" +import type { Service as WebSocketExecutorService } from "../../src/route/transport/websocket.js" export type HandlerInput = { readonly request: HttpClientRequest.HttpClientRequest diff --git a/packages/ai/test/lib/tool-runtime.ts b/packages/ai/test/lib/tool-runtime.ts index 56c7d91ea3..629720cd19 100644 --- a/packages/ai/test/lib/tool-runtime.ts +++ b/packages/ai/test/lib/tool-runtime.ts @@ -1,5 +1,5 @@ import { Effect, Stream } from "effect" -import { LLMClient } from "../../src/route" +import { LLMClient } from "../../src/route.js" import { LLMEvent, LLMRequest, @@ -10,9 +10,9 @@ import { ToolResultPart, type ToolResultValue, type Usage, -} from "../../src/schema" -import { type Tools, toDefinitions } from "../../src/tool" -import { ToolRuntime } from "../../src/tool-runtime" +} from "../../src/schema/index.js" +import { type Tools, toDefinitions } from "../../src/tool.js" +import { ToolRuntime } from "../../src/tool-runtime.js" interface RunOptions { readonly request: LLMRequest diff --git a/packages/ai/test/llm-option-types.types.ts b/packages/ai/test/llm-option-types.types.ts index c6a8058123..30d785dde6 100644 --- a/packages/ai/test/llm-option-types.types.ts +++ b/packages/ai/test/llm-option-types.types.ts @@ -5,8 +5,8 @@ import { type LanguageModel, type LanguageModelProviderOptions, type ProviderOptions, -} from "../src" -import { OpenAIChat } from "../src/protocols" +} from "../src/index.js" +import { OpenAIChat } from "../src/protocols.js" interface ExampleOptions { readonly [key: string]: unknown diff --git a/packages/ai/test/llm.test.ts b/packages/ai/test/llm.test.ts index d875b0c466..f2427c3ed5 100644 --- a/packages/ai/test/llm.test.ts +++ b/packages/ai/test/llm.test.ts @@ -1,7 +1,7 @@ import { describe, expect, test } from "bun:test" -import { CacheHint, LLM, LLMResponse } from "../src" -import * as OpenAIChat from "../src/protocols/openai-chat" -import * as OpenAIResponses from "../src/protocols/openai-responses" +import { CacheHint, LLM, LLMResponse } from "../src/index.js" +import * as OpenAIChat from "../src/protocols/openai-chat.js" +import * as OpenAIResponses from "../src/protocols/openai-responses.js" import { GenerationOptions, LLMRequest, @@ -11,7 +11,7 @@ import { ToolChoice, ToolDefinition, ToolResultPart, -} from "../src/schema" +} from "../src/schema/index.js" const chatRoute = OpenAIChat.route const responsesRoute = OpenAIResponses.route diff --git a/packages/ai/test/provider-error.test.ts b/packages/ai/test/provider-error.test.ts index ca499c46c4..cbf145067a 100644 --- a/packages/ai/test/provider-error.test.ts +++ b/packages/ai/test/provider-error.test.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from "bun:test" -import { isContextOverflow } from "../src" -import { classifyProviderFailure } from "../src/provider-error" +import { isContextOverflow } from "../src/index.js" +import { classifyProviderFailure } from "../src/provider-error.js" describe("provider error classification", () => { test("classifies provider token limit messages as context overflow", () => { diff --git a/packages/ai/test/provider-options/anthropic-compatible.types.ts b/packages/ai/test/provider-options/anthropic-compatible.types.ts index 3f7de8fd14..6fd690e5ab 100644 --- a/packages/ai/test/provider-options/anthropic-compatible.types.ts +++ b/packages/ai/test/provider-options/anthropic-compatible.types.ts @@ -1,5 +1,5 @@ -import { LLM } from "../../src" -import { AnthropicCompatible } from "../../src/providers" +import { LLM } from "../../src/index.js" +import { AnthropicCompatible } from "../../src/providers.js" const model = AnthropicCompatible.configure({ baseURL: "https://example.com" }).model("claude") diff --git a/packages/ai/test/provider-options/anthropic.types.ts b/packages/ai/test/provider-options/anthropic.types.ts index 2d6c104094..7d241643bd 100644 --- a/packages/ai/test/provider-options/anthropic.types.ts +++ b/packages/ai/test/provider-options/anthropic.types.ts @@ -1,5 +1,5 @@ -import { LLM } from "../../src" -import { Anthropic } from "../../src/providers" +import { LLM } from "../../src/index.js" +import { Anthropic } from "../../src/providers.js" const model = Anthropic.provider.model("claude-sonnet-4-5") diff --git a/packages/ai/test/provider-options/azure.types.ts b/packages/ai/test/provider-options/azure.types.ts index 8441f5528a..015c85bed9 100644 --- a/packages/ai/test/provider-options/azure.types.ts +++ b/packages/ai/test/provider-options/azure.types.ts @@ -1,5 +1,5 @@ -import { LLM } from "../../src" -import { Azure } from "../../src/providers" +import { LLM } from "../../src/index.js" +import { Azure } from "../../src/providers.js" const model = Azure.configure({ resourceName: "example" }).responses("deployment") diff --git a/packages/ai/test/provider-options/cloudflare.types.ts b/packages/ai/test/provider-options/cloudflare.types.ts index e98d5153ca..56c7785872 100644 --- a/packages/ai/test/provider-options/cloudflare.types.ts +++ b/packages/ai/test/provider-options/cloudflare.types.ts @@ -1,5 +1,5 @@ -import { LLM } from "../../src" -import { CloudflareWorkersAI } from "../../src/providers" +import { LLM } from "../../src/index.js" +import { CloudflareWorkersAI } from "../../src/providers.js" const model = CloudflareWorkersAI.configure({ accountId: "account", apiKey: "test" }).model("model") diff --git a/packages/ai/test/provider-options/google-vertex-chat.types.ts b/packages/ai/test/provider-options/google-vertex-chat.types.ts index d64f0af14b..45095dd5f4 100644 --- a/packages/ai/test/provider-options/google-vertex-chat.types.ts +++ b/packages/ai/test/provider-options/google-vertex-chat.types.ts @@ -1,5 +1,5 @@ -import { LLM } from "../../src" -import { GoogleVertexChat } from "../../src/providers" +import { LLM } from "../../src/index.js" +import { GoogleVertexChat } from "../../src/providers.js" const model = GoogleVertexChat.configure({ accessToken: "test", project: "project" }).model("gemini") diff --git a/packages/ai/test/provider-options/google-vertex-messages.types.ts b/packages/ai/test/provider-options/google-vertex-messages.types.ts index 040a4e03da..aff99972e9 100644 --- a/packages/ai/test/provider-options/google-vertex-messages.types.ts +++ b/packages/ai/test/provider-options/google-vertex-messages.types.ts @@ -1,5 +1,5 @@ -import { LLM } from "../../src" -import { GoogleVertexMessages } from "../../src/providers" +import { LLM } from "../../src/index.js" +import { GoogleVertexMessages } from "../../src/providers.js" const model = GoogleVertexMessages.configure({ accessToken: "test", project: "project" }).model("claude") diff --git a/packages/ai/test/provider-options/google-vertex-responses.types.ts b/packages/ai/test/provider-options/google-vertex-responses.types.ts index 3a64689102..d90d4038a3 100644 --- a/packages/ai/test/provider-options/google-vertex-responses.types.ts +++ b/packages/ai/test/provider-options/google-vertex-responses.types.ts @@ -1,5 +1,5 @@ -import { LLM } from "../../src" -import { GoogleVertexResponses } from "../../src/providers" +import { LLM } from "../../src/index.js" +import { GoogleVertexResponses } from "../../src/providers.js" const model = GoogleVertexResponses.configure({ accessToken: "test", project: "project" }).model("gemini") diff --git a/packages/ai/test/provider-options/google-vertex.types.ts b/packages/ai/test/provider-options/google-vertex.types.ts index 6098092f89..618f9069da 100644 --- a/packages/ai/test/provider-options/google-vertex.types.ts +++ b/packages/ai/test/provider-options/google-vertex.types.ts @@ -1,5 +1,5 @@ -import { LLM } from "../../src" -import { GoogleVertex } from "../../src/providers" +import { LLM } from "../../src/index.js" +import { GoogleVertex } from "../../src/providers.js" const model = GoogleVertex.provider.configure({ apiKey: "test" }).model("gemini-2.5-pro") diff --git a/packages/ai/test/provider-options/google.types.ts b/packages/ai/test/provider-options/google.types.ts index 8ced51055e..9aae75efcb 100644 --- a/packages/ai/test/provider-options/google.types.ts +++ b/packages/ai/test/provider-options/google.types.ts @@ -1,5 +1,5 @@ -import { LLM } from "../../src" -import { Google } from "../../src/providers" +import { LLM } from "../../src/index.js" +import { Google } from "../../src/providers.js" const model = Google.provider.model("gemini-2.5-pro") diff --git a/packages/ai/test/provider-options/openai-compatible-responses.types.ts b/packages/ai/test/provider-options/openai-compatible-responses.types.ts index cb178b3b97..f9a12d8f4d 100644 --- a/packages/ai/test/provider-options/openai-compatible-responses.types.ts +++ b/packages/ai/test/provider-options/openai-compatible-responses.types.ts @@ -1,5 +1,5 @@ -import { LLM } from "../../src" -import { OpenAICompatibleResponses } from "../../src/providers" +import { LLM } from "../../src/index.js" +import { OpenAICompatibleResponses } from "../../src/providers.js" const model = OpenAICompatibleResponses.configure({ baseURL: "https://example.com" }).model("model") diff --git a/packages/ai/test/provider-options/openai-compatible.types.ts b/packages/ai/test/provider-options/openai-compatible.types.ts index 94cfd2d24c..7504468997 100644 --- a/packages/ai/test/provider-options/openai-compatible.types.ts +++ b/packages/ai/test/provider-options/openai-compatible.types.ts @@ -1,5 +1,5 @@ -import { LLM } from "../../src" -import { OpenAICompatible } from "../../src/providers" +import { LLM } from "../../src/index.js" +import { OpenAICompatible } from "../../src/providers.js" const model = OpenAICompatible.deepseek.model("deepseek-chat") diff --git a/packages/ai/test/provider-options/openai.types.ts b/packages/ai/test/provider-options/openai.types.ts index 9546e1271b..174118ecbe 100644 --- a/packages/ai/test/provider-options/openai.types.ts +++ b/packages/ai/test/provider-options/openai.types.ts @@ -1,5 +1,5 @@ -import { LLM } from "../../src" -import { OpenAI } from "../../src/providers" +import { LLM } from "../../src/index.js" +import { OpenAI } from "../../src/providers.js" const model = OpenAI.responses("gpt-5") diff --git a/packages/ai/test/provider-options/openrouter.types.ts b/packages/ai/test/provider-options/openrouter.types.ts index e9c30a1e8e..90e3894a01 100644 --- a/packages/ai/test/provider-options/openrouter.types.ts +++ b/packages/ai/test/provider-options/openrouter.types.ts @@ -1,5 +1,5 @@ -import { LLM } from "../../src" -import { OpenRouter } from "../../src/providers" +import { LLM } from "../../src/index.js" +import { OpenRouter } from "../../src/providers.js" const model = OpenRouter.provider.model("anthropic/claude-sonnet-4.5") diff --git a/packages/ai/test/provider-options/xai.types.ts b/packages/ai/test/provider-options/xai.types.ts index ab1a99c46b..b70d8416ca 100644 --- a/packages/ai/test/provider-options/xai.types.ts +++ b/packages/ai/test/provider-options/xai.types.ts @@ -1,5 +1,5 @@ -import { LLM } from "../../src" -import { XAI } from "../../src/providers" +import { LLM } from "../../src/index.js" +import { XAI } from "../../src/providers.js" const model = XAI.provider.model("grok-4") diff --git a/packages/ai/test/provider.types.ts b/packages/ai/test/provider.types.ts index 7ce0c5014c..c8dbf82008 100644 --- a/packages/ai/test/provider.types.ts +++ b/packages/ai/test/provider.types.ts @@ -1,5 +1,5 @@ -import { Provider } from "../src/provider" -import { ProviderID, type LanguageModel } from "../src/schema" +import { Provider } from "../src/provider.js" +import { ProviderID, type LanguageModel } from "../src/schema/index.js" declare const model: (id: string) => LanguageModel declare const requiredModel: (id: string, options: { readonly baseURL: string }) => LanguageModel diff --git a/packages/ai/test/provider/anthropic-messages-cache.recorded.test.ts b/packages/ai/test/provider/anthropic-messages-cache.recorded.test.ts index c6b9814e3c..e89d7974fe 100644 --- a/packages/ai/test/provider/anthropic-messages-cache.recorded.test.ts +++ b/packages/ai/test/provider/anthropic-messages-cache.recorded.test.ts @@ -1,10 +1,10 @@ import { describe, expect } from "bun:test" import { Effect } from "effect" -import { CacheHint, LLM, LLMRequest, Message, ToolCallPart, ToolDefinition } from "../../src" -import { LLMClient } from "../../src/route" -import * as Anthropic from "../../src/providers/anthropic" -import { LARGE_CACHEABLE_SYSTEM } from "../recorded-scenarios" -import { recordedTests } from "../recorded-test" +import { CacheHint, LLM, LLMRequest, Message, ToolCallPart, ToolDefinition } from "../../src/index.js" +import { LLMClient } from "../../src/route.js" +import * as Anthropic from "../../src/providers/anthropic.js" +import { LARGE_CACHEABLE_SYSTEM } from "../recorded-scenarios.js" +import { recordedTests } from "../recorded-test.js" const model = Anthropic.configure({ apiKey: process.env.ANTHROPIC_API_KEY ?? "fixture", diff --git a/packages/ai/test/provider/anthropic-messages.recorded.test.ts b/packages/ai/test/provider/anthropic-messages.recorded.test.ts index 203fcb4962..070e30f1f4 100644 --- a/packages/ai/test/provider/anthropic-messages.recorded.test.ts +++ b/packages/ai/test/provider/anthropic-messages.recorded.test.ts @@ -1,10 +1,10 @@ import { describe, expect } from "bun:test" import { Effect } from "effect" -import { LLM, AIError, Message, ToolCallPart } from "../../src" -import { LLMClient } from "../../src/route" -import * as Anthropic from "../../src/providers/anthropic" -import { weatherToolName } from "../recorded-scenarios" -import { recordedTests } from "../recorded-test" +import { LLM, AIError, Message, ToolCallPart } from "../../src/index.js" +import { LLMClient } from "../../src/route.js" +import * as Anthropic from "../../src/providers/anthropic.js" +import { weatherToolName } from "../recorded-scenarios.js" +import { recordedTests } from "../recorded-test.js" const model = Anthropic.configure({ apiKey: process.env.ANTHROPIC_API_KEY ?? "fixture", diff --git a/packages/ai/test/provider/anthropic-messages.test.ts b/packages/ai/test/provider/anthropic-messages.test.ts index 3e5d399377..ab1047f2c9 100644 --- a/packages/ai/test/provider/anthropic-messages.test.ts +++ b/packages/ai/test/provider/anthropic-messages.test.ts @@ -1,14 +1,14 @@ import { describe, expect } from "bun:test" import { Effect } from "effect" import { HttpClientRequest } from "effect/unstable/http" -import { CacheHint, LLM, AIError, LLMRequest, Message, ToolCallPart, ToolDefinition, Usage } from "../../src" -import { Auth, LLMClient } from "../../src/route" -import { compileRequest } from "../../src/route/client" -import * as AnthropicMessages from "../../src/protocols/anthropic-messages" -import { continuationRequest, nativeAnthropicMessagesContinuation } from "../continuation-scenarios" -import { it } from "../lib/effect" -import { dynamicResponse, fixedResponse } from "../lib/http" -import { sseEvents } from "../lib/sse" +import { CacheHint, LLM, AIError, LLMRequest, Message, ToolCallPart, ToolDefinition, Usage } from "../../src/index.js" +import { Auth, LLMClient } from "../../src/route.js" +import { compileRequest } from "../../src/route/client.js" +import * as AnthropicMessages from "../../src/protocols/anthropic-messages.js" +import { continuationRequest, nativeAnthropicMessagesContinuation } from "../continuation-scenarios.js" +import { it } from "../lib/effect.js" +import { dynamicResponse, fixedResponse } from "../lib/http.js" +import { sseEvents } from "../lib/sse.js" const model = AnthropicMessages.route .with({ endpoint: { baseURL: "https://api.anthropic.test/v1/" }, auth: Auth.header("x-api-key", "test") }) diff --git a/packages/ai/test/provider/bedrock-converse-cache.recorded.test.ts b/packages/ai/test/provider/bedrock-converse-cache.recorded.test.ts index 8209ab1121..273bbe7248 100644 --- a/packages/ai/test/provider/bedrock-converse-cache.recorded.test.ts +++ b/packages/ai/test/provider/bedrock-converse-cache.recorded.test.ts @@ -1,10 +1,10 @@ import { describe, expect } from "bun:test" import { Effect } from "effect" -import { CacheHint, LLM } from "../../src" -import { LLMClient } from "../../src/route" -import { AmazonBedrock } from "../../src/providers" -import { LARGE_CACHEABLE_SYSTEM } from "../recorded-scenarios" -import { recordedTests } from "../recorded-test" +import { CacheHint, LLM } from "../../src/index.js" +import { LLMClient } from "../../src/route.js" +import { AmazonBedrock } from "../../src/providers.js" +import { LARGE_CACHEABLE_SYSTEM } from "../recorded-scenarios.js" +import { recordedTests } from "../recorded-test.js" const RECORDING_REGION = process.env.BEDROCK_RECORDING_REGION ?? "us-east-1" diff --git a/packages/ai/test/provider/bedrock-converse.test.ts b/packages/ai/test/provider/bedrock-converse.test.ts index 3ab9ae8e41..fc2456c2e1 100644 --- a/packages/ai/test/provider/bedrock-converse.test.ts +++ b/packages/ai/test/provider/bedrock-converse.test.ts @@ -11,13 +11,13 @@ import { ToolCallPart, ToolChoice, ToolDefinition, -} from "../../src" -import { LLMClient } from "../../src/route" -import { compileRequest } from "../../src/route/client" -import { AmazonBedrock } from "../../src/providers" -import * as BedrockConverse from "../../src/protocols/bedrock-converse" -import { it } from "../lib/effect" -import { fixedResponse } from "../lib/http" +} from "../../src/index.js" +import { LLMClient } from "../../src/route.js" +import { compileRequest } from "../../src/route/client.js" +import { AmazonBedrock } from "../../src/providers.js" +import * as BedrockConverse from "../../src/protocols/bedrock-converse.js" +import { it } from "../lib/effect.js" +import { fixedResponse } from "../lib/http.js" import { eventSummary, expectWeatherToolLoop, @@ -25,8 +25,8 @@ import { weatherTool, weatherToolLoopRequest, weatherToolName, -} from "../recorded-scenarios" -import { recordedTests } from "../recorded-test" +} from "../recorded-scenarios.js" +import { recordedTests } from "../recorded-test.js" const codec = new EventStreamCodec(toUtf8, fromUtf8) const utf8Encoder = new TextEncoder() diff --git a/packages/ai/test/provider/bedrock-mantle.test.ts b/packages/ai/test/provider/bedrock-mantle.test.ts index 3345071ecc..6eb7ffa9e2 100644 --- a/packages/ai/test/provider/bedrock-mantle.test.ts +++ b/packages/ai/test/provider/bedrock-mantle.test.ts @@ -1,12 +1,12 @@ import { describe, expect } from "bun:test" import { Effect } from "effect" import { HttpClientRequest } from "effect/unstable/http" -import { LLM } from "../../src" -import { AmazonBedrockMantle } from "../../src/providers" -import { compileRequest, LLMClient } from "../../src/route/client" -import { it } from "../lib/effect" -import { dynamicResponse } from "../lib/http" -import { recordedTests } from "../recorded-test" +import { LLM } from "../../src/index.js" +import { AmazonBedrockMantle } from "../../src/providers.js" +import { compileRequest, LLMClient } from "../../src/route/client.js" +import { it } from "../lib/effect.js" +import { dynamicResponse } from "../lib/http.js" +import { recordedTests } from "../recorded-test.js" const credentials = { region: "us-east-2", diff --git a/packages/ai/test/provider/cloudflare.test.ts b/packages/ai/test/provider/cloudflare.test.ts index e09e321873..2d113fcb72 100644 --- a/packages/ai/test/provider/cloudflare.test.ts +++ b/packages/ai/test/provider/cloudflare.test.ts @@ -1,12 +1,12 @@ import { describe, expect } from "bun:test" import { ConfigProvider, Effect, Schema } from "effect" import { HttpClientRequest } from "effect/unstable/http" -import { LLM, LLMEvent } from "../../src" -import { CloudflareAIGateway, CloudflareWorkersAI } from "../../src/providers/cloudflare" -import { compileRequest } from "../../src/route/client" -import { it } from "../lib/effect" -import { dynamicResponse } from "../lib/http" -import { sseEvents } from "../lib/sse" +import { LLM, LLMEvent } from "../../src/index.js" +import { CloudflareAIGateway, CloudflareWorkersAI } from "../../src/providers/cloudflare.js" +import { compileRequest } from "../../src/route/client.js" +import { it } from "../lib/effect.js" +import { dynamicResponse } from "../lib/http.js" +import { sseEvents } from "../lib/sse.js" const Json = Schema.fromJsonString(Schema.Unknown) const decodeJson = Schema.decodeUnknownSync(Json) diff --git a/packages/ai/test/provider/gemini-cache.recorded.test.ts b/packages/ai/test/provider/gemini-cache.recorded.test.ts index d210c5c024..636707d6b8 100644 --- a/packages/ai/test/provider/gemini-cache.recorded.test.ts +++ b/packages/ai/test/provider/gemini-cache.recorded.test.ts @@ -1,10 +1,10 @@ import { describe, expect } from "bun:test" import { Effect } from "effect" -import { LLM } from "../../src" -import { LLMClient } from "../../src/route" -import * as Google from "../../src/providers/google" -import { LARGE_CACHEABLE_SYSTEM } from "../recorded-scenarios" -import { recordedTests } from "../recorded-test" +import { LLM } from "../../src/index.js" +import { LLMClient } from "../../src/route.js" +import * as Google from "../../src/providers/google.js" +import { LARGE_CACHEABLE_SYSTEM } from "../recorded-scenarios.js" +import { recordedTests } from "../recorded-test.js" const model = Google.configure({ apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY ?? process.env.GEMINI_API_KEY ?? "fixture", diff --git a/packages/ai/test/provider/gemini.test.ts b/packages/ai/test/provider/gemini.test.ts index 42d7754a59..69cc5afe6b 100644 --- a/packages/ai/test/provider/gemini.test.ts +++ b/packages/ai/test/provider/gemini.test.ts @@ -1,13 +1,13 @@ import { describe, expect } from "bun:test" import { Effect } from "effect" -import { LLM, AIError, LLMRequest, Message, ToolCallPart, ToolDefinition, Usage } from "../../src" -import { Auth, LLMClient } from "../../src/route" -import { compileRequest } from "../../src/route/client" -import * as Gemini from "../../src/protocols/gemini" -import { ProviderShared } from "../../src/protocols/shared" -import { it } from "../lib/effect" -import { fixedResponse } from "../lib/http" -import { sseEvents, sseRaw } from "../lib/sse" +import { LLM, AIError, LLMRequest, Message, ToolCallPart, ToolDefinition, Usage } from "../../src/index.js" +import { Auth, LLMClient } from "../../src/route.js" +import { compileRequest } from "../../src/route/client.js" +import * as Gemini from "../../src/protocols/gemini.js" +import { ProviderShared } from "../../src/protocols/shared.js" +import { it } from "../lib/effect.js" +import { fixedResponse } from "../lib/http.js" +import { sseEvents, sseRaw } from "../lib/sse.js" const model = Gemini.route .with({ diff --git a/packages/ai/test/provider/golden.recorded.test.ts b/packages/ai/test/provider/golden.recorded.test.ts index 2ab4bd66c5..f6f8dfb9c6 100644 --- a/packages/ai/test/provider/golden.recorded.test.ts +++ b/packages/ai/test/provider/golden.recorded.test.ts @@ -1,12 +1,12 @@ -import * as Anthropic from "../../src/providers/anthropic" -import * as AnthropicCompatible from "../../src/providers/anthropic-compatible" -import { CloudflareAIGateway, CloudflareWorkersAI } from "../../src/providers/cloudflare" -import * as Google from "../../src/providers/google" -import * as OpenAI from "../../src/providers/openai" -import * as OpenAICompatible from "../../src/providers/openai-compatible" -import * as OpenRouter from "../../src/providers/openrouter" -import * as XAI from "../../src/providers/xai" -import { describeRecordedGoldenScenarios } from "../recorded-golden" +import * as Anthropic from "../../src/providers/anthropic.js" +import * as AnthropicCompatible from "../../src/providers/anthropic-compatible.js" +import { CloudflareAIGateway, CloudflareWorkersAI } from "../../src/providers/cloudflare.js" +import * as Google from "../../src/providers/google.js" +import * as OpenAI from "../../src/providers/openai.js" +import * as OpenAICompatible from "../../src/providers/openai-compatible.js" +import * as OpenRouter from "../../src/providers/openrouter.js" +import * as XAI from "../../src/providers/xai.js" +import { describeRecordedGoldenScenarios } from "../recorded-golden.js" const openAI = OpenAI.configure({ apiKey: process.env.OPENAI_API_KEY ?? "fixture", diff --git a/packages/ai/test/provider/google-images.recorded.test.ts b/packages/ai/test/provider/google-images.recorded.test.ts index cd7530c651..ff26208432 100644 --- a/packages/ai/test/provider/google-images.recorded.test.ts +++ b/packages/ai/test/provider/google-images.recorded.test.ts @@ -1,9 +1,9 @@ import { describe, expect } from "bun:test" import { Effect } from "effect" -import { Image, ImageInput } from "../../src" -import { Google } from "../../src/providers" -import { dimensions } from "../lib/image" -import { recordedTests } from "../recorded-test" +import { Image, ImageInput } from "../../src/index.js" +import { Google } from "../../src/providers.js" +import { dimensions } from "../lib/image.js" +import { recordedTests } from "../recorded-test.js" const model = Google.configure({ apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY ?? "fixture", diff --git a/packages/ai/test/provider/google-vertex.test.ts b/packages/ai/test/provider/google-vertex.test.ts index 5aa29d4bc5..5deacdab4d 100644 --- a/packages/ai/test/provider/google-vertex.test.ts +++ b/packages/ai/test/provider/google-vertex.test.ts @@ -1,14 +1,14 @@ import { describe, expect } from "bun:test" import { Effect } from "effect" import { HttpClientRequest } from "effect/unstable/http" -import { LLM } from "../../src" -import { GoogleVertex, GoogleVertexChat, GoogleVertexMessages, GoogleVertexResponses } from "../../src/providers" -import { LLMClient } from "../../src/route" -import { compileRequest } from "../../src/route/client" -import { it } from "../lib/effect" -import { dynamicResponse } from "../lib/http" -import { deltaChunk, finishChunk } from "../lib/openai-chunks" -import { sseEvents } from "../lib/sse" +import { LLM } from "../../src/index.js" +import { GoogleVertex, GoogleVertexChat, GoogleVertexMessages, GoogleVertexResponses } from "../../src/providers.js" +import { LLMClient } from "../../src/route.js" +import { compileRequest } from "../../src/route/client.js" +import { it } from "../lib/effect.js" +import { dynamicResponse } from "../lib/http.js" +import { deltaChunk, finishChunk } from "../lib/openai-chunks.js" +import { sseEvents } from "../lib/sse.js" describe("Google Vertex providers", () => { it.effect("sends Gemini requests to the global Vertex endpoint", () => diff --git a/packages/ai/test/provider/openai-chat-reasoning.recorded.test.ts b/packages/ai/test/provider/openai-chat-reasoning.recorded.test.ts index 8cfc7ae607..b4c859bcce 100644 --- a/packages/ai/test/provider/openai-chat-reasoning.recorded.test.ts +++ b/packages/ai/test/provider/openai-chat-reasoning.recorded.test.ts @@ -1,13 +1,13 @@ import { describe, expect } from "bun:test" import { Effect } from "effect" -import { LLM, LLMEvent, LLMResponse, LanguageModel } from "../../src" -import { OpenAIChat } from "../../src/protocols/openai-chat" -import * as OpenAICompatible from "../../src/providers/openai-compatible" -import * as OpenRouter from "../../src/providers/openrouter" -import { LLMClient } from "../../src/route" -import { compileRequest } from "../../src/route/client" -import { recordedTests } from "../recorded-test" -import { expectWeatherToolLoop, goldenWeatherToolLoopRequest, runWeatherToolLoop } from "../recorded-scenarios" +import { LLM, LLMEvent, LLMResponse, LanguageModel } from "../../src/index.js" +import { OpenAIChat } from "../../src/protocols/openai-chat.js" +import * as OpenAICompatible from "../../src/providers/openai-compatible.js" +import * as OpenRouter from "../../src/providers/openrouter.js" +import { LLMClient } from "../../src/route.js" +import { compileRequest } from "../../src/route/client.js" +import { recordedTests } from "../recorded-test.js" +import { expectWeatherToolLoop, goldenWeatherToolLoopRequest, runWeatherToolLoop } from "../recorded-scenarios.js" const cases = [ { diff --git a/packages/ai/test/provider/openai-chat.test.ts b/packages/ai/test/provider/openai-chat.test.ts index 6a0f7740ef..910e57d26a 100644 --- a/packages/ai/test/provider/openai-chat.test.ts +++ b/packages/ai/test/provider/openai-chat.test.ts @@ -12,19 +12,19 @@ import { ToolCallPart, ToolDefinition, Usage, -} from "../../src" -import * as Azure from "../../src/providers/azure" -import * as OpenAI from "../../src/providers/openai" -import * as OpenAICompatible from "../../src/providers/openai-compatible" -import * as XAI from "../../src/providers/xai" -import * as OpenAIChat from "../../src/protocols/openai-chat" -import { ProviderShared } from "../../src/protocols/shared" -import { Auth, LLMClient } from "../../src/route" -import { compileRequest } from "../../src/route/client" -import { it } from "../lib/effect" -import { dynamicResponse, fixedResponse, truncatedStream } from "../lib/http" -import { deltaChunk, usageChunk } from "../lib/openai-chunks" -import { sseEvents } from "../lib/sse" +} from "../../src/index.js" +import * as Azure from "../../src/providers/azure.js" +import * as OpenAI from "../../src/providers/openai.js" +import * as OpenAICompatible from "../../src/providers/openai-compatible.js" +import * as XAI from "../../src/providers/xai.js" +import * as OpenAIChat from "../../src/protocols/openai-chat.js" +import { ProviderShared } from "../../src/protocols/shared.js" +import { Auth, LLMClient } from "../../src/route.js" +import { compileRequest } from "../../src/route/client.js" +import { it } from "../lib/effect.js" +import { dynamicResponse, fixedResponse, truncatedStream } from "../lib/http.js" +import { deltaChunk, usageChunk } from "../lib/openai-chunks.js" +import { sseEvents } from "../lib/sse.js" const TargetJson = Schema.fromJsonString(Schema.Unknown) const encodeJson = Schema.encodeSync(TargetJson) diff --git a/packages/ai/test/provider/openai-compatible-chat.test.ts b/packages/ai/test/provider/openai-compatible-chat.test.ts index 3f2199f731..405a1bcb2d 100644 --- a/packages/ai/test/provider/openai-compatible-chat.test.ts +++ b/packages/ai/test/provider/openai-compatible-chat.test.ts @@ -1,14 +1,14 @@ import { describe, expect } from "bun:test" import { Effect, Schema } from "effect" import { HttpClientRequest } from "effect/unstable/http" -import { LLM, LLMRequest, Message, ToolCallPart, ToolChoice, ToolDefinition } from "../../src" -import { Auth, LLMClient } from "../../src/route" -import { compileRequest } from "../../src/route/client" -import * as OpenAICompatible from "../../src/providers/openai-compatible" -import * as OpenAICompatibleChat from "../../src/protocols/openai-compatible-chat" -import { it } from "../lib/effect" -import { dynamicResponse, fixedResponse } from "../lib/http" -import { sseEvents } from "../lib/sse" +import { LLM, LLMRequest, Message, ToolCallPart, ToolChoice, ToolDefinition } from "../../src/index.js" +import { Auth, LLMClient } from "../../src/route.js" +import { compileRequest } from "../../src/route/client.js" +import * as OpenAICompatible from "../../src/providers/openai-compatible.js" +import * as OpenAICompatibleChat from "../../src/protocols/openai-compatible-chat.js" +import { it } from "../lib/effect.js" +import { dynamicResponse, fixedResponse } from "../lib/http.js" +import { sseEvents } from "../lib/sse.js" const Json = Schema.fromJsonString(Schema.Unknown) const decodeJson = Schema.decodeUnknownSync(Json) diff --git a/packages/ai/test/provider/openai-compatible-responses.test.ts b/packages/ai/test/provider/openai-compatible-responses.test.ts index 7d52b10cd1..7afdd6859b 100644 --- a/packages/ai/test/provider/openai-compatible-responses.test.ts +++ b/packages/ai/test/provider/openai-compatible-responses.test.ts @@ -1,16 +1,16 @@ import { describe, expect } from "bun:test" import { Effect } from "effect" -import { LLM, LLMEvent, Message } from "../../src" -import { configure } from "../../src/providers/openai-compatible-responses" -import { OpenAI } from "../../src/providers" -import { OpenResponses } from "../../src/protocols/open-responses" -import { OpenAICompatibleResponses } from "../../src/protocols/openai-compatible-responses" -import { OpenAIResponses } from "../../src/protocols/openai-responses" -import { LLMClient } from "../../src/route" -import { compileRequest } from "../../src/route/client" -import { it } from "../lib/effect" -import { fixedResponse } from "../lib/http" -import { sseEvents } from "../lib/sse" +import { LLM, LLMEvent, Message } from "../../src/index.js" +import { configure } from "../../src/providers/openai-compatible-responses.js" +import { OpenAI } from "../../src/providers.js" +import { OpenResponses } from "../../src/protocols/open-responses.js" +import { OpenAICompatibleResponses } from "../../src/protocols/openai-compatible-responses.js" +import { OpenAIResponses } from "../../src/protocols/openai-responses.js" +import { LLMClient } from "../../src/route.js" +import { compileRequest } from "../../src/route/client.js" +import { it } from "../lib/effect.js" +import { fixedResponse } from "../lib/http.js" +import { sseEvents } from "../lib/sse.js" describe("Open Responses-compatible route", () => { it.effect("uses the Open Responses baseline for a configured deployment", () => diff --git a/packages/ai/test/provider/openai-images.recorded.test.ts b/packages/ai/test/provider/openai-images.recorded.test.ts index 8fa2e7546e..3d3ce45ddd 100644 --- a/packages/ai/test/provider/openai-images.recorded.test.ts +++ b/packages/ai/test/provider/openai-images.recorded.test.ts @@ -1,9 +1,9 @@ import { describe, expect } from "bun:test" import { Effect } from "effect" -import { Image, ImageInput } from "../../src" -import { OpenAI } from "../../src/providers" -import { dimensions } from "../lib/image" -import { recordedTests } from "../recorded-test" +import { Image, ImageInput } from "../../src/index.js" +import { OpenAI } from "../../src/providers.js" +import { dimensions } from "../lib/image.js" +import { recordedTests } from "../recorded-test.js" const model = OpenAI.configure({ apiKey: process.env.OPENAI_API_KEY ?? "fixture", diff --git a/packages/ai/test/provider/openai-responses-cache.recorded.test.ts b/packages/ai/test/provider/openai-responses-cache.recorded.test.ts index fa764f3535..76f9da84bc 100644 --- a/packages/ai/test/provider/openai-responses-cache.recorded.test.ts +++ b/packages/ai/test/provider/openai-responses-cache.recorded.test.ts @@ -1,10 +1,10 @@ import { describe, expect } from "bun:test" import { Effect } from "effect" -import { LLM } from "../../src" -import { LLMClient } from "../../src/route" -import * as OpenAI from "../../src/providers/openai" -import { LARGE_CACHEABLE_SYSTEM } from "../recorded-scenarios" -import { recordedTests } from "../recorded-test" +import { LLM } from "../../src/index.js" +import { LLMClient } from "../../src/route.js" +import * as OpenAI from "../../src/providers/openai.js" +import { LARGE_CACHEABLE_SYSTEM } from "../recorded-scenarios.js" +import { recordedTests } from "../recorded-test.js" const model = OpenAI.configure({ apiKey: process.env.OPENAI_API_KEY ?? "fixture", diff --git a/packages/ai/test/provider/openai-responses-images.recorded.test.ts b/packages/ai/test/provider/openai-responses-images.recorded.test.ts index 41b9ab84d4..51ca8f1729 100644 --- a/packages/ai/test/provider/openai-responses-images.recorded.test.ts +++ b/packages/ai/test/provider/openai-responses-images.recorded.test.ts @@ -1,8 +1,8 @@ import { describe, expect } from "bun:test" import { Effect } from "effect" -import { LLM, LLMEvent, Message } from "../../src" -import { OpenAI } from "../../src/providers" -import { recordedTests } from "../recorded-test" +import { LLM, LLMEvent, Message } from "../../src/index.js" +import { OpenAI } from "../../src/providers.js" +import { recordedTests } from "../recorded-test.js" const openai = OpenAI.configure({ apiKey: process.env.OPENAI_API_KEY ?? "fixture", diff --git a/packages/ai/test/provider/openai-responses.test.ts b/packages/ai/test/provider/openai-responses.test.ts index ebfa6c4f33..cfef867420 100644 --- a/packages/ai/test/provider/openai-responses.test.ts +++ b/packages/ai/test/provider/openai-responses.test.ts @@ -12,18 +12,18 @@ import { ToolDefinition, ToolResultPart, Usage, -} from "../../src" -import { Auth, LLMClient, RequestExecutor, WebSocketExecutor } from "../../src/route" -import { compileRequest } from "../../src/route/client" -import * as Azure from "../../src/providers/azure" -import * as OpenAI from "../../src/providers/openai" -import * as XAI from "../../src/providers/xai" -import * as OpenAIResponses from "../../src/protocols/openai-responses" -import * as ProviderShared from "../../src/protocols/shared" -import { continuationRequest, nativeOpenAIResponsesContinuation } from "../continuation-scenarios" -import { it } from "../lib/effect" -import { dynamicResponse, fixedResponse } from "../lib/http" -import { sseEvents } from "../lib/sse" +} from "../../src/index.js" +import { Auth, LLMClient, RequestExecutor, WebSocketExecutor } from "../../src/route.js" +import { compileRequest } from "../../src/route/client.js" +import * as Azure from "../../src/providers/azure.js" +import * as OpenAI from "../../src/providers/openai.js" +import * as XAI from "../../src/providers/xai.js" +import * as OpenAIResponses from "../../src/protocols/openai-responses.js" +import * as ProviderShared from "../../src/protocols/shared.js" +import { continuationRequest, nativeOpenAIResponsesContinuation } from "../continuation-scenarios.js" +import { it } from "../lib/effect.js" +import { dynamicResponse, fixedResponse } from "../lib/http.js" +import { sseEvents } from "../lib/sse.js" const model = OpenAIResponses.route .with({ endpoint: { baseURL: "https://api.openai.test/v1/" }, auth: Auth.bearer("test") }) diff --git a/packages/ai/test/provider/openrouter.test.ts b/packages/ai/test/provider/openrouter.test.ts index 6077e5c797..93399cdbd7 100644 --- a/packages/ai/test/provider/openrouter.test.ts +++ b/packages/ai/test/provider/openrouter.test.ts @@ -1,12 +1,12 @@ import { describe, expect } from "bun:test" import { Effect } from "effect" -import { CacheHint, LLM, Message } from "../../src" -import { LLMClient } from "../../src/route" -import { compileRequest } from "../../src/route/client" -import * as OpenRouter from "../../src/providers/openrouter" -import { it } from "../lib/effect" -import { fixedResponse } from "../lib/http" -import { sseEvents } from "../lib/sse" +import { CacheHint, LLM, Message } from "../../src/index.js" +import { LLMClient } from "../../src/route.js" +import { compileRequest } from "../../src/route/client.js" +import * as OpenRouter from "../../src/providers/openrouter.js" +import { it } from "../lib/effect.js" +import { fixedResponse } from "../lib/http.js" +import { sseEvents } from "../lib/sse.js" describe("OpenRouter", () => { it.effect("prepares OpenRouter models through the OpenAI-compatible Chat route", () => diff --git a/packages/ai/test/provider/pdf.recorded.test.ts b/packages/ai/test/provider/pdf.recorded.test.ts index 5f9221607d..635f6d99c5 100644 --- a/packages/ai/test/provider/pdf.recorded.test.ts +++ b/packages/ai/test/provider/pdf.recorded.test.ts @@ -1,11 +1,11 @@ import { describe, expect } from "bun:test" import { Effect, Schema, Stream } from "effect" -import { LLM, LLMResponse, Message, ToolDefinition, type LanguageModel } from "../../src" -import { AmazonBedrock, Anthropic, Google, OpenAI, XAI } from "../../src/providers" -import { LLMClient } from "../../src/route" -import { Tool } from "../../src/tool" -import { runTools } from "../lib/tool-runtime" -import { recordedTests } from "../recorded-test" +import { LLM, LLMResponse, Message, ToolDefinition, type LanguageModel } from "../../src/index.js" +import { AmazonBedrock, Anthropic, Google, OpenAI, XAI } from "../../src/providers.js" +import { LLMClient } from "../../src/route.js" +import { Tool } from "../../src/tool.js" +import { runTools } from "../lib/tool-runtime.js" +import { recordedTests } from "../recorded-test.js" const CODE = "ORCHID-7391" const PDF = diff --git a/packages/ai/test/provider/xai-images.recorded.test.ts b/packages/ai/test/provider/xai-images.recorded.test.ts index e856e83cc0..19e663fe71 100644 --- a/packages/ai/test/provider/xai-images.recorded.test.ts +++ b/packages/ai/test/provider/xai-images.recorded.test.ts @@ -1,9 +1,9 @@ import { describe, expect } from "bun:test" import { Effect } from "effect" -import { Image, ImageInput } from "../../src" -import { XAI } from "../../src/providers" -import { dimensions } from "../lib/image" -import { recordedTests } from "../recorded-test" +import { Image, ImageInput } from "../../src/index.js" +import { XAI } from "../../src/providers.js" +import { dimensions } from "../lib/image.js" +import { recordedTests } from "../recorded-test.js" const model = XAI.configure({ apiKey: process.env.XAI_API_KEY ?? "fixture", diff --git a/packages/ai/test/provider/xai-images.test.ts b/packages/ai/test/provider/xai-images.test.ts index ce801f2f91..43ebb6e12b 100644 --- a/packages/ai/test/provider/xai-images.test.ts +++ b/packages/ai/test/provider/xai-images.test.ts @@ -1,11 +1,11 @@ import { describe, expect } from "bun:test" import { Effect, Layer } from "effect" import { Headers, HttpClientRequest } from "effect/unstable/http" -import { Image, ImageClient } from "../../src" -import { XAI } from "../../src/providers" -import { Auth } from "../../src/route" -import { it } from "../lib/effect" -import { dynamicResponse } from "../lib/http" +import { Image, ImageClient } from "../../src/index.js" +import { XAI } from "../../src/providers.js" +import { Auth } from "../../src/route.js" +import { it } from "../lib/effect.js" +import { dynamicResponse } from "../lib/http.js" describe("xAI Images", () => { it.effect("generates through the OpenAI-compatible Images API", () => diff --git a/packages/ai/test/provider/zai-images.recorded.test.ts b/packages/ai/test/provider/zai-images.recorded.test.ts index a1395d1bcb..a1716b1a0a 100644 --- a/packages/ai/test/provider/zai-images.recorded.test.ts +++ b/packages/ai/test/provider/zai-images.recorded.test.ts @@ -1,8 +1,8 @@ import { describe, expect } from "bun:test" import { Effect } from "effect" -import { Image } from "../../src" -import { ZAI } from "../../src/providers" -import { recordedTests } from "../recorded-test" +import { Image } from "../../src/index.js" +import { ZAI } from "../../src/providers.js" +import { recordedTests } from "../recorded-test.js" const model = ZAI.configure({ apiKey: process.env.ZAI_API_KEY ?? "fixture" }).image("cogview-4-250304") diff --git a/packages/ai/test/provider/zai-images.test.ts b/packages/ai/test/provider/zai-images.test.ts index bea8cd3e48..7a0f022061 100644 --- a/packages/ai/test/provider/zai-images.test.ts +++ b/packages/ai/test/provider/zai-images.test.ts @@ -1,10 +1,10 @@ import { describe, expect } from "bun:test" import { Effect, Layer } from "effect" import { HttpClientRequest } from "effect/unstable/http" -import { Image, ImageClient } from "../../src" -import { ZAI } from "../../src/providers" -import { it } from "../lib/effect" -import { dynamicResponse, fixedResponse } from "../lib/http" +import { Image, ImageClient } from "../../src/index.js" +import { ZAI } from "../../src/providers.js" +import { it } from "../lib/effect.js" +import { dynamicResponse, fixedResponse } from "../lib/http.js" describe("Z.ai Images", () => { it.effect("generates through the Z.ai Images API", () => diff --git a/packages/ai/test/recorded-golden.ts b/packages/ai/test/recorded-golden.ts index cca25c299f..f3590254c4 100644 --- a/packages/ai/test/recorded-golden.ts +++ b/packages/ai/test/recorded-golden.ts @@ -1,10 +1,10 @@ import type { HttpRecorder } from "@opencode-ai/http-recorder" import { describe } from "bun:test" import { Effect } from "effect" -import type { LanguageModel } from "../src" -import { goldenScenarioTags, goldenScenarioTitle, runGoldenScenario, type GoldenScenarioID } from "./recorded-scenarios" -import { recordedTests } from "./recorded-test" -import { kebab } from "./recorded-utils" +import type { LanguageModel } from "../src/index.js" +import { goldenScenarioTags, goldenScenarioTitle, runGoldenScenario, type GoldenScenarioID } from "./recorded-scenarios.js" +import { recordedTests } from "./recorded-test.js" +import { kebab } from "./recorded-utils.js" type Transport = "http" | "websocket" diff --git a/packages/ai/test/recorded-runner.ts b/packages/ai/test/recorded-runner.ts index 904a9366ac..a201d9c47f 100644 --- a/packages/ai/test/recorded-runner.ts +++ b/packages/ai/test/recorded-runner.ts @@ -1,8 +1,8 @@ import type { HttpRecorder } from "@opencode-ai/http-recorder" import { test, type TestOptions } from "bun:test" import { Effect, type Layer } from "effect" -import { testEffect } from "./lib/effect" -import { cassetteName, classifiedTags, matchesSelected, missingEnv, unique } from "./recorded-utils" +import { testEffect } from "./lib/effect.js" +import { cassetteName, classifiedTags, matchesSelected, missingEnv, unique } from "./recorded-utils.js" export type RecordedBody = Effect.Effect | (() => Effect.Effect) diff --git a/packages/ai/test/recorded-scenarios.ts b/packages/ai/test/recorded-scenarios.ts index f9650e0e1c..29f5933011 100644 --- a/packages/ai/test/recorded-scenarios.ts +++ b/packages/ai/test/recorded-scenarios.ts @@ -13,9 +13,9 @@ import { type ContentPart, type FinishReason, type LanguageModel, -} from "../src" -import { LLMClient } from "../src/route" -import { Tool } from "../src/tool" +} from "../src/index.js" +import { LLMClient } from "../src/route.js" +import { Tool } from "../src/tool.js" export const weatherToolName = "get_weather" diff --git a/packages/ai/test/recorded-test.ts b/packages/ai/test/recorded-test.ts index a0df87d9ca..ed57eeb9ec 100644 --- a/packages/ai/test/recorded-test.ts +++ b/packages/ai/test/recorded-test.ts @@ -2,17 +2,17 @@ import { HttpRecorder } from "@opencode-ai/http-recorder" import { Layer } from "effect" import * as path from "node:path" import { fileURLToPath } from "node:url" -import { LLMClient, RequestExecutor, WebSocketExecutor } from "../src/route" -import { ImageClient } from "../src/image-client" -import type { Service as ImageClientService } from "../src/image-client" -import type { Service as LLMClientService } from "../src/route/client" -import type { Service as RequestExecutorService } from "../src/route/executor" -import type { Service as WebSocketExecutorService } from "../src/route/transport/websocket" +import { LLMClient, RequestExecutor, WebSocketExecutor } from "../src/route.js" +import { ImageClient } from "../src/image-client.js" +import type { Service as ImageClientService } from "../src/image-client.js" +import type { Service as LLMClientService } from "../src/route/client.js" +import type { Service as RequestExecutorService } from "../src/route/executor.js" +import type { Service as WebSocketExecutorService } from "../src/route/transport/websocket.js" import { recordedEffectGroup, type RecordedCaseOptions as RunnerCaseOptions, type RecordedGroupOptions, -} from "./recorded-runner" +} from "./recorded-runner.js" const __dirname = path.dirname(fileURLToPath(import.meta.url)) const FIXTURES_DIR = path.resolve(__dirname, "fixtures", "recordings") diff --git a/packages/ai/test/response.test.ts b/packages/ai/test/response.test.ts index f05f8e167e..1fae972a2b 100644 --- a/packages/ai/test/response.test.ts +++ b/packages/ai/test/response.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from "bun:test" -import { LLMEvent, LLMResponse } from "../src" +import { LLMEvent, LLMResponse } from "../src/index.js" const reduce = (events: ReadonlyArray) => events.reduce(LLMResponse.reduce, LLMResponse.empty()) const finishEvents = (events: ReadonlyArray) => events.filter(LLMEvent.is.finish) diff --git a/packages/ai/test/route.test.ts b/packages/ai/test/route.test.ts index 681583bc9e..d84c9346c5 100644 --- a/packages/ai/test/route.test.ts +++ b/packages/ai/test/route.test.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from "bun:test" -import * as OpenAIChat from "../src/protocols/openai-chat" -import { Auth } from "../src/route" +import * as OpenAIChat from "../src/protocols/openai-chat.js" +import { Auth } from "../src/route.js" describe("Route.with", () => { test("merges endpoint query and header defaults while replacing auth and id", () => { diff --git a/packages/ai/test/schema.test.ts b/packages/ai/test/schema.test.ts index bf5c94dfd9..4a01be238a 100644 --- a/packages/ai/test/schema.test.ts +++ b/packages/ai/test/schema.test.ts @@ -1,7 +1,7 @@ import { describe, expect, test } from "bun:test" import { Effect, Schema } from "effect" -import * as OpenAIChat from "../src/protocols/openai-chat" -import * as OpenAIResponses from "../src/protocols/openai-responses" +import * as OpenAIChat from "../src/protocols/openai-chat.js" +import * as OpenAIResponses from "../src/protocols/openai-responses.js" import { AIError, ContentPart, @@ -12,8 +12,8 @@ import { ModelID, ProviderID, Usage, -} from "../src/schema" -import { ProviderShared } from "../src/protocols/shared" +} from "../src/schema/index.js" +import { ProviderShared } from "../src/protocols/shared.js" const model = new LanguageModel({ id: ModelID.make("fake-model"), diff --git a/packages/ai/test/tool-runtime.test.ts b/packages/ai/test/tool-runtime.test.ts index 85ea829b43..e3665bd7a9 100644 --- a/packages/ai/test/tool-runtime.test.ts +++ b/packages/ai/test/tool-runtime.test.ts @@ -10,18 +10,18 @@ import { ToolChoice, ToolOutput, toDefinitions, -} from "../src" -import { Auth, LLMClient } from "../src/route" -import * as AnthropicMessages from "../src/protocols/anthropic-messages" -import * as OpenAIChat from "../src/protocols/openai-chat" -import * as OpenAIResponses from "../src/protocols/openai-responses" -import { Tool, ToolFailure, type ToolExecuteContext } from "../src/tool" -import { ToolRuntime } from "../src/tool-runtime" -import { it } from "./lib/effect" -import * as TestToolRuntime from "./lib/tool-runtime" -import { dynamicResponse, scriptedResponses } from "./lib/http" -import { deltaChunk, finishChunk, toolCallChunk } from "./lib/openai-chunks" -import { sseEvents } from "./lib/sse" +} from "../src/index.js" +import { Auth, LLMClient } from "../src/route.js" +import * as AnthropicMessages from "../src/protocols/anthropic-messages.js" +import * as OpenAIChat from "../src/protocols/openai-chat.js" +import * as OpenAIResponses from "../src/protocols/openai-responses.js" +import { Tool, ToolFailure, type ToolExecuteContext } from "../src/tool.js" +import { ToolRuntime } from "../src/tool-runtime.js" +import { it } from "./lib/effect.js" +import * as TestToolRuntime from "./lib/tool-runtime.js" +import { dynamicResponse, scriptedResponses } from "./lib/http.js" +import { deltaChunk, finishChunk, toolCallChunk } from "./lib/openai-chunks.js" +import { sseEvents } from "./lib/sse.js" const model = OpenAIChat.route .with({ endpoint: { baseURL: "https://api.openai.test/v1/" }, auth: Auth.bearer("test") }) diff --git a/packages/ai/test/tool-schema-projection.test.ts b/packages/ai/test/tool-schema-projection.test.ts index 4f83942a66..551d231da3 100644 --- a/packages/ai/test/tool-schema-projection.test.ts +++ b/packages/ai/test/tool-schema-projection.test.ts @@ -1,11 +1,11 @@ import { describe, expect, test } from "bun:test" import { Effect } from "effect" -import { LLM } from "../src" -import { OpenAIChat } from "../src/protocols" -import { ToolSchemaProjection } from "../src/protocols/utils/tool-schema" -import { Auth } from "../src/route" -import { compileRequest } from "../src/route/client" -import { it } from "./lib/effect" +import { LLM } from "../src/index.js" +import { OpenAIChat } from "../src/protocols.js" +import { ToolSchemaProjection } from "../src/protocols/utils/tool-schema.js" +import { Auth } from "../src/route.js" +import { compileRequest } from "../src/route/client.js" +import { it } from "./lib/effect.js" describe("tool schema projections", () => { test("moonshot strips $ref siblings and converts tuple arrays to a schema object", () => { diff --git a/packages/ai/test/tool-stream.test.ts b/packages/ai/test/tool-stream.test.ts index 51c2c6fcfc..f549bf04ad 100644 --- a/packages/ai/test/tool-stream.test.ts +++ b/packages/ai/test/tool-stream.test.ts @@ -1,8 +1,8 @@ import { describe, expect } from "bun:test" import { Effect } from "effect" -import { AIError } from "../src/schema" -import { ToolStream } from "../src/protocols/utils/tool-stream" -import { it } from "./lib/effect" +import { AIError } from "../src/schema/index.js" +import { ToolStream } from "../src/protocols/utils/tool-stream.js" +import { it } from "./lib/effect.js" const ADAPTER = "test-route" diff --git a/packages/ai/test/tool.types.ts b/packages/ai/test/tool.types.ts index 611de720e6..9407b22249 100644 --- a/packages/ai/test/tool.types.ts +++ b/packages/ai/test/tool.types.ts @@ -1,8 +1,8 @@ import { Effect, Schema } from "effect" -import { LLM, LLMRequest, ToolRuntime, toDefinitions } from "../src" -import * as OpenAIChat from "../src/protocols/openai-chat" -import { Auth } from "../src/route" -import { Tool } from "../src/tool" +import { LLM, LLMRequest, ToolRuntime, toDefinitions } from "../src/index.js" +import * as OpenAIChat from "../src/protocols/openai-chat.js" +import { Auth } from "../src/route.js" +import { Tool } from "../src/tool.js" const request = LLM.request({ model: OpenAIChat.route.with({ auth: Auth.bearer("fixture") }).model({ id: "gpt-4o-mini" }), diff --git a/packages/ai/tsconfig.json b/packages/ai/tsconfig.json index dfd9a832c7..ee018ab7b0 100644 --- a/packages/ai/tsconfig.json +++ b/packages/ai/tsconfig.json @@ -2,6 +2,9 @@ "$schema": "https://json.schemastore.org/tsconfig.json", "extends": "@tsconfig/bun/tsconfig.json", "compilerOptions": { + "module": "NodeNext", + "moduleResolution": "NodeNext", + "allowImportingTsExtensions": false, "rootDir": "src", "outDir": "dist", "declaration": true, diff --git a/packages/client/src/effect/generated/client.ts b/packages/client/src/effect/generated/client.ts index e2f35207de..ca1d6e74dc 100644 --- a/packages/client/src/effect/generated/client.ts +++ b/packages/client/src/effect/generated/client.ts @@ -233,7 +233,7 @@ import type { Endpoint29_0Input, Endpoint29_0Output, } from "../api/api.js" -import { ClientError } from "./client-error" +import { ClientError } from "./client-error.js" type RawClient = HttpApiClient.ForApi diff --git a/packages/client/src/effect/generated/index.ts b/packages/client/src/effect/generated/index.ts index bc0dbc9fa4..0589939b46 100644 --- a/packages/client/src/effect/generated/index.ts +++ b/packages/client/src/effect/generated/index.ts @@ -1,2 +1,2 @@ -export { ClientError } from "./client-error" -export * as OpenCode from "./client" +export { ClientError } from "./client-error.js" +export * as OpenCode from "./client.js" diff --git a/packages/client/src/promise/generated/client.ts b/packages/client/src/promise/generated/client.ts index de9dfe492b..497c605782 100644 --- a/packages/client/src/promise/generated/client.ts +++ b/packages/client/src/promise/generated/client.ts @@ -228,8 +228,8 @@ import type { WebsearchQueryOutput, ConfigGetInput, ConfigGetOutput, -} from "./types" -import { ClientError } from "./client-error" +} from "./types.js" +import { ClientError } from "./client-error.js" export interface ClientOptions { readonly baseUrl: string diff --git a/packages/client/src/promise/generated/index.ts b/packages/client/src/promise/generated/index.ts index 2570372cf8..1a4e5ea3fe 100644 --- a/packages/client/src/promise/generated/index.ts +++ b/packages/client/src/promise/generated/index.ts @@ -1,3 +1,3 @@ -export { ClientError, type ClientErrorReason } from "./client-error" -export * as OpenCode from "./client" -export * from "./types" +export { ClientError, type ClientErrorReason } from "./client-error.js" +export * as OpenCode from "./client.js" +export * from "./types.js" diff --git a/packages/client/src/promise/index.ts b/packages/client/src/promise/index.ts index a15ba0643e..9008f3be7b 100644 --- a/packages/client/src/promise/index.ts +++ b/packages/client/src/promise/index.ts @@ -1,4 +1,4 @@ -export * from "./generated/index" +export * from "./generated/index.js" export type { AgentApi, CatalogApi, @@ -14,5 +14,5 @@ export type { SessionApi, SkillApi, } from "./api.js" -export type { EventSubscribeOutput as OpenCodeEvent } from "./generated/types" -export type OpenCodeClient = ReturnType +export type { EventSubscribeOutput as OpenCodeEvent } from "./generated/types.js" +export type OpenCodeClient = ReturnType diff --git a/packages/effect-drizzle-sqlite/examples/basic.ts b/packages/effect-drizzle-sqlite/examples/basic.ts index 80397cd6e6..cab249ca71 100644 --- a/packages/effect-drizzle-sqlite/examples/basic.ts +++ b/packages/effect-drizzle-sqlite/examples/basic.ts @@ -5,7 +5,7 @@ import * as Context from "effect/Context" import * as Effect from "effect/Effect" import * as Layer from "effect/Layer" import * as Schema from "effect/Schema" -import { EffectDrizzleSqlite } from "../src" +import { EffectDrizzleSqlite } from "../src/index.js" const users = sqliteTable("users", { id: integer().primaryKey({ autoIncrement: true }), diff --git a/packages/effect-drizzle-sqlite/src/effect-sqlite/driver.ts b/packages/effect-drizzle-sqlite/src/effect-sqlite/driver.ts index f2ffc207d3..9a0d2ddce1 100644 --- a/packages/effect-drizzle-sqlite/src/effect-sqlite/driver.ts +++ b/packages/effect-drizzle-sqlite/src/effect-sqlite/driver.ts @@ -7,10 +7,10 @@ import { EffectLogger } from "drizzle-orm/effect-core" import { entityKind } from "drizzle-orm/entity" import type { AnyRelations, EmptyRelations } from "drizzle-orm/relations" import { SQLiteAsyncDialect } from "drizzle-orm/sqlite-core/dialect" -import { SQLiteEffectDatabase } from "../sqlite-core/effect/db" +import { SQLiteEffectDatabase } from "../sqlite-core/effect/db.js" import type { DrizzleConfig } from "drizzle-orm/utils" -import { jitCompatCheck } from "../internal/drizzle-utils" -import { type EffectSQLiteQueryEffectHKT, type EffectSQLiteRunResult, EffectSQLiteSession } from "./session" +import { jitCompatCheck } from "../internal/drizzle-utils.js" +import { type EffectSQLiteQueryEffectHKT, type EffectSQLiteRunResult, EffectSQLiteSession } from "./session.js" export class EffectSQLiteDatabase extends SQLiteEffectDatabase< EffectSQLiteQueryEffectHKT, diff --git a/packages/effect-drizzle-sqlite/src/effect-sqlite/index.ts b/packages/effect-drizzle-sqlite/src/effect-sqlite/index.ts index 1133e48b3a..c1f8a7f413 100644 --- a/packages/effect-drizzle-sqlite/src/effect-sqlite/index.ts +++ b/packages/effect-drizzle-sqlite/src/effect-sqlite/index.ts @@ -1,4 +1,4 @@ /* oxlint-disable */ export { EffectLogger } from "drizzle-orm/effect-core" -export * from "./driver" -export * from "./session" +export * from "./driver.js" +export * from "./session.js" diff --git a/packages/effect-drizzle-sqlite/src/effect-sqlite/migrator.ts b/packages/effect-drizzle-sqlite/src/effect-sqlite/migrator.ts index 6d0d155143..727950fe5b 100644 --- a/packages/effect-drizzle-sqlite/src/effect-sqlite/migrator.ts +++ b/packages/effect-drizzle-sqlite/src/effect-sqlite/migrator.ts @@ -2,8 +2,8 @@ import type { MigrationConfig } from "drizzle-orm/migrator" import { readMigrationFiles } from "drizzle-orm/migrator" import type { AnyRelations } from "drizzle-orm/relations" -import { migrate as coreMigrate } from "../sqlite-core/effect/session" -import type { EffectSQLiteDatabase } from "./driver" +import { migrate as coreMigrate } from "../sqlite-core/effect/session.js" +import type { EffectSQLiteDatabase } from "./driver.js" export function migrate( db: EffectSQLiteDatabase, diff --git a/packages/effect-drizzle-sqlite/src/effect-sqlite/session.ts b/packages/effect-drizzle-sqlite/src/effect-sqlite/session.ts index cba4c11bd4..e34099f184 100644 --- a/packages/effect-drizzle-sqlite/src/effect-sqlite/session.ts +++ b/packages/effect-drizzle-sqlite/src/effect-sqlite/session.ts @@ -15,7 +15,7 @@ import type { AnyRelations } from "drizzle-orm/relations" import type { RelationalQueryMapperConfig } from "drizzle-orm/relations" import type { Query } from "drizzle-orm/sql/sql" import type { SQLiteAsyncDialect } from "drizzle-orm/sqlite-core/dialect" -import { SQLiteEffectPreparedQuery, SQLiteEffectSession, SQLiteEffectTransaction } from "../sqlite-core/effect/session" +import { SQLiteEffectPreparedQuery, SQLiteEffectSession, SQLiteEffectTransaction } from "../sqlite-core/effect/session.js" import type { SelectedFieldsOrdered } from "drizzle-orm/sqlite-core/query-builders/select.types" import type { PreparedQueryConfig, SQLiteExecuteMethod, SQLiteTransactionConfig } from "drizzle-orm/sqlite-core/session" diff --git a/packages/effect-drizzle-sqlite/src/index.ts b/packages/effect-drizzle-sqlite/src/index.ts index d6606b7d9f..926c601c4e 100644 --- a/packages/effect-drizzle-sqlite/src/index.ts +++ b/packages/effect-drizzle-sqlite/src/index.ts @@ -1,6 +1,6 @@ export { EffectLogger } from "drizzle-orm/effect-core" -export * from "./effect-sqlite/driver" -export * from "./effect-sqlite/session" -export { migrate } from "./effect-sqlite/migrator" +export * from "./effect-sqlite/driver.js" +export * from "./effect-sqlite/session.js" +export { migrate } from "./effect-sqlite/migrator.js" -export * as EffectDrizzleSqlite from "." +export * as EffectDrizzleSqlite from "./index.js" diff --git a/packages/effect-drizzle-sqlite/src/sqlite-core/effect/count.ts b/packages/effect-drizzle-sqlite/src/sqlite-core/effect/count.ts index c420d6fbb0..e227653568 100644 --- a/packages/effect-drizzle-sqlite/src/sqlite-core/effect/count.ts +++ b/packages/effect-drizzle-sqlite/src/sqlite-core/effect/count.ts @@ -5,7 +5,7 @@ import { entityKind } from "drizzle-orm/entity" import { SQL, sql, type SQLWrapper } from "drizzle-orm/sql/sql" import type { SQLiteTable } from "drizzle-orm/sqlite-core/table" import type { SQLiteView } from "drizzle-orm/sqlite-core/view" -import type { SQLiteEffectSession } from "./session" +import type { SQLiteEffectSession } from "./session.js" function buildSQLiteEmbeddedCount(source: SQLiteTable | SQLiteView | SQL | SQLWrapper, filters?: SQL) { return sql`(select count(*) from ${source}${sql.raw(" where ").if(filters)}${filters})` diff --git a/packages/effect-drizzle-sqlite/src/sqlite-core/effect/db.ts b/packages/effect-drizzle-sqlite/src/sqlite-core/effect/db.ts index ac4cc140ad..523e5ce987 100644 --- a/packages/effect-drizzle-sqlite/src/sqlite-core/effect/db.ts +++ b/packages/effect-drizzle-sqlite/src/sqlite-core/effect/db.ts @@ -17,15 +17,15 @@ import type { SQLiteTable } from "drizzle-orm/sqlite-core/table" import type { SQLiteViewBase } from "drizzle-orm/sqlite-core/view-base" import { WithSubquery } from "drizzle-orm/subquery" import type { WithBuilder } from "drizzle-orm/sqlite-core/subquery" -import { SQLiteEffectCountBuilder } from "./count" -import { SQLiteEffectDeleteBase } from "./delete" -import { SQLiteEffectInsertBuilder } from "./insert" -import { SQLiteEffectRelationalQueryBuilder } from "./query" -import { SQLiteEffectRaw } from "./raw" -import { SQLiteEffectSelectBuilder } from "./select" -import type { SQLiteEffectSelectBase } from "./select" -import type { SQLiteEffectSession, SQLiteEffectTransaction } from "./session" -import { SQLiteEffectUpdateBuilder } from "./update" +import { SQLiteEffectCountBuilder } from "./count.js" +import { SQLiteEffectDeleteBase } from "./delete.js" +import { SQLiteEffectInsertBuilder } from "./insert.js" +import { SQLiteEffectRelationalQueryBuilder } from "./query.js" +import { SQLiteEffectRaw } from "./raw.js" +import { SQLiteEffectSelectBuilder } from "./select.js" +import type { SQLiteEffectSelectBase } from "./select.js" +import type { SQLiteEffectSession, SQLiteEffectTransaction } from "./session.js" +import { SQLiteEffectUpdateBuilder } from "./update.js" export class SQLiteEffectDatabase< TEffectHKT extends QueryEffectHKTBase, diff --git a/packages/effect-drizzle-sqlite/src/sqlite-core/effect/delete.ts b/packages/effect-drizzle-sqlite/src/sqlite-core/effect/delete.ts index 616e5ad249..3e56ae3d6c 100644 --- a/packages/effect-drizzle-sqlite/src/sqlite-core/effect/delete.ts +++ b/packages/effect-drizzle-sqlite/src/sqlite-core/effect/delete.ts @@ -15,8 +15,8 @@ import { extractUsedTable } from "drizzle-orm/sqlite-core/utils" import type { Subquery } from "drizzle-orm/subquery" import { type DrizzleTypeError, type ValueOrArray } from "drizzle-orm/utils" import type { SQLiteColumn } from "drizzle-orm/sqlite-core/columns/common" -import { getTableColumnsRuntime, orderSelectedFields } from "../../internal/drizzle-utils" -import type { SQLiteEffectPreparedQuery, SQLiteEffectSession } from "./session" +import { getTableColumnsRuntime, orderSelectedFields } from "../../internal/drizzle-utils.js" +import type { SQLiteEffectPreparedQuery, SQLiteEffectSession } from "./session.js" export type SQLiteEffectDeleteWithout< T extends AnySQLiteEffectDelete, diff --git a/packages/effect-drizzle-sqlite/src/sqlite-core/effect/index.ts b/packages/effect-drizzle-sqlite/src/sqlite-core/effect/index.ts index ab7aeb1ab6..4565d3bfd1 100644 --- a/packages/effect-drizzle-sqlite/src/sqlite-core/effect/index.ts +++ b/packages/effect-drizzle-sqlite/src/sqlite-core/effect/index.ts @@ -1,10 +1,10 @@ /* oxlint-disable */ -export * from "./count" -export * from "./db" -export * from "./delete" -export * from "./insert" -export * from "./query" -export * from "./raw" -export * from "./select" -export * from "./session" -export * from "./update" +export * from "./count.js" +export * from "./db.js" +export * from "./delete.js" +export * from "./insert.js" +export * from "./query.js" +export * from "./raw.js" +export * from "./select.js" +export * from "./session.js" +export * from "./update.js" diff --git a/packages/effect-drizzle-sqlite/src/sqlite-core/effect/insert.ts b/packages/effect-drizzle-sqlite/src/sqlite-core/effect/insert.ts index 904aa4a076..43e91fff97 100644 --- a/packages/effect-drizzle-sqlite/src/sqlite-core/effect/insert.ts +++ b/packages/effect-drizzle-sqlite/src/sqlite-core/effect/insert.ts @@ -22,8 +22,8 @@ import { type DrizzleTypeError, haveSameKeys } from "drizzle-orm/utils" import type { SQLiteColumn } from "drizzle-orm/sqlite-core/columns/common" import { QueryBuilder } from "drizzle-orm/sqlite-core/query-builders/query-builder" import type { SQLiteUpdateSetSource } from "drizzle-orm/sqlite-core/query-builders/update" -import { getTableColumnsRuntime, mapUpdateSet, orderSelectedFields } from "../../internal/drizzle-utils" -import type { SQLiteEffectPreparedQuery, SQLiteEffectSession } from "./session" +import { getTableColumnsRuntime, mapUpdateSet, orderSelectedFields } from "../../internal/drizzle-utils.js" +import type { SQLiteEffectPreparedQuery, SQLiteEffectSession } from "./session.js" export type SQLiteEffectInsertWithout< T extends AnySQLiteEffectInsert, diff --git a/packages/effect-drizzle-sqlite/src/sqlite-core/effect/query.ts b/packages/effect-drizzle-sqlite/src/sqlite-core/effect/query.ts index 1f6b1ece0c..460c35c588 100644 --- a/packages/effect-drizzle-sqlite/src/sqlite-core/effect/query.ts +++ b/packages/effect-drizzle-sqlite/src/sqlite-core/effect/query.ts @@ -16,7 +16,7 @@ import type { KnownKeysOnly } from "drizzle-orm/utils" import type { SQLiteDialect } from "drizzle-orm/sqlite-core/dialect" import type { PreparedQueryConfig } from "drizzle-orm/sqlite-core/session" import type { SQLiteTable } from "drizzle-orm/sqlite-core/table" -import type { SQLiteEffectPreparedQuery, SQLiteEffectSession } from "./session" +import type { SQLiteEffectPreparedQuery, SQLiteEffectSession } from "./session.js" export class SQLiteEffectRelationalQueryBuilder< out TSchema extends TablesRelationalConfig, diff --git a/packages/effect-drizzle-sqlite/src/sqlite-core/effect/select.ts b/packages/effect-drizzle-sqlite/src/sqlite-core/effect/select.ts index b2fffeca3c..a65fc5492b 100644 --- a/packages/effect-drizzle-sqlite/src/sqlite-core/effect/select.ts +++ b/packages/effect-drizzle-sqlite/src/sqlite-core/effect/select.ts @@ -26,8 +26,8 @@ import type { SQLiteTable } from "drizzle-orm/sqlite-core/table" import { SQLiteViewBase } from "drizzle-orm/sqlite-core/view-base" import { Subquery } from "drizzle-orm/subquery" import { type Assume, getTableColumns } from "drizzle-orm/utils" -import { getViewSelectedFieldsRuntime, orderSelectedFields } from "../../internal/drizzle-utils" -import type { SQLiteEffectPreparedQuery, SQLiteEffectSession } from "./session" +import { getViewSelectedFieldsRuntime, orderSelectedFields } from "../../internal/drizzle-utils.js" +import type { SQLiteEffectPreparedQuery, SQLiteEffectSession } from "./session.js" export type SQLiteEffectSelectPrepare< T extends AnySQLiteEffectSelect, diff --git a/packages/effect-drizzle-sqlite/src/sqlite-core/effect/session.ts b/packages/effect-drizzle-sqlite/src/sqlite-core/effect/session.ts index ea83efe0a2..58b1064348 100644 --- a/packages/effect-drizzle-sqlite/src/sqlite-core/effect/session.ts +++ b/packages/effect-drizzle-sqlite/src/sqlite-core/effect/session.ts @@ -24,10 +24,10 @@ import { fillPlaceholders, type Query, type SQL, sql } from "drizzle-orm/sql/sql import type { SQLiteAsyncDialect } from "drizzle-orm/sqlite-core/dialect" import type { SelectedFieldsOrdered } from "drizzle-orm/sqlite-core/query-builders/select.types" import type { PreparedQueryConfig, SQLiteExecuteMethod, SQLiteTransactionConfig } from "drizzle-orm/sqlite-core/session" -import { upgradeIfNeeded } from "../../up-migrations/effect-sqlite" +import { upgradeIfNeeded } from "../../up-migrations/effect-sqlite.js" import { assertUnreachable, makeJitQueryMapper, type RowsMapper } from "drizzle-orm/utils" -import { mapResultRow } from "../../internal/drizzle-utils" -import { SQLiteEffectDatabase } from "./db" +import { mapResultRow } from "../../internal/drizzle-utils.js" +import { SQLiteEffectDatabase } from "./db.js" type MigrationConfigWithInit = MigrationConfig & { init?: boolean } diff --git a/packages/effect-drizzle-sqlite/src/sqlite-core/effect/update.ts b/packages/effect-drizzle-sqlite/src/sqlite-core/effect/update.ts index 741b18b2e5..5a39708a10 100644 --- a/packages/effect-drizzle-sqlite/src/sqlite-core/effect/update.ts +++ b/packages/effect-drizzle-sqlite/src/sqlite-core/effect/update.ts @@ -22,8 +22,8 @@ import { getViewSelectedFieldsRuntime, mapUpdateSet, orderSelectedFields, -} from "../../internal/drizzle-utils" -import type { SQLiteEffectPreparedQuery, SQLiteEffectSession } from "./session" +} from "../../internal/drizzle-utils.js" +import type { SQLiteEffectPreparedQuery, SQLiteEffectSession } from "./session.js" export type SQLiteEffectUpdateWithout< T extends AnySQLiteEffectUpdate, diff --git a/packages/effect-drizzle-sqlite/src/up-migrations/effect-sqlite.ts b/packages/effect-drizzle-sqlite/src/up-migrations/effect-sqlite.ts index 3418752271..d79eb8b2f5 100644 --- a/packages/effect-drizzle-sqlite/src/up-migrations/effect-sqlite.ts +++ b/packages/effect-drizzle-sqlite/src/up-migrations/effect-sqlite.ts @@ -5,13 +5,13 @@ import { EffectDrizzleError } from "drizzle-orm/effect-core/errors" import type { QueryEffectHKTBase } from "drizzle-orm/effect-core/query-effect" import type { MigrationMeta } from "drizzle-orm/migrator" import { sql } from "drizzle-orm/sql/sql" -import type { SQLiteEffectSession } from "../sqlite-core/effect/session" +import type { SQLiteEffectSession } from "../sqlite-core/effect/session.js" import { buildSQLiteMigrationBackfillStatements, prepareSQLiteMigrationBackfill, type SQLiteMigrationTableRow, -} from "./sqlite" -import { GET_VERSION_FOR, MIGRATIONS_TABLE_VERSIONS, type UpgradeResult } from "./utils" +} from "./sqlite.js" +import { GET_VERSION_FOR, MIGRATIONS_TABLE_VERSIONS, type UpgradeResult } from "./utils.js" const migrationUpgradeError = (cause: unknown) => new EffectDrizzleError({ diff --git a/packages/effect-drizzle-sqlite/src/up-migrations/sqlite.ts b/packages/effect-drizzle-sqlite/src/up-migrations/sqlite.ts index 2887c66bed..6cf99b0c3b 100644 --- a/packages/effect-drizzle-sqlite/src/up-migrations/sqlite.ts +++ b/packages/effect-drizzle-sqlite/src/up-migrations/sqlite.ts @@ -5,7 +5,7 @@ import type { AnyRelations } from "drizzle-orm/relations" import { type SQL, sql } from "drizzle-orm/sql/sql" import type { BaseSQLiteDatabase } from "drizzle-orm/sqlite-core" import type { SQLiteSession } from "drizzle-orm/sqlite-core/session" -import { GET_VERSION_FOR, MIGRATIONS_TABLE_VERSIONS, type UpgradeResult } from "./utils" +import { GET_VERSION_FOR, MIGRATIONS_TABLE_VERSIONS, type UpgradeResult } from "./utils.js" /** @internal */ export type SQLiteMigrationTableRow = { id: number | null; hash: string; created_at: number } diff --git a/packages/effect-drizzle-sqlite/test/sqlite.test.ts b/packages/effect-drizzle-sqlite/test/sqlite.test.ts index 5303ee069a..fa4d527e96 100644 --- a/packages/effect-drizzle-sqlite/test/sqlite.test.ts +++ b/packages/effect-drizzle-sqlite/test/sqlite.test.ts @@ -9,7 +9,7 @@ import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core" import { Effect } from "effect" import type { SqlClient as SqlClientService } from "effect/unstable/sql/SqlClient" import { isSqlError } from "effect/unstable/sql/SqlError" -import { EffectDrizzleSqlite } from "../src" +import { EffectDrizzleSqlite } from "../src/index.js" const users = sqliteTable("users", { id: integer().primaryKey({ autoIncrement: true }), diff --git a/packages/effect-drizzle-sqlite/tsconfig.json b/packages/effect-drizzle-sqlite/tsconfig.json index 2bc480ffbb..370932e437 100644 --- a/packages/effect-drizzle-sqlite/tsconfig.json +++ b/packages/effect-drizzle-sqlite/tsconfig.json @@ -2,6 +2,9 @@ "$schema": "https://json.schemastore.org/tsconfig", "extends": "@tsconfig/bun/tsconfig.json", "compilerOptions": { + "module": "NodeNext", + "moduleResolution": "NodeNext", + "allowImportingTsExtensions": false, "lib": ["ESNext", "DOM", "DOM.Iterable"], "noUncheckedIndexedAccess": false, "plugins": [ diff --git a/packages/httpapi-codegen/src/index.ts b/packages/httpapi-codegen/src/index.ts index 8d4983b817..c01dc98a66 100644 --- a/packages/httpapi-codegen/src/index.ts +++ b/packages/httpapi-codegen/src/index.ts @@ -351,7 +351,7 @@ export function emitPromise( { path: "index.ts", content: - 'export { ClientError, type ClientErrorReason } from "./client-error"\nexport * as OpenCode from "./client"\nexport * from "./types"\n', + 'export { ClientError, type ClientErrorReason } from "./client-error.js"\nexport * as OpenCode from "./client.js"\nexport * from "./types.js"\n', }, ], } @@ -593,7 +593,7 @@ function renderEffectFiles(groups: ReadonlyArray): Output["files"] { { path: "client.ts", content: renderClient(groups) }, { path: "index.ts", - content: 'export { ClientError } from "./client-error"\nexport * as OpenCode from "./client"\n', + content: 'export { ClientError } from "./client-error.js"\nexport * as OpenCode from "./client.js"\n', }, ] } @@ -701,7 +701,7 @@ function renderImportedEffectFiles( options.shapeModule === undefined ? "" : `const preserveEffect = () => (effect: Effect.Effect) => effect\n${usesStream ? "const preserveStream = () => (stream: Stream.Stream) => stream\n" : ""}\n` - const client = `// Generated by @opencode-ai/httpapi-codegen. Do not edit.\nimport { Effect${usesStream ? ", Stream" : ""}, Schema } from "effect"\nimport { Sse } from "effect/unstable/encoding"\nimport { HttpClientError } from "effect/unstable/http"\n${httpApiImport}${imports}\n${shapeImport}import { ClientError } from "./client-error"\n\n${projection?.source ?? ""}type RawClient = HttpApiClient.ForApi\n\nconst mapClientError = (error: E) => HttpClientError.isHttpClientError(error) || Schema.isSchemaError(error) || Sse.Retry.is(error) ? new ClientError({ cause: error }) : error\n\n${preserve}${adapters.join("\n\n")}\n\nconst adaptClient = (raw: RawClient) => ({ ${fields.join(", ")} })\n\nexport const make = (options?: { readonly baseUrl?: URL | string }) => HttpApiClient.make(${api}, options).pipe(Effect.map(adaptClient))\n` + const client = `// Generated by @opencode-ai/httpapi-codegen. Do not edit.\nimport { Effect${usesStream ? ", Stream" : ""}, Schema } from "effect"\nimport { Sse } from "effect/unstable/encoding"\nimport { HttpClientError } from "effect/unstable/http"\n${httpApiImport}${imports}\n${shapeImport}import { ClientError } from "./client-error.js"\n\n${projection?.source ?? ""}type RawClient = HttpApiClient.ForApi\n\nconst mapClientError = (error: E) => HttpClientError.isHttpClientError(error) || Schema.isSchemaError(error) || Sse.Retry.is(error) ? new ClientError({ cause: error }) : error\n\n${preserve}${adapters.join("\n\n")}\n\nconst adaptClient = (raw: RawClient) => ({ ${fields.join(", ")} })\n\nexport const make = (options?: { readonly baseUrl?: URL | string }) => HttpApiClient.make(${api}, options).pipe(Effect.map(adaptClient))\n` return [ { path: "client-error.ts", @@ -711,7 +711,7 @@ function renderImportedEffectFiles( { path: "client.ts", content: client }, { path: "index.ts", - content: 'export { ClientError } from "./client-error"\nexport * as OpenCode from "./client"\n', + content: 'export { ClientError } from "./client-error.js"\nexport * as OpenCode from "./client.js"\n', }, ] } @@ -906,7 +906,7 @@ function renderPromiseClient(groups: ReadonlyArray) { if (group.endpoints[0]?.topLevel) return fields return `${JSON.stringify(group.identifier)}: { ${fields} }` }) - return `import type { ${imports.join(", ")} } from "./types"\nimport { ClientError } from "./client-error"\n\nexport interface ClientOptions {\n readonly baseUrl: string\n readonly fetch?: typeof globalThis.fetch\n readonly headers?: RequestInit["headers"]\n}\n\nexport interface RequestOptions {\n readonly signal?: AbortSignal\n readonly headers?: RequestInit["headers"]\n}\n\ninterface RequestDescriptor {\n readonly method: string\n readonly path: string\n readonly query?: Record\n readonly headers?: Record\n readonly body?: unknown\n readonly successStatus: number\n readonly declaredStatuses: ReadonlyArray\n readonly empty: boolean\n}\n\nconst maxSseEventBytes = 16 * 1024 * 1024\n\nexport function make(options: ClientOptions) {\n const fetch = options.fetch ?? globalThis.fetch\n\n const prepare = (descriptor: RequestDescriptor, requestOptions?: RequestOptions) => {\n const url = new URL(descriptor.path, options.baseUrl)\n for (const [key, value] of Object.entries(descriptor.query ?? {})) appendQuery(url.searchParams, key, value)\n const headers = new Headers(options.headers)\n for (const [key, value] of Object.entries(descriptor.headers ?? {})) {\n if (value !== undefined && value !== null) headers.set(key, String(value))\n }\n for (const [key, value] of new Headers(requestOptions?.headers)) headers.set(key, value)\n if (descriptor.body !== undefined && !headers.has("content-type")) headers.set("content-type", "application/json")\n return {\n url,\n init: {\n method: descriptor.method,\n signal: requestOptions?.signal,\n headers,\n body: descriptor.body === undefined ? undefined : JSON.stringify(descriptor.body),\n } satisfies RequestInit,\n }\n }\n\n const execute = async (descriptor: RequestDescriptor, requestOptions?: RequestOptions) => {\n try {\n const prepared = prepare(descriptor, requestOptions)\n return await fetch(prepared.url, prepared.init)\n } catch (cause) {\n throw new ClientError("Transport", { cause })\n }\n }\n\n const responseError = async (response: Response, descriptor: RequestDescriptor): Promise => {\n if (descriptor.declaredStatuses.includes(response.status)) throw await json(response)\n try {\n await response.body?.cancel()\n } catch {}\n throw new ClientError("UnexpectedStatus", { cause: { status: response.status } })\n }\n\n const request = async (descriptor: RequestDescriptor, requestOptions?: RequestOptions): Promise => {\n const response = await execute(descriptor, requestOptions)\n if (response.status !== descriptor.successStatus) return responseError(response, descriptor)\n if (descriptor.empty) {\n try {\n await response.body?.cancel()\n } catch {}\n return undefined as A\n }\n return await json(response) as A\n }\n\n const sse = (descriptor: RequestDescriptor, requestOptions?: RequestOptions): AsyncIterable => ({\n async *[Symbol.asyncIterator]() {\n const response = await execute(descriptor, requestOptions)\n if (response.status !== descriptor.successStatus) await responseError(response, descriptor)\n if (!isContentType(response, "text/event-stream")) {\n try {\n await response.body?.cancel()\n } catch {}\n throw new ClientError("UnsupportedContentType")\n }\n if (response.body === null) throw new ClientError("MalformedResponse")\n const reader = response.body.getReader()\n const decoder = new TextDecoder()\n let buffer = ""\n try {\n while (true) {\n let next: ReadableStreamReadResult\n try {\n next = await reader.read()\n } catch (cause) {\n throw new ClientError("Transport", { cause })\n }\n buffer += decoder.decode(next.value, { stream: !next.done })\n if (buffer.length > maxSseEventBytes) throw new ClientError("SseEventTooLarge")\n const trailingCarriageReturn = !next.done && buffer.endsWith("\\r")\n if (trailingCarriageReturn) buffer = buffer.slice(0, -1)\n buffer = buffer.replaceAll("\\r\\n", "\\n").replaceAll("\\r", "\\n")\n if (trailingCarriageReturn) buffer += "\\r"\n if (next.done && buffer !== "") buffer += "\\n\\n"\n let boundary = buffer.indexOf("\\n\\n")\n while (boundary >= 0) {\n const block = buffer.slice(0, boundary)\n buffer = buffer.slice(boundary + 2)\n const data = block.split("\\n").flatMap((line) => line.startsWith("data:") ? [line.slice(5).trimStart()] : []).join("\\n")\n if (data !== "") {\n try {\n yield JSON.parse(data) as A\n } catch (cause) {\n throw new ClientError("MalformedResponse", { cause })\n }\n }\n boundary = buffer.indexOf("\\n\\n")\n }\n if (next.done) return\n }\n } finally {\n try {\n await reader.cancel()\n } catch {}\n reader.releaseLock()\n }\n },\n })\n\n return { ${fields.join(", ")} }\n}\n\nfunction appendQuery(params: URLSearchParams, key: string, value: unknown): void {\n if (value === undefined) return\n if (value === null) {\n params.append(key, "null")\n return\n }\n if (Array.isArray(value)) {\n for (const item of value) appendQuery(params, key, item)\n return\n }\n if (typeof value === "object") {\n for (const [child, item] of Object.entries(value)) appendQuery(params, \`\${key}[\${child}]\`, item)\n return\n }\n params.append(key, String(value))\n}\n\nasync function json(response: Response): Promise {\n if (!isContentType(response, "application/json") && !response.headers.get("content-type")?.includes("+json")) {\n try {\n await response.body?.cancel()\n } catch {}\n throw new ClientError("UnsupportedContentType")\n }\n let text: string\n try {\n text = await response.text()\n } catch (cause) {\n throw new ClientError("Transport", { cause })\n }\n if (text === "") throw new ClientError("MalformedResponse")\n try {\n return JSON.parse(text)\n } catch (cause) {\n throw new ClientError("MalformedResponse", { cause })\n }\n}\n\nfunction isContentType(response: Response, expected: string) {\n return response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase() === expected\n}\n` + return `import type { ${imports.join(", ")} } from "./types.js"\nimport { ClientError } from "./client-error.js"\n\nexport interface ClientOptions {\n readonly baseUrl: string\n readonly fetch?: typeof globalThis.fetch\n readonly headers?: RequestInit["headers"]\n}\n\nexport interface RequestOptions {\n readonly signal?: AbortSignal\n readonly headers?: RequestInit["headers"]\n}\n\ninterface RequestDescriptor {\n readonly method: string\n readonly path: string\n readonly query?: Record\n readonly headers?: Record\n readonly body?: unknown\n readonly successStatus: number\n readonly declaredStatuses: ReadonlyArray\n readonly empty: boolean\n}\n\nconst maxSseEventBytes = 16 * 1024 * 1024\n\nexport function make(options: ClientOptions) {\n const fetch = options.fetch ?? globalThis.fetch\n\n const prepare = (descriptor: RequestDescriptor, requestOptions?: RequestOptions) => {\n const url = new URL(descriptor.path, options.baseUrl)\n for (const [key, value] of Object.entries(descriptor.query ?? {})) appendQuery(url.searchParams, key, value)\n const headers = new Headers(options.headers)\n for (const [key, value] of Object.entries(descriptor.headers ?? {})) {\n if (value !== undefined && value !== null) headers.set(key, String(value))\n }\n for (const [key, value] of new Headers(requestOptions?.headers)) headers.set(key, value)\n if (descriptor.body !== undefined && !headers.has("content-type")) headers.set("content-type", "application/json")\n return {\n url,\n init: {\n method: descriptor.method,\n signal: requestOptions?.signal,\n headers,\n body: descriptor.body === undefined ? undefined : JSON.stringify(descriptor.body),\n } satisfies RequestInit,\n }\n }\n\n const execute = async (descriptor: RequestDescriptor, requestOptions?: RequestOptions) => {\n try {\n const prepared = prepare(descriptor, requestOptions)\n return await fetch(prepared.url, prepared.init)\n } catch (cause) {\n throw new ClientError("Transport", { cause })\n }\n }\n\n const responseError = async (response: Response, descriptor: RequestDescriptor): Promise => {\n if (descriptor.declaredStatuses.includes(response.status)) throw await json(response)\n try {\n await response.body?.cancel()\n } catch {}\n throw new ClientError("UnexpectedStatus", { cause: { status: response.status } })\n }\n\n const request = async (descriptor: RequestDescriptor, requestOptions?: RequestOptions): Promise => {\n const response = await execute(descriptor, requestOptions)\n if (response.status !== descriptor.successStatus) return responseError(response, descriptor)\n if (descriptor.empty) {\n try {\n await response.body?.cancel()\n } catch {}\n return undefined as A\n }\n return await json(response) as A\n }\n\n const sse = (descriptor: RequestDescriptor, requestOptions?: RequestOptions): AsyncIterable => ({\n async *[Symbol.asyncIterator]() {\n const response = await execute(descriptor, requestOptions)\n if (response.status !== descriptor.successStatus) await responseError(response, descriptor)\n if (!isContentType(response, "text/event-stream")) {\n try {\n await response.body?.cancel()\n } catch {}\n throw new ClientError("UnsupportedContentType")\n }\n if (response.body === null) throw new ClientError("MalformedResponse")\n const reader = response.body.getReader()\n const decoder = new TextDecoder()\n let buffer = ""\n try {\n while (true) {\n let next: ReadableStreamReadResult\n try {\n next = await reader.read()\n } catch (cause) {\n throw new ClientError("Transport", { cause })\n }\n buffer += decoder.decode(next.value, { stream: !next.done })\n if (buffer.length > maxSseEventBytes) throw new ClientError("SseEventTooLarge")\n const trailingCarriageReturn = !next.done && buffer.endsWith("\\r")\n if (trailingCarriageReturn) buffer = buffer.slice(0, -1)\n buffer = buffer.replaceAll("\\r\\n", "\\n").replaceAll("\\r", "\\n")\n if (trailingCarriageReturn) buffer += "\\r"\n if (next.done && buffer !== "") buffer += "\\n\\n"\n let boundary = buffer.indexOf("\\n\\n")\n while (boundary >= 0) {\n const block = buffer.slice(0, boundary)\n buffer = buffer.slice(boundary + 2)\n const data = block.split("\\n").flatMap((line) => line.startsWith("data:") ? [line.slice(5).trimStart()] : []).join("\\n")\n if (data !== "") {\n try {\n yield JSON.parse(data) as A\n } catch (cause) {\n throw new ClientError("MalformedResponse", { cause })\n }\n }\n boundary = buffer.indexOf("\\n\\n")\n }\n if (next.done) return\n }\n } finally {\n try {\n await reader.cancel()\n } catch {}\n reader.releaseLock()\n }\n },\n })\n\n return { ${fields.join(", ")} }\n}\n\nfunction appendQuery(params: URLSearchParams, key: string, value: unknown): void {\n if (value === undefined) return\n if (value === null) {\n params.append(key, "null")\n return\n }\n if (Array.isArray(value)) {\n for (const item of value) appendQuery(params, key, item)\n return\n }\n if (typeof value === "object") {\n for (const [child, item] of Object.entries(value)) appendQuery(params, \`\${key}[\${child}]\`, item)\n return\n }\n params.append(key, String(value))\n}\n\nasync function json(response: Response): Promise {\n if (!isContentType(response, "application/json") && !response.headers.get("content-type")?.includes("+json")) {\n try {\n await response.body?.cancel()\n } catch {}\n throw new ClientError("UnsupportedContentType")\n }\n let text: string\n try {\n text = await response.text()\n } catch (cause) {\n throw new ClientError("Transport", { cause })\n }\n if (text === "") throw new ClientError("MalformedResponse")\n try {\n return JSON.parse(text)\n } catch (cause) {\n throw new ClientError("MalformedResponse", { cause })\n }\n}\n\nfunction isContentType(response: Response, expected: string) {\n return response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase() === expected\n}\n` } function promiseTypePrefix(group: string, path: ReadonlyArray) { @@ -1700,7 +1700,7 @@ function renderGroup(group: Group, groupIndex: number) { ? `HttpApiClient.Client` : `HttpApiClient.Client.Group` const usesStream = group.endpoints.some((item) => item.operation.success === "stream") - return `// Generated by @opencode-ai/httpapi-codegen. Do not edit.\nimport { Effect, Schema${usesStream ? ", Stream" : ""} } from "effect"\nimport { Sse } from "effect/unstable/encoding"\nimport { HttpClientError } from "effect/unstable/http"\nimport { HttpApiClient, HttpApiEndpoint, HttpApiGroup${usesHttpApiSchema ? ", HttpApiSchema" : ""} } from "effect/unstable/httpapi"\nimport { ClientError } from "./client-error"\n\n${declarations}\n\nexport const Group${groupIndex} = ${groupSource}\n\ntype RawGroup = ${rawGroup}\n\n${adapters.join("\n\n")}\n\nexport const adaptGroup${groupIndex} = (raw: RawGroup) => ({ ${methods} })\n` + return `// Generated by @opencode-ai/httpapi-codegen. Do not edit.\nimport { Effect, Schema${usesStream ? ", Stream" : ""} } from "effect"\nimport { Sse } from "effect/unstable/encoding"\nimport { HttpClientError } from "effect/unstable/http"\nimport { HttpApiClient, HttpApiEndpoint, HttpApiGroup${usesHttpApiSchema ? ", HttpApiSchema" : ""} } from "effect/unstable/httpapi"\nimport { ClientError } from "./client-error.js"\n\n${declarations}\n\nexport const Group${groupIndex} = ${groupSource}\n\ntype RawGroup = ${rawGroup}\n\n${adapters.join("\n\n")}\n\nexport const adaptGroup${groupIndex} = (raw: RawGroup) => ({ ${methods} })\n` } function renderEffectRequestPart( diff --git a/packages/httpapi-codegen/test/generated/event.ts b/packages/httpapi-codegen/test/generated/event.ts index af34a065a5..bd8a2926e0 100644 --- a/packages/httpapi-codegen/test/generated/event.ts +++ b/packages/httpapi-codegen/test/generated/event.ts @@ -3,7 +3,7 @@ import { Effect, Schema, Stream } from "effect" import { Sse } from "effect/unstable/encoding" import { HttpClientError } from "effect/unstable/http" import { HttpApiClient, HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi" -import { ClientError } from "./client-error" +import { ClientError } from "./client-error.js" const Endpoint0SuccessData = Schema.Struct({ type: Schema.String }) diff --git a/packages/httpapi-codegen/test/generated/index.ts b/packages/httpapi-codegen/test/generated/index.ts index bc0dbc9fa4..0589939b46 100644 --- a/packages/httpapi-codegen/test/generated/index.ts +++ b/packages/httpapi-codegen/test/generated/index.ts @@ -1,2 +1,2 @@ -export { ClientError } from "./client-error" -export * as OpenCode from "./client" +export { ClientError } from "./client-error.js" +export * as OpenCode from "./client.js" diff --git a/packages/httpapi-codegen/test/generated/session.ts b/packages/httpapi-codegen/test/generated/session.ts index fed4a1cc3e..dc288a175f 100644 --- a/packages/httpapi-codegen/test/generated/session.ts +++ b/packages/httpapi-codegen/test/generated/session.ts @@ -3,7 +3,7 @@ import { Effect, Schema } from "effect" import { Sse } from "effect/unstable/encoding" import { HttpClientError } from "effect/unstable/http" import { HttpApiClient, HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi" -import { ClientError } from "./client-error" +import { ClientError } from "./client-error.js" const Endpoint0Success = Schema.String diff --git a/packages/httpapi-codegen/test/generated/system.ts b/packages/httpapi-codegen/test/generated/system.ts index 6ba523d2c0..8f2a25afa6 100644 --- a/packages/httpapi-codegen/test/generated/system.ts +++ b/packages/httpapi-codegen/test/generated/system.ts @@ -3,7 +3,7 @@ import { Effect, Schema } from "effect" import { Sse } from "effect/unstable/encoding" import { HttpClientError } from "effect/unstable/http" import { HttpApiClient, HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi" -import { ClientError } from "./client-error" +import { ClientError } from "./client-error.js" const Endpoint0Success = Schema.String diff --git a/patches/@ff-labs%2Ffff-bun@0.10.1.patch b/patches/@ff-labs%2Ffff-bun@0.10.1.patch new file mode 100644 index 0000000000..f370ce39da --- /dev/null +++ b/patches/@ff-labs%2Ffff-bun@0.10.1.patch @@ -0,0 +1,90 @@ +diff --git a/src/download.ts b/src/download.ts +index 74918f3d27917197f4dce589937d0d8fa9956226..6515c40223fec909f9f80e5721b82ed1e4d87fcc 100644 +--- a/src/download.ts ++++ b/src/download.ts +@@ -10,7 +10,7 @@ import { existsSync } from "node:fs"; + import { createRequire } from "node:module"; + import { dirname, join } from "node:path"; + import { fileURLToPath } from "node:url"; +-import { getLibFilename, getNpmPackageName } from "./platform"; ++import { getLibFilename, getNpmPackageName } from "./platform.js"; + + /** + * Get the current file's directory +diff --git a/src/ffi.ts b/src/ffi.ts +index 0a9f3b075a8153db8fbad9593cb1ebd5938279f1..3599a15d9da40ca0e78850651ac3b7e1952ba230 100644 +--- a/src/ffi.ts ++++ b/src/ffi.ts +@@ -17,8 +17,8 @@ import { + ptr, + read, + } from "bun:ffi"; +-import { findBinary } from "./download"; +-import { embeddedLibPath } from "./embedded"; ++import { findBinary } from "./download.js"; ++import { embeddedLibPath } from "./embedded.js"; + import type { + DirItem, + DirSearchResult, +@@ -34,8 +34,8 @@ import type { + SearchResult, + WatchEvent, + WatchEventKind, +-} from "./fff-api"; +-import { createGrepCursor, err } from "./fff-api"; ++} from "./fff-api.js"; ++import { createGrepCursor, err } from "./fff-api.js"; + + /** Grep mode constants matching the C API (u8). */ + const GREP_MODE_PLAIN = 0; +diff --git a/src/finder.ts b/src/finder.ts +index d8210b43f4502527a2356fb0c3de837bc909ac97..31724f6a8aee51f76c76c5ebd6de5e12f3fafd99 100644 +--- a/src/finder.ts ++++ b/src/finder.ts +@@ -36,7 +36,7 @@ import { + isAvailable, + type NativeHandle, + readWatchEventBatch, +-} from "./ffi"; ++} from "./ffi.js"; + + import type { + DirSearchOptions, +@@ -56,9 +56,9 @@ import type { + WatchBatchCallback, + WatchOptions, + WatchUnsubscribe, +-} from "./fff-api"; ++} from "./fff-api.js"; + +-import { err } from "./fff-api"; ++import { err } from "./fff-api.js"; + + /** + * FileFinder - Fast file finder with fuzzy search +diff --git a/src/index.ts b/src/index.ts +index 3b54b82d03bd5d37f3665d59c91273dc62118c1b..17bf456ea78d6b1f432d514f12eb430cc8bfcab1 100644 +--- a/src/index.ts ++++ b/src/index.ts +@@ -1,4 +1,4 @@ +-export { binaryExists, findBinary } from "./download"; ++export { binaryExists, findBinary } from "./download.js"; + export type { + DbHealth, + DirItem, +@@ -29,12 +29,12 @@ export type { + WatchEventKind, + WatchOptions, + WatchUnsubscribe, +-} from "./fff-api"; ++} from "./fff-api.js"; + +-export { FileFinder } from "./finder"; ++export { FileFinder } from "./finder.js"; + export { + getLibExtension, + getLibFilename, + getNpmPackageName, + getTriple, +-} from "./platform"; ++} from "./platform.js";