@opencode/ai 0.0.0-dev-20025 → 0.0.0-dev-20027

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.
@@ -126,11 +126,11 @@ export declare const toolResultText: (part: ToolResultPart) => string;
126
126
  export declare const errorText: (error: unknown) => string;
127
127
  /**
128
128
  * `framing` step for Server-Sent Events. Decodes UTF-8, runs the SSE channel
129
- * decoder, optionally filters named events, and drops empty events. `[DONE]`
130
- * is dropped by default or retained for protocols that use it as their stream
131
- * boundary. Retry control events are ignored without interrupting the stream.
132
- * Decoder failures become provider output errors so the public error channel
133
- * stays `AIError`.
129
+ * decoder, optionally filters named events, and drops empty and bare `null`
130
+ * events. `[DONE]` is dropped by default or retained for protocols that use it
131
+ * as their stream boundary. Retry control events are ignored without
132
+ * interrupting the stream. Decoder failures become provider output errors so
133
+ * the public error channel stays `AIError`.
134
134
  */
135
135
  export declare const sseFraming: (bytes: Stream.Stream<Uint8Array, AIError>, events?: ReadonlySet<string>, includeDone?: boolean) => Stream.Stream<string, AIError>;
136
136
  /**
@@ -174,11 +174,11 @@ export const errorText = (error) => {
174
174
  };
175
175
  /**
176
176
  * `framing` step for Server-Sent Events. Decodes UTF-8, runs the SSE channel
177
- * decoder, optionally filters named events, and drops empty events. `[DONE]`
178
- * is dropped by default or retained for protocols that use it as their stream
179
- * boundary. Retry control events are ignored without interrupting the stream.
180
- * Decoder failures become provider output errors so the public error channel
181
- * stays `AIError`.
177
+ * decoder, optionally filters named events, and drops empty and bare `null`
178
+ * events. `[DONE]` is dropped by default or retained for protocols that use it
179
+ * as their stream boundary. Retry control events are ignored without
180
+ * interrupting the stream. Decoder failures become provider output errors so
181
+ * the public error channel stays `AIError`.
182
182
  */
183
183
  export const sseFraming = (bytes, events, includeDone = false) => bytes.pipe(Stream.decodeText(), Stream.mapAccumEffect(() => {
184
184
  const output = [];
@@ -196,6 +196,10 @@ export const sseFraming = (bytes, events, includeDone = false) => bytes.pipe(Str
196
196
  return [state, state.output.splice(0)];
197
197
  })), Stream.filter((event) => (events === undefined || events.has(event.event)) &&
198
198
  event.data.length > 0 &&
199
+ // Some OpenAI-compatible proxies serialize an empty flush as a bare
200
+ // `data: null`, between events or after `[DONE]`. No protocol has a
201
+ // null event, so it carries nothing and must not abort the stream.
202
+ event.data !== "null" &&
199
203
  (event.data !== "[DONE]" || includeDone || (events !== undefined && event.event !== "message"))), Stream.map((event) => event.data));
200
204
  /**
201
205
  * Canonical invalid-request constructor shared by protocol lowering.
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-20025",
3
+ "version": "0.0.0-dev-20027",
4
4
  "name": "@opencode/ai",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,7 +34,7 @@
34
34
  "devDependencies": {
35
35
  "@clack/prompts": "1.0.0-alpha.1",
36
36
  "@effect/platform-node": "4.0.0-rc.112",
37
- "@opencode/http-recorder": "0.0.0-dev-20025",
37
+ "@opencode/http-recorder": "0.0.0-dev-20027",
38
38
  "@tsconfig/bun": "1.0.9",
39
39
  "@types/bun": "1.4.0",
40
40
  "@typescript/native-preview": "7.0.0-dev.20251207.1",
@@ -44,7 +44,7 @@
44
44
  "@aws-sdk/credential-providers": "3.1057.0",
45
45
  "@smithy/eventstream-codec": "4.2.14",
46
46
  "@smithy/util-utf8": "4.2.2",
47
- "@opencode/schema": "0.0.0-dev-20025",
47
+ "@opencode/schema": "0.0.0-dev-20027",
48
48
  "aws4fetch": "1.0.20",
49
49
  "effect": "4.0.0-rc.112",
50
50
  "google-auth-library": "10.5.0"