@jeffusion/bungee-core 5.22.0 → 5.23.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 (34) hide show
  1. package/dist/main.js +3382 -3104
  2. package/dist/plugins/anthropic-request-sanitizer/index.js.map +2 -2
  3. package/dist/plugins/anthropic-tool-name-transformer/index.js.map +2 -2
  4. package/dist/plugins/chatgpt-oauth/control.js.map +2 -2
  5. package/dist/plugins/chatgpt-oauth/index.js +20 -7
  6. package/dist/plugins/chatgpt-oauth/index.js.map +6 -6
  7. package/dist/plugins/codex-router/index.js +174 -80
  8. package/dist/plugins/codex-router/index.js.map +8 -8
  9. package/dist/plugins/codex-router/manifest.json +63 -12
  10. package/dist/plugins/deepseek-reasoning-fix/index.js.map +2 -2
  11. package/dist/plugins/key-access/control.js.map +3 -3
  12. package/dist/plugins/key-access/index.js +19 -5
  13. package/dist/plugins/key-access/index.js.map +6 -6
  14. package/dist/plugins/key-access/ingress.js +19 -5
  15. package/dist/plugins/key-access/ingress.js.map +6 -6
  16. package/dist/plugins/key-rate-limit/index.js.map +2 -2
  17. package/dist/plugins/llm-protocol-adapter/control.js +785 -209
  18. package/dist/plugins/llm-protocol-adapter/control.js.map +21 -17
  19. package/dist/plugins/llm-protocol-adapter/index.js +861 -208
  20. package/dist/plugins/llm-protocol-adapter/index.js.map +21 -17
  21. package/dist/plugins/llm-protocol-adapter/manifest.json +7 -0
  22. package/dist/plugins/local-accounts/control.js.map +2 -2
  23. package/dist/plugins/local-accounts/index.js.map +2 -2
  24. package/dist/plugins/model-mapping/index.js.map +2 -2
  25. package/dist/plugins/models-dev/index.js.map +2 -2
  26. package/dist/plugins/signature-repair/index.js.map +2 -2
  27. package/dist/plugins/token-budget/control.js.map +2 -2
  28. package/dist/plugins/token-budget/index.js.map +3 -3
  29. package/dist/plugins/token-metering/index.js +9 -9
  30. package/dist/plugins/token-metering/index.js.map +7 -7
  31. package/dist/plugins/token-stats/control.js.map +2 -2
  32. package/dist/plugins/token-stats/index.js.map +3 -3
  33. package/dist/plugins/token-stats/ui/PriceModelPicker.svelte +3 -3
  34. package/package.json +2 -2
@@ -210,8 +210,22 @@ function check(target, policy, scopes = [target.routeId]) {
210
210
  return { error: "key-access.scope_denied", status: 403 };
211
211
  return null;
212
212
  }
213
+ function authorize(target, value) {
214
+ try {
215
+ const publication = validatePublication(value);
216
+ const scopes = protectedScopes(target, publication);
217
+ if (scopes.length === 0)
218
+ return null;
219
+ if (target.principal.domain === "anonymous")
220
+ return { error: "unauthorized", status: 401 };
221
+ return check(target, validatePolicy(publication.byKey[target.principal.keyId] ?? null), scopes);
222
+ } catch {
223
+ return { error: "key-access.policy_unavailable", status: 503 };
224
+ }
225
+ }
213
226
  function createIngress() {
214
227
  return {
228
+ authorize,
215
229
  bodyRequirements(target, value) {
216
230
  const publication = validatePublication(value);
217
231
  if (protectedScopes(target, publication).length === 0 || target.principal.domain !== "data")
@@ -245,12 +259,12 @@ function createIngress() {
245
259
  const p = validatePublication(value);
246
260
  if (protectedScopes(target, p).length === 0)
247
261
  return { snapshot: null };
248
- if (target.principal.domain === "anonymous")
249
- return { denial: { error: "unauthorized", status: 401 } };
262
+ const denial = authorize(target, p);
263
+ if (denial)
264
+ return { denial };
250
265
  const policy = validatePolicy(p.byKey[target.principal.keyId] ?? null);
251
266
  const scopes = protectedScopes(target, p);
252
- const denial = check(target, policy, scopes);
253
- return denial ? { denial } : { snapshot: { routeId: target.routeId, entryRouteId: target.entryRouteId ?? null, scopes, policy } };
267
+ return { snapshot: { routeId: target.routeId, entryRouteId: target.entryRouteId ?? null, scopes, policy } };
254
268
  } catch {
255
269
  return { denial: { error: "key-access.policy_unavailable", status: 503 } };
256
270
  }
@@ -277,4 +291,4 @@ export {
277
291
  validatePublication
278
292
  };
279
293
 
280
- //# debugId=4EF3DBF8CAE9272464756E2164756E21
294
+ //# debugId=D0FC8EE0A47A039A64756E2164756E21