@opencode-ai/ai 0.0.0-next-16794 → 0.0.0-next-16797

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.
@@ -339,7 +339,6 @@ export interface ParserState {
339
339
  readonly providerMetadataKey: string;
340
340
  readonly tools: ToolStream.State<string>;
341
341
  readonly hasFunctionCall: boolean;
342
- readonly hasFunctionCallError: boolean;
343
342
  readonly lifecycle: Lifecycle.State;
344
343
  readonly messageItems: ReadonlySet<string>;
345
344
  readonly messagePhase: (value: unknown) => MessagePhase | null | undefined;
@@ -447,14 +447,8 @@ const mapUsage = (usage, providerMetadataKey) => {
447
447
  providerMetadata: { [providerMetadataKey]: usage },
448
448
  });
449
449
  };
450
- const mapFinishReason = (event, hasFunctionCall, hasFunctionCallError) => {
450
+ const mapFinishReason = (event, hasFunctionCall) => {
451
451
  const reason = event.response?.incomplete_details?.reason;
452
- if (reason === "max_output_tokens")
453
- return "length";
454
- if (reason === "content_filter")
455
- return "content-filter";
456
- if (hasFunctionCallError)
457
- return "error";
458
452
  if (reason === undefined || reason === null) {
459
453
  if (hasFunctionCall)
460
454
  return "tool-calls";
@@ -462,6 +456,10 @@ const mapFinishReason = (event, hasFunctionCall, hasFunctionCallError) => {
462
456
  return "unknown";
463
457
  return "stop";
464
458
  }
459
+ if (reason === "max_output_tokens")
460
+ return "length";
461
+ if (reason === "content_filter")
462
+ return "content-filter";
465
463
  return hasFunctionCall ? "tool-calls" : "unknown";
466
464
  };
467
465
  export const providerMetadata = (state, metadata) => ({
@@ -687,8 +685,8 @@ const onOutputItemDone = Effect.fn("OpenResponses.onOutputItemDone")(function* (
687
685
  {
688
686
  ...state,
689
687
  lifecycle,
690
- hasFunctionCall: resultEvents.some(LLMEvent.is.toolCall) || state.hasFunctionCall,
691
- hasFunctionCallError: resultEvents.some(LLMEvent.is.toolInputError) || state.hasFunctionCallError,
688
+ hasFunctionCall: resultEvents.some((event) => LLMEvent.is.toolCall(event) || LLMEvent.is.toolInputError(event)) ||
689
+ state.hasFunctionCall,
692
690
  tools: result.tools,
693
691
  },
694
692
  events,
@@ -722,7 +720,7 @@ const onResponseFinish = (state, event) => {
722
720
  const events = [];
723
721
  const lifecycle = Lifecycle.finish(state.lifecycle, events, {
724
722
  reason: {
725
- normalized: mapFinishReason(event, state.hasFunctionCall, state.hasFunctionCallError),
723
+ normalized: mapFinishReason(event, state.hasFunctionCall),
726
724
  raw: event.response?.incomplete_details?.reason,
727
725
  },
728
726
  usage: mapUsage(event.response?.usage, state.providerMetadataKey),
@@ -815,7 +813,6 @@ export const initial = (request, extension = BASE) => ({
815
813
  name: extension.name,
816
814
  providerMetadataKey: request.model.route.providerMetadataKey ?? "openresponses",
817
815
  hasFunctionCall: false,
818
- hasFunctionCallError: false,
819
816
  tools: ToolStream.empty(),
820
817
  lifecycle: Lifecycle.initial(),
821
818
  messageItems: new Set(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "0.0.0-next-16794",
3
+ "version": "0.0.0-next-16797",
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-beta.101",
33
- "@opencode-ai/http-recorder": "0.0.0-next-16794",
33
+ "@opencode-ai/http-recorder": "0.0.0-next-16797",
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-next-16794",
42
+ "@opencode-ai/schema": "0.0.0-next-16797",
43
43
  "aws4fetch": "1.0.20",
44
44
  "effect": "4.0.0-beta.101",
45
45
  "google-auth-library": "10.5.0"