@jeffusion/bungee-llms 5.23.1 → 5.23.3
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.
package/dist/plugin-api.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { TOKEN_ACCOUNTING_AUTHORITIES, assertCanonicalTokenAccountingEventV2, cr
|
|
|
2
2
|
export type { CanonicalTokenAccountingEventV2 } from './token-accounting/types';
|
|
3
3
|
export * from './responses-codec';
|
|
4
4
|
export * from './protocol-session';
|
|
5
|
-
export { protocolRequestPath } from './protocol-session/endpoint';
|
|
5
|
+
export { protocolRequestPath, protocolRequestModel } from './protocol-session/endpoint';
|
package/dist/plugin-api.js
CHANGED
|
@@ -5243,6 +5243,31 @@ function validateStreamEnvelope(raw, protocol) {
|
|
|
5243
5243
|
}
|
|
5244
5244
|
}
|
|
5245
5245
|
// src/protocol-session/endpoint.ts
|
|
5246
|
+
function protocolRequestModel(protocol, body, url) {
|
|
5247
|
+
if (protocol === "gemini_generate_content") {
|
|
5248
|
+
let path;
|
|
5249
|
+
try {
|
|
5250
|
+
path = new URL(url).pathname;
|
|
5251
|
+
} catch {
|
|
5252
|
+
return fail("invalid_payload", "A valid Gemini target URL is required", "url");
|
|
5253
|
+
}
|
|
5254
|
+
const match = path.match(/\/models\/([^/]+):(?:streamGenerateContent|generateContent)$/);
|
|
5255
|
+
if (!match)
|
|
5256
|
+
return fail("invalid_payload", "Gemini target URL has no terminal model", "url");
|
|
5257
|
+
try {
|
|
5258
|
+
const model = decodeURIComponent(match[1]);
|
|
5259
|
+
if (model)
|
|
5260
|
+
return model;
|
|
5261
|
+
} catch {
|
|
5262
|
+
return fail("invalid_payload", "Gemini target model encoding is invalid", "url");
|
|
5263
|
+
}
|
|
5264
|
+
return fail("invalid_payload", "Gemini target model is required", "url");
|
|
5265
|
+
}
|
|
5266
|
+
const model = body?.model;
|
|
5267
|
+
if (typeof model !== "string" || !model)
|
|
5268
|
+
return fail("invalid_payload", "Target model is required", "model");
|
|
5269
|
+
return model;
|
|
5270
|
+
}
|
|
5246
5271
|
function protocolRequestPath(protocol, model, streaming) {
|
|
5247
5272
|
switch (protocol) {
|
|
5248
5273
|
case "responses":
|
|
@@ -5274,6 +5299,7 @@ export {
|
|
|
5274
5299
|
encodeResponsesResult,
|
|
5275
5300
|
getProviderTokenAccountingCapabilities,
|
|
5276
5301
|
inspectAgentMessages,
|
|
5302
|
+
protocolRequestModel,
|
|
5277
5303
|
protocolRequestPath,
|
|
5278
5304
|
replaceAgentMessageEncryptedContent
|
|
5279
5305
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { LLMProtocol } from './types';
|
|
2
|
+
/** Read the actual generation model. Gemini's URL is authoritative, including base prefixes. */
|
|
3
|
+
export declare function protocolRequestModel(protocol: LLMProtocol, body: unknown, url?: string | URL): string;
|
|
2
4
|
/** Generation endpoint; Responses keeps the host/provider's /responses entry contract. */
|
|
3
5
|
export declare function protocolRequestPath(protocol: LLMProtocol, model: string, streaming: boolean): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeffusion/bungee-llms",
|
|
3
|
-
"version": "5.23.
|
|
3
|
+
"version": "5.23.3",
|
|
4
4
|
"description": "Extensible LLM adapters and protocol conversion package for Bungee",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"prepublishOnly": "bun run build"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@jeffusion/bungee-types": "^5.23.
|
|
14
|
+
"@jeffusion/bungee-types": "^5.23.3"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"bun-types": "^1.3.2",
|