New:Socket for Asana Is Now Available.Learn more
Sign In

@opencode-ai/ai

Package Overview
Dependencies
Maintainers
2
Versions
907
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opencode-ai/ai - npm Package Compare versions

Comparing version
0.0.0-dev-18240
to
0.0.0-dev-18244
+3
-4
dist/protocols/shared.d.ts

@@ -122,6 +122,5 @@ import { Tool } from "@opencode-ai/schema/tool";

* keep-alive events so the protocol event schema sees one JSON string per
* element. The SSE channel emits a
* `Retry` control event on its error channel; we drop it here (we don't
* implement client-driven retries). Decoder failures become provider output
* errors so the public error channel stays `AIError`.
* element. Retry control events are ignored without interrupting the stream.
* Decoder failures become provider output errors so the public error channel
* stays `AIError`.
*/

@@ -128,0 +127,0 @@ export declare const sseFraming: (bytes: Stream.Stream<Uint8Array, AIError>, events?: ReadonlySet<string>) => Stream.Stream<string, AIError>;

@@ -165,8 +165,21 @@ import { Buffer } from "node:buffer";

* keep-alive events so the protocol event schema sees one JSON string per
* element. The SSE channel emits a
* `Retry` control event on its error channel; we drop it here (we don't
* implement client-driven retries). Decoder failures become provider output
* errors so the public error channel stays `AIError`.
* element. Retry control events are ignored without interrupting the stream.
* Decoder failures become provider output errors so the public error channel
* stays `AIError`.
*/
export const sseFraming = (bytes, events) => bytes.pipe(Stream.decodeText(), Stream.pipeThroughChannel(Sse.decode()), Stream.catchTag("Retry", () => Stream.empty), Stream.catchTag("SseError", (error) => Stream.fail(eventError("sse", error.message))), Stream.filter((event) => (events === undefined || events.has(event.event)) &&
export const sseFraming = (bytes, events) => bytes.pipe(Stream.decodeText(), Stream.mapAccumEffect(() => {
const output = [];
return {
output,
parser: Sse.makeParser((event) => {
if (event._tag === "Event")
output.push(event);
}),
};
}, (state, chunk) => Effect.gen(function* () {
const error = state.parser.feed(chunk);
if (error)
return yield* eventError("sse", error.message);
return [state, state.output.splice(0)];
})), Stream.filter((event) => (events === undefined || events.has(event.event)) &&
event.data.length > 0 &&

@@ -173,0 +186,0 @@ (event.data !== "[DONE]" || (events !== undefined && event.event !== "message"))), Stream.map((event) => event.data));

{
"$schema": "https://json.schemastore.org/package.json",
"version": "0.0.0-dev-18240",
"version": "0.0.0-dev-18244",
"name": "@opencode-ai/ai",

@@ -33,3 +33,3 @@ "type": "module",

"@effect/platform-node": "4.0.0-rc.111",
"@opencode-ai/http-recorder": "0.0.0-dev-18240",
"@opencode-ai/http-recorder": "0.0.0-dev-18244",
"@tsconfig/bun": "1.0.9",

@@ -43,3 +43,3 @@ "@types/bun": "1.3.13",

"@smithy/util-utf8": "4.2.2",
"@opencode-ai/schema": "0.0.0-dev-18240",
"@opencode-ai/schema": "0.0.0-dev-18244",
"aws4fetch": "1.0.20",

@@ -46,0 +46,0 @@ "effect": "4.0.0-rc.111",