@opencode/ai 2.0.31 → 2.1.0
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/ai-client.d.ts +2 -2
- package/dist/experimental/evaluation-client.d.ts +1 -1
- package/dist/experimental/evaluation.d.ts +20 -20
- package/dist/experimental/realtime.d.ts +47 -0
- package/dist/experimental/realtime.js +99 -0
- package/dist/experimental/system-one.d.ts +1 -1
- package/dist/experimental.d.ts +2 -0
- package/dist/experimental.js +1 -0
- package/dist/image-client.d.ts +8 -8
- package/dist/image.d.ts +593 -437
- package/dist/llm.d.ts +51 -51
- package/dist/media-client.d.ts +1 -1
- package/dist/media.d.ts +4 -4
- package/dist/promise.d.ts +199 -198
- package/dist/protocols/alibaba-chat.d.ts +81 -82
- package/dist/protocols/alibaba-chat.js +0 -1
- package/dist/protocols/alibaba-messages.d.ts +99 -99
- package/dist/protocols/alibaba-responses.d.ts +120 -120
- package/dist/protocols/anthropic-messages.d.ts +187 -187
- package/dist/protocols/anthropic-messages.js +3 -2
- package/dist/protocols/assemblyai-transcription.d.ts +1 -1
- package/dist/protocols/bedrock-converse.d.ts +75 -79
- package/dist/protocols/bfl-images.d.ts +1 -1
- package/dist/protocols/cartesia-speech.d.ts +17 -17
- package/dist/protocols/cohere-chat.d.ts +26 -23
- package/dist/protocols/cohere-chat.js +22 -1
- package/dist/protocols/deepgram-speech.d.ts +17 -17
- package/dist/protocols/deepgram-transcription.d.ts +1 -1
- package/dist/protocols/elevenlabs-speech.d.ts +17 -17
- package/dist/protocols/elevenlabs-transcription.d.ts +1 -1
- package/dist/protocols/fal-images.d.ts +1 -1
- package/dist/protocols/fal-video.d.ts +1 -1
- package/dist/protocols/gemini.d.ts +55 -55
- package/dist/protocols/gemini.js +11 -1
- package/dist/protocols/google-images.d.ts +1 -1
- package/dist/protocols/google-interactions.d.ts +64 -62
- package/dist/protocols/google-interactions.js +19 -1
- package/dist/protocols/google-speech.d.ts +17 -17
- package/dist/protocols/google-transcription.d.ts +47 -47
- package/dist/protocols/google-video.d.ts +1 -1
- package/dist/protocols/meta-messages.d.ts +121 -121
- package/dist/protocols/meta-responses.d.ts +201 -201
- package/dist/protocols/mistral-chat.d.ts +45 -45
- package/dist/protocols/open-responses-channel.d.ts +1 -1
- package/dist/protocols/open-responses.d.ts +584 -450
- package/dist/protocols/open-responses.js +27 -35
- package/dist/protocols/openai-chat.d.ts +248 -248
- package/dist/protocols/openai-chat.js +11 -42
- package/dist/protocols/openai-compatible-chat.d.ts +32 -32
- package/dist/protocols/openai-compatible-responses.d.ts +88 -88
- package/dist/protocols/openai-images.d.ts +17 -17
- package/dist/protocols/openai-responses.d.ts +567 -567
- package/dist/protocols/openai-responses.js +1 -1
- package/dist/protocols/openai-speech.d.ts +17 -17
- package/dist/protocols/openai-transcription.d.ts +47 -47
- package/dist/protocols/replicate-images.d.ts +1 -1
- package/dist/protocols/runway-video.d.ts +1 -1
- package/dist/protocols/shared.d.ts +12 -1
- package/dist/protocols/shared.js +17 -1
- package/dist/protocols/stability-images.d.ts +2 -2
- package/dist/protocols/utils/bedrock-cache.d.ts +2 -2
- package/dist/protocols/utils/bedrock-media.d.ts +4 -4
- package/dist/protocols/utils/openai-options.d.ts +1 -1
- package/dist/protocols/utils/speech-stream.d.ts +1 -1
- package/dist/protocols/utils/tool-schema.d.ts +10 -5
- package/dist/protocols/utils/tool-stream.d.ts +152 -152
- package/dist/protocols/venice-chat.d.ts +109 -110
- package/dist/protocols/venice-chat.js +0 -1
- package/dist/protocols/xai-images.d.ts +1 -1
- package/dist/protocols/xai-responses.d.ts +79 -79
- package/dist/protocols/xai-video.d.ts +1 -1
- package/dist/protocols/zai-chat.d.ts +77 -78
- package/dist/protocols/zai-chat.js +0 -1
- package/dist/protocols/zai-images.d.ts +1 -1
- package/dist/protocols/zai-messages.d.ts +97 -97
- package/dist/providers/alibaba.d.ts +222 -283
- package/dist/providers/amazon-bedrock-mantle.d.ts +291 -298
- package/dist/providers/amazon-bedrock.d.ts +22 -28
- package/dist/providers/anthropic-compatible.d.ts +86 -90
- package/dist/providers/anthropic.d.ts +86 -90
- package/dist/providers/assemblyai.d.ts +2 -6
- package/dist/providers/azure.d.ts +228 -238
- package/dist/providers/baseten.d.ts +66 -70
- package/dist/providers/black-forest-labs.d.ts +2 -6
- package/dist/providers/cartesia.d.ts +2 -6
- package/dist/providers/cerebras.d.ts +66 -70
- package/dist/providers/cerebras.js +0 -1
- package/dist/providers/cloudflare-ai-gateway.d.ts +352 -356
- package/dist/providers/cloudflare-workers-ai.d.ts +66 -70
- package/dist/providers/cohere.d.ts +122 -132
- package/dist/providers/cohere.js +0 -2
- package/dist/providers/deepgram.d.ts +2 -7
- package/dist/providers/deepinfra.d.ts +66 -70
- package/dist/providers/deepinfra.js +0 -1
- package/dist/providers/deepseek.d.ts +66 -70
- package/dist/providers/deepseek.js +1 -1
- package/dist/providers/digitalocean.d.ts +137 -141
- package/dist/providers/elevenlabs.d.ts +2 -7
- package/dist/providers/fal.d.ts +2 -7
- package/dist/providers/fireworks.d.ts +66 -70
- package/dist/providers/google-vertex-chat.d.ts +34 -38
- package/dist/providers/google-vertex-interactions.d.ts +31 -41
- package/dist/providers/google-vertex-messages.d.ts +81 -85
- package/dist/providers/google-vertex-mistral.d.ts +23 -27
- package/dist/providers/google-vertex-responses.d.ts +90 -94
- package/dist/providers/google-vertex.d.ts +26 -30
- package/dist/providers/google.d.ts +94 -109
- package/dist/providers/groq.d.ts +111 -115
- package/dist/providers/groq.js +0 -1
- package/dist/providers/meta.d.ts +309 -317
- package/dist/providers/meta.js +1 -1
- package/dist/providers/minimax.d.ts +296 -303
- package/dist/providers/minimax.js +1 -1
- package/dist/providers/mistral.d.ts +22 -26
- package/dist/providers/moonshot.d.ts +296 -303
- package/dist/providers/moonshot.js +0 -1
- package/dist/providers/openai-compatible-responses.d.ts +90 -94
- package/dist/providers/openai-compatible.d.ts +34 -38
- package/dist/providers/openai.d.ts +93 -108
- package/dist/providers/opencode.d.ts +2 -8
- package/dist/providers/openrouter.d.ts +137 -144
- package/dist/providers/replicate.d.ts +2 -6
- package/dist/providers/runway.d.ts +2 -6
- package/dist/providers/stability.d.ts +2 -7
- package/dist/providers/togetherai.d.ts +66 -70
- package/dist/providers/togetherai.js +1 -1
- package/dist/providers/typesafe-ai.d.ts +2 -8
- package/dist/providers/venice.d.ts +58 -63
- package/dist/providers/vercel-ai-gateway.d.ts +2 -12
- package/dist/providers/xai.d.ts +38 -50
- package/dist/providers/zai-coding-plan.d.ts +206 -213
- package/dist/providers/zai.d.ts +40 -46
- package/dist/route/client.d.ts +51 -51
- package/dist/route/media-protocol.d.ts +1 -1
- package/dist/route/transport/http.d.ts +1 -1
- package/dist/route/transport/websocket.d.ts +8 -8
- package/dist/schema/errors.d.ts +19 -19
- package/dist/schema/events.d.ts +3090 -3288
- package/dist/schema/messages.d.ts +8 -7
- package/dist/schema/options.d.ts +2 -1
- package/dist/schema/options.js +2 -1
- package/dist/speech-client.d.ts +8 -8
- package/dist/speech.d.ts +434 -398
- package/dist/testing.d.ts +338 -338
- package/dist/tool-runtime.d.ts +1 -1
- package/dist/transcription-client.d.ts +23 -23
- package/dist/transcription.d.ts +562 -646
- package/dist/utils/sanitize.d.ts +4 -0
- package/dist/utils/sanitize.js +23 -6
- package/dist/video-client.d.ts +8 -8
- package/dist/video.d.ts +416 -372
- package/package.json +6 -6
|
@@ -252,7 +252,7 @@ export const protocol = Protocol.make({
|
|
|
252
252
|
const endpoint = Endpoint.path(PATH, { baseURL: DEFAULT_BASE_URL });
|
|
253
253
|
const auth = Auth.none;
|
|
254
254
|
export const httpTransport = HttpTransport.sseJson.with();
|
|
255
|
-
export const channelTransport =
|
|
255
|
+
export const channelTransport = OpenResponsesChannel.transport;
|
|
256
256
|
export const transport = channelTransport({
|
|
257
257
|
id: ADAPTER,
|
|
258
258
|
name: NAME,
|
|
@@ -16,12 +16,12 @@ interface State extends SpeechStream.Audio {
|
|
|
16
16
|
readonly usage?: MediaUsage;
|
|
17
17
|
}
|
|
18
18
|
export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
19
|
-
readonly id: string;
|
|
20
19
|
readonly type: "generation-queued";
|
|
20
|
+
readonly id: string;
|
|
21
21
|
readonly position?: number | undefined;
|
|
22
22
|
} | {
|
|
23
|
-
readonly id: string;
|
|
24
23
|
readonly type: "generation-progress";
|
|
24
|
+
readonly id: string;
|
|
25
25
|
readonly progress?: number | undefined;
|
|
26
26
|
} | {
|
|
27
27
|
readonly type: "audio-delta";
|
|
@@ -36,11 +36,6 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
36
36
|
} | {
|
|
37
37
|
readonly type: "finish";
|
|
38
38
|
readonly audio: import("../media.js").Asset;
|
|
39
|
-
readonly providerMetadata?: {
|
|
40
|
-
readonly [x: string]: {
|
|
41
|
-
readonly [x: string]: unknown;
|
|
42
|
-
};
|
|
43
|
-
} | undefined;
|
|
44
39
|
readonly usage?: {
|
|
45
40
|
readonly type: "tokens";
|
|
46
41
|
readonly input?: number | undefined;
|
|
@@ -63,7 +58,7 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
63
58
|
readonly seconds: number;
|
|
64
59
|
} | undefined;
|
|
65
60
|
readonly notices?: readonly {
|
|
66
|
-
readonly type: "
|
|
61
|
+
readonly type: "filtered" | "moderated" | "other";
|
|
67
62
|
readonly message: string;
|
|
68
63
|
readonly providerMetadata?: {
|
|
69
64
|
readonly [x: string]: {
|
|
@@ -71,16 +66,21 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
71
66
|
};
|
|
72
67
|
} | undefined;
|
|
73
68
|
}[] | undefined;
|
|
69
|
+
readonly providerMetadata?: {
|
|
70
|
+
readonly [x: string]: {
|
|
71
|
+
readonly [x: string]: unknown;
|
|
72
|
+
};
|
|
73
|
+
} | undefined;
|
|
74
74
|
}, string | Uint8Array<ArrayBufferLike>, State>;
|
|
75
75
|
export declare const model: (input: MediaRoute.ModelInput) => SpeechModel<OpenAISpeechOptions>;
|
|
76
76
|
export declare const OpenAISpeech: {
|
|
77
77
|
readonly protocol: MediaProtocol.Streamed<Request, {
|
|
78
|
-
readonly id: string;
|
|
79
78
|
readonly type: "generation-queued";
|
|
79
|
+
readonly id: string;
|
|
80
80
|
readonly position?: number | undefined;
|
|
81
81
|
} | {
|
|
82
|
-
readonly id: string;
|
|
83
82
|
readonly type: "generation-progress";
|
|
83
|
+
readonly id: string;
|
|
84
84
|
readonly progress?: number | undefined;
|
|
85
85
|
} | {
|
|
86
86
|
readonly type: "audio-delta";
|
|
@@ -95,11 +95,6 @@ export declare const OpenAISpeech: {
|
|
|
95
95
|
} | {
|
|
96
96
|
readonly type: "finish";
|
|
97
97
|
readonly audio: import("../media.js").Asset;
|
|
98
|
-
readonly providerMetadata?: {
|
|
99
|
-
readonly [x: string]: {
|
|
100
|
-
readonly [x: string]: unknown;
|
|
101
|
-
};
|
|
102
|
-
} | undefined;
|
|
103
98
|
readonly usage?: {
|
|
104
99
|
readonly type: "tokens";
|
|
105
100
|
readonly input?: number | undefined;
|
|
@@ -122,7 +117,7 @@ export declare const OpenAISpeech: {
|
|
|
122
117
|
readonly seconds: number;
|
|
123
118
|
} | undefined;
|
|
124
119
|
readonly notices?: readonly {
|
|
125
|
-
readonly type: "
|
|
120
|
+
readonly type: "filtered" | "moderated" | "other";
|
|
126
121
|
readonly message: string;
|
|
127
122
|
readonly providerMetadata?: {
|
|
128
123
|
readonly [x: string]: {
|
|
@@ -130,7 +125,12 @@ export declare const OpenAISpeech: {
|
|
|
130
125
|
};
|
|
131
126
|
} | undefined;
|
|
132
127
|
}[] | undefined;
|
|
128
|
+
readonly providerMetadata?: {
|
|
129
|
+
readonly [x: string]: {
|
|
130
|
+
readonly [x: string]: unknown;
|
|
131
|
+
};
|
|
132
|
+
} | undefined;
|
|
133
133
|
}, string | Uint8Array<ArrayBufferLike>, State>;
|
|
134
|
-
readonly model:
|
|
134
|
+
readonly model: typeof model;
|
|
135
135
|
};
|
|
136
136
|
export {};
|
|
@@ -59,12 +59,12 @@ interface State {
|
|
|
59
59
|
readonly transcript?: Transcript;
|
|
60
60
|
}
|
|
61
61
|
export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
62
|
-
readonly id: string;
|
|
63
62
|
readonly type: "generation-queued";
|
|
63
|
+
readonly id: string;
|
|
64
64
|
readonly position?: number | undefined;
|
|
65
65
|
} | {
|
|
66
|
-
readonly id: string;
|
|
67
66
|
readonly type: "generation-progress";
|
|
67
|
+
readonly id: string;
|
|
68
68
|
readonly progress?: number | undefined;
|
|
69
69
|
} | {
|
|
70
70
|
readonly type: "text-delta";
|
|
@@ -78,14 +78,22 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
78
78
|
readonly speaker?: string | undefined;
|
|
79
79
|
};
|
|
80
80
|
} | {
|
|
81
|
-
readonly type: "finish";
|
|
82
81
|
readonly text: string;
|
|
82
|
+
readonly segments?: readonly {
|
|
83
|
+
readonly text: string;
|
|
84
|
+
readonly startSeconds: number;
|
|
85
|
+
readonly endSeconds: number;
|
|
86
|
+
readonly speaker?: string | undefined;
|
|
87
|
+
}[] | undefined;
|
|
88
|
+
readonly words?: readonly {
|
|
89
|
+
readonly text: string;
|
|
90
|
+
readonly startSeconds: number;
|
|
91
|
+
readonly endSeconds: number;
|
|
92
|
+
readonly speaker?: string | undefined;
|
|
93
|
+
readonly confidence?: number | undefined;
|
|
94
|
+
}[] | undefined;
|
|
95
|
+
readonly language?: string | undefined;
|
|
83
96
|
readonly durationSeconds?: number | undefined;
|
|
84
|
-
readonly providerMetadata?: {
|
|
85
|
-
readonly [x: string]: {
|
|
86
|
-
readonly [x: string]: unknown;
|
|
87
|
-
};
|
|
88
|
-
} | undefined;
|
|
89
97
|
readonly usage?: {
|
|
90
98
|
readonly type: "tokens";
|
|
91
99
|
readonly input?: number | undefined;
|
|
@@ -108,7 +116,7 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
108
116
|
readonly seconds: number;
|
|
109
117
|
} | undefined;
|
|
110
118
|
readonly notices?: readonly {
|
|
111
|
-
readonly type: "
|
|
119
|
+
readonly type: "filtered" | "moderated" | "other";
|
|
112
120
|
readonly message: string;
|
|
113
121
|
readonly providerMetadata?: {
|
|
114
122
|
readonly [x: string]: {
|
|
@@ -116,30 +124,22 @@ export declare const protocol: MediaProtocol.Streamed<Request, {
|
|
|
116
124
|
};
|
|
117
125
|
} | undefined;
|
|
118
126
|
}[] | undefined;
|
|
119
|
-
readonly
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}[] | undefined;
|
|
126
|
-
readonly words?: readonly {
|
|
127
|
-
readonly text: string;
|
|
128
|
-
readonly startSeconds: number;
|
|
129
|
-
readonly endSeconds: number;
|
|
130
|
-
readonly speaker?: string | undefined;
|
|
131
|
-
readonly confidence?: number | undefined;
|
|
132
|
-
}[] | undefined;
|
|
127
|
+
readonly providerMetadata?: {
|
|
128
|
+
readonly [x: string]: {
|
|
129
|
+
readonly [x: string]: unknown;
|
|
130
|
+
};
|
|
131
|
+
} | undefined;
|
|
132
|
+
readonly type: "finish";
|
|
133
133
|
}, Frame, State>;
|
|
134
134
|
export declare const model: (input: MediaRoute.ModelInput) => TranscriptionModel<OpenAITranscriptionOptions>;
|
|
135
135
|
export declare const OpenAITranscription: {
|
|
136
136
|
readonly protocol: MediaProtocol.Streamed<Request, {
|
|
137
|
-
readonly id: string;
|
|
138
137
|
readonly type: "generation-queued";
|
|
138
|
+
readonly id: string;
|
|
139
139
|
readonly position?: number | undefined;
|
|
140
140
|
} | {
|
|
141
|
-
readonly id: string;
|
|
142
141
|
readonly type: "generation-progress";
|
|
142
|
+
readonly id: string;
|
|
143
143
|
readonly progress?: number | undefined;
|
|
144
144
|
} | {
|
|
145
145
|
readonly type: "text-delta";
|
|
@@ -153,14 +153,22 @@ export declare const OpenAITranscription: {
|
|
|
153
153
|
readonly speaker?: string | undefined;
|
|
154
154
|
};
|
|
155
155
|
} | {
|
|
156
|
-
readonly type: "finish";
|
|
157
156
|
readonly text: string;
|
|
157
|
+
readonly segments?: readonly {
|
|
158
|
+
readonly text: string;
|
|
159
|
+
readonly startSeconds: number;
|
|
160
|
+
readonly endSeconds: number;
|
|
161
|
+
readonly speaker?: string | undefined;
|
|
162
|
+
}[] | undefined;
|
|
163
|
+
readonly words?: readonly {
|
|
164
|
+
readonly text: string;
|
|
165
|
+
readonly startSeconds: number;
|
|
166
|
+
readonly endSeconds: number;
|
|
167
|
+
readonly speaker?: string | undefined;
|
|
168
|
+
readonly confidence?: number | undefined;
|
|
169
|
+
}[] | undefined;
|
|
170
|
+
readonly language?: string | undefined;
|
|
158
171
|
readonly durationSeconds?: number | undefined;
|
|
159
|
-
readonly providerMetadata?: {
|
|
160
|
-
readonly [x: string]: {
|
|
161
|
-
readonly [x: string]: unknown;
|
|
162
|
-
};
|
|
163
|
-
} | undefined;
|
|
164
172
|
readonly usage?: {
|
|
165
173
|
readonly type: "tokens";
|
|
166
174
|
readonly input?: number | undefined;
|
|
@@ -183,7 +191,7 @@ export declare const OpenAITranscription: {
|
|
|
183
191
|
readonly seconds: number;
|
|
184
192
|
} | undefined;
|
|
185
193
|
readonly notices?: readonly {
|
|
186
|
-
readonly type: "
|
|
194
|
+
readonly type: "filtered" | "moderated" | "other";
|
|
187
195
|
readonly message: string;
|
|
188
196
|
readonly providerMetadata?: {
|
|
189
197
|
readonly [x: string]: {
|
|
@@ -191,21 +199,13 @@ export declare const OpenAITranscription: {
|
|
|
191
199
|
};
|
|
192
200
|
} | undefined;
|
|
193
201
|
}[] | undefined;
|
|
194
|
-
readonly
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}[] | undefined;
|
|
201
|
-
readonly words?: readonly {
|
|
202
|
-
readonly text: string;
|
|
203
|
-
readonly startSeconds: number;
|
|
204
|
-
readonly endSeconds: number;
|
|
205
|
-
readonly speaker?: string | undefined;
|
|
206
|
-
readonly confidence?: number | undefined;
|
|
207
|
-
}[] | undefined;
|
|
202
|
+
readonly providerMetadata?: {
|
|
203
|
+
readonly [x: string]: {
|
|
204
|
+
readonly [x: string]: unknown;
|
|
205
|
+
};
|
|
206
|
+
} | undefined;
|
|
207
|
+
readonly type: "finish";
|
|
208
208
|
}, Frame, State>;
|
|
209
|
-
readonly model:
|
|
209
|
+
readonly model: typeof model;
|
|
210
210
|
};
|
|
211
211
|
export {};
|
|
@@ -9,8 +9,19 @@ export { Json, decodeJson, encodeJson, isRecord };
|
|
|
9
9
|
export declare const JsonObject: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
10
10
|
export declare const optionalArray: <const S extends Schema.Top>(schema: S) => Schema.optional<Schema.$Array<S>>;
|
|
11
11
|
export declare const optionalNull: <const S extends Schema.Top>(schema: S) => Schema.optional<Schema.NullOr<S>>;
|
|
12
|
+
/** Optional provider field where an explicit `null` means absent, so decoding never yields `null`. */
|
|
13
|
+
export declare const optionalNullish: <const S extends Schema.Top>(schema: S) => Schema.decodeTo<Schema.optional<Schema.toType<S>>, Schema.optional<Schema.NullOr<S>>, never, never>;
|
|
12
14
|
/** Optional field whose malformed value decodes to `undefined` instead of failing the enclosing struct. */
|
|
13
15
|
export declare const lenient: <const S extends Schema.Top>(schema: S) => Schema.optionalKey<Schema.middlewareDecoding<Schema.UndefinedOr<S>, S["DecodingServices"]>>;
|
|
16
|
+
/**
|
|
17
|
+
* Accepts stream frames that carry no `type`, alongside the typed event schema. Gateways inject such frames as
|
|
18
|
+
* keep-alives, so they decode as an ignored event; one with an `error` still decodes as an error event.
|
|
19
|
+
*/
|
|
20
|
+
export declare const withUntypedFrames: <const S extends Schema.Codec<{
|
|
21
|
+
readonly type: string;
|
|
22
|
+
}, {
|
|
23
|
+
readonly type: string;
|
|
24
|
+
}>>(event: S) => Schema.Union<readonly [S, Schema.decodeTo<S, Schema.$Record<Schema.String, Schema.Unknown>, never, never>]>;
|
|
14
25
|
/** Provider-defined string enum: known values for autocomplete, any string accepted at runtime. */
|
|
15
26
|
export declare const knownString: <Known extends string>() => Schema.declare<OpenString<Known>, OpenString<Known>>;
|
|
16
27
|
export declare const OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH = 64;
|
|
@@ -93,10 +104,10 @@ export declare const wrapSystemUpdate: (parts: ReadonlyArray<{
|
|
|
93
104
|
export declare const systemUpdateText: (route: string, message: Message) => Effect.Effect<{
|
|
94
105
|
readonly type: "text";
|
|
95
106
|
readonly text: string;
|
|
107
|
+
readonly cache?: import("../schema/options.js").CacheHint | undefined;
|
|
96
108
|
readonly metadata?: {
|
|
97
109
|
readonly [x: string]: unknown;
|
|
98
110
|
} | undefined;
|
|
99
|
-
readonly cache?: import("../schema/options.js").CacheHint | undefined;
|
|
100
111
|
readonly providerMetadata?: {
|
|
101
112
|
readonly [x: string]: {
|
|
102
113
|
readonly [x: string]: unknown;
|
package/dist/protocols/shared.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tool } from "@opencode/schema/tool";
|
|
2
|
-
import { Effect, Option, Schema } from "effect";
|
|
2
|
+
import { Effect, Option, Predicate, Schema, SchemaGetter, SchemaTransformation } from "effect";
|
|
3
3
|
import { Headers, HttpClientRequest } from "effect/http";
|
|
4
4
|
import { Media } from "../media.js";
|
|
5
5
|
import { InvalidProviderOutputError, InvalidRequestError, UnsupportedOperationError, AIError, LLMRequest, Message, ToolDefinition, } from "../schema/index.js";
|
|
@@ -10,8 +10,24 @@ const isJson = Schema.is(Schema.Json);
|
|
|
10
10
|
export const JsonObject = Schema.Record(Schema.String, Schema.Unknown);
|
|
11
11
|
export const optionalArray = (schema) => Schema.optional(Schema.Array(schema));
|
|
12
12
|
export const optionalNull = (schema) => Schema.optional(Schema.NullOr(schema));
|
|
13
|
+
/** Optional provider field where an explicit `null` means absent, so decoding never yields `null`. */
|
|
14
|
+
export const optionalNullish = (schema) => Schema.optional(Schema.NullOr(schema)).pipe(Schema.decodeTo(Schema.optional(Schema.toType(schema)), SchemaTransformation.transformOptional({
|
|
15
|
+
decode: Option.filter(Predicate.isNotNullish),
|
|
16
|
+
encode: (value) => value,
|
|
17
|
+
})));
|
|
13
18
|
/** Optional field whose malformed value decodes to `undefined` instead of failing the enclosing struct. */
|
|
14
19
|
export const lenient = (schema) => Schema.optionalKey(Schema.UndefinedOr(schema).pipe(Schema.catchDecoding(() => Effect.succeed(Option.some(undefined)))));
|
|
20
|
+
/**
|
|
21
|
+
* Accepts stream frames that carry no `type`, alongside the typed event schema. Gateways inject such frames as
|
|
22
|
+
* keep-alives, so they decode as an ignored event; one with an `error` still decodes as an error event.
|
|
23
|
+
*/
|
|
24
|
+
export const withUntypedFrames = (event) => Schema.Union([
|
|
25
|
+
event,
|
|
26
|
+
JsonObject.check(Schema.makeFilter((frame) => !("type" in frame))).pipe(Schema.decodeTo(event, {
|
|
27
|
+
decode: SchemaGetter.transform((frame) => ({ ...frame, type: frame.error != null ? "error" : "ignored" })),
|
|
28
|
+
encode: SchemaGetter.forbidden(() => "Untyped stream frames are decode-only"),
|
|
29
|
+
})),
|
|
30
|
+
]);
|
|
15
31
|
/** Provider-defined string enum: known values for autocomplete, any string accepted at runtime. */
|
|
16
32
|
export const knownString = () => Schema.declare((value) => typeof value === "string", {
|
|
17
33
|
expected: "string",
|
|
@@ -34,6 +34,6 @@ export declare const StabilityImages: {
|
|
|
34
34
|
readonly upscaleProtocol: MediaProtocol.Queued<UpscaleRequest, ImageResponse, {
|
|
35
35
|
readonly id: string;
|
|
36
36
|
}>;
|
|
37
|
-
readonly model:
|
|
38
|
-
readonly upscaleModel:
|
|
37
|
+
readonly model: typeof model;
|
|
38
|
+
readonly upscaleModel: typeof upscaleModel;
|
|
39
39
|
};
|
|
@@ -9,10 +9,10 @@ export declare const CachePointBlock: Schema.Struct<{
|
|
|
9
9
|
export type CachePointBlock = Schema.Schema.Type<typeof CachePointBlock>;
|
|
10
10
|
export declare const BEDROCK_BREAKPOINT_CAP = 4;
|
|
11
11
|
export declare const breakpoints: (model: LLMRequest["model"]) => {
|
|
12
|
-
supported: boolean;
|
|
13
|
-
ttl1h: boolean;
|
|
14
12
|
remaining: number;
|
|
15
13
|
dropped: number;
|
|
14
|
+
supported: boolean;
|
|
15
|
+
ttl1h: boolean;
|
|
16
16
|
};
|
|
17
17
|
export type Breakpoints = ReturnType<typeof breakpoints>;
|
|
18
18
|
export declare const block: (breakpoints: Breakpoints, cache: CacheHint | undefined) => CachePointBlock | undefined;
|
|
@@ -25,26 +25,26 @@ export type DocumentBlock = Schema.Schema.Type<typeof DocumentBlock>;
|
|
|
25
25
|
export declare const lower: (part: {
|
|
26
26
|
readonly type: "media";
|
|
27
27
|
readonly media: import("../../media.js").Asset;
|
|
28
|
+
readonly filename?: string | undefined;
|
|
29
|
+
readonly cache?: import("../../schema/options.js").CacheHint | undefined;
|
|
28
30
|
readonly metadata?: {
|
|
29
31
|
readonly [x: string]: unknown;
|
|
30
32
|
} | undefined;
|
|
31
|
-
readonly cache?: import("../../schema/options.js").CacheHint | undefined;
|
|
32
33
|
readonly providerMetadata?: {
|
|
33
34
|
readonly [x: string]: {
|
|
34
35
|
readonly [x: string]: unknown;
|
|
35
36
|
};
|
|
36
37
|
} | undefined;
|
|
37
|
-
readonly filename?: string | undefined;
|
|
38
38
|
}, documentNames: Set<string>) => Effect.Effect<{
|
|
39
39
|
image: {
|
|
40
|
-
format: "
|
|
40
|
+
format: "gif" | "jpeg" | "png" | "webp";
|
|
41
41
|
source: {
|
|
42
42
|
bytes: string;
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
45
|
}[] | ({
|
|
46
46
|
readonly document: {
|
|
47
|
-
readonly format: "
|
|
47
|
+
readonly format: "csv" | "doc" | "docx" | "html" | "md" | "pdf" | "txt" | "xls" | "xlsx";
|
|
48
48
|
readonly name: string;
|
|
49
49
|
readonly source: {
|
|
50
50
|
readonly bytes: string;
|
|
@@ -12,5 +12,5 @@ export declare const OpenAITextVerbosity: import("effect/Schema").declare<OpenRe
|
|
|
12
12
|
export declare const OpenAIResponseIncludable: import("effect/Schema").declare<OpenResponsesOptions.ResponseIncludable, OpenResponsesOptions.ResponseIncludable>;
|
|
13
13
|
export declare const OpenAIServiceTier: import("effect/Schema").declare<OpenResponsesOptions.ServiceTier, OpenResponsesOptions.ServiceTier>;
|
|
14
14
|
export declare const isReasoningEffort: (effort: unknown) => effort is OpenAIReasoningEffort;
|
|
15
|
-
export declare const resolve:
|
|
15
|
+
export declare const resolve: typeof OpenResponsesOptions.resolve;
|
|
16
16
|
export * as OpenAIOptions from "./openai-options.js";
|
|
@@ -31,7 +31,7 @@ export declare const pcm: (encoding: PcmEncoding, sampleRate: number | undefined
|
|
|
31
31
|
mediaType: string;
|
|
32
32
|
info: {
|
|
33
33
|
format: string;
|
|
34
|
-
encoding: "
|
|
34
|
+
encoding: "pcm_alaw" | "pcm_f32le" | "pcm_mulaw" | "pcm_s16le";
|
|
35
35
|
sampleRate: number | undefined;
|
|
36
36
|
channels: number;
|
|
37
37
|
};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { type JsonSchema, type LanguageModel, type LLMRequest } from "../../schema/index.js";
|
|
2
|
+
import { GeminiJsonSchema } from "./gemini-json-schema.js";
|
|
3
|
+
declare const moonshot: (schema: JsonSchema) => JsonSchema;
|
|
4
|
+
declare const openAI: (schema: JsonSchema) => JsonSchema;
|
|
5
|
+
declare const tools: (entries: LLMRequest["tools"], model: LanguageModel) => LLMRequest["tools"];
|
|
2
6
|
export declare const ToolSchemaProjection: {
|
|
3
|
-
readonly gemini:
|
|
4
|
-
readonly moonshot:
|
|
5
|
-
readonly openAI:
|
|
6
|
-
readonly responses:
|
|
7
|
-
readonly tools:
|
|
7
|
+
readonly gemini: typeof GeminiJsonSchema.normalize;
|
|
8
|
+
readonly moonshot: typeof moonshot;
|
|
9
|
+
readonly openAI: typeof openAI;
|
|
10
|
+
readonly responses: typeof openAI;
|
|
11
|
+
readonly tools: typeof tools;
|
|
8
12
|
};
|
|
13
|
+
export {};
|