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

@opencode-ai/ai

Package Overview
Dependencies
Maintainers
2
Versions
1084
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-18204
to
0.0.0-dev-18209
+5
-1
dist/protocols/open-responses.d.ts

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

readonly item_id: Schema.optional<Schema.String>;
readonly output_index: Schema.optional<Schema.Number>;
readonly summary_index: Schema.optional<Schema.Number>;

@@ -465,2 +466,3 @@ readonly item: Schema.optional<Schema.StructWithRest<Schema.Struct<{

readonly lifecycle: Lifecycle.State;
readonly outputItems: Readonly<Record<number, string>>;
readonly messageItems: ReadonlySet<string>;

@@ -666,6 +668,7 @@ readonly messagePhases: Readonly<Record<string, MessagePhase | null>>;

export declare const terminal: (event: Event) => boolean;
export declare const outputItemID: (state: ParserState, event: Event) => string | undefined;
export declare const onReasoningDelta: (state: ParserState, event: Event, itemID: string) => StepResult;
export declare const onReasoningDone: (state: ParserState, event: Event, itemID: string) => StepResult;
export declare const providerFailure: (id: string, event: Event, fallback: string) => AIError;
export declare const step: (state: ParserState, event: Event) => AIError | Effect.Effect<[ParserState, readonly ({
export declare const step: (state: ParserState, input: Event) => AIError | Effect.Effect<[ParserState, readonly ({
readonly type: "step-start";

@@ -1037,2 +1040,3 @@ readonly index: number;

readonly item_id?: string | undefined;
readonly output_index?: number | undefined;
readonly summary_index?: number | undefined;

@@ -1039,0 +1043,0 @@ }, ParserState>;

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

item_id: Schema.optional(Schema.String),
output_index: Schema.optional(Schema.Number),
summary_index: Schema.optional(Schema.Number),

@@ -608,2 +609,3 @@ item: Schema.optional(StreamItem),

};
export const outputItemID = (state, event) => event.output_index === undefined ? event.item_id : (state.outputItems[event.output_index] ?? event.item_id);
export const onReasoningDelta = (state, event, itemID) => {

@@ -933,3 +935,6 @@ const item = state.reasoningItems[itemID];

const providerError = (state, event, fallback) => providerFailure(state.id, event, fallback);
export const step = (state, event) => {
export const step = (state, input) => {
const event = input.item_id && outputItemID(state, input) !== input.item_id
? { ...input, item_id: outputItemID(state, input) }
: input;
if (event.type === "response.output_text.delta" || event.type === "response.output_text.done") {

@@ -973,3 +978,5 @@ if (!event.item_id)

return ProviderShared.eventError(state.id, `${event.type} message is missing id`);
return Effect.succeed(onOutputItemAdded(state, event));
return Effect.succeed(onOutputItemAdded(event.output_index !== undefined && event.item?.id
? { ...state, outputItems: { ...state.outputItems, [event.output_index]: event.item.id } }
: state, event));
}

@@ -1007,2 +1014,3 @@ if (event.type === "response.function_call_arguments.delta" || event.type === "response.function_call_arguments.done")

lifecycle: Lifecycle.initial(),
outputItems: {},
messageItems: new Set(),

@@ -1009,0 +1017,0 @@ messagePhases: {},

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

readonly item_id?: string | undefined;
readonly output_index?: number | undefined;
readonly summary_index?: number | undefined;

@@ -327,0 +328,0 @@ }, OpenResponses.ParserState>;

+1
-1

@@ -142,3 +142,3 @@ import { Effect, Encoding, Schema } from "effect";

return event.item_id
? Effect.succeed(OpenResponses.onReasoningDelta(state, event, event.item_id))
? Effect.succeed(OpenResponses.onReasoningDelta(state, event, OpenResponses.outputItemID(state, event) ?? event.item_id))
: ProviderShared.eventError(ADAPTER, `${event.type} is missing item_id`);

@@ -145,0 +145,0 @@ if (event.type === "response.output_item.done" && event.item && ResponsesHostedTools.isItem(event.item, HOSTED_TOOLS))

@@ -182,4 +182,5 @@ import { Protocol } from "../route/protocol.js";

readonly item_id?: string | undefined;
readonly output_index?: number | undefined;
readonly summary_index?: number | undefined;
}, OpenResponses.ParserState>;
export * as XAIResponses from "./xai-responses.js";
{
"$schema": "https://json.schemastore.org/package.json",
"version": "0.0.0-dev-18204",
"version": "0.0.0-dev-18209",
"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-18204",
"@opencode-ai/http-recorder": "0.0.0-dev-18209",
"@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-18204",
"@opencode-ai/schema": "0.0.0-dev-18209",
"aws4fetch": "1.0.20",

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