@opencode-ai/ai 0.0.0-dev-18239 → 0.0.0-dev-18244
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.
|
@@ -119,10 +119,9 @@ export declare const errorText: (error: unknown) => string;
|
|
|
119
119
|
* `framing` step for Server-Sent Events. Decodes UTF-8, runs the SSE channel
|
|
120
120
|
* decoder, optionally filters named events, and drops empty / `[DONE]`
|
|
121
121
|
* keep-alive events so the protocol event schema sees one JSON string per
|
|
122
|
-
* element.
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* errors so the public error channel stays `AIError`.
|
|
122
|
+
* element. Retry control events are ignored without interrupting the stream.
|
|
123
|
+
* Decoder failures become provider output errors so the public error channel
|
|
124
|
+
* stays `AIError`.
|
|
126
125
|
*/
|
|
127
126
|
export declare const sseFraming: (bytes: Stream.Stream<Uint8Array, AIError>, events?: ReadonlySet<string>) => Stream.Stream<string, AIError>;
|
|
128
127
|
/**
|
package/dist/protocols/shared.js
CHANGED
|
@@ -162,12 +162,25 @@ export const errorText = (error) => {
|
|
|
162
162
|
* `framing` step for Server-Sent Events. Decodes UTF-8, runs the SSE channel
|
|
163
163
|
* decoder, optionally filters named events, and drops empty / `[DONE]`
|
|
164
164
|
* keep-alive events so the protocol event schema sees one JSON string per
|
|
165
|
-
* element.
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* errors so the public error channel stays `AIError`.
|
|
165
|
+
* element. Retry control events are ignored without interrupting the stream.
|
|
166
|
+
* Decoder failures become provider output errors so the public error channel
|
|
167
|
+
* stays `AIError`.
|
|
169
168
|
*/
|
|
170
|
-
export const sseFraming = (bytes, events) => bytes.pipe(Stream.decodeText(), Stream.
|
|
169
|
+
export const sseFraming = (bytes, events) => bytes.pipe(Stream.decodeText(), Stream.mapAccumEffect(() => {
|
|
170
|
+
const output = [];
|
|
171
|
+
return {
|
|
172
|
+
output,
|
|
173
|
+
parser: Sse.makeParser((event) => {
|
|
174
|
+
if (event._tag === "Event")
|
|
175
|
+
output.push(event);
|
|
176
|
+
}),
|
|
177
|
+
};
|
|
178
|
+
}, (state, chunk) => Effect.gen(function* () {
|
|
179
|
+
const error = state.parser.feed(chunk);
|
|
180
|
+
if (error)
|
|
181
|
+
return yield* eventError("sse", error.message);
|
|
182
|
+
return [state, state.output.splice(0)];
|
|
183
|
+
})), Stream.filter((event) => (events === undefined || events.has(event.event)) &&
|
|
171
184
|
event.data.length > 0 &&
|
|
172
185
|
(event.data !== "[DONE]" || (events !== undefined && event.event !== "message"))), Stream.map((event) => event.data));
|
|
173
186
|
/**
|
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-18244",
|
|
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-rc.111",
|
|
33
|
-
"@opencode-ai/http-recorder": "0.0.0-dev-
|
|
33
|
+
"@opencode-ai/http-recorder": "0.0.0-dev-18244",
|
|
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-18244",
|
|
43
43
|
"aws4fetch": "1.0.20",
|
|
44
44
|
"effect": "4.0.0-rc.111",
|
|
45
45
|
"google-auth-library": "10.5.0"
|