billion-context 0.1.73-pr.475.291 → 0.1.73

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
@@ -50217,6 +50217,12 @@ ${body.slice(0, 4e3)}...`;
50217
50217
  ${body}`;
50218
50218
  }
50219
50219
 
50220
+ // src/sse-util.ts
50221
+ function normalizeSseLineEndings(buf) {
50222
+ if (buf.indexOf("\r") === -1) return buf;
50223
+ return buf.replace(/\r\n|\r/g, "\n");
50224
+ }
50225
+
50220
50226
  // src/loop/tag-echo-filter.ts
50221
50227
  var PAIRED = /\x3cacp\s[^<>]{0,256}>([^<>]{0,64})<\/acp>/;
50222
50228
  var LONE_OPEN = /\x3cacp(?:\s[^<>]{0,256})?>/;
@@ -53377,11 +53383,6 @@ function rewriteResponsesJsonResponse(body, ctx) {
53377
53383
  if (!body || typeof body !== "object") return body;
53378
53384
  const b2 = body;
53379
53385
  if (!Array.isArray(b2.output)) return body;
53380
- const probe = JSON.stringify(b2.output);
53381
- if (containsRenderTagText(probe)) {
53382
- ctx.log(`[warn: tag echo] non-stream responses output contains <acp tag: ${probe.slice(0, 120).replace(/\n/g, " ")}`);
53383
- stripResponsesText(b2);
53384
- }
53385
53386
  let converted = false;
53386
53387
  let sawReal = false;
53387
53388
  const noteParts = [];
@@ -53943,14 +53944,6 @@ function buildStatusPanel(input) {
53943
53944
  import { fileURLToPath as fileURLToPath2 } from "url";
53944
53945
  import fs4 from "fs";
53945
53946
  import path8 from "path";
53946
-
53947
- // src/sse-util.ts
53948
- function normalizeSseLineEndings(buf) {
53949
- if (buf.indexOf("\r") === -1) return buf;
53950
- return buf.replace(/\r\n|\r/g, "\n");
53951
- }
53952
-
53953
- // src/plugin.ts
53954
53947
  var PROXY_VERSION = (() => {
53955
53948
  try {
53956
53949
  const here = fileURLToPath2(import.meta.url);
@@ -54610,7 +54603,7 @@ async function pipePluginJson(stream2, res, session, protocol) {
54610
54603
  try {
54611
54604
  const json = JSON.parse(text);
54612
54605
  const usage = json["usage"];
54613
- if (session && usage) {
54606
+ if (usage) {
54614
54607
  const input = num2(usage["prompt_tokens"]) ?? num2(usage["input_tokens"]);
54615
54608
  if (input !== void 0) {
54616
54609
  applyUsageSample(session, {
@@ -57625,12 +57618,7 @@ ${hdrText}
57625
57618
  if (prepared && prepared.resetAfterSuccess) {
57626
57619
  const [toClient, toObserve] = responseBody.tee();
57627
57620
  const observed = observeResponsesTerminalState(toObserve, prepared.stream);
57628
- const tagLog = (msg) => log2("info", `[${prepared.session.id}] ${msg}`);
57629
- if ((upstream.headers.get("content-type") ?? "").includes("text/event-stream")) {
57630
- await pipePluginResponsesWithStrip(toClient, res, void 0, tagLog);
57631
- } else {
57632
- await pipeThrough(toClient, res);
57633
- }
57621
+ await pipeThrough(toClient, res);
57634
57622
  clearUpstreamTimer();
57635
57623
  const terminal = await observed;
57636
57624
  if (terminal === "completed") {
@@ -57648,9 +57636,6 @@ ${hdrText}
57648
57636
  await pipePluginChatWithStrip(responseBody, res, p2.protocol, void 0, tagLog);
57649
57637
  }
57650
57638
  clearUpstreamTimer();
57651
- } else if (prepared && (upstream.headers.get("content-type") ?? "").includes("application/json")) {
57652
- await pipePluginJson(upstream.body, res, void 0, prepared.protocol);
57653
- clearUpstreamTimer();
57654
57639
  } else {
57655
57640
  await pipeThrough(responseBody, res);
57656
57641
  clearUpstreamTimer();