billion-context 0.1.69-pr.444.270 → 0.1.69

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.
package/dist/index.js CHANGED
@@ -51995,20 +51995,6 @@ function createResponsesAdapter(textProtocol, projection) {
51995
51995
  let responseObj = null;
51996
51996
  let terminalRaw = null;
51997
51997
  let terminalKind = null;
51998
- let createdForwarded = false;
51999
- let createdRespId = null;
52000
- const ensureCreated = () => {
52001
- if (createdForwarded) return null;
52002
- createdForwarded = true;
52003
- if (!createdRespId) createdRespId = `resp-proxy-${Date.now()}`;
52004
- return Buffer.from(
52005
- `event: response.created
52006
- data: ${JSON.stringify({ type: "response.created", response: { id: createdRespId, status: "in_progress", output: [] } })}
52007
-
52008
- `,
52009
- "utf8"
52010
- );
52011
- };
52012
51998
  return {
52013
51999
  buildRequest(coreMessages, systemPrompt, requestBody) {
52014
52000
  const customToolCallIds = /* @__PURE__ */ new Set();
@@ -52063,11 +52049,6 @@ data: ${JSON.stringify({ type: "response.created", response: { id: createdRespId
52063
52049
  outputIndex = Math.max(outputIndex, obj.output_index + 1);
52064
52050
  }
52065
52051
  if (type === "response.created" || type === "response.in_progress") {
52066
- if (type === "response.created") {
52067
- const resp = obj.response;
52068
- if (resp && typeof resp.id === "string") createdRespId = resp.id;
52069
- if (round === 1) createdForwarded = true;
52070
- }
52071
52052
  yield { kind: "meta", chunk: rawBuf, firstRoundOnly: true };
52072
52053
  } else if (type === "response.output_item.added") {
52073
52054
  const item = obj.item;
@@ -52224,22 +52205,18 @@ data: ${JSON.stringify({ type: "response.created", response: { id: createdRespId
52224
52205
  return terminalRaw;
52225
52206
  }
52226
52207
  if (!responseObj && opts?.finishReason === "failed") {
52227
- const parts = [];
52228
- const created = ensureCreated();
52229
- if (created) parts.push(created);
52230
52208
  const failed = {
52231
- id: createdRespId ?? `resp-error-${Date.now()}`,
52209
+ id: `resp-error-${Date.now()}`,
52232
52210
  status: "failed",
52233
52211
  error: { code: "server_error", message: "upstream returned no response" }
52234
52212
  };
52235
- parts.push(Buffer.from(
52213
+ return Buffer.from(
52236
52214
  `event: response.failed
52237
52215
  data: ${JSON.stringify({ type: "response.failed", response: failed })}
52238
52216
 
52239
52217
  `,
52240
52218
  "utf8"
52241
- ));
52242
- return Buffer.concat(parts);
52219
+ );
52243
52220
  }
52244
52221
  let resp = responseObj ? { ...responseObj } : { id: `resp-proxy-${Date.now()}`, status: "completed", output: [] };
52245
52222
  if (opts?.usage) {
@@ -52259,22 +52236,18 @@ data: ${JSON.stringify({ type: "response.failed", response: failed })}
52259
52236
  return buildCompleted(resp);
52260
52237
  },
52261
52238
  emitError(message) {
52262
- const parts = [];
52263
- const created = ensureCreated();
52264
- if (created) parts.push(created);
52265
52239
  const resp = {
52266
- id: createdRespId ?? `resp-error-${Date.now()}`,
52240
+ id: `resp-error-${Date.now()}`,
52267
52241
  status: "failed",
52268
52242
  error: { code: "server_error", message }
52269
52243
  };
52270
- parts.push(Buffer.from(
52244
+ return Buffer.from(
52271
52245
  `event: response.failed
52272
52246
  data: ${JSON.stringify({ type: "response.failed", response: resp })}
52273
52247
 
52274
52248
  `,
52275
52249
  "utf8"
52276
- ));
52277
- return Buffer.concat(parts);
52250
+ );
52278
52251
  },
52279
52252
  extractTextTriggers(text) {
52280
52253
  const calls = [];