@opencode-ai/ai 0.0.0-next-17239 → 0.0.0-next-17250
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cache-policy.d.ts +1 -1
- package/dist/cache-policy.js +2 -2
- package/dist/image-client.d.ts +3 -3
- package/dist/image-client.js +1 -1
- package/dist/image.d.ts +2 -2
- package/dist/image.js +2 -2
- package/dist/index.d.ts +18 -18
- package/dist/index.js +12 -12
- package/dist/llm.d.ts +8 -8
- package/dist/llm.js +3 -3
- package/dist/protocols/anthropic-messages.d.ts +7 -7
- package/dist/protocols/anthropic-messages.js +13 -13
- package/dist/protocols/bedrock-converse.d.ts +10 -10
- package/dist/protocols/bedrock-converse.js +14 -14
- package/dist/protocols/bedrock-event-stream.d.ts +2 -2
- package/dist/protocols/bedrock-event-stream.js +3 -3
- package/dist/protocols/gemini.d.ts +6 -6
- package/dist/protocols/gemini.js +11 -11
- package/dist/protocols/google-images.d.ts +3 -3
- package/dist/protocols/google-images.js +5 -5
- package/dist/protocols/index.d.ts +9 -9
- package/dist/protocols/index.js +9 -9
- package/dist/protocols/open-responses.d.ts +7 -7
- package/dist/protocols/open-responses.js +10 -10
- package/dist/protocols/openai-chat.d.ts +7 -7
- package/dist/protocols/openai-chat.js +13 -13
- package/dist/protocols/openai-compatible-chat.d.ts +3 -3
- package/dist/protocols/openai-compatible-chat.js +5 -5
- package/dist/protocols/openai-compatible-responses.d.ts +3 -3
- package/dist/protocols/openai-compatible-responses.js +4 -4
- package/dist/protocols/openai-images.d.ts +3 -3
- package/dist/protocols/openai-images.js +6 -6
- package/dist/protocols/openai-responses.d.ts +7 -7
- package/dist/protocols/openai-responses.js +12 -12
- package/dist/protocols/shared.d.ts +7 -7
- package/dist/protocols/shared.js +3 -3
- package/dist/protocols/utils/bedrock-auth.d.ts +2 -2
- package/dist/protocols/utils/bedrock-auth.js +3 -3
- package/dist/protocols/utils/bedrock-cache.d.ts +4 -4
- package/dist/protocols/utils/bedrock-cache.js +2 -2
- package/dist/protocols/utils/bedrock-media.d.ts +2 -2
- package/dist/protocols/utils/bedrock-media.js +2 -2
- package/dist/protocols/utils/gemini-tool-schema.d.ts +1 -1
- package/dist/protocols/utils/gemini-tool-schema.js +2 -2
- package/dist/protocols/utils/image-input.d.ts +2 -2
- package/dist/protocols/utils/image-input.js +1 -1
- package/dist/protocols/utils/lifecycle.d.ts +2 -2
- package/dist/protocols/utils/lifecycle.js +2 -2
- package/dist/protocols/utils/open-responses-options.d.ts +2 -2
- package/dist/protocols/utils/open-responses-options.js +2 -2
- package/dist/protocols/utils/openai-options.d.ts +3 -3
- package/dist/protocols/utils/openai-options.js +3 -3
- package/dist/protocols/utils/tool-schema.d.ts +1 -1
- package/dist/protocols/utils/tool-schema.js +2 -2
- package/dist/protocols/utils/tool-stream.d.ts +9 -9
- package/dist/protocols/utils/tool-stream.js +3 -3
- package/dist/protocols/xai-images.d.ts +3 -3
- package/dist/protocols/xai-images.js +5 -5
- package/dist/protocols/zai-images.d.ts +3 -3
- package/dist/protocols/zai-images.js +5 -5
- package/dist/protocols.d.ts +1 -1
- package/dist/protocols.js +1 -1
- package/dist/provider-error.d.ts +1 -1
- package/dist/provider-error.js +1 -1
- package/dist/provider-package.d.ts +2 -2
- package/dist/provider-package.js +1 -1
- package/dist/provider.d.ts +2 -2
- package/dist/provider.js +1 -1
- package/dist/providers/amazon-bedrock/mantle/chat.d.ts +2 -2
- package/dist/providers/amazon-bedrock/mantle/chat.js +1 -1
- package/dist/providers/amazon-bedrock/mantle/responses.d.ts +2 -2
- package/dist/providers/amazon-bedrock/mantle/responses.js +1 -1
- package/dist/providers/amazon-bedrock/mantle.d.ts +2 -2
- package/dist/providers/amazon-bedrock/mantle.js +1 -1
- package/dist/providers/amazon-bedrock-mantle.d.ts +17 -17
- package/dist/providers/amazon-bedrock-mantle.js +6 -6
- package/dist/providers/amazon-bedrock.d.ts +9 -9
- package/dist/providers/amazon-bedrock.js +3 -3
- package/dist/providers/anthropic-compatible.d.ts +10 -10
- package/dist/providers/anthropic-compatible.js +4 -4
- package/dist/providers/anthropic.d.ts +10 -10
- package/dist/providers/anthropic.js +4 -4
- package/dist/providers/azure/chat.d.ts +2 -2
- package/dist/providers/azure/chat.js +1 -1
- package/dist/providers/azure/responses.d.ts +2 -2
- package/dist/providers/azure/responses.js +1 -1
- package/dist/providers/azure.d.ts +14 -14
- package/dist/providers/azure.js +7 -7
- package/dist/providers/cloudflare.d.ts +12 -12
- package/dist/providers/cloudflare.js +4 -4
- package/dist/providers/google-vertex/chat.d.ts +2 -2
- package/dist/providers/google-vertex/chat.js +1 -1
- package/dist/providers/google-vertex/gemini.d.ts +2 -2
- package/dist/providers/google-vertex/gemini.js +1 -1
- package/dist/providers/google-vertex/messages.d.ts +2 -2
- package/dist/providers/google-vertex/messages.js +1 -1
- package/dist/providers/google-vertex/responses.d.ts +2 -2
- package/dist/providers/google-vertex/responses.js +1 -1
- package/dist/providers/google-vertex-chat.d.ts +9 -9
- package/dist/providers/google-vertex-chat.js +3 -3
- package/dist/providers/google-vertex-messages.d.ts +8 -8
- package/dist/providers/google-vertex-messages.js +8 -8
- package/dist/providers/google-vertex-responses.d.ts +9 -9
- package/dist/providers/google-vertex-responses.js +3 -3
- package/dist/providers/google-vertex-shared.d.ts +2 -2
- package/dist/providers/google-vertex-shared.js +2 -2
- package/dist/providers/google-vertex.d.ts +8 -8
- package/dist/providers/google-vertex.js +7 -7
- package/dist/providers/google.d.ts +15 -15
- package/dist/providers/google.js +4 -4
- package/dist/providers/index.d.ts +18 -18
- package/dist/providers/index.js +18 -18
- package/dist/providers/open-responses-options.d.ts +3 -3
- package/dist/providers/open-responses-options.js +1 -1
- package/dist/providers/openai/chat.d.ts +2 -2
- package/dist/providers/openai/chat.js +1 -1
- package/dist/providers/openai/responses.d.ts +2 -2
- package/dist/providers/openai/responses.js +1 -1
- package/dist/providers/openai-compatible/responses.d.ts +1 -1
- package/dist/providers/openai-compatible/responses.js +1 -1
- package/dist/providers/openai-compatible-responses.d.ts +10 -10
- package/dist/providers/openai-compatible-responses.js +3 -3
- package/dist/providers/openai-compatible.d.ts +16 -16
- package/dist/providers/openai-compatible.js +4 -4
- package/dist/providers/openai-options.d.ts +4 -4
- package/dist/providers/openai-options.js +2 -2
- package/dist/providers/openai.d.ts +30 -30
- package/dist/providers/openai.js +6 -6
- package/dist/providers/openrouter.d.ts +11 -11
- package/dist/providers/openrouter.js +10 -10
- package/dist/providers/xai.d.ts +23 -23
- package/dist/providers/xai.js +9 -9
- package/dist/providers/zai.d.ts +7 -7
- package/dist/providers/zai.js +3 -3
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +1 -1
- package/dist/route/auth-options.d.ts +2 -2
- package/dist/route/auth-options.js +2 -2
- package/dist/route/auth.d.ts +2 -2
- package/dist/route/auth.js +2 -2
- package/dist/route/client.d.ts +11 -11
- package/dist/route/client.js +9 -9
- package/dist/route/endpoint.d.ts +2 -2
- package/dist/route/endpoint.js +2 -2
- package/dist/route/executor.d.ts +3 -3
- package/dist/route/executor.js +3 -3
- package/dist/route/framing.d.ts +2 -2
- package/dist/route/framing.js +2 -2
- package/dist/route/index.d.ts +16 -16
- package/dist/route/index.js +9 -9
- package/dist/route/protocol.d.ts +2 -2
- package/dist/route/protocol.js +1 -1
- package/dist/route/transport/http.d.ts +3 -3
- package/dist/route/transport/http.js +5 -5
- package/dist/route/transport/index.d.ts +8 -8
- package/dist/route/transport/index.js +4 -4
- package/dist/route/transport/websocket.d.ts +2 -2
- package/dist/route/transport/websocket.js +2 -2
- package/dist/route.d.ts +1 -1
- package/dist/route.js +1 -1
- package/dist/schema/errors.js +1 -1
- package/dist/schema/events.d.ts +2 -2
- package/dist/schema/events.js +3 -3
- package/dist/schema/index.d.ts +5 -5
- package/dist/schema/index.js +5 -5
- package/dist/schema/messages.d.ts +3 -3
- package/dist/schema/messages.js +3 -3
- package/dist/schema/options.d.ts +2 -2
- package/dist/schema/options.js +2 -2
- package/dist/testing.d.ts +20 -20
- package/dist/testing.js +3 -3
- package/dist/tool-runtime.d.ts +2 -2
- package/dist/tool-runtime.js +2 -2
- package/dist/tool.d.ts +3 -3
- package/dist/tool.js +2 -2
- package/package.json +3 -3
package/dist/route/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { Route, LLMClient } from "./client";
|
|
2
|
-
export * from "./executor";
|
|
3
|
-
export { Auth } from "./auth";
|
|
4
|
-
export { AuthOptions } from "./auth-options";
|
|
5
|
-
export { Endpoint } from "./endpoint";
|
|
6
|
-
export { Framing } from "./framing";
|
|
7
|
-
export { Protocol } from "./protocol";
|
|
8
|
-
export { HttpTransport, WebSocketExecutor, WebSocketTransport } from "./transport";
|
|
9
|
-
export * as Transport from "./transport";
|
|
1
|
+
export { Route, LLMClient } from "./client.js";
|
|
2
|
+
export * from "./executor.js";
|
|
3
|
+
export { Auth } from "./auth.js";
|
|
4
|
+
export { AuthOptions } from "./auth-options.js";
|
|
5
|
+
export { Endpoint } from "./endpoint.js";
|
|
6
|
+
export { Framing } from "./framing.js";
|
|
7
|
+
export { Protocol } from "./protocol.js";
|
|
8
|
+
export { HttpTransport, WebSocketExecutor, WebSocketTransport } from "./transport/index.js";
|
|
9
|
+
export * as Transport from "./transport/index.js";
|
package/dist/route/protocol.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema, type Effect } from "effect";
|
|
2
|
-
import type { AIError, LLMEvent, LLMRequest, ProtocolID } from "../schema";
|
|
2
|
+
import type { AIError, LLMEvent, LLMRequest, ProtocolID } from "../schema/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* The semantic API contract of one model server family.
|
|
5
5
|
*
|
|
@@ -74,4 +74,4 @@ export interface ProtocolStream<Frame, Event, State> {
|
|
|
74
74
|
*/
|
|
75
75
|
export declare const make: <Body, Frame, Event, State>(input: Protocol<Body, Frame, Event, State>) => Protocol<Body, Frame, Event, State>;
|
|
76
76
|
export declare const jsonEvent: <const S extends Schema.Top>(schema: S) => Schema.fromJsonString<S>;
|
|
77
|
-
export * as Protocol from "./protocol";
|
|
77
|
+
export * as Protocol from "./protocol.js";
|
package/dist/route/protocol.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { Headers, HttpClientRequest } from "effect/unstable/http";
|
|
3
|
-
import { Framing } from "../framing";
|
|
4
|
-
import type { HttpMiddleware, Transport, TransportPrepareInput } from "./index";
|
|
3
|
+
import { Framing } from "../framing.js";
|
|
4
|
+
import type { HttpMiddleware, Transport, TransportPrepareInput } from "./index.js";
|
|
5
5
|
export type JsonRequestInput<Body> = TransportPrepareInput<Body>;
|
|
6
6
|
export interface JsonRequestParts<Body = unknown> {
|
|
7
7
|
readonly url: string;
|
|
@@ -19,7 +19,7 @@ export declare const jsonRequestParts: <Body>(input: JsonRequestInput<Body>) =>
|
|
|
19
19
|
jsonBody: Record<string, unknown> | Body;
|
|
20
20
|
bodyText: string;
|
|
21
21
|
headers: Headers.Headers;
|
|
22
|
-
}, import("
|
|
22
|
+
}, import("../../schema/errors.js").AIError, never>;
|
|
23
23
|
export interface HttpJsonInput<_Body, Frame> {
|
|
24
24
|
readonly framing: Framing.Definition<Frame>;
|
|
25
25
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Effect, Stream } from "effect";
|
|
2
2
|
import { Headers, HttpClientRequest } from "effect/unstable/http";
|
|
3
|
-
import { Auth } from "../auth";
|
|
4
|
-
import { render as renderEndpoint } from "../endpoint";
|
|
5
|
-
import { Framing } from "../framing";
|
|
6
|
-
import * as ProviderShared from "../../protocols/shared";
|
|
7
|
-
import { mergeJsonRecords } from "../../schema";
|
|
3
|
+
import { Auth } from "../auth.js";
|
|
4
|
+
import { render as renderEndpoint } from "../endpoint.js";
|
|
5
|
+
import { Framing } from "../framing.js";
|
|
6
|
+
import * as ProviderShared from "../../protocols/shared.js";
|
|
7
|
+
import { mergeJsonRecords } from "../../schema/index.js";
|
|
8
8
|
const applyQuery = (url, query) => {
|
|
9
9
|
if (!query)
|
|
10
10
|
return url;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Effect, Stream } from "effect";
|
|
2
|
-
import { Endpoint } from "../endpoint";
|
|
3
|
-
import { Auth } from "../auth";
|
|
4
|
-
import type { HttpMiddleware, Interface as RequestExecutorInterface } from "../executor";
|
|
5
|
-
import type { Interface as WebSocketExecutorInterface } from "./websocket";
|
|
6
|
-
import type { AIError, LLMRequest } from "../../schema";
|
|
2
|
+
import { Endpoint } from "../endpoint.js";
|
|
3
|
+
import { Auth } from "../auth.js";
|
|
4
|
+
import type { HttpMiddleware, Interface as RequestExecutorInterface } from "../executor.js";
|
|
5
|
+
import type { Interface as WebSocketExecutorInterface } from "./websocket.js";
|
|
6
|
+
import type { AIError, LLMRequest } from "../../schema/index.js";
|
|
7
7
|
export interface TransportRuntime {
|
|
8
8
|
readonly http: RequestExecutorInterface;
|
|
9
9
|
readonly webSocket?: WebSocketExecutorInterface;
|
|
@@ -24,6 +24,6 @@ export interface TransportPrepareInput<Body> {
|
|
|
24
24
|
}) => Record<string, string>;
|
|
25
25
|
readonly middleware?: HttpMiddleware;
|
|
26
26
|
}
|
|
27
|
-
export * as HttpTransport from "./http";
|
|
28
|
-
export type { HttpHandler, HttpMiddleware } from "../executor";
|
|
29
|
-
export { WebSocketExecutor, WebSocketTransport } from "./websocket";
|
|
27
|
+
export * as HttpTransport from "./http.js";
|
|
28
|
+
export type { HttpHandler, HttpMiddleware } from "../executor.js";
|
|
29
|
+
export { WebSocketExecutor, WebSocketTransport } from "./websocket.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Endpoint } from "../endpoint";
|
|
2
|
-
import { Auth } from "../auth";
|
|
3
|
-
export * as HttpTransport from "./http";
|
|
4
|
-
export { WebSocketExecutor, WebSocketTransport } from "./websocket";
|
|
1
|
+
import { Endpoint } from "../endpoint.js";
|
|
2
|
+
import { Auth } from "../auth.js";
|
|
3
|
+
export * as HttpTransport from "./http.js";
|
|
4
|
+
export { WebSocketExecutor, WebSocketTransport } from "./websocket.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context, Effect, Layer, Stream } from "effect";
|
|
2
2
|
import { Headers } from "effect/unstable/http";
|
|
3
|
-
import { AIError } from "../../schema";
|
|
4
|
-
import type { Transport } from "./index";
|
|
3
|
+
import { AIError } from "../../schema/index.js";
|
|
4
|
+
import type { Transport } from "./index.js";
|
|
5
5
|
export interface WebSocketRequest {
|
|
6
6
|
readonly url: string;
|
|
7
7
|
readonly headers: Headers.Headers;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Cause, Context, Effect, Layer, Queue, Stream } from "effect";
|
|
2
2
|
import { Headers } from "effect/unstable/http";
|
|
3
|
-
import { AIError, TransportReason } from "../../schema";
|
|
4
|
-
import * as HttpTransport from "./http";
|
|
3
|
+
import { AIError, TransportReason } from "../../schema/index.js";
|
|
4
|
+
import * as HttpTransport from "./http.js";
|
|
5
5
|
export class Service extends Context.Service()("@opencode/AI/WebSocketExecutor") {
|
|
6
6
|
}
|
|
7
7
|
const transportError = (method, message, input = {}) => new AIError({
|
package/dist/route.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./route/index";
|
|
1
|
+
export * from "./route/index.js";
|
package/dist/route.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./route/index";
|
|
1
|
+
export * from "./route/index.js";
|
package/dist/schema/errors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { Tool } from "@opencode-ai/schema/tool";
|
|
3
|
-
import { ModelID, ProviderID, ProviderMetadata, RouteID } from "./ids";
|
|
3
|
+
import { ModelID, ProviderID, ProviderMetadata, RouteID } from "./ids.js";
|
|
4
4
|
export const ProviderFailureClassification = Schema.Literals(["context-overflow", "payload-too-large"]);
|
|
5
5
|
export class HttpRequestDetails extends Schema.Class("AI.HttpRequestDetails")({
|
|
6
6
|
method: Schema.String,
|
package/dist/schema/events.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import { ContentBlockID, ProviderMetadata, ToolCallID } from "./ids";
|
|
3
|
-
import { Message, ToolOutput, ToolResultValue } from "./messages";
|
|
2
|
+
import { ContentBlockID, ProviderMetadata, ToolCallID } from "./ids.js";
|
|
3
|
+
import { Message, ToolOutput, ToolResultValue } from "./messages.js";
|
|
4
4
|
declare const Usage_base: Schema.Class<Usage, Schema.Struct<{
|
|
5
5
|
readonly inputTokens: Schema.optional<Schema.Number>;
|
|
6
6
|
readonly outputTokens: Schema.optional<Schema.Number>;
|
package/dist/schema/events.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import { ContentBlockID, FinishReason, ProviderMetadata, ToolCallID } from "./ids";
|
|
3
|
-
import { Message, ToolCallPart, ToolOutput, ToolResultPart, ToolResultValue } from "./messages";
|
|
4
|
-
import { ProviderFailureClassification } from "./errors";
|
|
2
|
+
import { ContentBlockID, FinishReason, ProviderMetadata, ToolCallID } from "./ids.js";
|
|
3
|
+
import { Message, ToolCallPart, ToolOutput, ToolResultPart, ToolResultValue } from "./messages.js";
|
|
4
|
+
import { ProviderFailureClassification } from "./errors.js";
|
|
5
5
|
/**
|
|
6
6
|
* Token usage reported by an LLM provider.
|
|
7
7
|
*
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./ids";
|
|
2
|
-
export * from "./options";
|
|
3
|
-
export * from "./messages";
|
|
4
|
-
export * from "./events";
|
|
5
|
-
export * from "./errors";
|
|
1
|
+
export * from "./ids.js";
|
|
2
|
+
export * from "./options.js";
|
|
3
|
+
export * from "./messages.js";
|
|
4
|
+
export * from "./events.js";
|
|
5
|
+
export * from "./errors.js";
|
package/dist/schema/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./ids";
|
|
2
|
-
export * from "./options";
|
|
3
|
-
export * from "./messages";
|
|
4
|
-
export * from "./events";
|
|
5
|
-
export * from "./errors";
|
|
1
|
+
export * from "./ids.js";
|
|
2
|
+
export * from "./options.js";
|
|
3
|
+
export * from "./messages.js";
|
|
4
|
+
export * from "./events.js";
|
|
5
|
+
export * from "./errors.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { Tool } from "@opencode-ai/schema/tool";
|
|
3
|
-
import { CacheHint, GenerationOptions, HttpOptions } from "./options";
|
|
3
|
+
import { CacheHint, GenerationOptions, HttpOptions } from "./options.js";
|
|
4
4
|
declare const systemPartSchema: Schema.Struct<{
|
|
5
5
|
readonly type: Schema.Literal<"text">;
|
|
6
6
|
readonly text: Schema.String;
|
|
@@ -357,11 +357,11 @@ export declare namespace ToolChoice {
|
|
|
357
357
|
}
|
|
358
358
|
declare const LLMRequest_base: Schema.Class<LLMRequest, Schema.Struct<{
|
|
359
359
|
readonly id: Schema.optional<Schema.String>;
|
|
360
|
-
readonly model: Schema.declare<import("./options").LanguageModel<{
|
|
360
|
+
readonly model: Schema.declare<import("./options.js").LanguageModel<{
|
|
361
361
|
readonly [x: string]: {
|
|
362
362
|
readonly [x: string]: unknown;
|
|
363
363
|
};
|
|
364
|
-
}>, import("./options").LanguageModel<{
|
|
364
|
+
}>, import("./options.js").LanguageModel<{
|
|
365
365
|
readonly [x: string]: {
|
|
366
366
|
readonly [x: string]: unknown;
|
|
367
367
|
};
|
package/dist/schema/messages.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { Tool } from "@opencode-ai/schema/tool";
|
|
3
|
-
import { JsonSchema, MessageRole, ProviderMetadata } from "./ids";
|
|
4
|
-
import { CacheHint, CachePolicy, GenerationOptions, HttpOptions, LanguageModelSchema, ProviderOptions } from "./options";
|
|
5
|
-
import { isRecord } from "../utils/record";
|
|
3
|
+
import { JsonSchema, MessageRole, ProviderMetadata } from "./ids.js";
|
|
4
|
+
import { CacheHint, CachePolicy, GenerationOptions, HttpOptions, LanguageModelSchema, ProviderOptions, } from "./options.js";
|
|
5
|
+
import { isRecord } from "../utils/record.js";
|
|
6
6
|
const systemPartSchema = Schema.Struct({
|
|
7
7
|
type: Schema.Literal("text"),
|
|
8
8
|
text: Schema.String,
|
package/dist/schema/options.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import { ModelID, ProviderID } from "./ids";
|
|
3
|
-
import type { AnyRoute } from "../route/client";
|
|
2
|
+
import { ModelID, ProviderID } from "./ids.js";
|
|
3
|
+
import type { AnyRoute } from "../route/client.js";
|
|
4
4
|
export declare const mergeJsonRecords: (...items: ReadonlyArray<Record<string, unknown> | undefined>) => Record<string, unknown> | undefined;
|
|
5
5
|
export declare const ProviderOptions: Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
6
6
|
export type ProviderOptions = Schema.Schema.Type<typeof ProviderOptions>;
|
package/dist/schema/options.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import { JsonSchema, ModelID, ProviderID } from "./ids";
|
|
3
|
-
import { isRecord } from "../utils/record";
|
|
2
|
+
import { JsonSchema, ModelID, ProviderID } from "./ids.js";
|
|
3
|
+
import { isRecord } from "../utils/record.js";
|
|
4
4
|
export const mergeJsonRecords = (...items) => {
|
|
5
5
|
const defined = items.filter((item) => item !== undefined);
|
|
6
6
|
if (defined.length === 0)
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * as TestLLM from "./testing";
|
|
2
|
-
import { type Interface as LLMClientShape } from "./route/client";
|
|
3
|
-
import { LLMEvent, type FinishReasonDetails, type AIError, type LLMRequest, type UsageInput } from "./schema";
|
|
1
|
+
export * as TestLLM from "./testing.js";
|
|
2
|
+
import { type Interface as LLMClientShape } from "./route/client.js";
|
|
3
|
+
import { LLMEvent, type FinishReasonDetails, type AIError, type LLMRequest, type UsageInput } from "./schema/index.js";
|
|
4
4
|
import { Context, Effect, Layer, Scope, Stream } from "effect";
|
|
5
5
|
export type Response = readonly LLMEvent[] | Stream.Stream<LLMEvent, AIError>;
|
|
6
6
|
export type Gate = Readonly<{
|
|
@@ -185,7 +185,7 @@ export declare const complete: (options: {
|
|
|
185
185
|
readonly [x: string]: unknown;
|
|
186
186
|
};
|
|
187
187
|
} | undefined;
|
|
188
|
-
readonly usage?: import("./schema").Usage | undefined;
|
|
188
|
+
readonly usage?: import("./schema/events.js").Usage | undefined;
|
|
189
189
|
} | {
|
|
190
190
|
readonly type: "finish";
|
|
191
191
|
readonly reason: {
|
|
@@ -197,7 +197,7 @@ export declare const complete: (options: {
|
|
|
197
197
|
readonly [x: string]: unknown;
|
|
198
198
|
};
|
|
199
199
|
} | undefined;
|
|
200
|
-
readonly usage?: import("./schema").Usage | undefined;
|
|
200
|
+
readonly usage?: import("./schema/events.js").Usage | undefined;
|
|
201
201
|
} | {
|
|
202
202
|
readonly type: "provider-error";
|
|
203
203
|
readonly message: string;
|
|
@@ -367,7 +367,7 @@ export declare const stop: (...events: readonly LLMEvent[]) => ({
|
|
|
367
367
|
readonly [x: string]: unknown;
|
|
368
368
|
};
|
|
369
369
|
} | undefined;
|
|
370
|
-
readonly usage?: import("./schema").Usage | undefined;
|
|
370
|
+
readonly usage?: import("./schema/events.js").Usage | undefined;
|
|
371
371
|
} | {
|
|
372
372
|
readonly type: "finish";
|
|
373
373
|
readonly reason: {
|
|
@@ -379,7 +379,7 @@ export declare const stop: (...events: readonly LLMEvent[]) => ({
|
|
|
379
379
|
readonly [x: string]: unknown;
|
|
380
380
|
};
|
|
381
381
|
} | undefined;
|
|
382
|
-
readonly usage?: import("./schema").Usage | undefined;
|
|
382
|
+
readonly usage?: import("./schema/events.js").Usage | undefined;
|
|
383
383
|
} | {
|
|
384
384
|
readonly type: "provider-error";
|
|
385
385
|
readonly message: string;
|
|
@@ -549,7 +549,7 @@ export declare const toolCalls: (...events: readonly LLMEvent[]) => ({
|
|
|
549
549
|
readonly [x: string]: unknown;
|
|
550
550
|
};
|
|
551
551
|
} | undefined;
|
|
552
|
-
readonly usage?: import("./schema").Usage | undefined;
|
|
552
|
+
readonly usage?: import("./schema/events.js").Usage | undefined;
|
|
553
553
|
} | {
|
|
554
554
|
readonly type: "finish";
|
|
555
555
|
readonly reason: {
|
|
@@ -561,7 +561,7 @@ export declare const toolCalls: (...events: readonly LLMEvent[]) => ({
|
|
|
561
561
|
readonly [x: string]: unknown;
|
|
562
562
|
};
|
|
563
563
|
} | undefined;
|
|
564
|
-
readonly usage?: import("./schema").Usage | undefined;
|
|
564
|
+
readonly usage?: import("./schema/events.js").Usage | undefined;
|
|
565
565
|
} | {
|
|
566
566
|
readonly type: "provider-error";
|
|
567
567
|
readonly message: string;
|
|
@@ -731,7 +731,7 @@ export declare const text: (value: string, id: string) => ({
|
|
|
731
731
|
readonly [x: string]: unknown;
|
|
732
732
|
};
|
|
733
733
|
} | undefined;
|
|
734
|
-
readonly usage?: import("./schema").Usage | undefined;
|
|
734
|
+
readonly usage?: import("./schema/events.js").Usage | undefined;
|
|
735
735
|
} | {
|
|
736
736
|
readonly type: "finish";
|
|
737
737
|
readonly reason: {
|
|
@@ -743,7 +743,7 @@ export declare const text: (value: string, id: string) => ({
|
|
|
743
743
|
readonly [x: string]: unknown;
|
|
744
744
|
};
|
|
745
745
|
} | undefined;
|
|
746
|
-
readonly usage?: import("./schema").Usage | undefined;
|
|
746
|
+
readonly usage?: import("./schema/events.js").Usage | undefined;
|
|
747
747
|
} | {
|
|
748
748
|
readonly type: "provider-error";
|
|
749
749
|
readonly message: string;
|
|
@@ -913,7 +913,7 @@ export declare const textWithUsage: (value: string, id: string, inputTokens: num
|
|
|
913
913
|
readonly [x: string]: unknown;
|
|
914
914
|
};
|
|
915
915
|
} | undefined;
|
|
916
|
-
readonly usage?: import("./schema").Usage | undefined;
|
|
916
|
+
readonly usage?: import("./schema/events.js").Usage | undefined;
|
|
917
917
|
} | {
|
|
918
918
|
readonly type: "finish";
|
|
919
919
|
readonly reason: {
|
|
@@ -925,7 +925,7 @@ export declare const textWithUsage: (value: string, id: string, inputTokens: num
|
|
|
925
925
|
readonly [x: string]: unknown;
|
|
926
926
|
};
|
|
927
927
|
} | undefined;
|
|
928
|
-
readonly usage?: import("./schema").Usage | undefined;
|
|
928
|
+
readonly usage?: import("./schema/events.js").Usage | undefined;
|
|
929
929
|
} | {
|
|
930
930
|
readonly type: "provider-error";
|
|
931
931
|
readonly message: string;
|
|
@@ -1095,7 +1095,7 @@ export declare const tool: (id: string, name: string, input: unknown) => ({
|
|
|
1095
1095
|
readonly [x: string]: unknown;
|
|
1096
1096
|
};
|
|
1097
1097
|
} | undefined;
|
|
1098
|
-
readonly usage?: import("./schema").Usage | undefined;
|
|
1098
|
+
readonly usage?: import("./schema/events.js").Usage | undefined;
|
|
1099
1099
|
} | {
|
|
1100
1100
|
readonly type: "finish";
|
|
1101
1101
|
readonly reason: {
|
|
@@ -1107,7 +1107,7 @@ export declare const tool: (id: string, name: string, input: unknown) => ({
|
|
|
1107
1107
|
readonly [x: string]: unknown;
|
|
1108
1108
|
};
|
|
1109
1109
|
} | undefined;
|
|
1110
|
-
readonly usage?: import("./schema").Usage | undefined;
|
|
1110
|
+
readonly usage?: import("./schema/events.js").Usage | undefined;
|
|
1111
1111
|
} | {
|
|
1112
1112
|
readonly type: "provider-error";
|
|
1113
1113
|
readonly message: string;
|
|
@@ -1277,7 +1277,7 @@ export declare const failAfter: (error: AIError, ...events: readonly LLMEvent[])
|
|
|
1277
1277
|
readonly [x: string]: unknown;
|
|
1278
1278
|
};
|
|
1279
1279
|
} | undefined;
|
|
1280
|
-
readonly usage?: import("./schema").Usage | undefined;
|
|
1280
|
+
readonly usage?: import("./schema/events.js").Usage | undefined;
|
|
1281
1281
|
} | {
|
|
1282
1282
|
readonly type: "finish";
|
|
1283
1283
|
readonly reason: {
|
|
@@ -1289,7 +1289,7 @@ export declare const failAfter: (error: AIError, ...events: readonly LLMEvent[])
|
|
|
1289
1289
|
readonly [x: string]: unknown;
|
|
1290
1290
|
};
|
|
1291
1291
|
} | undefined;
|
|
1292
|
-
readonly usage?: import("./schema").Usage | undefined;
|
|
1292
|
+
readonly usage?: import("./schema/events.js").Usage | undefined;
|
|
1293
1293
|
} | {
|
|
1294
1294
|
readonly type: "provider-error";
|
|
1295
1295
|
readonly message: string;
|
|
@@ -1459,7 +1459,7 @@ export declare const hangAfter: (...events: readonly LLMEvent[]) => Stream.Strea
|
|
|
1459
1459
|
readonly [x: string]: unknown;
|
|
1460
1460
|
};
|
|
1461
1461
|
} | undefined;
|
|
1462
|
-
readonly usage?: import("./schema").Usage | undefined;
|
|
1462
|
+
readonly usage?: import("./schema/events.js").Usage | undefined;
|
|
1463
1463
|
} | {
|
|
1464
1464
|
readonly type: "finish";
|
|
1465
1465
|
readonly reason: {
|
|
@@ -1471,7 +1471,7 @@ export declare const hangAfter: (...events: readonly LLMEvent[]) => Stream.Strea
|
|
|
1471
1471
|
readonly [x: string]: unknown;
|
|
1472
1472
|
};
|
|
1473
1473
|
} | undefined;
|
|
1474
|
-
readonly usage?: import("./schema").Usage | undefined;
|
|
1474
|
+
readonly usage?: import("./schema/events.js").Usage | undefined;
|
|
1475
1475
|
} | {
|
|
1476
1476
|
readonly type: "provider-error";
|
|
1477
1477
|
readonly message: string;
|
|
@@ -1483,7 +1483,7 @@ export declare const hangAfter: (...events: readonly LLMEvent[]) => Stream.Strea
|
|
|
1483
1483
|
readonly classification?: "context-overflow" | "payload-too-large" | undefined;
|
|
1484
1484
|
}, never, never>;
|
|
1485
1485
|
export declare const layer: (options?: LayerOptions) => Layer.Layer<Service, never, never>;
|
|
1486
|
-
export declare const clientLayer: Layer.Layer<import(".").
|
|
1486
|
+
export declare const clientLayer: Layer.Layer<import("./route/client.js").Service, never, Service>;
|
|
1487
1487
|
export declare const push: (...responses: readonly Response[]) => Effect.Effect<void, never, Service>;
|
|
1488
1488
|
export declare const always: (response: Response) => Effect.Effect<void, never, Service>;
|
|
1489
1489
|
export declare const wait: (count: number) => Effect.Effect<void, never, Service>;
|
package/dist/testing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * as TestLLM from "./testing";
|
|
2
|
-
import { LLMClient } from "./route/client";
|
|
3
|
-
import { LLMEvent, LLMResponse, } from "./schema";
|
|
1
|
+
export * as TestLLM from "./testing.js";
|
|
2
|
+
import { LLMClient } from "./route/client.js";
|
|
3
|
+
import { LLMEvent, LLMResponse, } from "./schema/index.js";
|
|
4
4
|
import { Context, Deferred, Effect, Latch, Layer, Queue, Scope, Stream } from "effect";
|
|
5
5
|
export class Service extends Context.Service()("@opencode/ai/TestLLM") {
|
|
6
6
|
}
|
package/dist/tool-runtime.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import { LLMEvent, type ToolCallPart, type ToolOutput as ToolOutputType, type ToolResultValue as ToolResultValueType } from "./schema";
|
|
3
|
-
import { type Tools } from "./tool";
|
|
2
|
+
import { LLMEvent, type ToolCallPart, type ToolOutput as ToolOutputType, type ToolResultValue as ToolResultValueType } from "./schema/index.js";
|
|
3
|
+
import { type Tools } from "./tool.js";
|
|
4
4
|
export interface ToolSettlement {
|
|
5
5
|
readonly result: ToolResultValueType;
|
|
6
6
|
readonly output?: ToolOutputType;
|
package/dist/tool-runtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import { LLMEvent, ToolFailure, ToolOutput, ToolResultValue, } from "./schema";
|
|
3
|
-
import {} from "./tool";
|
|
2
|
+
import { LLMEvent, ToolFailure, ToolOutput, ToolResultValue, } from "./schema/index.js";
|
|
3
|
+
import {} from "./tool.js";
|
|
4
4
|
/** Execute one canonical tool call without owning provider IO or continuation. */
|
|
5
5
|
export const dispatch = (tools, call) => {
|
|
6
6
|
const tool = tools[call.name];
|
package/dist/tool.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect, JsonSchema, Schema } from "effect";
|
|
2
2
|
import { Tool } from "@opencode-ai/schema/tool";
|
|
3
|
-
import type { ToolCallPart, ToolDefinition as ToolDefinitionClass, ToolOutput as ToolOutputType } from "./schema";
|
|
4
|
-
import { ToolFailure } from "./schema";
|
|
3
|
+
import type { ToolCallPart, ToolDefinition as ToolDefinitionClass, ToolOutput as ToolOutputType } from "./schema/index.js";
|
|
4
|
+
import { ToolFailure } from "./schema/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Schema constraint for tool parameters / success values: no decoding or
|
|
7
7
|
* encoding services are allowed. Tools should be self-contained — anything
|
|
@@ -132,4 +132,4 @@ export type Tools = Record<string, AnyTool>;
|
|
|
132
132
|
*/
|
|
133
133
|
export declare const toDefinitions: (tools: Tools) => ReadonlyArray<ToolDefinitionClass>;
|
|
134
134
|
export { ToolFailure };
|
|
135
|
-
export * as Tool from "./tool";
|
|
135
|
+
export * as Tool from "./tool.js";
|
package/dist/tool.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect, JsonSchema, Schema } from "effect";
|
|
2
2
|
import { Tool } from "@opencode-ai/schema/tool";
|
|
3
|
-
import { ToolDefinition, ToolFailure, ToolOutput } from "./schema";
|
|
3
|
+
import { ToolDefinition, ToolFailure, ToolOutput } from "./schema/index.js";
|
|
4
4
|
export function make(config) {
|
|
5
5
|
if ("jsonSchema" in config) {
|
|
6
6
|
return {
|
|
@@ -63,4 +63,4 @@ const toJsonSchema = (schema) => {
|
|
|
63
63
|
};
|
|
64
64
|
const project = (toModelOutput, toStructuredOutput, parameters, id, output) => ToolOutput.make(toStructuredOutput?.(output) ?? output, toModelOutput?.({ id, parameters, output }) ?? (typeof output === "string" ? [{ type: "text", text: output }] : []));
|
|
65
65
|
export { ToolFailure };
|
|
66
|
-
export * as Tool from "./tool";
|
|
66
|
+
export * as Tool from "./tool.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-17250",
|
|
4
4
|
"name": "@opencode-ai/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
32
32
|
"@effect/platform-node": "4.0.0-beta.101",
|
|
33
|
-
"@opencode-ai/http-recorder": "0.0.0-next-
|
|
33
|
+
"@opencode-ai/http-recorder": "0.0.0-next-17250",
|
|
34
34
|
"@tsconfig/bun": "1.0.9",
|
|
35
35
|
"@types/bun": "1.3.13",
|
|
36
36
|
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@smithy/eventstream-codec": "4.2.14",
|
|
41
41
|
"@smithy/util-utf8": "4.2.2",
|
|
42
|
-
"@opencode-ai/schema": "0.0.0-next-
|
|
42
|
+
"@opencode-ai/schema": "0.0.0-next-17250",
|
|
43
43
|
"aws4fetch": "1.0.20",
|
|
44
44
|
"effect": "4.0.0-beta.101",
|
|
45
45
|
"google-auth-library": "10.5.0"
|