@jeffusion/bungee-core 6.16.1 → 6.17.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.
Files changed (37) hide show
  1. package/dist/main.js +5700 -2198
  2. package/dist/observability-worker.js +3245 -1495
  3. package/dist/plugins/anthropic-request-sanitizer/index.js.map +2 -2
  4. package/dist/plugins/anthropic-tool-name-transformer/index.js.map +2 -2
  5. package/dist/plugins/chatgpt-oauth/index.js +37 -15
  6. package/dist/plugins/chatgpt-oauth/index.js.map +5 -5
  7. package/dist/plugins/codex-router/index.js +21 -3
  8. package/dist/plugins/codex-router/index.js.map +5 -5
  9. package/dist/plugins/deepseek-reasoning-fix/index.js.map +2 -2
  10. package/dist/plugins/key-access/index.js +1 -1
  11. package/dist/plugins/key-access/index.js.map +4 -4
  12. package/dist/plugins/key-access/ingress.js +1 -1
  13. package/dist/plugins/key-access/ingress.js.map +3 -3
  14. package/dist/plugins/key-rate-limit/index.js.map +2 -2
  15. package/dist/plugins/llm-protocol-adapter/control.js +1 -1
  16. package/dist/plugins/llm-protocol-adapter/control.js.map +3 -3
  17. package/dist/plugins/llm-protocol-adapter/index.js +1 -1
  18. package/dist/plugins/llm-protocol-adapter/index.js.map +5 -5
  19. package/dist/plugins/llm-tps/index.js.map +2 -2
  20. package/dist/plugins/model-mapping/index.js +1 -1
  21. package/dist/plugins/model-mapping/index.js.map +4 -4
  22. package/dist/plugins/models-dev/index.js.map +2 -2
  23. package/dist/plugins/request-logs/index.js +505 -118
  24. package/dist/plugins/request-logs/index.js.map +11 -10
  25. package/dist/plugins/request-logs/ingress.js +3 -23
  26. package/dist/plugins/request-logs/ingress.js.map +3 -3
  27. package/dist/plugins/request-logs/ui/RequestLogsPage.svelte +215 -130
  28. package/dist/plugins/signature-repair/index.js.map +2 -2
  29. package/dist/plugins/token-budget/index.js.map +2 -2
  30. package/dist/plugins/token-metering/index.js.map +2 -2
  31. package/dist/plugins/token-stats/control.js +257 -61
  32. package/dist/plugins/token-stats/control.js.map +7 -6
  33. package/dist/plugins/token-stats/index.js +271 -127
  34. package/dist/plugins/token-stats/index.js.map +8 -8
  35. package/dist/plugins/token-stats/manifest.json +2 -2
  36. package/dist/plugins/user-auth/index.js.map +2 -2
  37. package/package.json +3 -2
@@ -1418,6 +1418,17 @@ function applyToolAllowlist(body, input, allowlist) {
1418
1418
  }
1419
1419
 
1420
1420
  // plugins/codex-router/server/index.ts
1421
+ function recordHistoryRejection(requestId, branch, reason) {
1422
+ try {
1423
+ console.error(JSON.stringify({
1424
+ event: "codex_router_history_rejected",
1425
+ code: "codex_router_unrestorable_history_start_new_conversation",
1426
+ .../^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(requestId) ? { requestId } : {},
1427
+ branch,
1428
+ reason
1429
+ }));
1430
+ } catch {}
1431
+ }
1421
1432
  var CodexRouterPlugin = definePlugin(class {
1422
1433
  static name = "codex-router";
1423
1434
  static version = "1.0.0";
@@ -1487,8 +1498,11 @@ var CodexRouterPlugin = definePlugin(class {
1487
1498
  if (!Array.isArray(delta))
1488
1499
  throw new DataAdmissionError(422, "codex_router_invalid_history");
1489
1500
  if (protocol === "responses" && prior.items.some((item) => item.encrypted_content || item.type === "compaction")) {
1490
- if (JSON.stringify(prior.target) !== JSON.stringify(binding.target) || prior.origin?.provider !== binding.provider || prior.origin?.model !== binding.model || !prior.origin?.upstreamId)
1501
+ const reason = JSON.stringify(prior.target) !== JSON.stringify(binding.target) ? "target_mismatch" : prior.origin?.provider !== binding.provider ? "provider_mismatch" : prior.origin?.model !== binding.model ? "model_mismatch" : !prior.origin?.upstreamId ? "upstream_missing" : undefined;
1502
+ if (reason) {
1503
+ recordHistoryRejection(context.requestId, "native_history_origin", reason);
1491
1504
  throw new DataAdmissionError(422, "codex_router_unrestorable_history_start_new_conversation");
1505
+ }
1492
1506
  requiredUpstreamId = prior.origin.upstreamId;
1493
1507
  }
1494
1508
  input.input = [...prior.items, ...delta];
@@ -1508,8 +1522,10 @@ var CodexRouterPlugin = definePlugin(class {
1508
1522
  message: "This Chat target cannot restore a native compaction item. Switch back to the original Responses route, or start a new conversation with a readable summary."
1509
1523
  });
1510
1524
  }
1511
- if (protocol !== "responses" && protocol !== "gemini_generate_content" && !allowLossyContinuation && logicalInput.some((item) => item?.encrypted_content || item?.type === "compaction"))
1525
+ if (protocol !== "responses" && protocol !== "gemini_generate_content" && !allowLossyContinuation && logicalInput.some((item) => item?.encrypted_content || item?.type === "compaction")) {
1526
+ recordHistoryRejection(context.requestId, "target_history_protocol", "opaque_history_unsupported");
1512
1527
  throw new DataAdmissionError(422, "codex_router_unrestorable_history_start_new_conversation");
1528
+ }
1513
1529
  const hasTools = input.tools?.length || logicalInput.some((item) => (item?.type === "additional_tools" || item?.type === "tool_search_output") && item.tools?.length);
1514
1530
  if (hasTools && (!capabilities.toolCall || binding.capabilityOverrides?.tools === false))
1515
1531
  throw new DataAdmissionError(422, "codex_router_tools_unsupported");
@@ -1622,6 +1638,7 @@ var CodexRouterPlugin = definePlugin(class {
1622
1638
  headers.delete(key);
1623
1639
  headers.set("content-type", "application/json");
1624
1640
  headers.set("etag", headers.get("etag") ?? record.snapshot.upstreamEtag);
1641
+ context.responseOrigin = "gateway";
1625
1642
  return { ...result, response: new Response(JSON.stringify(record.snapshot.native), { headers }) };
1626
1643
  }
1627
1644
  }
@@ -1638,6 +1655,7 @@ var CodexRouterPlugin = definePlugin(class {
1638
1655
  const merged = await this.catalogResponse(native, response.headers, record, response.status);
1639
1656
  if (record && !record.signal.aborted)
1640
1657
  this.snapshots.put(record.snapshotKey, native, response.headers.get("etag"));
1658
+ context.responseOrigin = "gateway";
1641
1659
  return merged;
1642
1660
  });
1643
1661
  hooks.onFinally.tap("codex-router.catalog-cleanup", (context) => {
@@ -1681,4 +1699,4 @@ export {
1681
1699
  server_default as default
1682
1700
  };
1683
1701
 
1684
- //# debugId=C32BEAD32E6A84D764756E2164756E21
1702
+ //# debugId=1C3BC34B59FC62CB64756E2164756E21