New:Socket for Asana Is Now Available.Learn more
Get Started

@opencode-ai/ai

Package Overview
Dependencies
Maintainers
2
Versions
1089
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-18192
to
0.0.0-dev-18193
+6
-1
dist/protocols/open-responses-continuation.js

@@ -136,3 +136,8 @@ import { AIError, TransportReason } from "../schema/index.js";

protocol: PROTOCOL,
value: { version: VERSION, responseID, request, output: output.slice() },
value: {
version: VERSION,
responseID,
request,
output: event.response?.output ? [...event.response.output] : output.slice(),
},
},

@@ -139,0 +144,0 @@ };

@@ -405,2 +405,10 @@ import { Effect, Schema } from "effect";

}>>>;
readonly output: Schema.optional<Schema.$Array<Schema.StructWithRest<Schema.Struct<{
readonly type: Schema.String;
readonly id: Schema.optional<Schema.String>;
readonly call_id: Schema.optional<Schema.String>;
readonly name: Schema.optional<Schema.String>;
readonly arguments: Schema.optional<Schema.String>;
readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
readonly usage: Schema.optional<Schema.NullOr<Schema.Struct<{

@@ -660,3 +668,3 @@ readonly input_tokens: Schema.optional<Schema.Number>;

export declare const providerFailure: (id: string, event: Event, fallback: string) => AIError;
export declare const step: (state: ParserState, event: Event) => AIError | Effect.Effect<StepResult, never, never> | Effect.Effect<[ParserState, readonly ({
export declare const step: (state: ParserState, event: Event) => AIError | Effect.Effect<[ParserState, readonly ({
readonly type: "step-start";

@@ -843,3 +851,3 @@ readonly index: number;

readonly classification?: "context-overflow" | "payload-too-large" | undefined;
})[]], AIError, never>;
})[]], AIError, never> | Effect.Effect<StepResult, never, never>;
/**

@@ -993,2 +1001,11 @@ * The provider-neutral Open Responses protocol. Provider-specific Responses

readonly id?: string | undefined;
readonly output?: readonly {
readonly [x: string]: unknown;
readonly type: string;
readonly id?: string | undefined;
readonly name?: string | undefined;
readonly arguments?: string | undefined;
readonly encrypted_content?: string | null | undefined;
readonly call_id?: string | undefined;
}[] | undefined;
readonly error?: {

@@ -995,0 +1012,0 @@ readonly type?: string | null | undefined;

+17
-8

@@ -216,2 +216,3 @@ import { Effect, Schema } from "effect";

incomplete_details: optionalNull(Schema.Struct({ reason: Schema.optional(Schema.String) })),
output: Schema.optional(Schema.Array(StreamItem)),
usage: optionalNull(OpenResponsesUsage),

@@ -859,10 +860,18 @@ error: optionalNull(OpenResponsesErrorPayload),

const onResponseFinish = Effect.fn("OpenResponses.onResponseFinish")(function* (state, event) {
const reconciled = event.type === "response.completed"
? yield* Effect.reduce(event.response?.output ?? [], () => [state, NO_EVENTS], ([current, events], item) => {
if (item.type !== "function_call" || !item.id || !current.tools[item.id])
return Effect.succeed([current, events]);
return onOutputItemDone(current, { type: "response.output_item.done", item }).pipe(Effect.map(([next, emitted]) => [next, [...events, ...emitted]]));
})
: [state, NO_EVENTS];
const current = reconciled[0];
// Some compatible providers omit output_item.done even after completing the response.
const pending = event.type === "response.completed"
? yield* ToolStream.finishAll(state.id, state.tools)
: { tools: state.tools, events: NO_EVENTS };
const events = [...pending.events];
? yield* ToolStream.finishAll(current.id, current.tools)
: { tools: current.tools, events: NO_EVENTS };
const events = [...reconciled[1], ...pending.events];
const hasFunctionCall = pending.events.some((event) => LLMEvent.is.toolCall(event) || LLMEvent.is.toolInputError(event)) ||
state.hasFunctionCall;
const lifecycle = Lifecycle.finish(state.lifecycle, events, {
current.hasFunctionCall;
const lifecycle = Lifecycle.finish(current.lifecycle, events, {
reason: {

@@ -872,5 +881,5 @@ normalized: mapFinishReason(event, hasFunctionCall),

},
usage: mapUsage(event.response?.usage, state.providerMetadataKey),
usage: mapUsage(event.response?.usage, current.providerMetadataKey),
providerMetadata: event.response?.id || event.response?.service_tier
? providerMetadata(state, {
? providerMetadata(current, {
responseId: event.response.id,

@@ -881,3 +890,3 @@ serviceTier: event.response.service_tier,

});
return [{ ...state, lifecycle, hasFunctionCall, tools: pending.tools }, events];
return [{ ...current, lifecycle, hasFunctionCall, tools: pending.tools }, events];
});

@@ -884,0 +893,0 @@ // Build the prettiest summary available from whatever the provider supplied.

@@ -289,2 +289,11 @@ import { Schema } from "effect";

readonly id?: string | undefined;
readonly output?: readonly {
readonly [x: string]: unknown;
readonly type: string;
readonly id?: string | undefined;
readonly name?: string | undefined;
readonly arguments?: string | undefined;
readonly encrypted_content?: string | null | undefined;
readonly call_id?: string | undefined;
}[] | undefined;
readonly error?: {

@@ -291,0 +300,0 @@ readonly type?: string | null | undefined;

@@ -146,2 +146,11 @@ import { Protocol } from "../route/protocol.js";

readonly id?: string | undefined;
readonly output?: readonly {
readonly [x: string]: unknown;
readonly type: string;
readonly id?: string | undefined;
readonly name?: string | undefined;
readonly arguments?: string | undefined;
readonly encrypted_content?: string | null | undefined;
readonly call_id?: string | undefined;
}[] | undefined;
readonly error?: {

@@ -148,0 +157,0 @@ readonly type?: string | null | undefined;

{
"$schema": "https://json.schemastore.org/package.json",
"version": "0.0.0-dev-18192",
"version": "0.0.0-dev-18193",
"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-18192",
"@opencode-ai/http-recorder": "0.0.0-dev-18193",
"@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-18192",
"@opencode-ai/schema": "0.0.0-dev-18193",
"aws4fetch": "1.0.20",

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