@jeffusion/bungee-core 6.2.0 → 6.3.0

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.
@@ -17457,6 +17457,16 @@ var LLM_TPS_SAMPLES = {
17457
17457
  }
17458
17458
  };
17459
17459
 
17460
+ // src/migrations/llm-tps-model.ts
17461
+ var LLM_TPS_MODEL = {
17462
+ version: "003",
17463
+ name: "llm_tps_model",
17464
+ up(db) {
17465
+ db.run(`ALTER TABLE llm_tps_samples ADD COLUMN model TEXT
17466
+ CHECK (model IS NULL OR (typeof(model) = 'text' AND length(trim(model)) > 0))`);
17467
+ }
17468
+ };
17469
+
17460
17470
  // src/migrations/schema.ts
17461
17471
  var ACCESS_SCHEMA_STATEMENTS = [
17462
17472
  `CREATE TABLE access_logs (
@@ -18051,7 +18061,7 @@ class MigrationManager {
18051
18061
  }
18052
18062
 
18053
18063
  // src/migrations/index.ts
18054
- var migrations = [ACCESS_BASELINE, LLM_TPS_SAMPLES];
18064
+ var migrations = [ACCESS_BASELINE, LLM_TPS_SAMPLES, LLM_TPS_MODEL];
18055
18065
 
18056
18066
  // src/master-runtime/observability-worker.ts
18057
18067
  function headerEntries(headers) {
@@ -5915,7 +5915,7 @@ async function relayPayload(result, param, signal) {
5915
5915
  const contentType = result.bodyHandle.identity.contentType;
5916
5916
  if (contentType === "" || contentType.includes("text/event-stream") || contentType.includes("application/octet-stream")) {
5917
5917
  const iterator = result.bodyHandle.events({ id: "llm-adapter.relay", mandatory: true, signal })[Symbol.asyncIterator]();
5918
- let call, callIndex, args = "", argumentBytes = 0, argumentsDone, outputDone = false, terminal = false, done = false;
5918
+ let call, callIndex, args = "", argumentBytes = 0, sawArgumentDelta = false, argumentsDone, outputDone = false, terminal = false, done = false;
5919
5919
  const reasoning = new Map;
5920
5920
  let reasoningBytes = 0;
5921
5921
  const reasoningEvents = new Set(["response.reasoning_summary_part.added", "response.reasoning_summary_part.done", "response.reasoning_summary_text.delta", "response.reasoning_summary_text.done", "response.reasoning_text.delta", "response.reasoning_text.done"]);
@@ -5949,6 +5949,8 @@ async function relayPayload(result, param, signal) {
5949
5949
  if (event.type === "response.created" || event.type === "response.in_progress") {
5950
5950
  if (event.response?.error || ["failed", "incomplete", "cancelled"].includes(event.response?.status))
5951
5951
  invalid(param);
5952
+ } else if (event.type === "response.metadata") {
5953
+ continue;
5952
5954
  } else if (event.type === "response.output_item.added") {
5953
5955
  if (!Number.isSafeInteger(event.output_index) || event.output_index < 0 || event.output_index >= 128 || event.output_index === callIndex || reasoning.has(event.output_index) || typeof event.item?.id !== "string")
5954
5956
  invalid(param);
@@ -5970,10 +5972,12 @@ async function relayPayload(result, param, signal) {
5970
5972
  argumentBytes += Buffer.byteLength(event.delta);
5971
5973
  if (argumentBytes > result.bodyHandle.maxBytes)
5972
5974
  invalid(param);
5975
+ sawArgumentDelta = true;
5973
5976
  args += event.delta;
5974
5977
  } else if (event.type === "response.function_call_arguments.done") {
5975
- if (!call || argumentsDone !== undefined || event.item_id !== call.id || event.output_index !== callIndex || event.arguments !== args)
5978
+ if (!call || argumentsDone !== undefined || event.item_id !== call.id || event.output_index !== callIndex || typeof event.arguments !== "string" || sawArgumentDelta && event.arguments !== args || Buffer.byteLength(event.arguments) > result.bodyHandle.maxBytes)
5976
5979
  invalid(param);
5980
+ args = event.arguments;
5977
5981
  argumentsDone = args;
5978
5982
  } else if (event.type === "response.output_item.done") {
5979
5983
  const thought = reasoning.get(event.output_index);
@@ -6465,4 +6469,4 @@ export {
6465
6469
  control_default as default
6466
6470
  };
6467
6471
 
6468
- //# debugId=9CFEB78BC44DC26B64756E2164756E21
6472
+ //# debugId=53F531283A2005E364756E2164756E21