@acarmisc/backstage-plugin-litellm 0.34.0 → 0.36.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/api.d.ts +13 -1
- package/dist/components/ConnectPage.d.ts +7 -0
- package/dist/components/TeamUsage.d.ts +11 -1
- package/dist/connect.d.ts +8 -0
- package/dist/index.cjs.js +365 -153
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.esm.js +350 -138
- package/dist/index.esm.js.map +4 -4
- package/dist/plugin.d.ts +40 -0
- package/dist/types.d.ts +6 -1
- package/package.json +2 -2
package/dist/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type FetchApi, type DiscoveryApi } from '@backstage/frontend-plugin-api';
|
|
2
|
-
import { UserInfo, VirtualKey, ModelInfo, UsageMetrics, TeamInfo, GenerateKeyRequest, GenerateKeyResponse, UpdateKeyRequest, AuditLogsParams, PaginatedAuditLogs, LiteLlmConfig, VectorStoreInfo, McpServerInfo, CreateTeamRequest, CreateTeamResponse, UpdateTeamRequest } from './types';
|
|
2
|
+
import { UserInfo, VirtualKey, ModelInfo, UsageMetrics, TeamMemberUsage, TeamInfo, GenerateKeyRequest, GenerateKeyResponse, UpdateKeyRequest, AuditLogsParams, PaginatedAuditLogs, LiteLlmConfig, VectorStoreInfo, McpServerInfo, CreateTeamRequest, CreateTeamResponse, UpdateTeamRequest } from './types';
|
|
3
3
|
export declare class ApiError extends Error {
|
|
4
4
|
body: unknown;
|
|
5
5
|
status: number;
|
|
@@ -26,6 +26,10 @@ export interface LiteLlmApiInterface {
|
|
|
26
26
|
}>;
|
|
27
27
|
listModels(): Promise<ModelInfo[]>;
|
|
28
28
|
getTeams(): Promise<TeamInfo[]>;
|
|
29
|
+
connectLocalClient(redirectUri: string, team?: string): Promise<{
|
|
30
|
+
key: string;
|
|
31
|
+
team: string | null;
|
|
32
|
+
}>;
|
|
29
33
|
getManagedTeams(): Promise<TeamInfo[]>;
|
|
30
34
|
addTeamMember(teamId: string, body: {
|
|
31
35
|
userEntityRef: string;
|
|
@@ -38,6 +42,8 @@ export interface LiteLlmApiInterface {
|
|
|
38
42
|
setTeamMcpServers(teamId: string, mcpServers: string[]): Promise<TeamInfo>;
|
|
39
43
|
getUsage(startDate: string, endDate: string): Promise<UsageMetrics>;
|
|
40
44
|
getTeamUsage(teamId: string, startDate: string, endDate: string): Promise<UsageMetrics>;
|
|
45
|
+
/** Per-member breakdown; rejects (403/404) when the caller may not see it. */
|
|
46
|
+
getTeamMemberUsage(teamId: string, startDate: string, endDate: string): Promise<TeamMemberUsage>;
|
|
41
47
|
getAuditLogs(params: AuditLogsParams): Promise<PaginatedAuditLogs>;
|
|
42
48
|
getConfig(): Promise<LiteLlmConfig>;
|
|
43
49
|
createTeam(request: CreateTeamRequest): Promise<CreateTeamResponse>;
|
|
@@ -83,6 +89,11 @@ export declare class LiteLlmApi implements LiteLlmApiInterface {
|
|
|
83
89
|
}>;
|
|
84
90
|
getAuditLogs(params: AuditLogsParams): Promise<PaginatedAuditLogs>;
|
|
85
91
|
listModels(): Promise<ModelInfo[]>;
|
|
92
|
+
/** Mints (or rotates) the caller's connect-flow key, optionally bound to one of their teams. */
|
|
93
|
+
connectLocalClient(redirectUri: string, team?: string): Promise<{
|
|
94
|
+
key: string;
|
|
95
|
+
team: string | null;
|
|
96
|
+
}>;
|
|
86
97
|
getTeams(): Promise<TeamInfo[]>;
|
|
87
98
|
getManagedTeams(): Promise<TeamInfo[]>;
|
|
88
99
|
addTeamMember(teamId: string, body: {
|
|
@@ -96,6 +107,7 @@ export declare class LiteLlmApi implements LiteLlmApiInterface {
|
|
|
96
107
|
setTeamMcpServers(teamId: string, mcpServers: string[]): Promise<TeamInfo>;
|
|
97
108
|
getUsage(startDate: string, endDate: string): Promise<UsageMetrics>;
|
|
98
109
|
getTeamUsage(teamId: string, startDate: string, endDate: string): Promise<UsageMetrics>;
|
|
110
|
+
getTeamMemberUsage(teamId: string, startDate: string, endDate: string): Promise<TeamMemberUsage>;
|
|
99
111
|
getConfig(): Promise<LiteLlmConfig>;
|
|
100
112
|
createTeam(request: CreateTeamRequest): Promise<CreateTeamResponse>;
|
|
101
113
|
updateTeam(teamId: string, request: UpdateTeamRequest): Promise<TeamInfo>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Confirmation page for local clients (abby-desktop installer, OpenCode plugins): mints one
|
|
4
|
+
* key per selected team through fetchApi, so the Backstage session authenticates the call,
|
|
5
|
+
* then hands the keys back to the client's loopback listener.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ConnectPage: FC;
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { TeamInfo, UsageMetrics } from '../types';
|
|
2
|
+
import { TeamInfo, TeamMemberUsage, UsageMetrics } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Per-member usage for the period, sorted by spend. Dollars are replaced by
|
|
5
|
+
* the share of team spend when the backend hides them.
|
|
6
|
+
*/
|
|
7
|
+
export declare const MemberUsageTable: FC<{
|
|
8
|
+
usage: TeamMemberUsage;
|
|
9
|
+
}>;
|
|
3
10
|
interface TeamUsageProps {
|
|
4
11
|
teams: TeamInfo[];
|
|
5
12
|
loading: boolean;
|
|
6
13
|
getTeamUsage: (teamId: string) => UsageMetrics | null;
|
|
7
14
|
getTeamUsageLoading: (teamId: string) => boolean;
|
|
15
|
+
/** Per-member breakdown for a team; null hides the section. */
|
|
16
|
+
getTeamMemberUsage?: (teamId: string) => TeamMemberUsage | null;
|
|
17
|
+
getTeamMemberUsageLoading?: (teamId: string) => boolean;
|
|
8
18
|
canManage?: boolean;
|
|
9
19
|
onEditTeam?: (team: TeamInfo) => void;
|
|
10
20
|
/** When true (with `onCreateTeam`), a "Create Team" action renders in the section header. */
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local-client connect flow (e.g. abby-desktop's installer): the client listens on a loopback
|
|
3
|
+
* port and opens /litellm/connect?redirect_uri=http://localhost:<port>/callback&state=<nonce>.
|
|
4
|
+
*/
|
|
5
|
+
/** Same rule as the backend: only http://localhost|127.0.0.1:<port>/callback, never an open redirect. */
|
|
6
|
+
export declare function isLoopbackCallback(uri: string | null): uri is string;
|
|
7
|
+
/** Hands the keys to the local client as a form POST, so they never land in a URL or the browser history. */
|
|
8
|
+
export declare function postToLoopback(redirectUri: string, fields: [string, string][]): void;
|