billion-context 0.1.106-pr.722.560 → 0.1.106

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
@@ -55868,46 +55868,6 @@ data: ${JSON.stringify({ type: "message_stop" })}
55868
55868
  }
55869
55869
  }
55870
55870
  }
55871
- function emitUpstreamTruncation(res, protocol, finished, log2) {
55872
- const message = "upstream stream ended before a completion event; this turn may be incomplete";
55873
- log2?.(`[acp-proxy: upstream stream truncated (${protocol})${finished ? " \u2014 finish reason seen, synthesizing missing terminal byte" : " \u2014 emitting in-band error"}]`);
55874
- try {
55875
- if (protocol === "openai") {
55876
- if (finished) {
55877
- safeWrite(res, "data: [DONE]\n\n");
55878
- } else {
55879
- safeWrite(res, `data: ${JSON.stringify({ error: { type: "server_error", code: "upstream_stream_truncated", message } })}
55880
-
55881
- data: [DONE]
55882
-
55883
- `);
55884
- }
55885
- } else if (protocol === "responses") {
55886
- safeWrite(res, `event: error
55887
- data: ${JSON.stringify({ type: "error", code: "upstream_stream_truncated", message })}
55888
-
55889
- `);
55890
- } else {
55891
- if (finished) {
55892
- safeWrite(res, `event: message_stop
55893
- data: ${JSON.stringify({ type: "message_stop" })}
55894
-
55895
- `);
55896
- } else {
55897
- safeWrite(res, `event: error
55898
- data: ${JSON.stringify({ type: "error", error: { type: "server_error", code: "upstream_stream_truncated", message } })}
55899
-
55900
- `);
55901
- }
55902
- }
55903
- } catch {
55904
- } finally {
55905
- try {
55906
- res.end();
55907
- } catch {
55908
- }
55909
- }
55910
- }
55911
55871
  function emitPreflightError(res, protocol, error, log2) {
55912
55872
  const err2 = { type: "server_error", code: "preflight_compress_failed", message: error.message, retryable: error.retryable };
55913
55873
  log2?.(`[acp-proxy: preflight failed after early response commit \u2014 delivering in-band: ${error.message}]`);
@@ -57053,17 +57013,12 @@ data: ${JSON.stringify({ type: "content_block_delta", index, delta: { type: delt
57053
57013
  }
57054
57014
  if (res.destroyed || res.writableEnded) break;
57055
57015
  }
57056
- const truncated = !sawTerminal && !res.destroyed && !res.writableEnded;
57057
- if (!truncated && buf.length > 0 && !res.destroyed && !res.writableEnded) await write(buf);
57016
+ if (buf.length > 0 && !res.destroyed && !res.writableEnded) await write(buf);
57058
57017
  const rest = flushTails();
57059
57018
  if (rest.length > 0 && !res.destroyed && !res.writableEnded) await write(rest);
57060
57019
  settleUsage();
57061
57020
  maybeNoteTruncated();
57062
57021
  maybeWarnDegenerate();
57063
- if (truncated) {
57064
- emitUpstreamTruncation(res, protocol, finalFinishReason !== void 0, log2);
57065
- return;
57066
- }
57067
57022
  } catch (e) {
57068
57023
  settleUsage();
57069
57024
  maybeNoteTruncated();
@@ -57071,14 +57026,7 @@ data: ${JSON.stringify({ type: "content_block_delta", index, delta: { type: delt
57071
57026
  log2?.("client aborted mid-stream");
57072
57027
  return;
57073
57028
  }
57074
- try {
57075
- const rest = flushTails();
57076
- if (rest.length > 0) await write(rest);
57077
- } catch {
57078
- }
57079
- log("warn", `[plugin] upstream stream read failed (${protocol}): ${String(e instanceof Error ? e.message : e)} \u2014 emitting in-band truncation signal`);
57080
- emitUpstreamTruncation(res, protocol, finalFinishReason !== void 0, log2);
57081
- return;
57029
+ throw e;
57082
57030
  } finally {
57083
57031
  reader.releaseLock();
57084
57032
  res.end();
@@ -57236,10 +57184,6 @@ async function pipePluginResponsesWithStrip(stream2, res, session, log2) {
57236
57184
  maybeWarnDegenerate();
57237
57185
  settleUsage();
57238
57186
  maybeNoteTruncated();
57239
- if (!sawTerminal && !res.destroyed && !res.writableEnded) {
57240
- emitUpstreamTruncation(res, "responses", false, log2);
57241
- return;
57242
- }
57243
57187
  } catch (e) {
57244
57188
  settleUsage();
57245
57189
  maybeNoteTruncated();
@@ -57247,14 +57191,7 @@ async function pipePluginResponsesWithStrip(stream2, res, session, log2) {
57247
57191
  log2?.("client aborted mid-stream");
57248
57192
  return;
57249
57193
  }
57250
- try {
57251
- const rest = flushTail("");
57252
- if (rest.length > 0) await write(rest);
57253
- } catch {
57254
- }
57255
- log("warn", `[plugin] upstream stream read failed (responses): ${String(e instanceof Error ? e.message : e)} \u2014 emitting in-band truncation signal`);
57256
- emitUpstreamTruncation(res, "responses", false, log2);
57257
- return;
57194
+ throw e;
57258
57195
  } finally {
57259
57196
  reader.releaseLock();
57260
57197
  res.end();