@agentmark-ai/api-types 0.4.0 → 0.6.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/types.d.ts +65 -1
- package/dist/types.js +7 -0
- package/package.json +2 -2
package/dist/types.d.ts
CHANGED
|
@@ -99,6 +99,42 @@ export interface ModelStats {
|
|
|
99
99
|
export interface ModelStatsResponse {
|
|
100
100
|
models: ModelStats[];
|
|
101
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Aggregates for one (promptName, commitSha) pair — the per-version metrics
|
|
104
|
+
* behind prompt-version trace linking. `commitSha` is `''` for spans ingested
|
|
105
|
+
* before version stamping (or from paths with no commit to stamp).
|
|
106
|
+
*/
|
|
107
|
+
export interface PromptVersionStats {
|
|
108
|
+
promptName: string;
|
|
109
|
+
commitSha: string;
|
|
110
|
+
requests: number;
|
|
111
|
+
errorCount: number;
|
|
112
|
+
errorRate: number;
|
|
113
|
+
cost: number;
|
|
114
|
+
tokens: number;
|
|
115
|
+
avgLatencyMs: number;
|
|
116
|
+
/** Average score across all scores attached to this version's traces; null when unscored. */
|
|
117
|
+
avgScore: number | null;
|
|
118
|
+
/** Number of score rows behind `avgScore`. */
|
|
119
|
+
scoreCount: number;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Parameters for the per-prompt-version stats query.
|
|
123
|
+
*/
|
|
124
|
+
export interface PromptVersionStatsParams {
|
|
125
|
+
/** Restrict to a single prompt name. Omit for all prompts. */
|
|
126
|
+
promptName?: string;
|
|
127
|
+
/** Max number of (prompt, version) rows returned. */
|
|
128
|
+
limit?: number;
|
|
129
|
+
/** Single-env scoping. Mirrors ScoresParams. Undefined = no env filter. */
|
|
130
|
+
env?: EnvironmentQueryScope;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Response for the per-prompt-version stats query.
|
|
134
|
+
*/
|
|
135
|
+
export interface PromptVersionStatsResponse {
|
|
136
|
+
versions: PromptVersionStats[];
|
|
137
|
+
}
|
|
102
138
|
/**
|
|
103
139
|
* A single ranking item for dimension-grouped queries.
|
|
104
140
|
* Used by getRankingData to return data grouped by any dimension
|
|
@@ -265,7 +301,11 @@ export interface TracesParams extends PaginationParams {
|
|
|
265
301
|
name?: string;
|
|
266
302
|
tags?: string[];
|
|
267
303
|
commitSha?: string;
|
|
268
|
-
|
|
304
|
+
/**
|
|
305
|
+
* AND of leaves and one-level OR-groups (see {@link AnalyticsFilterNode}).
|
|
306
|
+
* Plain `AnalyticsFilter[]` callers keep working unchanged.
|
|
307
|
+
*/
|
|
308
|
+
filters?: AnalyticsFilterNode[];
|
|
269
309
|
sortBy?: string;
|
|
270
310
|
sortOrder?: 'asc' | 'desc';
|
|
271
311
|
/** Single-env scoping per FR-031/FR-051. Undefined = no env filter. */
|
|
@@ -728,6 +768,24 @@ export interface AnalyticsFilter {
|
|
|
728
768
|
operator: string;
|
|
729
769
|
value: string | string[];
|
|
730
770
|
}
|
|
771
|
+
/**
|
|
772
|
+
* Disjunction of leaf predicates — matches rows satisfying ANY member.
|
|
773
|
+
* One level deep by design: a filter list is an AND of leaves and OR-groups
|
|
774
|
+
* (conjunctive normal form); members are always leaves, never nested groups.
|
|
775
|
+
*/
|
|
776
|
+
export interface AnalyticsFilterOrGroup {
|
|
777
|
+
or: AnalyticsFilter[];
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* One element of a filter list: a leaf predicate or an OR-group.
|
|
781
|
+
* `AnalyticsFilter[]` stays assignable wherever `AnalyticsFilterNode[]` is
|
|
782
|
+
* accepted, so existing AND-only callers are unaffected.
|
|
783
|
+
*/
|
|
784
|
+
export type AnalyticsFilterNode = AnalyticsFilter | AnalyticsFilterOrGroup;
|
|
785
|
+
/**
|
|
786
|
+
* Type guard for OR-group nodes in a filter list.
|
|
787
|
+
*/
|
|
788
|
+
export declare function isAnalyticsFilterOrGroup(node: AnalyticsFilterNode): node is AnalyticsFilterOrGroup;
|
|
731
789
|
/**
|
|
732
790
|
* Supported filter fields for metrics queries.
|
|
733
791
|
*/
|
|
@@ -842,6 +900,12 @@ export interface IAnalyticsService {
|
|
|
842
900
|
getMetrics(ctx: TenantContext, dateRange: DateRange, filters?: AnalyticsFilter[], env?: EnvironmentQueryScope): Promise<MetricsResponse>;
|
|
843
901
|
getExtendedMetrics(ctx: TenantContext, dateRange: DateRange, env?: EnvironmentQueryScope): Promise<ExtendedMetricsResponse>;
|
|
844
902
|
getModelStats(ctx: TenantContext, dateRange: DateRange, limit?: number, filters?: AnalyticsFilter[], env?: EnvironmentQueryScope): Promise<ModelStatsResponse>;
|
|
903
|
+
/**
|
|
904
|
+
* Per (promptName, commitSha) aggregates — prompt-version trace linking.
|
|
905
|
+
* Optional so existing implementers (e.g. the CLI's local service) remain
|
|
906
|
+
* source-compatible; the cloud AnalyticsService implements it.
|
|
907
|
+
*/
|
|
908
|
+
getPromptVersionStats?(ctx: TenantContext, dateRange: DateRange, params?: PromptVersionStatsParams): Promise<PromptVersionStatsResponse>;
|
|
845
909
|
getTraces(ctx: TenantContext, params: TracesParams): Promise<TracesResponse>;
|
|
846
910
|
getTraceDetail(ctx: TenantContext, traceId: string, env?: EnvironmentQueryScope): Promise<TraceDetail | null>;
|
|
847
911
|
getTraceDetailLightweight(ctx: TenantContext, traceId: string, env?: EnvironmentQueryScope): Promise<TraceDetail | null>;
|
package/dist/types.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.isFilterConfigV2 = isFilterConfigV2;
|
|
11
11
|
exports.isViewConfigV3 = isViewConfigV3;
|
|
12
|
+
exports.isAnalyticsFilterOrGroup = isAnalyticsFilterOrGroup;
|
|
12
13
|
/**
|
|
13
14
|
* Type guard for v2 saved filter configs.
|
|
14
15
|
*/
|
|
@@ -21,3 +22,9 @@ function isFilterConfigV2(config) {
|
|
|
21
22
|
function isViewConfigV3(config) {
|
|
22
23
|
return 'version' in config && config.version === 3;
|
|
23
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Type guard for OR-group nodes in a filter list.
|
|
27
|
+
*/
|
|
28
|
+
function isAnalyticsFilterOrGroup(node) {
|
|
29
|
+
return typeof node === 'object' && node !== null && Array.isArray(node.or);
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentmark-ai/api-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Shared API contract types for AgentMark services",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"clean": "rm -rf dist"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@agentmark-ai/api-schemas": "0.
|
|
18
|
+
"@agentmark-ai/api-schemas": "0.5.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"typescript": "^5.5.3"
|