@acarmisc/backstage-plugin-litellm-backend 0.21.0 → 0.22.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.
- package/dist/index.cjs.js +5 -1
- package/dist/index.cjs.js.map +2 -2
- package/dist/routes/opencode.js +12 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -10637,6 +10637,8 @@ function registerOpencodeRoutes(router, ctx) {
|
|
|
10637
10637
|
const reusable = existing.find(
|
|
10638
10638
|
(k) => k.key_alias === alias && !k.blocked && k.user_id === userId
|
|
10639
10639
|
);
|
|
10640
|
+
const teamPerm = teamId ? (await client.getTeamInfo(teamId).catch(() => void 0))?.object_permission : void 0;
|
|
10641
|
+
const mcp = teamPerm?.mcp_servers?.length || teamPerm?.mcp_access_groups?.length ? { mcp_servers: teamPerm.mcp_servers ?? [], mcp_access_groups: teamPerm.mcp_access_groups ?? [] } : void 0;
|
|
10640
10642
|
const mintNewKey = async () => {
|
|
10641
10643
|
const profile = await resolveUserProfile(
|
|
10642
10644
|
tokenEntityRef,
|
|
@@ -10657,7 +10659,8 @@ function registerOpencodeRoutes(router, ctx) {
|
|
|
10657
10659
|
...profile.email && { created_by_email: profile.email },
|
|
10658
10660
|
...teamId && { opencode_team: teamId }
|
|
10659
10661
|
},
|
|
10660
|
-
user_id: userId
|
|
10662
|
+
user_id: userId,
|
|
10663
|
+
...mcp && { object_permission: mcp }
|
|
10661
10664
|
});
|
|
10662
10665
|
return result.key;
|
|
10663
10666
|
};
|
|
@@ -10668,6 +10671,7 @@ function registerOpencodeRoutes(router, ctx) {
|
|
|
10668
10671
|
try {
|
|
10669
10672
|
key = (await client.regenerateKey(keyHashOrId)).key;
|
|
10670
10673
|
rotated = true;
|
|
10674
|
+
if (key && mcp) await client.updateKey({ key, object_permission: mcp });
|
|
10671
10675
|
} catch (err) {
|
|
10672
10676
|
const unsupported = err instanceof LiteLLMUpstreamError && ([400, 404, 405, 501].includes(err.status) || /enterprise|premium/i.test(err.message));
|
|
10673
10677
|
if (!unsupported) throw err;
|