@acarmisc/backstage-plugin-litellm-backend 0.28.0 → 0.30.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/config.d.ts +19 -0
- package/dist/index.cjs.js +30 -2
- package/dist/index.cjs.js.map +3 -3
- package/dist/keySnippets.d.ts +8 -0
- package/dist/keySnippets.js +26 -0
- package/dist/openapi.js +2 -0
- package/dist/router.js +9 -0
- package/dist/routes/config.js +2 -0
- package/dist/routes/context.d.ts +5 -0
- package/package.json +1 -1
package/config.d.ts
CHANGED
|
@@ -450,6 +450,25 @@ export interface Config {
|
|
|
450
450
|
* @default false
|
|
451
451
|
*/
|
|
452
452
|
hideTeamBudgetForManagers?: boolean;
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Key-alias prefixes that identify system / service keys (e.g.
|
|
456
|
+
* ["svc-", "system-"]). The Keys table hides keys whose alias starts
|
|
457
|
+
* with one of these prefixes behind a "Hide service keys" toggle that
|
|
458
|
+
* is on by default; users can switch it off to see every key.
|
|
459
|
+
* Matching is case-insensitive. Display-only: the keys are still
|
|
460
|
+
* returned by the API and nothing is enforced server-side.
|
|
461
|
+
* @default []
|
|
462
|
+
*/
|
|
463
|
+
serviceKeyPrefixes?: string[];
|
|
464
|
+
/**
|
|
465
|
+
* Starter-snippet tabs shown after a key is generated, in this order.
|
|
466
|
+
* Allowed: office365, opencode, claude-code, pi, openai, curl. Omit to
|
|
467
|
+
* show all of them in that order (Office365 first). Must not be empty,
|
|
468
|
+
* contain unknown names, or repeat a tab. Display-only.
|
|
469
|
+
* @visibility frontend
|
|
470
|
+
*/
|
|
471
|
+
keySnippets?: Array<'office365' | 'opencode' | 'claude-code' | 'pi' | 'openai' | 'curl'>;
|
|
453
472
|
};
|
|
454
473
|
|
|
455
474
|
/**
|
package/dist/index.cjs.js
CHANGED
|
@@ -9167,6 +9167,26 @@ async function resolveUserRole(userEntityRef, roleConfigs, catalogClient, auth,
|
|
|
9167
9167
|
}
|
|
9168
9168
|
}
|
|
9169
9169
|
|
|
9170
|
+
// src/keySnippets.ts
|
|
9171
|
+
var KEY_SNIPPET_TABS = ["office365", "opencode", "claude-code", "pi", "openai", "curl"];
|
|
9172
|
+
function parseKeySnippetTabs(raw) {
|
|
9173
|
+
if (raw === void 0) return [...KEY_SNIPPET_TABS];
|
|
9174
|
+
if (raw.length === 0) {
|
|
9175
|
+
throw new Error("litellm.display.keySnippets must list at least one tab");
|
|
9176
|
+
}
|
|
9177
|
+
const allowed = KEY_SNIPPET_TABS;
|
|
9178
|
+
const unknown = raw.filter((tab) => !allowed.includes(tab));
|
|
9179
|
+
if (unknown.length > 0) {
|
|
9180
|
+
throw new Error(
|
|
9181
|
+
`litellm.display.keySnippets: unknown tab(s) ${unknown.join(", ")}. Allowed: ${KEY_SNIPPET_TABS.join(", ")}`
|
|
9182
|
+
);
|
|
9183
|
+
}
|
|
9184
|
+
if (new Set(raw).size !== raw.length) {
|
|
9185
|
+
throw new Error("litellm.display.keySnippets lists a tab more than once");
|
|
9186
|
+
}
|
|
9187
|
+
return raw;
|
|
9188
|
+
}
|
|
9189
|
+
|
|
9170
9190
|
// src/router.ts
|
|
9171
9191
|
var import_backstage_plugin_litellm_common11 = require("@acarmisc/backstage-plugin-litellm-common");
|
|
9172
9192
|
|
|
@@ -9786,7 +9806,9 @@ var openApiSpec = {
|
|
|
9786
9806
|
} },
|
|
9787
9807
|
display: { type: "object", properties: {
|
|
9788
9808
|
hideTeamBudgetForMembers: { type: "boolean" },
|
|
9789
|
-
hideTeamBudgetForManagers: { type: "boolean" }
|
|
9809
|
+
hideTeamBudgetForManagers: { type: "boolean" },
|
|
9810
|
+
serviceKeyPrefixes: { type: "array", items: { type: "string" } },
|
|
9811
|
+
keySnippets: { type: "array", items: { type: "string", enum: ["office365", "opencode", "claude-code", "pi", "openai", "curl"] } }
|
|
9790
9812
|
} }
|
|
9791
9813
|
} } } }
|
|
9792
9814
|
}
|
|
@@ -10054,7 +10076,9 @@ function registerConfigRoutes(router, ctx) {
|
|
|
10054
10076
|
},
|
|
10055
10077
|
display: {
|
|
10056
10078
|
hideTeamBudgetForMembers: ctx.teamBudgetVisibility.hideTeamBudgetForMembers,
|
|
10057
|
-
hideTeamBudgetForManagers: ctx.teamBudgetVisibility.hideTeamBudgetForManagers
|
|
10079
|
+
hideTeamBudgetForManagers: ctx.teamBudgetVisibility.hideTeamBudgetForManagers,
|
|
10080
|
+
serviceKeyPrefixes: ctx.serviceKeyPrefixes,
|
|
10081
|
+
keySnippets: ctx.keySnippets
|
|
10058
10082
|
}
|
|
10059
10083
|
});
|
|
10060
10084
|
});
|
|
@@ -13670,6 +13694,8 @@ async function createRouter(options) {
|
|
|
13670
13694
|
const userIdDomain = config.getOptionalString("litellm.userIdDomain");
|
|
13671
13695
|
const publicBaseUrl = config.getOptionalString("litellm.publicBaseUrl") ?? null;
|
|
13672
13696
|
const supportContact = config.getOptionalString("litellm.supportContact");
|
|
13697
|
+
const serviceKeyPrefixes = (config.getOptionalStringArray("litellm.display.serviceKeyPrefixes") ?? []).map((p) => p.trim()).filter((p) => p.length > 0);
|
|
13698
|
+
const keySnippets = parseKeySnippetTabs(config.getOptionalStringArray("litellm.display.keySnippets"));
|
|
13673
13699
|
const baseClient = options.client ?? new LiteLLMClient({ baseUrl, masterKey });
|
|
13674
13700
|
const userInfoCacheTtlSeconds = config.getOptionalNumber("litellm.cache.userInfoTtlSeconds") ?? 10;
|
|
13675
13701
|
const client = userInfoCacheTtlSeconds > 0 ? withUserInfoCache(baseClient, { ttlMs: userInfoCacheTtlSeconds * 1e3 }) : baseClient;
|
|
@@ -13728,6 +13754,8 @@ async function createRouter(options) {
|
|
|
13728
13754
|
baseUrl,
|
|
13729
13755
|
publicBaseUrl,
|
|
13730
13756
|
supportContact,
|
|
13757
|
+
serviceKeyPrefixes,
|
|
13758
|
+
keySnippets,
|
|
13731
13759
|
userIdDomain,
|
|
13732
13760
|
provisioningEnabled,
|
|
13733
13761
|
provisioningDefaults,
|