@opencode-ai/ai 0.0.0-dev-18192 → 0.0.0-dev-18195
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.
|
@@ -133,7 +133,12 @@ export const driver = (input) => {
|
|
|
133
133
|
...observation,
|
|
134
134
|
checkpoint: {
|
|
135
135
|
protocol: PROTOCOL,
|
|
136
|
-
value: {
|
|
136
|
+
value: {
|
|
137
|
+
version: VERSION,
|
|
138
|
+
responseID,
|
|
139
|
+
request,
|
|
140
|
+
output: event.response?.output ? [...event.response.output] : output.slice(),
|
|
141
|
+
},
|
|
137
142
|
},
|
|
138
143
|
};
|
|
139
144
|
}),
|
|
@@ -402,6 +402,14 @@ export declare const Event: Schema.StructWithRest<Schema.Struct<{
|
|
|
402
402
|
readonly incomplete_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
403
403
|
readonly reason: Schema.optional<Schema.String>;
|
|
404
404
|
}>>>;
|
|
405
|
+
readonly output: Schema.optional<Schema.$Array<Schema.StructWithRest<Schema.Struct<{
|
|
406
|
+
readonly type: Schema.String;
|
|
407
|
+
readonly id: Schema.optional<Schema.String>;
|
|
408
|
+
readonly call_id: Schema.optional<Schema.String>;
|
|
409
|
+
readonly name: Schema.optional<Schema.String>;
|
|
410
|
+
readonly arguments: Schema.optional<Schema.String>;
|
|
411
|
+
readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
412
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
|
|
405
413
|
readonly usage: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
406
414
|
readonly input_tokens: Schema.optional<Schema.Number>;
|
|
407
415
|
readonly input_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
@@ -656,7 +664,7 @@ export declare const terminal: (event: Event) => boolean;
|
|
|
656
664
|
export declare const onReasoningDelta: (state: ParserState, event: Event, itemID: string) => StepResult;
|
|
657
665
|
export declare const onReasoningDone: (state: ParserState, event: Event, itemID: string) => StepResult;
|
|
658
666
|
export declare const providerFailure: (id: string, event: Event, fallback: string) => AIError;
|
|
659
|
-
export declare const step: (state: ParserState, event: Event) => AIError | Effect.Effect<
|
|
667
|
+
export declare const step: (state: ParserState, event: Event) => AIError | Effect.Effect<[ParserState, readonly ({
|
|
660
668
|
readonly type: "step-start";
|
|
661
669
|
readonly index: number;
|
|
662
670
|
} | {
|
|
@@ -838,7 +846,7 @@ export declare const step: (state: ParserState, event: Event) => AIError | Effec
|
|
|
838
846
|
};
|
|
839
847
|
} | undefined;
|
|
840
848
|
readonly classification?: "context-overflow" | "payload-too-large" | undefined;
|
|
841
|
-
})[]], AIError, never>;
|
|
849
|
+
})[]], AIError, never> | Effect.Effect<StepResult, never, never>;
|
|
842
850
|
/**
|
|
843
851
|
* The provider-neutral Open Responses protocol. Provider-specific Responses
|
|
844
852
|
* implementations compose this baseline with their own tools and event variants.
|
|
@@ -987,6 +995,15 @@ export declare const protocol: Protocol<{
|
|
|
987
995
|
readonly response?: {
|
|
988
996
|
readonly [x: string]: unknown;
|
|
989
997
|
readonly id?: string | undefined;
|
|
998
|
+
readonly output?: readonly {
|
|
999
|
+
readonly [x: string]: unknown;
|
|
1000
|
+
readonly type: string;
|
|
1001
|
+
readonly id?: string | undefined;
|
|
1002
|
+
readonly name?: string | undefined;
|
|
1003
|
+
readonly arguments?: string | undefined;
|
|
1004
|
+
readonly encrypted_content?: string | null | undefined;
|
|
1005
|
+
readonly call_id?: string | undefined;
|
|
1006
|
+
}[] | undefined;
|
|
990
1007
|
readonly error?: {
|
|
991
1008
|
readonly type?: string | null | undefined;
|
|
992
1009
|
readonly code?: string | null | undefined;
|
|
@@ -213,6 +213,7 @@ export const Event = Schema.StructWithRest(Schema.Struct({
|
|
|
213
213
|
id: Schema.optional(Schema.String),
|
|
214
214
|
service_tier: optionalNull(Schema.String),
|
|
215
215
|
incomplete_details: optionalNull(Schema.Struct({ reason: Schema.optional(Schema.String) })),
|
|
216
|
+
output: Schema.optional(Schema.Array(StreamItem)),
|
|
216
217
|
usage: optionalNull(OpenResponsesUsage),
|
|
217
218
|
error: optionalNull(OpenResponsesErrorPayload),
|
|
218
219
|
}), [Schema.Record(Schema.String, Schema.Unknown)])),
|
|
@@ -855,27 +856,35 @@ const onOutputItemDone = Effect.fn("OpenResponses.onOutputItemDone")(function* (
|
|
|
855
856
|
return [state, NO_EVENTS];
|
|
856
857
|
});
|
|
857
858
|
const onResponseFinish = Effect.fn("OpenResponses.onResponseFinish")(function* (state, event) {
|
|
859
|
+
const reconciled = event.type === "response.completed"
|
|
860
|
+
? yield* Effect.reduce(event.response?.output ?? [], () => [state, NO_EVENTS], ([current, events], item) => {
|
|
861
|
+
if (item.type !== "function_call" || !item.id || !current.tools[item.id])
|
|
862
|
+
return Effect.succeed([current, events]);
|
|
863
|
+
return onOutputItemDone(current, { type: "response.output_item.done", item }).pipe(Effect.map(([next, emitted]) => [next, [...events, ...emitted]]));
|
|
864
|
+
})
|
|
865
|
+
: [state, NO_EVENTS];
|
|
866
|
+
const current = reconciled[0];
|
|
858
867
|
// Some compatible providers omit output_item.done even after completing the response.
|
|
859
868
|
const pending = event.type === "response.completed"
|
|
860
|
-
? yield* ToolStream.finishAll(
|
|
861
|
-
: { tools:
|
|
862
|
-
const events = [...pending.events];
|
|
869
|
+
? yield* ToolStream.finishAll(current.id, current.tools)
|
|
870
|
+
: { tools: current.tools, events: NO_EVENTS };
|
|
871
|
+
const events = [...reconciled[1], ...pending.events];
|
|
863
872
|
const hasFunctionCall = pending.events.some((event) => LLMEvent.is.toolCall(event) || LLMEvent.is.toolInputError(event)) ||
|
|
864
|
-
|
|
865
|
-
const lifecycle = Lifecycle.finish(
|
|
873
|
+
current.hasFunctionCall;
|
|
874
|
+
const lifecycle = Lifecycle.finish(current.lifecycle, events, {
|
|
866
875
|
reason: {
|
|
867
876
|
normalized: mapFinishReason(event, hasFunctionCall),
|
|
868
877
|
raw: event.response?.incomplete_details?.reason,
|
|
869
878
|
},
|
|
870
|
-
usage: mapUsage(event.response?.usage,
|
|
879
|
+
usage: mapUsage(event.response?.usage, current.providerMetadataKey),
|
|
871
880
|
providerMetadata: event.response?.id || event.response?.service_tier
|
|
872
|
-
? providerMetadata(
|
|
881
|
+
? providerMetadata(current, {
|
|
873
882
|
responseId: event.response.id,
|
|
874
883
|
serviceTier: event.response.service_tier,
|
|
875
884
|
})
|
|
876
885
|
: undefined,
|
|
877
886
|
});
|
|
878
|
-
return [{ ...
|
|
887
|
+
return [{ ...current, lifecycle, hasFunctionCall, tools: pending.tools }, events];
|
|
879
888
|
});
|
|
880
889
|
// Build the prettiest summary available from whatever the provider supplied.
|
|
881
890
|
// When both code and message are present, prefix the code so consumers see
|
|
@@ -286,6 +286,15 @@ export declare const protocol: Protocol<{
|
|
|
286
286
|
readonly response?: {
|
|
287
287
|
readonly [x: string]: unknown;
|
|
288
288
|
readonly id?: string | undefined;
|
|
289
|
+
readonly output?: readonly {
|
|
290
|
+
readonly [x: string]: unknown;
|
|
291
|
+
readonly type: string;
|
|
292
|
+
readonly id?: string | undefined;
|
|
293
|
+
readonly name?: string | undefined;
|
|
294
|
+
readonly arguments?: string | undefined;
|
|
295
|
+
readonly encrypted_content?: string | null | undefined;
|
|
296
|
+
readonly call_id?: string | undefined;
|
|
297
|
+
}[] | undefined;
|
|
289
298
|
readonly error?: {
|
|
290
299
|
readonly type?: string | null | undefined;
|
|
291
300
|
readonly code?: string | null | undefined;
|
|
@@ -143,6 +143,15 @@ export declare const protocol: Protocol<{
|
|
|
143
143
|
readonly response?: {
|
|
144
144
|
readonly [x: string]: unknown;
|
|
145
145
|
readonly id?: string | undefined;
|
|
146
|
+
readonly output?: readonly {
|
|
147
|
+
readonly [x: string]: unknown;
|
|
148
|
+
readonly type: string;
|
|
149
|
+
readonly id?: string | undefined;
|
|
150
|
+
readonly name?: string | undefined;
|
|
151
|
+
readonly arguments?: string | undefined;
|
|
152
|
+
readonly encrypted_content?: string | null | undefined;
|
|
153
|
+
readonly call_id?: string | undefined;
|
|
154
|
+
}[] | undefined;
|
|
146
155
|
readonly error?: {
|
|
147
156
|
readonly type?: string | null | undefined;
|
|
148
157
|
readonly code?: string | null | undefined;
|
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-18195",
|
|
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-18195",
|
|
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-18195",
|
|
43
43
|
"aws4fetch": "1.0.20",
|
|
44
44
|
"effect": "4.0.0-rc.111",
|
|
45
45
|
"google-auth-library": "10.5.0"
|