@arbidocs/sdk 0.4.10 → 0.4.12

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.
@@ -475,6 +475,12 @@ interface SSEStreamResult {
475
475
  usage: ResponseUsage | null;
476
476
  /** Token budget context snapshot from response.completed. */
477
477
  context: TokenBudgetContext | null;
478
+ /**
479
+ * The server sent the terminal `response.completed` event. A stream that ends without it was cut
480
+ * (proxy, network, server stall): `text` is then at best a partial answer and the stored message
481
+ * may still be `in_progress` — the caller must reconcile it, never present it as a finished answer.
482
+ */
483
+ completed: boolean;
478
484
  }
479
485
  /**
480
486
  * Stream SSE events from a Response, invoking callbacks as events arrive.
@@ -475,6 +475,12 @@ interface SSEStreamResult {
475
475
  usage: ResponseUsage | null;
476
476
  /** Token budget context snapshot from response.completed. */
477
477
  context: TokenBudgetContext | null;
478
+ /**
479
+ * The server sent the terminal `response.completed` event. A stream that ends without it was cut
480
+ * (proxy, network, server stall): `text` is then at best a partial answer and the stored message
481
+ * may still be `in_progress` — the caller must reconcile it, never present it as a finished answer.
482
+ */
483
+ completed: boolean;
478
484
  }
479
485
  /**
480
486
  * Stream SSE events from a Response, invoking callbacks as events arrive.
package/dist/browser.cjs CHANGED
@@ -3902,6 +3902,7 @@ async function streamSSE(response, callbacks = {}) {
3902
3902
  let metadata = null;
3903
3903
  let usage = null;
3904
3904
  let context = null;
3905
+ let completed = false;
3905
3906
  const eventHandlers = {
3906
3907
  // OpenAI Responses API events (dot-separated names from server)
3907
3908
  "response.created": (raw) => {
@@ -3952,6 +3953,7 @@ async function streamSSE(response, callbacks = {}) {
3952
3953
  },
3953
3954
  "response.completed": (raw) => {
3954
3955
  const data = JSON.parse(raw);
3956
+ completed = true;
3955
3957
  if (data.response?.usage) {
3956
3958
  usage = data.response.usage;
3957
3959
  callbacks.onUsage?.(data.response.usage);
@@ -4065,7 +4067,8 @@ async function streamSSE(response, callbacks = {}) {
4065
4067
  metadata,
4066
4068
  artifacts,
4067
4069
  usage,
4068
- context
4070
+ context,
4071
+ completed
4069
4072
  };
4070
4073
  }
4071
4074
  var consumeSSEStream = streamSSE;