@jeffusion/bungee-core 5.20.0 → 5.21.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 (41) hide show
  1. package/dist/config-worker/private-transport.d.ts +2 -0
  2. package/dist/data-admission/errors.d.ts +6 -1
  3. package/dist/gateway/contracts.d.ts +15 -4
  4. package/dist/gateway/forward-plugin.d.ts +2 -0
  5. package/dist/gateway/plugin.js +12 -2
  6. package/dist/gateway/request-plugin.d.ts +6 -0
  7. package/dist/gateway/responses-websocket-session.d.ts +18 -0
  8. package/dist/gateway/runtime.d.ts +1 -0
  9. package/dist/gateway/websocket-contracts.d.ts +1 -0
  10. package/dist/hooks/plugin-hooks.d.ts +2 -3
  11. package/dist/logger/access-log-writer.d.ts +2 -2
  12. package/dist/main.js +1199 -176
  13. package/dist/plugins/ai-transformer/index.js +1 -1
  14. package/dist/plugins/ai-transformer/index.js.map +4 -4
  15. package/dist/plugins/codex-router/control.js +6 -2
  16. package/dist/plugins/codex-router/control.js.map +4 -4
  17. package/dist/plugins/codex-router/index.js +498 -165
  18. package/dist/plugins/codex-router/index.js.map +13 -11
  19. package/dist/plugins/codex-router/manifest.json +124 -8
  20. package/dist/plugins/key-access/index.js +12 -2
  21. package/dist/plugins/key-access/index.js.map +3 -3
  22. package/dist/plugins/key-access/ingress.js +12 -2
  23. package/dist/plugins/key-access/ingress.js.map +3 -3
  24. package/dist/plugins/openai-messages-to-chat/index.js +6 -4
  25. package/dist/plugins/openai-messages-to-chat/index.js.map +4 -4
  26. package/dist/plugins/token-metering/index.js +1 -1
  27. package/dist/plugins/token-metering/index.js.map +4 -4
  28. package/dist/plugins/token-stats/manifest.json +16 -6
  29. package/dist/plugins/token-stats/ui/ClientModelPicker.svelte +13 -61
  30. package/dist/plugins/token-stats/ui/PriceModelPicker.svelte +18 -74
  31. package/dist/plugins/token-stats/ui/TokenStatsSettings.svelte +3 -2
  32. package/dist/plugins/token-stats/ui/model-search.ts +2 -45
  33. package/dist/plugins/token-stats/ui/pricing-catalog.ts +2 -1
  34. package/dist/scoped-plugin-registry.d.ts +7 -0
  35. package/dist/websocket/index.d.ts +1 -1
  36. package/dist/websocket/transport.d.ts +40 -18
  37. package/package.json +2 -2
  38. package/dist/plugins/chatgpt-oauth/ui/account-model.test.js +0 -69
  39. package/dist/plugins/local-accounts/ui/login-errors.test.ts +0 -22
  40. package/dist/plugins/token-stats/ui/client-model-search.test.ts +0 -58
  41. package/dist/plugins/token-stats/ui/pricing-catalog.test.ts +0 -114
@@ -81,8 +81,7 @@
81
81
  "execution": "control",
82
82
  "capability": "config.read"
83
83
  }
84
- ],
85
- "settings": "/catalog"
84
+ ]
86
85
  },
87
86
  "metadata": {
88
87
  "name": "metadata.name",
@@ -103,10 +102,41 @@
103
102
  "type": "object",
104
103
  "label": "Model",
105
104
  "properties": [
105
+ {
106
+ "name": "source",
107
+ "type": "string",
108
+ "label": "editor.source",
109
+ "required": false,
110
+ "validation": {
111
+ "trimmed": true,
112
+ "max": 512
113
+ }
114
+ },
115
+ {
116
+ "name": "sourceProvider",
117
+ "type": "string",
118
+ "label": "editor.sourceProvider",
119
+ "required": false,
120
+ "validation": {
121
+ "trimmed": true,
122
+ "max": 512
123
+ }
124
+ },
125
+ {
126
+ "name": "sourceProtocol",
127
+ "type": "select",
128
+ "label": "editor.sourceProtocol",
129
+ "options": [
130
+ {
131
+ "label": "Responses",
132
+ "value": "responses"
133
+ }
134
+ ]
135
+ },
106
136
  {
107
137
  "name": "provider",
108
138
  "type": "string",
109
- "label": "provider",
139
+ "label": "editor.provider",
110
140
  "required": true,
111
141
  "validation": {
112
142
  "trimmed": true,
@@ -116,7 +146,7 @@
116
146
  {
117
147
  "name": "model",
118
148
  "type": "string",
119
- "label": "model",
149
+ "label": "editor.model",
120
150
  "required": true,
121
151
  "validation": {
122
152
  "trimmed": true,
@@ -136,13 +166,13 @@
136
166
  {
137
167
  "name": "target",
138
168
  "type": "gateway_target",
139
- "label": "Target",
169
+ "label": "editor.target",
140
170
  "required": true
141
171
  },
142
172
  {
143
173
  "name": "capabilityOverrides",
144
174
  "type": "json",
145
- "label": "Capabilities"
175
+ "label": "editor.advanced"
146
176
  }
147
177
  ]
148
178
  }
@@ -150,14 +180,100 @@
150
180
  ],
151
181
  "translations": {
152
182
  "zh-CN": {
183
+ "editor.loaded": "已加载",
184
+ "editor.complete": "已全部加载",
185
+ "editor.loadMore": "加载更多",
153
186
  "metadata.name": "Codex 模型路由",
154
187
  "plugin.description": "从共享目录选择模型并绑定已有路由或服务",
155
- "models.label": "模型绑定"
188
+ "models.label": "模型绑定",
189
+ "editor.description": "按原始模型匹配请求,将目标模型转发到指定路由或服务。",
190
+ "editor.binding": "绑定",
191
+ "editor.match": "匹配请求",
192
+ "editor.sourceProvider": "原始提供商",
193
+ "editor.manual": "手动输入",
194
+ "editor.fromCatalog": "从目录选择",
195
+ "editor.source": "原始模型",
196
+ "editor.sourceHint": "精确匹配客户端请求中的模型标识;供应商仅用于目录筛选。",
197
+ "editor.sourcePlaceholder": "例如 gpt-5.4",
198
+ "editor.provider": "目标提供商",
199
+ "editor.model": "目标模型",
200
+ "editor.target": "转发路由 / 服务",
201
+ "editor.targetPlaceholder": "选择已有路由或服务",
202
+ "editor.search": "搜索模型",
203
+ "editor.empty": "没有匹配的模型",
204
+ "editor.loading": "正在加载模型目录",
205
+ "editor.error": "目录不可用,请检查 models.dev 或重试。",
206
+ "editor.targetsError": "无法读取转发目标,请重试。",
207
+ "editor.retry": "重试",
208
+ "editor.add": "添加模型绑定",
209
+ "editor.remove": "移除",
210
+ "editor.noBindings": "尚未配置模型绑定。",
211
+ "editor.noCatalog": "目录为空,请先启用 models.dev 并刷新目录。",
212
+ "editor.advanced": "能力限制(可选)",
213
+ "editor.context": "上下文长度上限",
214
+ "editor.contextHint": "留空使用目标模型的上下文长度。",
215
+ "editor.toolsOff": "禁用工具调用",
216
+ "editor.imagesOff": "禁用图片输入",
217
+ "editor.reasoningOff": "禁用推理能力",
218
+ "editor.reasoningEffort": "传递推理强度(目标需支持)",
219
+ "editor.increase": "增加上下文上限",
220
+ "editor.decrease": "减少上下文上限",
221
+ "editor.contextInvalid": "请输入正整数。",
222
+ "editor.sourceProtocol": "源模型协议",
223
+ "editor.targetProtocol": "目标模型协议",
224
+ "editor.targetProtocolPlaceholder": "选择目标接收协议",
225
+ "editor.route": "路由",
226
+ "editor.service": "服务",
227
+ "editor.targetUnavailable": "目标不可用",
228
+ "editor.noOptions": "没有匹配的选项"
156
229
  },
157
230
  "en": {
231
+ "editor.loaded": "Loaded",
232
+ "editor.complete": "All loaded",
233
+ "editor.loadMore": "Load more",
158
234
  "metadata.name": "Codex Router",
159
235
  "plugin.description": "Bind catalog models to existing routes or services",
160
- "models.label": "Model bindings"
236
+ "models.label": "Model bindings",
237
+ "editor.description": "Match the original model and forward the target model through an existing route or service.",
238
+ "editor.binding": "Binding",
239
+ "editor.match": "Match request",
240
+ "editor.sourceProvider": "Original provider",
241
+ "editor.manual": "Enter manually",
242
+ "editor.fromCatalog": "Choose from catalog",
243
+ "editor.source": "Original model",
244
+ "editor.sourceHint": "Match the exact model ID in client requests; the provider only filters the catalog.",
245
+ "editor.sourcePlaceholder": "For example, gpt-5.4",
246
+ "editor.provider": "Target provider",
247
+ "editor.model": "Target model",
248
+ "editor.target": "Forwarding route / service",
249
+ "editor.targetPlaceholder": "Select an existing route or service",
250
+ "editor.search": "Search models",
251
+ "editor.empty": "No matching models",
252
+ "editor.loading": "Loading model catalog",
253
+ "editor.error": "Catalog unavailable. Check models.dev or retry.",
254
+ "editor.targetsError": "Unable to load forwarding targets. Please retry.",
255
+ "editor.retry": "Retry",
256
+ "editor.add": "Add model binding",
257
+ "editor.remove": "Remove",
258
+ "editor.noBindings": "No model bindings configured.",
259
+ "editor.noCatalog": "The catalog is empty. Enable models.dev and refresh it first.",
260
+ "editor.advanced": "Capability limits (optional)",
261
+ "editor.context": "Context length limit",
262
+ "editor.contextHint": "Leave empty to use the target model context length.",
263
+ "editor.toolsOff": "Disable tool calls",
264
+ "editor.imagesOff": "Disable image input",
265
+ "editor.reasoningOff": "Disable reasoning",
266
+ "editor.reasoningEffort": "Forward reasoning effort (requires target support)",
267
+ "editor.increase": "Increase context limit",
268
+ "editor.decrease": "Decrease context limit",
269
+ "editor.contextInvalid": "Enter a positive whole number.",
270
+ "editor.sourceProtocol": "Source protocol",
271
+ "editor.targetProtocol": "Target protocol",
272
+ "editor.targetProtocolPlaceholder": "Select the target receiving protocol",
273
+ "editor.route": "Route",
274
+ "editor.service": "Service",
275
+ "editor.targetUnavailable": "Target unavailable",
276
+ "editor.noOptions": "No matching options"
161
277
  }
162
278
  }
163
279
  }
@@ -34,16 +34,26 @@ function definePlugin(plugin) {
34
34
  // packages/core/src/plugin-extensions.ts
35
35
  var ANONYMOUS_PRINCIPAL = Object.freeze({ domain: "anonymous", keyId: "", credentialVersion: 0 });
36
36
  // packages/core/src/data-admission/errors.ts
37
+ function safeDetails(details) {
38
+ if (!details)
39
+ return;
40
+ const message = typeof details.message === "string" && details.message.length <= 512 && !/[\x00-\x1f\x7f]/.test(details.message) ? details.message : undefined;
41
+ const param = typeof details.param === "string" && details.param.length <= 256 && /^[a-zA-Z_$][\w.$\[\]-]*$/.test(details.param) ? details.param : undefined;
42
+ return message === undefined && param === undefined ? undefined : Object.freeze({ message, param });
43
+ }
44
+
37
45
  class DataAdmissionError extends Error {
38
46
  status;
39
47
  code;
40
48
  retryAfter;
41
49
  name = "DataAdmissionError";
42
- constructor(status, code, retryAfter) {
50
+ details;
51
+ constructor(status, code, retryAfter, details) {
43
52
  super(code);
44
53
  this.status = status;
45
54
  this.code = code;
46
55
  this.retryAfter = retryAfter;
56
+ this.details = safeDetails(details);
47
57
  }
48
58
  }
49
59
  // packages/core/src/plugin-durable-state.ts
@@ -292,4 +302,4 @@ export {
292
302
  server_default as default
293
303
  };
294
304
 
295
- //# debugId=55B327A8EE449A7A64756E2164756E21
305
+ //# debugId=52B69A66A392B16C64756E2164756E21