@opencode/ai 2.2.4 → 2.2.6
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 +133 -69
- package/dist/cache-policy.d.ts +1 -1
- package/dist/cache-policy.js +16 -4
- package/dist/decision-client.d.ts +3 -3
- package/dist/decision.d.ts +20 -125
- package/dist/decision.js +25 -15
- package/dist/effect.d.ts +4 -15
- package/dist/effect.js +2 -6
- package/dist/effort-updates.d.ts +3 -3
- package/dist/effort-updates.js +2 -2
- package/dist/experimental/cloudflare-run-extraction.d.ts +7 -3
- package/dist/experimental/cloudflare-run-extraction.js +4 -1
- package/dist/experimental/extraction.d.ts +10 -40
- package/dist/experimental/extraction.js +14 -13
- package/dist/experimental.d.ts +8 -8
- package/dist/experimental.js +4 -4
- package/dist/generation.d.ts +0 -2
- package/dist/generation.js +2 -2
- package/dist/image-client.d.ts +13 -7
- package/dist/image-client.js +1 -1
- package/dist/image.d.ts +357 -464
- package/dist/image.js +17 -15
- package/dist/index.d.ts +28 -465
- package/dist/index.js +18 -17
- package/dist/llm.d.ts +65 -266
- package/dist/llm.js +101 -92
- package/dist/loop.d.ts +38 -0
- package/dist/loop.js +136 -0
- package/dist/media-model.d.ts +1 -1
- package/dist/media-model.js +8 -6
- package/dist/media.d.ts +9 -0
- package/dist/media.js +37 -2
- package/dist/protocols/alibaba-chat.d.ts +5 -1
- package/dist/protocols/alibaba-chat.js +3 -3
- package/dist/protocols/alibaba-images.d.ts +2 -2
- package/dist/protocols/alibaba-messages.js +3 -3
- package/dist/protocols/alibaba-responses.js +8 -20
- package/dist/protocols/anthropic-messages.d.ts +1 -1
- package/dist/protocols/anthropic-messages.js +57 -185
- package/dist/protocols/assemblyai-transcription.d.ts +2 -2
- package/dist/protocols/bedrock-converse.js +11 -22
- package/dist/protocols/cartesia-speech.d.ts +2 -2
- package/dist/protocols/cloudflare-workers-ai-images.d.ts +2 -2
- package/dist/protocols/cohere-chat.js +9 -12
- package/dist/protocols/deepgram-speech.d.ts +2 -2
- package/dist/protocols/deepgram-transcription.d.ts +2 -2
- package/dist/protocols/elevenlabs-speech.d.ts +2 -2
- package/dist/protocols/elevenlabs-transcription.d.ts +2 -2
- package/dist/protocols/gemini.d.ts +3 -0
- package/dist/protocols/gemini.js +56 -89
- package/dist/protocols/google-images.d.ts +2 -2
- package/dist/protocols/google-interactions.d.ts +3 -4
- package/dist/protocols/google-interactions.js +54 -32
- package/dist/protocols/google-speech.d.ts +2 -2
- package/dist/protocols/google-transcription.d.ts +2 -2
- package/dist/protocols/google-video.d.ts +2 -2
- package/dist/protocols/meta-images.d.ts +2 -2
- package/dist/protocols/meta-responses.js +26 -23
- package/dist/protocols/minimax-images.d.ts +2 -2
- package/dist/protocols/mistral-chat.js +14 -20
- package/dist/protocols/open-responses-channel.js +6 -19
- package/dist/protocols/open-responses-continuation.d.ts +1 -5
- package/dist/protocols/open-responses-continuation.js +1 -3
- package/dist/protocols/open-responses.d.ts +1 -21
- package/dist/protocols/open-responses.js +10 -15
- package/dist/protocols/openai-chat.d.ts +3 -23
- package/dist/protocols/openai-chat.js +26 -47
- package/dist/protocols/openai-compatible-chat.d.ts +1 -1
- package/dist/protocols/openai-compatible-responses.d.ts +2 -2
- package/dist/protocols/openai-compatible-responses.js +1 -1
- package/dist/protocols/openai-decisions.js +1 -1
- package/dist/protocols/openai-images.d.ts +2 -2
- package/dist/protocols/openai-responses.js +10 -29
- package/dist/protocols/openai-speech.d.ts +2 -2
- package/dist/protocols/openai-transcription.d.ts +2 -2
- package/dist/protocols/runway-video.d.ts +2 -2
- package/dist/protocols/shared.d.ts +1 -4
- package/dist/protocols/shared.js +13 -11
- package/dist/protocols/system-one.d.ts +4 -4
- package/dist/protocols/utils/bedrock-cache.js +2 -5
- package/dist/protocols/utils/bedrock-media.d.ts +0 -3
- package/dist/protocols/utils/cache.d.ts +3 -0
- package/dist/protocols/utils/cache.js +15 -2
- package/dist/protocols/utils/image-sizing.d.ts +1 -1
- package/dist/protocols/utils/responses-checkpoint.js +1 -1
- package/dist/protocols/utils/responses-compaction.d.ts +1 -1
- package/dist/protocols/utils/responses-compaction.js +6 -5
- package/dist/protocols/utils/responses-hosted-tools.d.ts +97 -1
- package/dist/protocols/utils/responses-hosted-tools.js +31 -0
- package/dist/protocols/utils/tool-stream.d.ts +5 -271
- package/dist/protocols/utils/tool-stream.js +3 -13
- package/dist/protocols/venice-chat.d.ts +3 -1
- package/dist/protocols/venice-chat.js +4 -4
- package/dist/protocols/xai-images.d.ts +2 -2
- package/dist/protocols/xai-responses.js +5 -25
- package/dist/protocols/xai-video.d.ts +2 -2
- package/dist/protocols/zai-chat.d.ts +5 -1
- package/dist/protocols/zai-chat.js +1 -1
- package/dist/protocols/zai-images.d.ts +2 -2
- package/dist/protocols/zai-messages.js +3 -3
- package/dist/provider-error.d.ts +0 -1
- package/dist/provider-error.js +9 -80
- package/dist/providers/alibaba.d.ts +67 -4
- package/dist/providers/alibaba.js +6 -1
- package/dist/providers/amazon-bedrock-mantle.d.ts +6 -3
- package/dist/providers/amazon-bedrock-mantle.js +6 -3
- package/dist/providers/amazon-bedrock.d.ts +6 -7
- package/dist/providers/amazon-bedrock.js +1 -1
- package/dist/providers/anthropic-compatible.d.ts +7 -8
- package/dist/providers/anthropic-compatible.js +2 -5
- package/dist/providers/anthropic.d.ts +8 -9
- package/dist/providers/anthropic.js +2 -7
- package/dist/providers/assemblyai.d.ts +2 -2
- package/dist/providers/assemblyai.js +2 -7
- package/dist/providers/azure/messages.d.ts +2 -0
- package/dist/providers/azure/messages.js +1 -0
- package/dist/providers/azure.d.ts +322 -7
- package/dist/providers/azure.js +25 -9
- package/dist/providers/baseten.d.ts +5 -5
- package/dist/providers/baseten.js +7 -21
- package/dist/providers/cartesia.d.ts +1 -1
- package/dist/providers/cerebras.d.ts +5 -5
- package/dist/providers/cerebras.js +4 -15
- package/dist/providers/cloudflare-ai-gateway.d.ts +21 -13
- package/dist/providers/cloudflare-ai-gateway.js +28 -40
- package/dist/providers/cloudflare-shared.d.ts +9 -0
- package/dist/providers/cloudflare-shared.js +25 -0
- package/dist/providers/cloudflare-workers-ai.d.ts +4 -4
- package/dist/providers/cloudflare-workers-ai.js +4 -20
- package/dist/providers/cohere/chat.js +2 -7
- package/dist/providers/cohere.d.ts +6 -5
- package/dist/providers/cohere.js +7 -13
- package/dist/providers/deepgram.d.ts +2 -2
- package/dist/providers/deepgram.js +2 -7
- package/dist/providers/deepinfra.d.ts +5 -5
- package/dist/providers/deepinfra.js +5 -13
- package/dist/providers/deepseek.d.ts +5 -5
- package/dist/providers/deepseek.js +3 -14
- package/dist/providers/digitalocean.d.ts +8 -5
- package/dist/providers/digitalocean.js +13 -14
- package/dist/providers/elevenlabs.d.ts +2 -2
- package/dist/providers/elevenlabs.js +2 -7
- package/dist/providers/fireworks.d.ts +5 -5
- package/dist/providers/fireworks.js +4 -15
- package/dist/providers/google/interactions.d.ts +1 -1
- package/dist/providers/google/interactions.js +2 -7
- package/dist/providers/google-vertex-chat.d.ts +3 -3
- package/dist/providers/google-vertex-chat.js +3 -29
- package/dist/providers/google-vertex-interactions.d.ts +3 -3
- package/dist/providers/google-vertex-messages.d.ts +3 -3
- package/dist/providers/google-vertex-messages.js +3 -29
- package/dist/providers/google-vertex-mistral.d.ts +3 -3
- package/dist/providers/google-vertex-mistral.js +3 -29
- package/dist/providers/google-vertex-responses.d.ts +3 -3
- package/dist/providers/google-vertex-responses.js +4 -30
- package/dist/providers/google-vertex-shared.d.ts +31 -0
- package/dist/providers/google-vertex-shared.js +25 -0
- package/dist/providers/google-vertex.d.ts +3 -3
- package/dist/providers/google.d.ts +15 -13
- package/dist/providers/google.js +9 -19
- package/dist/providers/groq.d.ts +5 -5
- package/dist/providers/groq.js +4 -15
- package/dist/providers/meta.d.ts +5 -5
- package/dist/providers/meta.js +10 -24
- package/dist/providers/minimax/chat.js +2 -7
- package/dist/providers/minimax/responses.js +2 -7
- package/dist/providers/minimax.d.ts +5 -5
- package/dist/providers/minimax.js +11 -23
- package/dist/providers/mistral.d.ts +10 -11
- package/dist/providers/mistral.js +3 -14
- package/dist/providers/moonshot/messages.js +2 -7
- package/dist/providers/moonshot/responses.js +2 -7
- package/dist/providers/moonshot.d.ts +5 -5
- package/dist/providers/moonshot.js +4 -16
- package/dist/providers/openai-compatible-responses.d.ts +6 -7
- package/dist/providers/openai-compatible-responses.js +2 -8
- package/dist/providers/openai-compatible.d.ts +6 -7
- package/dist/providers/openai-compatible.js +4 -10
- package/dist/providers/openai.d.ts +4 -4
- package/dist/providers/openai.js +3 -3
- package/dist/providers/opencode.d.ts +4 -4
- package/dist/providers/opencode.js +6 -2
- package/dist/providers/openrouter.d.ts +8 -5
- package/dist/providers/openrouter.js +16 -24
- package/dist/providers/runway.d.ts +1 -1
- package/dist/providers/settings.d.ts +40 -0
- package/dist/providers/settings.js +19 -0
- package/dist/providers/togetherai.d.ts +5 -5
- package/dist/providers/togetherai.js +5 -15
- package/dist/providers/typesafe-ai.d.ts +4 -4
- package/dist/providers/typesafe-ai.js +6 -2
- package/dist/providers/venice.d.ts +4 -4
- package/dist/providers/venice.js +6 -2
- package/dist/providers/vercel-ai-gateway.d.ts +5 -5
- package/dist/providers/vercel-ai-gateway.js +15 -28
- package/dist/providers/xai.d.ts +4 -4
- package/dist/providers/xai.js +4 -12
- package/dist/providers/zai-coding-plan/messages.js +2 -7
- package/dist/providers/zai-coding-plan/responses.js +2 -7
- package/dist/providers/zai-coding-plan.d.ts +5 -5
- package/dist/providers/zai-coding-plan.js +8 -15
- package/dist/providers/zai.d.ts +5 -5
- package/dist/providers/zai.js +10 -22
- package/dist/public.d.ts +12 -0
- package/dist/public.js +5 -0
- package/dist/route/auth-options.d.ts +9 -5
- package/dist/route/auth-options.js +10 -7
- package/dist/route/client.d.ts +50 -37
- package/dist/route/client.js +42 -53
- package/dist/route/decision.d.ts +8 -8
- package/dist/route/decision.js +3 -3
- package/dist/route/executor.d.ts +5 -0
- package/dist/route/executor.js +10 -0
- package/dist/route/index.d.ts +5 -7
- package/dist/route/index.js +1 -1
- package/dist/route/media.d.ts +7 -11
- package/dist/route/media.js +22 -26
- package/dist/route/transport/http.js +6 -5
- package/dist/route/transport/websocket.js +7 -1
- package/dist/schema/errors.d.ts +16 -17
- package/dist/schema/errors.js +63 -12
- package/dist/schema/events.d.ts +2563 -2954
- package/dist/schema/events.js +54 -109
- package/dist/schema/messages.d.ts +194 -137
- package/dist/schema/messages.js +66 -83
- package/dist/schema/options.d.ts +112 -65
- package/dist/schema/options.js +52 -101
- package/dist/speech-client.d.ts +7 -7
- package/dist/speech.d.ts +306 -316
- package/dist/speech.js +16 -14
- package/dist/testing.d.ts +31 -175
- package/dist/testing.js +60 -5
- package/dist/tool-history.d.ts +1 -1
- package/dist/tool-history.js +3 -10
- package/dist/tool-runtime.d.ts +9 -2
- package/dist/tool-runtime.js +17 -31
- package/dist/tool.d.ts +39 -43
- package/dist/tool.js +16 -26
- package/dist/transcription-client.d.ts +7 -7
- package/dist/transcription.d.ts +314 -265
- package/dist/transcription.js +16 -14
- package/dist/utils/provider-codes.d.ts +3 -0
- package/dist/utils/provider-codes.js +41 -0
- package/dist/video-client.d.ts +7 -7
- package/dist/video-client.js +1 -1
- package/dist/video.d.ts +269 -287
- package/dist/video.js +16 -14
- package/package.json +9 -9
- package/dist/experimental/testing.d.ts +0 -3
- package/dist/experimental/testing.js +0 -3
- package/dist/testing/decision.d.ts +0 -16
- package/dist/testing/decision.js +0 -20
- package/dist/testing/image.d.ts +0 -14
- package/dist/testing/image.js +0 -12
- package/dist/testing/media.d.ts +0 -18
- package/dist/testing/media.js +0 -36
- package/dist/testing/script.d.ts +0 -28
- package/dist/testing/script.js +0 -60
- package/dist/testing/speech.d.ts +0 -14
- package/dist/testing/speech.js +0 -12
- package/dist/testing/transcription.d.ts +0 -14
- package/dist/testing/transcription.js +0 -12
- package/dist/testing/video.d.ts +0 -14
- package/dist/testing/video.js +0 -12
package/dist/schema/options.js
CHANGED
|
@@ -34,102 +34,58 @@ export const ProviderMetadata = Schema.Record(Schema.String, Schema.Record(Schem
|
|
|
34
34
|
export const mergeProviderOptions = (...items) => mergeJsonRecords(...items);
|
|
35
35
|
/** Milliseconds for an HTTP timeout, or `false` to disable it. */
|
|
36
36
|
export const HttpTimeout = Schema.Union([Schema.Number.check(Schema.isGreaterThan(0)), Schema.Literal(false)]);
|
|
37
|
-
/** Applied to `
|
|
37
|
+
/** Applied to `timeout.headers` when a request leaves it unset. */
|
|
38
38
|
export const DEFAULT_HTTP_TIMEOUT_MS = 300_000;
|
|
39
39
|
/**
|
|
40
|
-
* Applied to `
|
|
40
|
+
* Applied to `timeout.chunk` when a request leaves it unset. Some providers, such as DeepSeek, have specifically asked
|
|
41
41
|
* clients to allow at least 15 minutes, because their models can stream nothing for minutes while they reason.
|
|
42
42
|
*/
|
|
43
43
|
export const DEFAULT_CHUNK_TIMEOUT_MS = 900_000;
|
|
44
44
|
/** `Content-Encoding` for JSON request bodies; `none` sends plain JSON. */
|
|
45
45
|
export const RequestEncoding = Schema.Literals(["zstd", "gzip", "none"]);
|
|
46
|
-
export
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
HttpOptions.make = make;
|
|
67
|
-
})(HttpOptions || (HttpOptions = {}));
|
|
68
|
-
export const mergeHttpOptions = (...items) => {
|
|
69
|
-
const body = mergeJsonRecords(...items.map((item) => item?.body));
|
|
70
|
-
const headers = mergeStringRecords(...items.map((item) => item?.headers));
|
|
71
|
-
const query = mergeStringRecords(...items.map((item) => item?.query));
|
|
72
|
-
const timeout = items.findLast((item) => item?.timeout !== undefined)?.timeout;
|
|
73
|
-
const headerTimeout = items.findLast((item) => item?.headerTimeout !== undefined)?.headerTimeout;
|
|
74
|
-
const chunkTimeout = items.findLast((item) => item?.chunkTimeout !== undefined)?.chunkTimeout;
|
|
75
|
-
const encoding = items.findLast((item) => item?.encoding !== undefined)?.encoding;
|
|
76
|
-
if (!body &&
|
|
77
|
-
!headers &&
|
|
78
|
-
!query &&
|
|
79
|
-
timeout === undefined &&
|
|
80
|
-
headerTimeout === undefined &&
|
|
81
|
-
chunkTimeout === undefined &&
|
|
82
|
-
encoding === undefined)
|
|
83
|
-
return undefined;
|
|
84
|
-
return new HttpOptions({ body, headers, query, timeout, headerTimeout, chunkTimeout, encoding });
|
|
46
|
+
export const timeoutConfig = (timeout) => typeof timeout === "object" ? timeout : { total: timeout };
|
|
47
|
+
const last = (values) => values.findLast((value) => value !== undefined);
|
|
48
|
+
const someDefined = (value) => Object.values(value).some((item) => item !== undefined) ? value : undefined;
|
|
49
|
+
/** Merge transport settings; later items win, headers, query and body merge by key. */
|
|
50
|
+
export const mergeTransport = (...items) => {
|
|
51
|
+
const timeouts = items.map((item) => timeoutConfig(item?.timeout));
|
|
52
|
+
const http = items.map((item) => item?.http);
|
|
53
|
+
return {
|
|
54
|
+
headers: mergeStringRecords(...items.map((item) => item?.headers)),
|
|
55
|
+
timeout: someDefined({
|
|
56
|
+
total: last(timeouts.map((item) => item.total)),
|
|
57
|
+
headers: last(timeouts.map((item) => item.headers)),
|
|
58
|
+
chunk: last(timeouts.map((item) => item.chunk)),
|
|
59
|
+
}),
|
|
60
|
+
http: someDefined({
|
|
61
|
+
query: mergeStringRecords(...http.map((item) => item?.query)),
|
|
62
|
+
body: mergeJsonRecords(...http.map((item) => item?.body)),
|
|
63
|
+
encoding: last(http.map((item) => item?.encoding)),
|
|
64
|
+
}),
|
|
65
|
+
};
|
|
85
66
|
};
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
topK: latestGeneration(items, "topK"),
|
|
108
|
-
frequencyPenalty: latestGeneration(items, "frequencyPenalty"),
|
|
109
|
-
presencePenalty: latestGeneration(items, "presencePenalty"),
|
|
110
|
-
seed: latestGeneration(items, "seed"),
|
|
111
|
-
stop: latestGeneration(items, "stop"),
|
|
112
|
-
});
|
|
113
|
-
return Object.values(result).some((value) => value !== undefined) ? result : undefined;
|
|
67
|
+
/** The keys of `GenerationOptionsFields`, for splitting a flat record into portable knobs and provider options. */
|
|
68
|
+
export const GENERATION_KEYS = new Set([
|
|
69
|
+
"maxTokens",
|
|
70
|
+
"temperature",
|
|
71
|
+
"topP",
|
|
72
|
+
"topK",
|
|
73
|
+
"frequencyPenalty",
|
|
74
|
+
"presencePenalty",
|
|
75
|
+
"seed",
|
|
76
|
+
"stop",
|
|
77
|
+
]);
|
|
78
|
+
/** Pick the generation knobs out of each item; later items win per knob. */
|
|
79
|
+
export const mergeGeneration = (...items) => Object.fromEntries([...GENERATION_KEYS].map((key) => [key, last(items.map((item) => item?.[key]))]));
|
|
80
|
+
/** Merge model options; later items win per key. Empty results are `undefined`. */
|
|
81
|
+
export const mergeRequestOptions = (...items) => {
|
|
82
|
+
const merged = Object.entries({
|
|
83
|
+
...mergeTransport(...items),
|
|
84
|
+
...mergeGeneration(...items),
|
|
85
|
+
providerOptions: mergeProviderOptions(...items.map((item) => item?.providerOptions)),
|
|
86
|
+
}).filter(([, value]) => value !== undefined);
|
|
87
|
+
return merged.length === 0 ? undefined : Object.fromEntries(merged);
|
|
114
88
|
};
|
|
115
|
-
export class LanguageModelDefaults extends Schema.Class("LLM.LanguageModelDefaults")({
|
|
116
|
-
generation: Schema.optional(GenerationOptions),
|
|
117
|
-
providerOptions: Schema.optional(ProviderOptions),
|
|
118
|
-
http: Schema.optional(HttpOptions),
|
|
119
|
-
}) {
|
|
120
|
-
}
|
|
121
|
-
(function (LanguageModelDefaults) {
|
|
122
|
-
/** Normalize selected-model request defaults without applying precedence. */
|
|
123
|
-
LanguageModelDefaults.make = (input) => {
|
|
124
|
-
if (input instanceof LanguageModelDefaults)
|
|
125
|
-
return input;
|
|
126
|
-
return new LanguageModelDefaults({
|
|
127
|
-
generation: input.generation === undefined ? undefined : GenerationOptions.make(input.generation),
|
|
128
|
-
providerOptions: input.providerOptions,
|
|
129
|
-
http: HttpOptions.make(input.http),
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
|
-
})(LanguageModelDefaults || (LanguageModelDefaults = {}));
|
|
133
89
|
export const ReasoningEfforts = ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
134
90
|
export const ReasoningEffort = Schema.declare((value) => typeof value === "string", { title: "ReasoningEffort" });
|
|
135
91
|
/** Tool schema sanitizer for a model family. `none` opts out of the protocol and model-name defaults. */
|
|
@@ -144,22 +100,12 @@ export class LanguageModelCompatibility extends Schema.Class("LLM.LanguageModelC
|
|
|
144
100
|
maxTokensField: Schema.optional(LanguageModelMaxTokensFieldCompatibility),
|
|
145
101
|
requireFinishReason: Schema.optional(Schema.Boolean),
|
|
146
102
|
requireAssistantAfterTool: Schema.optional(Schema.Boolean),
|
|
147
|
-
supportsStore: Schema.optional(Schema.Boolean),
|
|
148
|
-
/** Request usage in the stream with `stream_options.include_usage`. Defaults to true. */
|
|
149
|
-
streamUsage: Schema.optional(Schema.Boolean),
|
|
150
|
-
supportsStrictMode: Schema.optional(Schema.Boolean),
|
|
151
|
-
// Accepts `prompt_cache_key` in the request body. Chat omits the key unless
|
|
152
|
-
// this is true; other protocols omit it only when this is false.
|
|
153
|
-
// Session-affinity headers still flow regardless.
|
|
154
|
-
supportsPromptCacheKey: Schema.optional(Schema.Boolean),
|
|
155
103
|
/** Prompt-cache marker syntax the endpoint accepts. Overrides the route default; both send `cache_control`, and `alibaba` skips tool definitions. */
|
|
156
104
|
cacheFormat: Schema.optional(LanguageModelCacheFormatCompatibility),
|
|
157
105
|
zaiToolStream: Schema.optional(Schema.Boolean),
|
|
158
106
|
requireSignature: Schema.optional(Schema.Boolean),
|
|
159
107
|
/** Supports Anthropic's thinking-prefix mismatch controls. Overrides model-ID detection. */
|
|
160
108
|
supportsThinkingBlockBinding: Schema.optional(Schema.Boolean),
|
|
161
|
-
/** Supports per-message effort updates. Overrides model-ID detection. */
|
|
162
|
-
supportsEffortUpdates: Schema.optional(Schema.Boolean),
|
|
163
109
|
}) {
|
|
164
110
|
}
|
|
165
111
|
(function (LanguageModelCompatibility) {
|
|
@@ -170,13 +116,15 @@ export class LanguageModel {
|
|
|
170
116
|
id;
|
|
171
117
|
provider;
|
|
172
118
|
route;
|
|
173
|
-
|
|
119
|
+
options;
|
|
120
|
+
capabilities;
|
|
174
121
|
compatibility;
|
|
175
122
|
constructor(input) {
|
|
176
123
|
this.id = input.id;
|
|
177
124
|
this.provider = input.provider;
|
|
178
125
|
this.route = input.route;
|
|
179
|
-
this.
|
|
126
|
+
this.options = input.options;
|
|
127
|
+
this.capabilities = input.capabilities;
|
|
180
128
|
this.compatibility = input.compatibility;
|
|
181
129
|
}
|
|
182
130
|
static make(input) {
|
|
@@ -184,7 +132,9 @@ export class LanguageModel {
|
|
|
184
132
|
id: ModelID.make(input.id),
|
|
185
133
|
provider: ProviderID.make(input.provider),
|
|
186
134
|
route: input.route,
|
|
187
|
-
|
|
135
|
+
// The route's options are a preset under the model's own.
|
|
136
|
+
options: mergeRequestOptions(input.route.options, input.options),
|
|
137
|
+
capabilities: input.capabilities,
|
|
188
138
|
compatibility: input.compatibility === undefined ? undefined : LanguageModelCompatibility.make(input.compatibility),
|
|
189
139
|
});
|
|
190
140
|
}
|
|
@@ -193,7 +143,8 @@ export class LanguageModel {
|
|
|
193
143
|
id: model.id,
|
|
194
144
|
provider: model.provider,
|
|
195
145
|
route: model.route,
|
|
196
|
-
|
|
146
|
+
options: model.options,
|
|
147
|
+
capabilities: model.capabilities,
|
|
197
148
|
compatibility: model.compatibility,
|
|
198
149
|
};
|
|
199
150
|
}
|
package/dist/speech-client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context } from "effect";
|
|
2
2
|
import { MediaClient } from "./media-client.js";
|
|
3
|
-
import { type SpeechEvent, type
|
|
4
|
-
export type Interface = MediaClient.Interface<
|
|
3
|
+
import { type SpeechEvent, type SpeechRequest, type SpeechResponse } from "./speech.js";
|
|
4
|
+
export type Interface = MediaClient.Interface<SpeechRequest, SpeechEvent, SpeechResponse>;
|
|
5
5
|
declare const SpeechClientService_base: Context.ServiceClass<SpeechClientService, "@opencode/SpeechClient", Interface>;
|
|
6
6
|
export declare class SpeechClientService extends SpeechClientService_base {
|
|
7
7
|
}
|
|
@@ -57,8 +57,8 @@ export declare const SpeechClient: {
|
|
|
57
57
|
} | undefined;
|
|
58
58
|
})[];
|
|
59
59
|
readonly layer: import("effect/Layer").Layer<SpeechClientService, never, import("./route.js").RequestExecutorService>;
|
|
60
|
-
readonly generate: (request:
|
|
61
|
-
readonly stream: (request:
|
|
60
|
+
readonly generate: (request: SpeechRequest, options?: import("./generation.js").AwaitOptions) => import("effect/Effect").Effect<SpeechResponse, import("./public.js").AIError, SpeechClientService>;
|
|
61
|
+
readonly stream: (request: SpeechRequest, options?: import("./generation.js").AwaitOptions) => import("effect/Stream").Stream<{
|
|
62
62
|
readonly type: "audio-delta";
|
|
63
63
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
64
64
|
} | {
|
|
@@ -97,11 +97,11 @@ export declare const SpeechClient: {
|
|
|
97
97
|
readonly [x: string]: unknown;
|
|
98
98
|
};
|
|
99
99
|
} | undefined;
|
|
100
|
-
} | import("./generation.js").Observation, import("./
|
|
101
|
-
readonly start: (request:
|
|
100
|
+
} | import("./generation.js").Observation, import("./public.js").AIError, SpeechClientService>;
|
|
101
|
+
readonly start: (request: SpeechRequest) => import("effect/Effect").Effect<import("./generation.js").Generation<SpeechResponse>, import("./public.js").AIError, SpeechClientService>;
|
|
102
102
|
readonly resume: (model: import("./speech.js").SpeechModel<{
|
|
103
103
|
readonly [x: string]: unknown;
|
|
104
|
-
}>, token: unknown) => import("effect/Effect").Effect<import("./generation.js").Generation<SpeechResponse>, import("./
|
|
104
|
+
}>, token: unknown) => import("effect/Effect").Effect<import("./generation.js").Generation<SpeechResponse>, import("./public.js").AIError, SpeechClientService>;
|
|
105
105
|
readonly Service: typeof SpeechClientService;
|
|
106
106
|
};
|
|
107
107
|
export {};
|