@flashbacktech/flashbackclient 0.2.73 → 0.2.75
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/client.d.ts +40 -1
- package/dist/api/client.js +74 -2
- package/dist/api/index.d.ts +2 -1
- package/dist/api/index.js +3 -1
- package/dist/api/types/dashboard/stats.d.ts +246 -0
- package/dist/api/types/dashboard/stats.js +14 -0
- package/dist/api/types/storage/bridge.d.ts +7 -0
- package/dist/api/types/storage/bridge.js +8 -1
- package/package.json +1 -1
package/dist/api/client.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ import { CreatePolicyRequest, GetPoliciesQuery, GetPolicyViolationsQuery, GetPol
|
|
|
22
22
|
import { CreateConversationRequest, CreateConversationResponse, SendPromptRequest, SendPromptResponse, GetConversationsRequest, GetConversationsResponse, GetConversationMessagesResponse, GetConversationMessagesRequest, DeleteConversationRequest, DeleteConversationResponse } from './types/ai/conversation';
|
|
23
23
|
import { GetLinksRequest, GetLinksResponse, CreateLinkRequest, CreateLinkResponse, UpdateLinkRequest, UpdateLinkResponse, DeleteLinkResponse, GetLinkByTokenResponse } from './types/platform/links';
|
|
24
24
|
import { GetCreditsBalanceResponse, GetCreditsTransactionsRequest, GetCreditsTransactionsResponse, GetCreditsConsumptionRequest, GetCreditsConsumptionResponse, BuyCreditsPackRequest, BuyCreditsPackResponse, GetCreditsPacksResponse, GetCreditsRatesResponse, GetCreditsMonthlyStatsRequest, GetCreditsMonthlyStatsResponse } from './types/platform/credits';
|
|
25
|
+
import { StorageStatsQueryParams as V2StorageStatsQueryParams, StorageTimeSeriesResponse, StorageBreakdownResponse, StorageProviderBreakdownResponse, StorageBreakdownBy, AiGatewayStatsQueryParams, AiGatewayTimeSeriesResponse, AiGatewayBreakdownResponse, AiBreakdownBy, PrivateChatStatsQueryParams, PrivateChatTimeSeriesResponse, PrivateChatModelBreakdownResponse, PrivateChatUsersBreakdownResponse, PolicyStatsQueryParams, PolicyTimeSeriesResponse, PolicyTokenTimeSeriesResponse, PolicyBreakdownResponse, PolicyBreakdownBy, CreditStatsQueryParams, CreditTimeSeriesResponse, CreditBreakdownResponse, CreditBreakdownBy, DashboardStatsQueryParams, DashboardBreakdownQueryParams } from './types/dashboard/stats';
|
|
25
26
|
interface ErrorResponse {
|
|
26
27
|
message?: string;
|
|
27
28
|
[key: string]: any;
|
|
@@ -138,7 +139,7 @@ export declare class ApiClient implements IApiClient {
|
|
|
138
139
|
getBucketStats: (params?: {
|
|
139
140
|
bucketId?: string[];
|
|
140
141
|
}) => Promise<BucketStatsResponse>;
|
|
141
|
-
getNodeInfo: () => Promise<NodeInfoResponse>;
|
|
142
|
+
getNodeInfo: (nodeServices: number) => Promise<NodeInfoResponse>;
|
|
142
143
|
getPrivateNodeInfo: (orgId: string) => Promise<NodeInfoResponse>;
|
|
143
144
|
deletePrivateNode: (orgId: string, nodeId: string) => Promise<{
|
|
144
145
|
success: boolean;
|
|
@@ -293,5 +294,43 @@ export declare class ApiClient implements IApiClient {
|
|
|
293
294
|
getCreditsRates: () => Promise<GetCreditsRatesResponse>;
|
|
294
295
|
/** Get aggregated monthly credit stats for histogram (consumption, purchases, grants, balance) */
|
|
295
296
|
getCreditsMonthlyStats: (query?: GetCreditsMonthlyStatsRequest) => Promise<GetCreditsMonthlyStatsResponse>;
|
|
297
|
+
/** GET /v2/stats/storage — Time-series for storage gateway metrics. */
|
|
298
|
+
getStorageGatewayStats: (params: V2StorageStatsQueryParams) => Promise<StorageTimeSeriesResponse>;
|
|
299
|
+
/**
|
|
300
|
+
* GET /v2/stats/storage/breakdown/{by} — Storage breakdown by dimension.
|
|
301
|
+
* Use `by = 'providers'` for the provider breakdown which returns protocol/endpoint metadata.
|
|
302
|
+
*/
|
|
303
|
+
getStorageGatewayBreakdown: (by: Exclude<StorageBreakdownBy, "providers">, params: DashboardBreakdownQueryParams) => Promise<StorageBreakdownResponse>;
|
|
304
|
+
/** GET /v2/stats/storage/breakdown/providers — Includes protocol, provider, endpoint. */
|
|
305
|
+
getStorageGatewayProviderBreakdown: (params: DashboardBreakdownQueryParams) => Promise<StorageProviderBreakdownResponse>;
|
|
306
|
+
/** GET /v2/stats/ai — Time-series for AI gateway metrics (excludes Private Chat). */
|
|
307
|
+
getAiGatewayStats: (params: AiGatewayStatsQueryParams) => Promise<AiGatewayTimeSeriesResponse>;
|
|
308
|
+
/** GET /v2/stats/ai/breakdown/{by} — AI breakdown by dimension. */
|
|
309
|
+
getAiGatewayBreakdown: (by: AiBreakdownBy, params: DashboardBreakdownQueryParams) => Promise<AiGatewayBreakdownResponse>;
|
|
310
|
+
/**
|
|
311
|
+
* GET /v2/stats/private-chat — Time-series for private-chat metrics.
|
|
312
|
+
* Supports resource-level filters: `model` and `userId`.
|
|
313
|
+
*/
|
|
314
|
+
getPrivateChatStats: (params: PrivateChatStatsQueryParams) => Promise<PrivateChatTimeSeriesResponse>;
|
|
315
|
+
/** GET /v2/stats/private-chat/breakdown/models — Model breakdown with optional series. */
|
|
316
|
+
getPrivateChatModelsBreakdown: (params: DashboardBreakdownQueryParams) => Promise<PrivateChatModelBreakdownResponse>;
|
|
317
|
+
/**
|
|
318
|
+
* GET /v2/stats/private-chat/breakdown/users — Per-user totals + optional series.
|
|
319
|
+
* Returns conversationsCount and lastActiveAt per user.
|
|
320
|
+
*/
|
|
321
|
+
getPrivateChatUsersBreakdown: (params: DashboardBreakdownQueryParams) => Promise<PrivateChatUsersBreakdownResponse>;
|
|
322
|
+
/**
|
|
323
|
+
* GET /v2/stats/policies — Time-series of policy enforcement + token overhead.
|
|
324
|
+
* Supports resource-level filter: `ruleId`.
|
|
325
|
+
*/
|
|
326
|
+
getPolicyStats: (params: PolicyStatsQueryParams) => Promise<PolicyTimeSeriesResponse>;
|
|
327
|
+
/** GET /v2/stats/policies/tokens — Dedicated policy-token consumption time-series. */
|
|
328
|
+
getPolicyTokenStats: (params: DashboardStatsQueryParams) => Promise<PolicyTokenTimeSeriesResponse>;
|
|
329
|
+
/** GET /v2/stats/policies/breakdown/{by} — Policy breakdown by rules or users. */
|
|
330
|
+
getPolicyBreakdown: (by: PolicyBreakdownBy, params: DashboardBreakdownQueryParams) => Promise<PolicyBreakdownResponse>;
|
|
331
|
+
/** GET /v2/stats/credits — Credit consumption/grant time-series. */
|
|
332
|
+
getCreditStats: (params: CreditStatsQueryParams) => Promise<CreditTimeSeriesResponse>;
|
|
333
|
+
/** GET /v2/stats/credits/breakdown/{by} — Credit breakdown by dimension. */
|
|
334
|
+
getCreditBreakdown: (by: CreditBreakdownBy, params: DashboardBreakdownQueryParams) => Promise<CreditBreakdownResponse>;
|
|
296
335
|
}
|
|
297
336
|
export {};
|
package/dist/api/client.js
CHANGED
|
@@ -377,8 +377,8 @@ class ApiClient {
|
|
|
377
377
|
}
|
|
378
378
|
return this.makeRequest(`bucket/stats${queryParams.toString() ? `?${queryParams.toString()}` : ''}`, 'GET', null);
|
|
379
379
|
};
|
|
380
|
-
this.getNodeInfo = async () => {
|
|
381
|
-
return this.makeRequest('node', 'GET', null);
|
|
380
|
+
this.getNodeInfo = async (nodeServices) => {
|
|
381
|
+
return this.makeRequest('node?nodeServices=' + nodeServices, 'GET', null);
|
|
382
382
|
};
|
|
383
383
|
this.getPrivateNodeInfo = async (orgId) => {
|
|
384
384
|
return this.makeRequest(`organization/${orgId}/nodes`, 'GET', null);
|
|
@@ -919,6 +919,78 @@ class ApiClient {
|
|
|
919
919
|
const result = await this.makeRequest('credits/stats/monthly', 'GET', query ?? null);
|
|
920
920
|
return result;
|
|
921
921
|
};
|
|
922
|
+
// ====================================================================
|
|
923
|
+
// V2 Dashboard Statistics API
|
|
924
|
+
// ====================================================================
|
|
925
|
+
// ---- Storage Gateway ----
|
|
926
|
+
/** GET /v2/stats/storage — Time-series for storage gateway metrics. */
|
|
927
|
+
this.getStorageGatewayStats = async (params) => {
|
|
928
|
+
return this.makeRequest('v2/stats/storage', 'GET', params);
|
|
929
|
+
};
|
|
930
|
+
/**
|
|
931
|
+
* GET /v2/stats/storage/breakdown/{by} — Storage breakdown by dimension.
|
|
932
|
+
* Use `by = 'providers'` for the provider breakdown which returns protocol/endpoint metadata.
|
|
933
|
+
*/
|
|
934
|
+
this.getStorageGatewayBreakdown = async (by, params) => {
|
|
935
|
+
return this.makeRequest(`v2/stats/storage/breakdown/${by}`, 'GET', params);
|
|
936
|
+
};
|
|
937
|
+
/** GET /v2/stats/storage/breakdown/providers — Includes protocol, provider, endpoint. */
|
|
938
|
+
this.getStorageGatewayProviderBreakdown = async (params) => {
|
|
939
|
+
return this.makeRequest('v2/stats/storage/breakdown/providers', 'GET', params);
|
|
940
|
+
};
|
|
941
|
+
// ---- AI Gateway ----
|
|
942
|
+
/** GET /v2/stats/ai — Time-series for AI gateway metrics (excludes Private Chat). */
|
|
943
|
+
this.getAiGatewayStats = async (params) => {
|
|
944
|
+
return this.makeRequest('v2/stats/ai', 'GET', params);
|
|
945
|
+
};
|
|
946
|
+
/** GET /v2/stats/ai/breakdown/{by} — AI breakdown by dimension. */
|
|
947
|
+
this.getAiGatewayBreakdown = async (by, params) => {
|
|
948
|
+
return this.makeRequest(`v2/stats/ai/breakdown/${by}`, 'GET', params);
|
|
949
|
+
};
|
|
950
|
+
// ---- Private Chat ----
|
|
951
|
+
/**
|
|
952
|
+
* GET /v2/stats/private-chat — Time-series for private-chat metrics.
|
|
953
|
+
* Supports resource-level filters: `model` and `userId`.
|
|
954
|
+
*/
|
|
955
|
+
this.getPrivateChatStats = async (params) => {
|
|
956
|
+
return this.makeRequest('v2/stats/private-chat', 'GET', params);
|
|
957
|
+
};
|
|
958
|
+
/** GET /v2/stats/private-chat/breakdown/models — Model breakdown with optional series. */
|
|
959
|
+
this.getPrivateChatModelsBreakdown = async (params) => {
|
|
960
|
+
return this.makeRequest('v2/stats/private-chat/breakdown/models', 'GET', params);
|
|
961
|
+
};
|
|
962
|
+
/**
|
|
963
|
+
* GET /v2/stats/private-chat/breakdown/users — Per-user totals + optional series.
|
|
964
|
+
* Returns conversationsCount and lastActiveAt per user.
|
|
965
|
+
*/
|
|
966
|
+
this.getPrivateChatUsersBreakdown = async (params) => {
|
|
967
|
+
return this.makeRequest('v2/stats/private-chat/breakdown/users', 'GET', params);
|
|
968
|
+
};
|
|
969
|
+
// ---- Policies ----
|
|
970
|
+
/**
|
|
971
|
+
* GET /v2/stats/policies — Time-series of policy enforcement + token overhead.
|
|
972
|
+
* Supports resource-level filter: `ruleId`.
|
|
973
|
+
*/
|
|
974
|
+
this.getPolicyStats = async (params) => {
|
|
975
|
+
return this.makeRequest('v2/stats/policies', 'GET', params);
|
|
976
|
+
};
|
|
977
|
+
/** GET /v2/stats/policies/tokens — Dedicated policy-token consumption time-series. */
|
|
978
|
+
this.getPolicyTokenStats = async (params) => {
|
|
979
|
+
return this.makeRequest('v2/stats/policies/tokens', 'GET', params);
|
|
980
|
+
};
|
|
981
|
+
/** GET /v2/stats/policies/breakdown/{by} — Policy breakdown by rules or users. */
|
|
982
|
+
this.getPolicyBreakdown = async (by, params) => {
|
|
983
|
+
return this.makeRequest(`v2/stats/policies/breakdown/${by}`, 'GET', params);
|
|
984
|
+
};
|
|
985
|
+
// ---- Credits ----
|
|
986
|
+
/** GET /v2/stats/credits — Credit consumption/grant time-series. */
|
|
987
|
+
this.getCreditStats = async (params) => {
|
|
988
|
+
return this.makeRequest('v2/stats/credits', 'GET', params);
|
|
989
|
+
};
|
|
990
|
+
/** GET /v2/stats/credits/breakdown/{by} — Credit breakdown by dimension. */
|
|
991
|
+
this.getCreditBreakdown = async (by, params) => {
|
|
992
|
+
return this.makeRequest(`v2/stats/credits/breakdown/${by}`, 'GET', params);
|
|
993
|
+
};
|
|
922
994
|
this.baseURL = baseURL;
|
|
923
995
|
this.headers = {};
|
|
924
996
|
this.debug = false;
|
package/dist/api/index.d.ts
CHANGED
|
@@ -23,4 +23,5 @@ import * as ConversationTypes from './types/ai/conversation';
|
|
|
23
23
|
import * as AiStatsTypes from './types/ai/stats';
|
|
24
24
|
import * as LinksTypes from './types/platform/links';
|
|
25
25
|
import * as CreditsTypes from './types/platform/credits';
|
|
26
|
-
|
|
26
|
+
import * as DashboardStatsTypes from './types/dashboard/stats';
|
|
27
|
+
export { ApiClient, ApiTypes, AuthTypes, StatsTypes, ApiInterfaces, HttpError, BridgeTypes, EmailTypes, QuotaTypes, SubscriptionTypes, DeviceTypes, MFATypes, SettingsTypes, RolesTypes, WorkspaceTypes, OrganizationTypes, NodeRegistrationTypes, SystemEventTypes, UserTypes, AiApiKeyTypes, AiLlmTypes, PolicyTypes, ConversationTypes, AiStatsTypes, LinksTypes, CreditsTypes, DashboardStatsTypes };
|
package/dist/api/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.CreditsTypes = exports.LinksTypes = exports.AiStatsTypes = exports.ConversationTypes = exports.PolicyTypes = exports.AiLlmTypes = exports.AiApiKeyTypes = exports.UserTypes = exports.SystemEventTypes = exports.NodeRegistrationTypes = exports.OrganizationTypes = exports.WorkspaceTypes = exports.RolesTypes = exports.SettingsTypes = exports.MFATypes = exports.DeviceTypes = exports.SubscriptionTypes = exports.QuotaTypes = exports.EmailTypes = exports.BridgeTypes = exports.HttpError = exports.ApiInterfaces = exports.StatsTypes = exports.AuthTypes = exports.ApiTypes = exports.ApiClient = void 0;
|
|
36
|
+
exports.DashboardStatsTypes = exports.CreditsTypes = exports.LinksTypes = exports.AiStatsTypes = exports.ConversationTypes = exports.PolicyTypes = exports.AiLlmTypes = exports.AiApiKeyTypes = exports.UserTypes = exports.SystemEventTypes = exports.NodeRegistrationTypes = exports.OrganizationTypes = exports.WorkspaceTypes = exports.RolesTypes = exports.SettingsTypes = exports.MFATypes = exports.DeviceTypes = exports.SubscriptionTypes = exports.QuotaTypes = exports.EmailTypes = exports.BridgeTypes = exports.HttpError = exports.ApiInterfaces = exports.StatsTypes = exports.AuthTypes = exports.ApiTypes = exports.ApiClient = void 0;
|
|
37
37
|
const client_1 = require("./client");
|
|
38
38
|
Object.defineProperty(exports, "ApiClient", { enumerable: true, get: function () { return client_1.ApiClient; } });
|
|
39
39
|
Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return client_1.HttpError; } });
|
|
@@ -85,3 +85,5 @@ const LinksTypes = __importStar(require("./types/platform/links"));
|
|
|
85
85
|
exports.LinksTypes = LinksTypes;
|
|
86
86
|
const CreditsTypes = __importStar(require("./types/platform/credits"));
|
|
87
87
|
exports.CreditsTypes = CreditsTypes;
|
|
88
|
+
const DashboardStatsTypes = __importStar(require("./types/dashboard/stats"));
|
|
89
|
+
exports.DashboardStatsTypes = DashboardStatsTypes;
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dashboard Statistics API – V2 Unified Interface
|
|
3
|
+
*
|
|
4
|
+
* Shared request/response DTOs for all dashboard statistics endpoints:
|
|
5
|
+
* Storage Gateway, AI Gateway, Private Chat, Policies, Credits.
|
|
6
|
+
*
|
|
7
|
+
* Naming conventions (standardised across all endpoints):
|
|
8
|
+
* - "requests" – operation counts (never "apiCalls")
|
|
9
|
+
* - "tokensIn/Out" – base model token usage
|
|
10
|
+
* - "policyTokensIn/Out" – overhead from policy-evaluation LLMs
|
|
11
|
+
* - "latencyMs" – weighted-average latency across bridge nodes
|
|
12
|
+
*/
|
|
13
|
+
export type DashboardScope = 'org' | 'workspace' | 'repo';
|
|
14
|
+
export type DashboardWindow = '24h' | '7d' | '30d' | '90d' | '180d' | '365d';
|
|
15
|
+
export type DashboardTimeBucketSize = '5m' | '10m' | '1h' | '6h' | '12h' | '1d';
|
|
16
|
+
export type StorageBreakdownBy = 'workspaces' | 'repos' | 'buckets' | 'providers' | 'nodes';
|
|
17
|
+
export type AiBreakdownBy = 'workspaces' | 'repos' | 'models' | 'providers' | 'nodes';
|
|
18
|
+
export type PrivateChatBreakdownBy = 'models' | 'users';
|
|
19
|
+
export type PolicyBreakdownBy = 'rules' | 'users';
|
|
20
|
+
export type CreditBreakdownBy = 'workspaces' | 'repos' | 'models' | 'providers' | 'buckets';
|
|
21
|
+
/** Standard statistical summary computed over the returned time-bucket values. */
|
|
22
|
+
export interface SummaryStats {
|
|
23
|
+
total: number;
|
|
24
|
+
avg: number;
|
|
25
|
+
stdDev: number;
|
|
26
|
+
min: number;
|
|
27
|
+
max: number;
|
|
28
|
+
p10: number;
|
|
29
|
+
p50: number;
|
|
30
|
+
p90: number;
|
|
31
|
+
}
|
|
32
|
+
/** Metadata returned with every time-series response. */
|
|
33
|
+
export interface TimeSeriesMeta {
|
|
34
|
+
start: number;
|
|
35
|
+
end: number;
|
|
36
|
+
scope: DashboardScope;
|
|
37
|
+
scopeId?: string;
|
|
38
|
+
window: DashboardWindow;
|
|
39
|
+
timeBucketSize: DashboardTimeBucketSize;
|
|
40
|
+
resourceFilter?: {
|
|
41
|
+
type: 'bucket' | 'model' | 'user' | 'node' | 'rule';
|
|
42
|
+
id: string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** Metadata returned with every breakdown response. */
|
|
46
|
+
export interface BreakdownMeta {
|
|
47
|
+
start: number;
|
|
48
|
+
end: number;
|
|
49
|
+
scope: DashboardScope;
|
|
50
|
+
scopeId?: string;
|
|
51
|
+
breakdownBy: string;
|
|
52
|
+
includesSeries: boolean;
|
|
53
|
+
limit: number;
|
|
54
|
+
offset: number;
|
|
55
|
+
totalEntities: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Standard time-series response.
|
|
59
|
+
* `TPoint` carries per-bucket metric fields **plus** `ts` (and optional `entityId`).
|
|
60
|
+
*/
|
|
61
|
+
export interface TimeSeriesResponse<TPoint> {
|
|
62
|
+
success: boolean;
|
|
63
|
+
meta: TimeSeriesMeta;
|
|
64
|
+
summary: SummaryStats;
|
|
65
|
+
series: TPoint[];
|
|
66
|
+
message?: string;
|
|
67
|
+
error_code?: string;
|
|
68
|
+
}
|
|
69
|
+
/** A single entity inside a breakdown response. */
|
|
70
|
+
export interface BreakdownEntity<TTotals> {
|
|
71
|
+
entityId: string;
|
|
72
|
+
entityName?: string;
|
|
73
|
+
totals: TTotals;
|
|
74
|
+
series?: Array<{
|
|
75
|
+
ts: number;
|
|
76
|
+
} & TTotals>;
|
|
77
|
+
}
|
|
78
|
+
/** Standard breakdown response. */
|
|
79
|
+
export interface BreakdownResponse<TTotals> {
|
|
80
|
+
success: boolean;
|
|
81
|
+
meta: BreakdownMeta;
|
|
82
|
+
summary: {
|
|
83
|
+
total: number;
|
|
84
|
+
};
|
|
85
|
+
entities: BreakdownEntity<TTotals>[];
|
|
86
|
+
message?: string;
|
|
87
|
+
error_code?: string;
|
|
88
|
+
}
|
|
89
|
+
/** Base query parameters shared by all main time-series endpoints. */
|
|
90
|
+
export interface DashboardStatsQueryParams {
|
|
91
|
+
scope: DashboardScope;
|
|
92
|
+
id?: string;
|
|
93
|
+
window: DashboardWindow;
|
|
94
|
+
}
|
|
95
|
+
/** Base query parameters shared by all breakdown endpoints. */
|
|
96
|
+
export interface DashboardBreakdownQueryParams {
|
|
97
|
+
scope?: DashboardScope;
|
|
98
|
+
id?: string;
|
|
99
|
+
window: DashboardWindow;
|
|
100
|
+
includeSeries?: boolean;
|
|
101
|
+
limit?: number;
|
|
102
|
+
offset?: number;
|
|
103
|
+
}
|
|
104
|
+
export interface StorageMetrics {
|
|
105
|
+
uplBytes: number;
|
|
106
|
+
dwlBytes: number;
|
|
107
|
+
sizeChange: number;
|
|
108
|
+
latencyMs: number;
|
|
109
|
+
requests: number;
|
|
110
|
+
}
|
|
111
|
+
export interface StorageTimeSeriesPoint extends StorageMetrics {
|
|
112
|
+
ts: number;
|
|
113
|
+
entityId?: string;
|
|
114
|
+
}
|
|
115
|
+
/** GET /v2/stats/storage?scope=...&id=...&window=...&bucketId=... */
|
|
116
|
+
export interface StorageStatsQueryParams extends DashboardStatsQueryParams {
|
|
117
|
+
bucketId?: string;
|
|
118
|
+
}
|
|
119
|
+
export type StorageTimeSeriesResponse = TimeSeriesResponse<StorageTimeSeriesPoint>;
|
|
120
|
+
export type StorageBreakdownResponse = BreakdownResponse<StorageMetrics>;
|
|
121
|
+
/** Specialised entity for the storage-provider breakdown (protocol + endpoint). */
|
|
122
|
+
export interface StorageProviderEntity extends BreakdownEntity<StorageMetrics> {
|
|
123
|
+
protocol?: string;
|
|
124
|
+
provider?: string;
|
|
125
|
+
endpoint?: string;
|
|
126
|
+
}
|
|
127
|
+
export interface StorageProviderBreakdownResponse {
|
|
128
|
+
success: boolean;
|
|
129
|
+
meta: BreakdownMeta;
|
|
130
|
+
summary: {
|
|
131
|
+
total: number;
|
|
132
|
+
};
|
|
133
|
+
entities: StorageProviderEntity[];
|
|
134
|
+
message?: string;
|
|
135
|
+
error_code?: string;
|
|
136
|
+
}
|
|
137
|
+
export interface AiGatewayMetrics {
|
|
138
|
+
tokensIn: number;
|
|
139
|
+
tokensOut: number;
|
|
140
|
+
policyTokensIn: number;
|
|
141
|
+
policyTokensOut: number;
|
|
142
|
+
requests: number;
|
|
143
|
+
activeConversations: number;
|
|
144
|
+
latencyMs: number;
|
|
145
|
+
}
|
|
146
|
+
export interface AiGatewayTimeSeriesPoint extends AiGatewayMetrics {
|
|
147
|
+
ts: number;
|
|
148
|
+
entityId?: string;
|
|
149
|
+
}
|
|
150
|
+
/** GET /v2/stats/ai?scope=...&id=...&window=...&model=... */
|
|
151
|
+
export interface AiGatewayStatsQueryParams extends DashboardStatsQueryParams {
|
|
152
|
+
model?: string;
|
|
153
|
+
}
|
|
154
|
+
export type AiGatewayTimeSeriesResponse = TimeSeriesResponse<AiGatewayTimeSeriesPoint>;
|
|
155
|
+
export type AiGatewayBreakdownResponse = BreakdownResponse<AiGatewayMetrics>;
|
|
156
|
+
export interface PrivateChatMetrics {
|
|
157
|
+
tokensIn: number;
|
|
158
|
+
tokensOut: number;
|
|
159
|
+
requests: number;
|
|
160
|
+
}
|
|
161
|
+
export interface PrivateChatTimeSeriesPoint extends PrivateChatMetrics {
|
|
162
|
+
ts: number;
|
|
163
|
+
entityId?: string;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* GET /v2/stats/private-chat?scope=...&id=...&window=...&model=...&userId=...
|
|
167
|
+
*
|
|
168
|
+
* `model` and `userId` are resource-level filters that narrow the time-series
|
|
169
|
+
* to a single model or user respectively.
|
|
170
|
+
*/
|
|
171
|
+
export interface PrivateChatStatsQueryParams extends DashboardStatsQueryParams {
|
|
172
|
+
model?: string;
|
|
173
|
+
userId?: string;
|
|
174
|
+
}
|
|
175
|
+
export type PrivateChatTimeSeriesResponse = TimeSeriesResponse<PrivateChatTimeSeriesPoint>;
|
|
176
|
+
export type PrivateChatModelBreakdownResponse = BreakdownResponse<PrivateChatMetrics>;
|
|
177
|
+
/** Extended totals returned for users (includes conversation metadata). */
|
|
178
|
+
export interface PrivateChatUserTotals extends PrivateChatMetrics {
|
|
179
|
+
conversationsCount: number;
|
|
180
|
+
lastActiveAt?: number;
|
|
181
|
+
}
|
|
182
|
+
export interface PrivateChatUserEntity {
|
|
183
|
+
entityId: string;
|
|
184
|
+
entityName?: string;
|
|
185
|
+
totals: PrivateChatUserTotals;
|
|
186
|
+
series?: Array<{
|
|
187
|
+
ts: number;
|
|
188
|
+
} & PrivateChatMetrics>;
|
|
189
|
+
}
|
|
190
|
+
export interface PrivateChatUsersBreakdownResponse {
|
|
191
|
+
success: boolean;
|
|
192
|
+
meta: BreakdownMeta;
|
|
193
|
+
summary: {
|
|
194
|
+
total: number;
|
|
195
|
+
};
|
|
196
|
+
entities: PrivateChatUserEntity[];
|
|
197
|
+
message?: string;
|
|
198
|
+
error_code?: string;
|
|
199
|
+
}
|
|
200
|
+
export interface PolicyEnforcementMetrics {
|
|
201
|
+
violations: number;
|
|
202
|
+
alerts: number;
|
|
203
|
+
blocks: number;
|
|
204
|
+
severityLow: number;
|
|
205
|
+
severityMedium: number;
|
|
206
|
+
severityHigh: number;
|
|
207
|
+
}
|
|
208
|
+
export interface PolicyTokenMetrics {
|
|
209
|
+
policyTokensIn: number;
|
|
210
|
+
policyTokensOut: number;
|
|
211
|
+
}
|
|
212
|
+
export interface PolicyMetrics extends PolicyEnforcementMetrics, PolicyTokenMetrics {
|
|
213
|
+
}
|
|
214
|
+
export interface PolicyTimeSeriesPoint extends PolicyMetrics {
|
|
215
|
+
ts: number;
|
|
216
|
+
entityId?: string;
|
|
217
|
+
}
|
|
218
|
+
/** GET /v2/stats/policies?scope=...&id=...&window=...&ruleId=... */
|
|
219
|
+
export interface PolicyStatsQueryParams extends DashboardStatsQueryParams {
|
|
220
|
+
ruleId?: string;
|
|
221
|
+
}
|
|
222
|
+
export type PolicyTimeSeriesResponse = TimeSeriesResponse<PolicyTimeSeriesPoint>;
|
|
223
|
+
/**
|
|
224
|
+
* Dedicated policy-token time-series endpoint:
|
|
225
|
+
* GET /v2/stats/policies/tokens?scope=...&id=...&window=...
|
|
226
|
+
*/
|
|
227
|
+
export interface PolicyTokenTimeSeriesPoint extends PolicyTokenMetrics {
|
|
228
|
+
ts: number;
|
|
229
|
+
}
|
|
230
|
+
export type PolicyTokenTimeSeriesResponse = TimeSeriesResponse<PolicyTokenTimeSeriesPoint>;
|
|
231
|
+
export type PolicyBreakdownResponse = BreakdownResponse<PolicyEnforcementMetrics>;
|
|
232
|
+
export interface CreditMetrics {
|
|
233
|
+
creditsAi: number;
|
|
234
|
+
creditsStorage: number;
|
|
235
|
+
creditsTotal: number;
|
|
236
|
+
creditsPurchased: number;
|
|
237
|
+
creditsGranted: number;
|
|
238
|
+
}
|
|
239
|
+
export interface CreditTimeSeriesPoint extends CreditMetrics {
|
|
240
|
+
ts: number;
|
|
241
|
+
entityId?: string;
|
|
242
|
+
}
|
|
243
|
+
/** GET /v2/stats/credits?scope=...&id=...&window=... */
|
|
244
|
+
export type CreditStatsQueryParams = DashboardStatsQueryParams;
|
|
245
|
+
export type CreditTimeSeriesResponse = TimeSeriesResponse<CreditTimeSeriesPoint>;
|
|
246
|
+
export type CreditBreakdownResponse = BreakdownResponse<CreditMetrics>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Dashboard Statistics API – V2 Unified Interface
|
|
4
|
+
*
|
|
5
|
+
* Shared request/response DTOs for all dashboard statistics endpoints:
|
|
6
|
+
* Storage Gateway, AI Gateway, Private Chat, Policies, Credits.
|
|
7
|
+
*
|
|
8
|
+
* Naming conventions (standardised across all endpoints):
|
|
9
|
+
* - "requests" – operation counts (never "apiCalls")
|
|
10
|
+
* - "tokensIn/Out" – base model token usage
|
|
11
|
+
* - "policyTokensIn/Out" – overhead from policy-evaluation LLMs
|
|
12
|
+
* - "latencyMs" – weighted-average latency across bridge nodes
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -52,10 +52,17 @@ export interface NodeInfo {
|
|
|
52
52
|
lastUpdated: string;
|
|
53
53
|
url: string;
|
|
54
54
|
id_org?: string;
|
|
55
|
+
nodeServices: number;
|
|
55
56
|
}
|
|
56
57
|
export interface NodeInfoResponse {
|
|
57
58
|
success: true;
|
|
58
59
|
data: NodeInfo[];
|
|
59
60
|
total: number;
|
|
60
61
|
}
|
|
62
|
+
export declare enum ServiceFlag {
|
|
63
|
+
SERVICE_FLAG_NONE = 0,
|
|
64
|
+
SERVICE_FLAG_STORAGE = 1,
|
|
65
|
+
SERVICE_FLAG_AILLM = 2,
|
|
66
|
+
SERVICE_FLAG_CHAT = 4
|
|
67
|
+
}
|
|
61
68
|
export {};
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NodeStatusType = void 0;
|
|
3
|
+
exports.ServiceFlag = exports.NodeStatusType = void 0;
|
|
4
4
|
var NodeStatusType;
|
|
5
5
|
(function (NodeStatusType) {
|
|
6
6
|
NodeStatusType["ONLINE"] = "ONLINE";
|
|
7
7
|
NodeStatusType["OFFLINE"] = "OFFLINE";
|
|
8
8
|
NodeStatusType["DISCONNECTED"] = "DISCONNECTED";
|
|
9
9
|
})(NodeStatusType || (exports.NodeStatusType = NodeStatusType = {}));
|
|
10
|
+
var ServiceFlag;
|
|
11
|
+
(function (ServiceFlag) {
|
|
12
|
+
ServiceFlag[ServiceFlag["SERVICE_FLAG_NONE"] = 0] = "SERVICE_FLAG_NONE";
|
|
13
|
+
ServiceFlag[ServiceFlag["SERVICE_FLAG_STORAGE"] = 1] = "SERVICE_FLAG_STORAGE";
|
|
14
|
+
ServiceFlag[ServiceFlag["SERVICE_FLAG_AILLM"] = 2] = "SERVICE_FLAG_AILLM";
|
|
15
|
+
ServiceFlag[ServiceFlag["SERVICE_FLAG_CHAT"] = 4] = "SERVICE_FLAG_CHAT";
|
|
16
|
+
})(ServiceFlag || (exports.ServiceFlag = ServiceFlag = {}));
|