@agentmark-ai/api-types 0.5.0 → 0.7.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/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # @agentmark-ai/api-types
2
+
3
+ Shared API contract types (analytics service, traces, scores, experiments)
4
+ used by the AgentMark CLI dev server and the AgentMark platform.
5
+
6
+ Looking for the public wire contract (Zod schemas, error envelope)? That is
7
+ [`@agentmark-ai/api-schemas`](https://www.npmjs.com/package/@agentmark-ai/api-schemas).
package/dist/types.d.ts CHANGED
@@ -301,7 +301,11 @@ export interface TracesParams extends PaginationParams {
301
301
  name?: string;
302
302
  tags?: string[];
303
303
  commitSha?: string;
304
- filters?: AnalyticsFilter[];
304
+ /**
305
+ * AND of leaves and one-level OR-groups (see {@link AnalyticsFilterNode}).
306
+ * Plain `AnalyticsFilter[]` callers keep working unchanged.
307
+ */
308
+ filters?: AnalyticsFilterNode[];
305
309
  sortBy?: string;
306
310
  sortOrder?: 'asc' | 'desc';
307
311
  /** Single-env scoping per FR-031/FR-051. Undefined = no env filter. */
@@ -626,6 +630,12 @@ export interface ScoresParams extends Partial<PaginationParams> {
626
630
  sessionId?: string;
627
631
  startDate?: string;
628
632
  endDate?: string;
633
+ /**
634
+ * Structured filters over scores-table fields (name, score, source,
635
+ * user_id, resource_id, created_at) — AND of leaves and one-level
636
+ * OR-groups. Ignored by resource-keyed lookups (`resourceId` set).
637
+ */
638
+ filters?: AnalyticsFilterNode[];
629
639
  /** Single-env scoping per FR-031/FR-051/FR-109. Undefined = no env filter. */
630
640
  environment?: EnvironmentScope;
631
641
  /** Env-name allow-list from a saved filter (FR-122..FR-124). */
@@ -764,6 +774,24 @@ export interface AnalyticsFilter {
764
774
  operator: string;
765
775
  value: string | string[];
766
776
  }
777
+ /**
778
+ * Disjunction of leaf predicates — matches rows satisfying ANY member.
779
+ * One level deep by design: a filter list is an AND of leaves and OR-groups
780
+ * (conjunctive normal form); members are always leaves, never nested groups.
781
+ */
782
+ export interface AnalyticsFilterOrGroup {
783
+ or: AnalyticsFilter[];
784
+ }
785
+ /**
786
+ * One element of a filter list: a leaf predicate or an OR-group.
787
+ * `AnalyticsFilter[]` stays assignable wherever `AnalyticsFilterNode[]` is
788
+ * accepted, so existing AND-only callers are unaffected.
789
+ */
790
+ export type AnalyticsFilterNode = AnalyticsFilter | AnalyticsFilterOrGroup;
791
+ /**
792
+ * Type guard for OR-group nodes in a filter list.
793
+ */
794
+ export declare function isAnalyticsFilterOrGroup(node: AnalyticsFilterNode): node is AnalyticsFilterOrGroup;
767
795
  /**
768
796
  * Supported filter fields for metrics queries.
769
797
  */
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,21 +1,21 @@
1
1
  {
2
2
  "name": "@agentmark-ai/api-types",
3
- "version": "0.5.0",
4
- "description": "Shared API contract types for AgentMark services",
3
+ "version": "0.7.0",
4
+ "description": "Shared API contract types (analytics service, traces, scores) used by the AgentMark CLI dev server and platform. For the public wire schemas use @agentmark-ai/api-schemas.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
- "files": [
8
- "dist"
9
- ],
10
7
  "publishConfig": {
11
8
  "access": "public"
12
9
  },
10
+ "files": [
11
+ "dist"
12
+ ],
13
13
  "scripts": {
14
14
  "build": "tsc -p tsconfig.build.json",
15
15
  "clean": "rm -rf dist"
16
16
  },
17
17
  "dependencies": {
18
- "@agentmark-ai/api-schemas": "0.4.0"
18
+ "@agentmark-ai/api-schemas": "0.6.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "typescript": "^5.5.3"