@opencode-ai/ai 0.0.0-dev-17675 → 0.0.0-dev-17684
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/README.md +16 -4
- package/dist/cache-policy.js +3 -5
- package/dist/protocols/anthropic-messages.d.ts +25 -28
- package/dist/protocols/anthropic-messages.js +3 -3
- package/dist/protocols/gemini.d.ts +5 -9
- package/dist/protocols/gemini.js +2 -3
- package/dist/protocols/open-responses.d.ts +33 -33
- package/dist/protocols/open-responses.js +1 -1
- package/dist/protocols/openai-chat.d.ts +15 -15
- package/dist/protocols/openai-compatible-chat.d.ts +3 -3
- package/dist/protocols/openai-compatible-responses.d.ts +4 -4
- package/dist/protocols/openai-responses.d.ts +28 -28
- package/dist/protocols/openai-responses.js +1 -1
- package/dist/protocols/shared.d.ts +8 -14
- package/dist/protocols/shared.js +8 -14
- package/dist/protocols/utils/bedrock-cache.js +3 -4
- package/dist/protocols/utils/cache.js +3 -6
- package/dist/protocols/utils/open-responses-options.d.ts +10 -5
- package/dist/protocols/utils/open-responses-options.js +5 -3
- package/dist/protocols/utils/openai-options.d.ts +6 -4
- package/dist/protocols/utils/openai-options.js +3 -3
- package/dist/providers/amazon-bedrock-mantle.d.ts +18 -18
- package/dist/providers/amazon-bedrock.d.ts +3 -9
- package/dist/providers/anthropic-compatible.d.ts +11 -11
- package/dist/providers/anthropic.d.ts +12 -12
- package/dist/providers/azure.d.ts +15 -15
- package/dist/providers/cloudflare.d.ts +11 -11
- package/dist/providers/google-vertex-chat.d.ts +5 -5
- package/dist/providers/google-vertex-messages.d.ts +11 -11
- package/dist/providers/google-vertex-responses.d.ts +6 -6
- package/dist/providers/google-vertex-responses.js +1 -1
- package/dist/providers/google-vertex.d.ts +5 -7
- package/dist/providers/google-vertex.js +1 -1
- package/dist/providers/google.d.ts +4 -4
- package/dist/providers/open-responses-options.d.ts +1 -4
- package/dist/providers/openai-compatible-responses.d.ts +6 -6
- package/dist/providers/openai-compatible.d.ts +12 -12
- package/dist/providers/openai-options.d.ts +2 -4
- package/dist/providers/openai-options.js +3 -3
- package/dist/providers/openai.d.ts +19 -19
- package/dist/providers/openrouter.d.ts +15 -17
- package/dist/providers/openrouter.js +1 -1
- package/dist/providers/xai.d.ts +21 -23
- package/dist/providers/xai.js +1 -1
- package/dist/route/client.d.ts +1 -3
- package/dist/route/framing.d.ts +2 -2
- package/dist/route/protocol.d.ts +1 -2
- package/dist/route/protocol.js +1 -2
- package/dist/schema/errors.js +2 -1
- package/dist/schema/events.d.ts +5 -3
- package/dist/schema/events.js +5 -2
- package/dist/schema/ids.d.ts +0 -13
- package/dist/schema/ids.js +0 -9
- package/dist/schema/messages.d.ts +7 -7
- package/dist/schema/messages.js +5 -2
- package/dist/schema/options.d.ts +6 -8
- package/dist/schema/options.js +6 -18
- package/package.json +3 -3
package/dist/schema/ids.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import { ProviderMetadata } from "@opencode-ai/schema/ai";
|
|
3
|
-
import { LLM } from "@opencode-ai/schema/llm";
|
|
4
|
-
export { ProviderMetadata };
|
|
5
2
|
/** Stable string identifier for a protocol implementation. */
|
|
6
3
|
export const ProtocolID = Schema.String;
|
|
7
4
|
/** Stable string identifier for the runnable route. */
|
|
@@ -11,9 +8,3 @@ export const ProviderID = Schema.String.pipe(Schema.brand("AI.ProviderID"));
|
|
|
11
8
|
export const ResponseID = Schema.String;
|
|
12
9
|
export const ContentBlockID = Schema.String;
|
|
13
10
|
export const ToolCallID = Schema.String;
|
|
14
|
-
export const ReasoningEfforts = ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
15
|
-
export const ReasoningEffort = Schema.String;
|
|
16
|
-
export const TextVerbosity = Schema.Literals(["low", "medium", "high"]);
|
|
17
|
-
export const MessageRole = Schema.Literals(["system", "user", "assistant", "tool"]);
|
|
18
|
-
export const FinishReason = LLM.FinishReason;
|
|
19
|
-
export const JsonSchema = Schema.Record(Schema.String, Schema.Unknown);
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { Tool } from "@opencode-ai/schema/tool";
|
|
3
3
|
import { CacheHint, GenerationOptions, HttpOptions } from "./options.js";
|
|
4
|
+
export declare const MessageRole: Schema.Literals<readonly ["system", "user", "assistant", "tool"]>;
|
|
5
|
+
export type MessageRole = Schema.Schema.Type<typeof MessageRole>;
|
|
6
|
+
export declare const ProviderMetadata: Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
7
|
+
export type ProviderMetadata = Schema.Schema.Type<typeof ProviderMetadata>;
|
|
4
8
|
declare const systemPartSchema: Schema.Struct<{
|
|
5
9
|
readonly type: Schema.Literal<"text">;
|
|
6
10
|
readonly text: Schema.String;
|
|
@@ -358,13 +362,9 @@ export declare namespace ToolChoice {
|
|
|
358
362
|
declare const LLMRequest_base: Schema.Class<LLMRequest, Schema.Struct<{
|
|
359
363
|
readonly id: Schema.optional<Schema.String>;
|
|
360
364
|
readonly model: Schema.declare<import("./options.js").LanguageModel<{
|
|
361
|
-
readonly [x: string]:
|
|
362
|
-
readonly [x: string]: unknown;
|
|
363
|
-
};
|
|
365
|
+
readonly [x: string]: unknown;
|
|
364
366
|
}>, import("./options.js").LanguageModel<{
|
|
365
|
-
readonly [x: string]:
|
|
366
|
-
readonly [x: string]: unknown;
|
|
367
|
-
};
|
|
367
|
+
readonly [x: string]: unknown;
|
|
368
368
|
}>>;
|
|
369
369
|
readonly system: Schema.$Array<Schema.Struct<{
|
|
370
370
|
readonly type: Schema.Literal<"text">;
|
|
@@ -379,7 +379,7 @@ declare const LLMRequest_base: Schema.Class<LLMRequest, Schema.Struct<{
|
|
|
379
379
|
readonly tools: Schema.$Array<typeof ToolDefinition>;
|
|
380
380
|
readonly toolChoice: Schema.optional<typeof ToolChoice>;
|
|
381
381
|
readonly generation: Schema.optional<typeof GenerationOptions>;
|
|
382
|
-
readonly providerOptions: Schema.optional<Schema.$Record<Schema.String, Schema
|
|
382
|
+
readonly providerOptions: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
383
383
|
readonly http: Schema.optional<typeof HttpOptions>;
|
|
384
384
|
readonly cache: Schema.optional<Schema.Union<readonly [Schema.Literal<"auto">, Schema.Literal<"none">, Schema.Struct<{
|
|
385
385
|
readonly tools: Schema.optional<Schema.Boolean>;
|
package/dist/schema/messages.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { Tool } from "@opencode-ai/schema/tool";
|
|
3
|
-
import { JsonSchema,
|
|
4
|
-
import { CacheHint, CachePolicy, GenerationOptions, HttpOptions, LanguageModelSchema, ProviderOptions, } from "./options.js";
|
|
3
|
+
import { CacheHint, CachePolicy, GenerationOptions, HttpOptions, JsonSchema, LanguageModelSchema, ProviderOptions, } from "./options.js";
|
|
5
4
|
import { isRecord } from "../utils/record.js";
|
|
5
|
+
export const MessageRole = Schema.Literals(["system", "user", "assistant", "tool"]);
|
|
6
|
+
export const ProviderMetadata = Schema.Record(Schema.String, Schema.Record(Schema.String, Schema.Unknown)).annotate({
|
|
7
|
+
identifier: "LLM.ProviderMetadata",
|
|
8
|
+
});
|
|
6
9
|
const systemPartSchema = Schema.Struct({
|
|
7
10
|
type: Schema.Literal("text"),
|
|
8
11
|
text: Schema.String,
|
package/dist/schema/options.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { ModelID, ProviderID } from "./ids.js";
|
|
3
3
|
import type { AnyRoute } from "../route/client.js";
|
|
4
|
+
export declare const JsonSchema: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
5
|
+
export type JsonSchema = Schema.Schema.Type<typeof JsonSchema>;
|
|
4
6
|
export declare const mergeJsonRecords: (...items: ReadonlyArray<Record<string, unknown> | undefined>) => Record<string, unknown> | undefined;
|
|
5
|
-
export declare const ProviderOptions: Schema.$Record<Schema.String, Schema
|
|
7
|
+
export declare const ProviderOptions: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
6
8
|
export type ProviderOptions = Schema.Schema.Type<typeof ProviderOptions>;
|
|
7
9
|
export declare const mergeProviderOptions: (...items: ReadonlyArray<ProviderOptions | undefined>) => ProviderOptions | undefined;
|
|
8
10
|
declare const HttpOptions_base: Schema.Class<HttpOptions, Schema.Struct<{
|
|
@@ -62,7 +64,7 @@ export declare namespace LanguageModelLimits {
|
|
|
62
64
|
declare const LanguageModelDefaults_base: Schema.Class<LanguageModelDefaults, Schema.Struct<{
|
|
63
65
|
readonly limits: Schema.optional<typeof LanguageModelLimits>;
|
|
64
66
|
readonly generation: Schema.optional<typeof GenerationOptions>;
|
|
65
|
-
readonly providerOptions: Schema.optional<Schema.$Record<Schema.String, Schema
|
|
67
|
+
readonly providerOptions: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
66
68
|
readonly http: Schema.optional<typeof HttpOptions>;
|
|
67
69
|
}>, {}>;
|
|
68
70
|
export declare class LanguageModelDefaults extends LanguageModelDefaults_base {
|
|
@@ -124,13 +126,9 @@ export declare namespace LanguageModel {
|
|
|
124
126
|
export type LanguageModelInput = LanguageModel.Input;
|
|
125
127
|
export type LanguageModelProviderOptions<SelectedModel> = SelectedModel extends LanguageModel<infer Options> ? Options : never;
|
|
126
128
|
export declare const LanguageModelSchema: Schema.declare<LanguageModel<{
|
|
127
|
-
readonly [x: string]:
|
|
128
|
-
readonly [x: string]: unknown;
|
|
129
|
-
};
|
|
129
|
+
readonly [x: string]: unknown;
|
|
130
130
|
}>, LanguageModel<{
|
|
131
|
-
readonly [x: string]:
|
|
132
|
-
readonly [x: string]: unknown;
|
|
133
|
-
};
|
|
131
|
+
readonly [x: string]: unknown;
|
|
134
132
|
}>>;
|
|
135
133
|
declare const CacheHint_base: Schema.Class<CacheHint, Schema.Struct<{
|
|
136
134
|
readonly type: Schema.Literals<readonly ["ephemeral", "persistent"]>;
|
package/dist/schema/options.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import { ModelID, ProviderID } from "./ids.js";
|
|
3
3
|
import { isRecord } from "../utils/record.js";
|
|
4
|
+
export const JsonSchema = Schema.Record(Schema.String, Schema.Unknown);
|
|
4
5
|
export const mergeJsonRecords = (...items) => {
|
|
5
6
|
const defined = items.filter((item) => item !== undefined);
|
|
6
7
|
if (defined.length === 0)
|
|
@@ -26,20 +27,8 @@ const mergeStringRecords = (...items) => {
|
|
|
26
27
|
const result = Object.fromEntries(defined.flatMap((item) => Object.entries(item).filter((entry) => entry[1] !== undefined)));
|
|
27
28
|
return Object.keys(result).length === 0 ? undefined : result;
|
|
28
29
|
};
|
|
29
|
-
export const ProviderOptions = Schema.Record(Schema.String, Schema.
|
|
30
|
-
export const mergeProviderOptions = (...items) =>
|
|
31
|
-
const result = {};
|
|
32
|
-
for (const item of items) {
|
|
33
|
-
if (!item)
|
|
34
|
-
continue;
|
|
35
|
-
for (const [provider, options] of Object.entries(item)) {
|
|
36
|
-
const merged = mergeJsonRecords(result[provider], options);
|
|
37
|
-
if (merged)
|
|
38
|
-
result[provider] = merged;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return Object.keys(result).length === 0 ? undefined : result;
|
|
42
|
-
};
|
|
30
|
+
export const ProviderOptions = Schema.Record(Schema.String, Schema.Unknown);
|
|
31
|
+
export const mergeProviderOptions = (...items) => mergeJsonRecords(...items);
|
|
43
32
|
export class HttpOptions extends Schema.Class("AI.HttpOptions")({
|
|
44
33
|
body: Schema.optional(JsonSchema),
|
|
45
34
|
headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),
|
|
@@ -181,10 +170,9 @@ export class CacheHint extends Schema.Class("LLM.CacheHint")({
|
|
|
181
170
|
// Auto-placement policy for prompt caching. The protocol-neutral lowering step
|
|
182
171
|
// reads this and injects `CacheHint`s at the configured boundaries; the
|
|
183
172
|
// per-protocol body builders then translate those hints into wire markers as
|
|
184
|
-
// usual. `"auto"` is the
|
|
173
|
+
// usual. `"auto"` is the default for agent loops — it places
|
|
185
174
|
// breakpoints at the last tool definition, the first and last distinct system
|
|
186
|
-
// parts, and the conversation tail
|
|
187
|
-
// prior cache entry within Anthropic/Bedrock's 20-block lookback during long
|
|
175
|
+
// parts, and the conversation tail so recent prefixes remain reusable during
|
|
188
176
|
// tool loops.
|
|
189
177
|
//
|
|
190
178
|
// Pass `"none"` to opt out entirely (the legacy behavior). Pass the granular
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-17684",
|
|
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.107",
|
|
33
|
-
"@opencode-ai/http-recorder": "0.0.0-dev-
|
|
33
|
+
"@opencode-ai/http-recorder": "0.0.0-dev-17684",
|
|
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-dev-
|
|
42
|
+
"@opencode-ai/schema": "0.0.0-dev-17684",
|
|
43
43
|
"aws4fetch": "1.0.20",
|
|
44
44
|
"effect": "4.0.0-beta.107",
|
|
45
45
|
"google-auth-library": "10.5.0"
|