@providerprotocol/ai 0.0.31 → 0.0.32

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.
@@ -1,5 +1,5 @@
1
- import { X as Message, ad as MessageJSON, a6 as Turn, aX as TurnJSON, ae as StreamEvent, aP as ImageStreamResult, aU as ImageProviderStreamResult, aN as ImageResult, ag as StreamResult, f as Image, J as JSONSchema, N as ToolMetadata, aB as EmbeddingInput, G as Tool, P as Provider, M as ModelReference } from '../llm-DgDEy9il.js';
2
- import { d as EmbeddingResult } from '../embedding-k7g-BcSY.js';
1
+ import { _ as Message, ag as MessageJSON, a9 as Turn, b4 as TurnJSON, S as StreamEvent, aT as ImageStreamResult, aY as ImageProviderStreamResult, aR as ImageResult, ah as StreamResult, h as Image, J as JSONSchema, Q as ToolMetadata, aF as EmbeddingInput, K as Tool, P as Provider, M as ModelReference } from '../llm-BQJZj3cD.js';
2
+ import { d as EmbeddingResult } from '../embedding-D2BYIehX.js';
3
3
 
4
4
  /**
5
5
  * @fileoverview Proxy provider types.
@@ -90,8 +90,9 @@ function serializeTurn(turn) {
90
90
  };
91
91
  }
92
92
  function serializeStreamEvent(event) {
93
- if (event.delta.data instanceof Uint8Array) {
94
- const { data, ...rest } = event.delta;
93
+ const delta = event.delta;
94
+ if (delta.data instanceof Uint8Array) {
95
+ const { data, ...rest } = delta;
95
96
  const bytes = Array.from(data);
96
97
  const base64 = btoa(bytes.map((b) => String.fromCharCode(b)).join(""));
97
98
  return {
@@ -242,7 +243,8 @@ function createLLMHandler(options) {
242
243
  if ("messages" in parsed && "usage" in parsed && "cycles" in parsed) {
243
244
  resolveResponse(turnJSONToLLMResponse(parsed));
244
245
  } else {
245
- yield deserializeStreamEvent(parsed);
246
+ const event = deserializeStreamEvent(parsed);
247
+ yield event;
246
248
  }
247
249
  } catch {
248
250
  }
@@ -267,7 +269,8 @@ function createLLMHandler(options) {
267
269
  if ("messages" in parsed && "usage" in parsed && "cycles" in parsed) {
268
270
  resolveResponse(turnJSONToLLMResponse(parsed));
269
271
  } else {
270
- yield deserializeStreamEvent(parsed);
272
+ const event = deserializeStreamEvent(parsed);
273
+ yield event;
271
274
  }
272
275
  } catch {
273
276
  }