billion-context 0.1.40 → 0.1.41

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
@@ -48841,7 +48841,7 @@ async function* runCompressLoop(upstream, ctx, requestBody, requestOptions, adap
48841
48841
  }
48842
48842
  }
48843
48843
  } else if (ev.kind === "tool_call") {
48844
- calls.push({ name: ev.name, callId: ev.callId, arguments: ev.arguments });
48844
+ calls.push({ name: ev.name, callId: ev.callId, arguments: ev.arguments, passthrough: ev.passthrough });
48845
48845
  } else if (ev.kind === "usage") {
48846
48846
  usage = {
48847
48847
  inputTokens: ev.inputTokens,
@@ -48959,6 +48959,7 @@ async function* runCompressLoop(upstream, ctx, requestBody, requestOptions, adap
48959
48959
  }
48960
48960
  }
48961
48961
  for (const tc of realToolCalls) {
48962
+ if (tc.passthrough) continue;
48962
48963
  yield adapter.emitToolCall(tc);
48963
48964
  }
48964
48965
  const reRequest = proxyResults.length > 0 && realCalls === 0;
@@ -49201,13 +49202,18 @@ function createResponsesAdapter(textProtocol, projection) {
49201
49202
  } else if (type === "response.output_item.added") {
49202
49203
  const item = obj.item;
49203
49204
  if (item?.type === "function_call") {
49204
- const itemId = typeof item.id === "string" ? item.id : "";
49205
- pending.set(itemId, {
49206
- itemId,
49207
- callId: typeof item.call_id === "string" ? item.call_id : "",
49208
- name: typeof item.name === "string" ? item.name : "",
49209
- arguments: ""
49210
- });
49205
+ const fcName = typeof item.name === "string" ? item.name : "";
49206
+ if (PROXY_TOOL_NAMES.has(fcName)) {
49207
+ const itemId = typeof item.id === "string" ? item.id : "";
49208
+ pending.set(itemId, {
49209
+ itemId,
49210
+ callId: typeof item.call_id === "string" ? item.call_id : "",
49211
+ name: fcName,
49212
+ arguments: ""
49213
+ });
49214
+ } else {
49215
+ yield { kind: "meta", chunk: rawBuf, firstRoundOnly: false };
49216
+ }
49211
49217
  } else if (item?.type === "custom_tool_call") {
49212
49218
  yield { kind: "meta", chunk: rawBuf, firstRoundOnly: false };
49213
49219
  } else if (item?.type !== "message" || !suppressTextLifecycle) {
@@ -49227,11 +49233,13 @@ function createResponsesAdapter(textProtocol, projection) {
49227
49233
  const delta = typeof obj.delta === "string" ? obj.delta : "";
49228
49234
  const fc = pending.get(itemId);
49229
49235
  if (fc) fc.arguments += delta;
49236
+ else yield { kind: "meta", chunk: rawBuf, firstRoundOnly: false };
49230
49237
  } else if (type === "response.function_call_arguments.done") {
49231
49238
  const itemId = typeof obj.item_id === "string" ? obj.item_id : "";
49232
49239
  const args = typeof obj.arguments === "string" ? obj.arguments : "";
49233
49240
  const fc = pending.get(itemId);
49234
49241
  if (fc && args) fc.arguments = args;
49242
+ else yield { kind: "meta", chunk: rawBuf, firstRoundOnly: false };
49235
49243
  } else if (type === "response.output_item.done") {
49236
49244
  const item = obj.item;
49237
49245
  if (item?.type === "function_call") {
@@ -49246,6 +49254,15 @@ function createResponsesAdapter(textProtocol, projection) {
49246
49254
  callId: fc.callId,
49247
49255
  arguments: fc.arguments
49248
49256
  };
49257
+ } else {
49258
+ yield { kind: "meta", chunk: rawBuf, firstRoundOnly: false };
49259
+ yield {
49260
+ kind: "tool_call",
49261
+ name: typeof item.name === "string" ? item.name : "",
49262
+ callId: typeof item.call_id === "string" ? item.call_id : "",
49263
+ arguments: typeof item.arguments === "string" ? item.arguments : "",
49264
+ passthrough: true
49265
+ };
49249
49266
  }
49250
49267
  } else if (item?.type === "custom_tool_call") {
49251
49268
  yield { kind: "meta", chunk: rawBuf, firstRoundOnly: false };