@acarmisc/backstage-plugin-litellm-backend 0.17.3 → 0.17.5

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 CHANGED
@@ -12982,7 +12982,22 @@ function registerBridgeRoutes(router, ctx, bridgeOpts) {
12982
12982
  logger,
12983
12983
  bridgeIdentity
12984
12984
  );
12985
- res.json({ user_id: user.user_id, teams: user.teams ?? [] });
12985
+ const teamIds = user.teams ?? [];
12986
+ const teamMetadata = [];
12987
+ for (const teamId of teamIds) {
12988
+ try {
12989
+ const teamInfo = await client.getTeamInfo(teamId);
12990
+ teamMetadata.push({
12991
+ id: teamId,
12992
+ name: teamInfo.team_alias || teamId
12993
+ // Use alias as display name, fallback to ID
12994
+ });
12995
+ } catch (e) {
12996
+ logger.debug(`Could not fetch team info for ${teamId}: ${e.message}`);
12997
+ teamMetadata.push({ id: teamId });
12998
+ }
12999
+ }
13000
+ res.json({ user_id: user.user_id, teams: teamMetadata });
12986
13001
  } catch (error) {
12987
13002
  handleBridgeError(error, res);
12988
13003
  }
@@ -13238,6 +13253,12 @@ async function createRouter(options) {
13238
13253
 
13239
13254
  // src/plugin.ts
13240
13255
  var import_backstage_plugin_litellm_common10 = require("@acarmisc/backstage-plugin-litellm-common");
13256
+ var BRIDGE_UNAUTHENTICATED_PATHS = [
13257
+ "/bridge/health",
13258
+ "/bridge/keys",
13259
+ "/bridge/models",
13260
+ "/bridge/user/info"
13261
+ ];
13241
13262
  var litellmPlugin = (0, import_backend_plugin_api.createBackendPlugin)({
13242
13263
  pluginId: "litellm",
13243
13264
  register(reg) {
@@ -13270,11 +13291,7 @@ var litellmPlugin = (0, import_backend_plugin_api.createBackendPlugin)({
13270
13291
  });
13271
13292
  httpRouter.use(router);
13272
13293
  if (readBridgeConfig(config).enabled) {
13273
- for (const path of [
13274
- "/bridge/health",
13275
- "/bridge/keys",
13276
- "/bridge/models"
13277
- ]) {
13294
+ for (const path of BRIDGE_UNAUTHENTICATED_PATHS) {
13278
13295
  httpRouter.addAuthPolicy({ path, allow: "unauthenticated" });
13279
13296
  }
13280
13297
  }