@jeffusion/bungee-core 5.19.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 +16 -3
  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 -0
  11. package/dist/logger/access-log-writer.d.ts +2 -2
  12. package/dist/main.js +1234 -191
  13. package/dist/plugins/ai-transformer/index.js +11 -1
  14. package/dist/plugins/ai-transformer/index.js.map +5 -3
  15. package/dist/plugins/codex-router/control.js +677 -2
  16. package/dist/plugins/codex-router/control.js.map +19 -4
  17. package/dist/plugins/codex-router/index.js +4123 -33
  18. package/dist/plugins/codex-router/index.js.map +25 -7
  19. package/dist/plugins/codex-router/manifest.json +139 -9
  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 +693 -543
  25. package/dist/plugins/openai-messages-to-chat/index.js.map +8 -4
  26. package/dist/plugins/token-metering/index.js +652 -71
  27. package/dist/plugins/token-metering/index.js.map +5 -3
  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 +11 -2
  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
@@ -24,7 +24,14 @@
24
24
  "models-dev": "^1.0.0"
25
25
  },
26
26
  "services": {
27
- "provides": [],
27
+ "provides": [
28
+ {
29
+ "id": "codex-router.history.v1",
30
+ "version": 1,
31
+ "process": "control",
32
+ "kind": "rpc"
33
+ }
34
+ ],
28
35
  "consumes": [
29
36
  {
30
37
  "id": "models-dev.catalog.v1",
@@ -53,6 +60,13 @@
53
60
  "process": "worker",
54
61
  "plugin": "models-dev",
55
62
  "kind": "local"
63
+ },
64
+ {
65
+ "id": "codex-router.history.v1",
66
+ "version": 1,
67
+ "process": "worker",
68
+ "plugin": "codex-router",
69
+ "kind": "rpc"
56
70
  }
57
71
  ]
58
72
  },
@@ -67,8 +81,7 @@
67
81
  "execution": "control",
68
82
  "capability": "config.read"
69
83
  }
70
- ],
71
- "settings": "/catalog"
84
+ ]
72
85
  },
73
86
  "metadata": {
74
87
  "name": "metadata.name",
@@ -89,10 +102,41 @@
89
102
  "type": "object",
90
103
  "label": "Model",
91
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
+ },
92
136
  {
93
137
  "name": "provider",
94
138
  "type": "string",
95
- "label": "provider",
139
+ "label": "editor.provider",
96
140
  "required": true,
97
141
  "validation": {
98
142
  "trimmed": true,
@@ -102,7 +146,7 @@
102
146
  {
103
147
  "name": "model",
104
148
  "type": "string",
105
- "label": "model",
149
+ "label": "editor.model",
106
150
  "required": true,
107
151
  "validation": {
108
152
  "trimmed": true,
@@ -122,13 +166,13 @@
122
166
  {
123
167
  "name": "target",
124
168
  "type": "gateway_target",
125
- "label": "Target",
169
+ "label": "editor.target",
126
170
  "required": true
127
171
  },
128
172
  {
129
173
  "name": "capabilityOverrides",
130
174
  "type": "json",
131
- "label": "Capabilities"
175
+ "label": "editor.advanced"
132
176
  }
133
177
  ]
134
178
  }
@@ -136,14 +180,100 @@
136
180
  ],
137
181
  "translations": {
138
182
  "zh-CN": {
183
+ "editor.loaded": "已加载",
184
+ "editor.complete": "已全部加载",
185
+ "editor.loadMore": "加载更多",
139
186
  "metadata.name": "Codex 模型路由",
140
187
  "plugin.description": "从共享目录选择模型并绑定已有路由或服务",
141
- "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": "没有匹配的选项"
142
229
  },
143
230
  "en": {
231
+ "editor.loaded": "Loaded",
232
+ "editor.complete": "All loaded",
233
+ "editor.loadMore": "Load more",
144
234
  "metadata.name": "Codex Router",
145
235
  "plugin.description": "Bind catalog models to existing routes or services",
146
- "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"
147
277
  }
148
278
  }
149
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