@thinkai/tai-api-contract 2.22.0 → 2.23.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.
@@ -45,6 +45,27 @@ export interface paths {
45
45
  patch?: never;
46
46
  trace?: never;
47
47
  };
48
+ "/admin/readiness/token-usage/by-dimension": {
49
+ parameters: {
50
+ query?: never;
51
+ header?: never;
52
+ path?: never;
53
+ cookie?: never;
54
+ };
55
+ /**
56
+ * Token usage grouped by operation type and dimension
57
+ * @description Returns token consumption aggregated across all runs, grouped by `(operation, dimensionId)`. Analysis runs contribute per-dimension rows written by the readiness worker; fix runs contribute their existing per-criterion rows. Results are ordered by `operation` then `dimensionId`.
58
+ * **Authorization:** Bearer JWT required. Caller email must appear in `PLATFORM_ADMIN_EMAILS`.
59
+ */
60
+ get: operations["adminListReadinessTokenUsageByDimension"];
61
+ put?: never;
62
+ post?: never;
63
+ delete?: never;
64
+ options?: never;
65
+ head?: never;
66
+ patch?: never;
67
+ trace?: never;
68
+ };
48
69
  "/me": {
49
70
  parameters: {
50
71
  query?: never;
@@ -3647,6 +3668,60 @@ export interface components {
3647
3668
  */
3648
3669
  createdAt: string;
3649
3670
  };
3671
+ ReadinessTokenUsageByDimensionRowDto: {
3672
+ /**
3673
+ * Format: uuid
3674
+ * @description Workspace that owns the runs.
3675
+ */
3676
+ workspaceId: string;
3677
+ /** @description Repository slug (e.g. `owner/repo`). */
3678
+ providerSlug: string;
3679
+ /**
3680
+ * @description Operation type — analysis or fix.
3681
+ * @enum {string}
3682
+ */
3683
+ operation: "readiness_analysis" | "readiness_fix";
3684
+ /** @description Readiness dimension identifier. */
3685
+ dimensionId: string;
3686
+ /** @description Total primary Cursor Agent invocations across all runs. */
3687
+ totalInvocationCount: number;
3688
+ /** @description Total retry invocations across all runs. */
3689
+ totalRetryInvocationCount: number;
3690
+ /**
3691
+ * Format: int64
3692
+ * @description Sum of input tokens across all runs for this operation+dimension.
3693
+ */
3694
+ totalInputTokens: number;
3695
+ /**
3696
+ * Format: int64
3697
+ * @description Sum of output tokens across all runs.
3698
+ */
3699
+ totalOutputTokens: number;
3700
+ /**
3701
+ * Format: int64
3702
+ * @description Sum of cache-read tokens across all runs.
3703
+ */
3704
+ totalCacheReadTokens: number;
3705
+ /**
3706
+ * Format: int64
3707
+ * @description Sum of cache-write tokens across all runs.
3708
+ */
3709
+ totalCacheWriteTokens: number;
3710
+ /** @description Total rubric criteria processed (analysis runs only; 0 for fix rows). */
3711
+ totalCriteriaCount: number;
3712
+ /** @description Number of distinct runs contributing to this row. */
3713
+ runCount: number;
3714
+ /**
3715
+ * Format: date-time
3716
+ * @description Timestamp of the earliest contributing run (UTC).
3717
+ */
3718
+ firstSeenAt: string;
3719
+ /**
3720
+ * Format: date-time
3721
+ * @description Timestamp of the most recent contributing run (UTC).
3722
+ */
3723
+ lastSeenAt: string;
3724
+ };
3650
3725
  };
3651
3726
  responses: {
3652
3727
  /** @description Missing or invalid bearer token */
@@ -3893,6 +3968,7 @@ export type HrisSyncStatusListDto = components['schemas']['HrisSyncStatusListDto
3893
3968
  export type HrisTriggerSyncResultDto = components['schemas']['HrisTriggerSyncResultDto'];
3894
3969
  export type ActivityLogPageDto = components['schemas']['ActivityLogPageDto'];
3895
3970
  export type ReadinessTokenUsageRowDto = components['schemas']['ReadinessTokenUsageRowDto'];
3971
+ export type ReadinessTokenUsageByDimensionRowDto = components['schemas']['ReadinessTokenUsageByDimensionRowDto'];
3896
3972
  export type ResponseUnauthorized = components['responses']['Unauthorized'];
3897
3973
  export type ResponseForbidden = components['responses']['Forbidden'];
3898
3974
  export type ParameterWorkspaceId = components['parameters']['WorkspaceId'];
@@ -4052,6 +4128,67 @@ export interface operations {
4052
4128
  };
4053
4129
  };
4054
4130
  };
4131
+ adminListReadinessTokenUsageByDimension: {
4132
+ parameters: {
4133
+ query?: {
4134
+ /** @description Filter by workspace UUID. */
4135
+ workspaceId?: string;
4136
+ /** @description Filter by repository slug (e.g. `owner/repo`). */
4137
+ providerSlug?: string;
4138
+ /** @description Filter by operation type. */
4139
+ operation?: "readiness_analysis" | "readiness_fix";
4140
+ /** @description Filter by a specific readiness dimension ID. */
4141
+ dimensionId?: string;
4142
+ /** @description Include only rows whose last activity is at or after this ISO-8601 timestamp. */
4143
+ from?: string;
4144
+ /** @description Include only rows whose first activity is at or before this ISO-8601 timestamp. */
4145
+ to?: string;
4146
+ /** @description Maximum number of rows to return (default 200, max 500). */
4147
+ limit?: number;
4148
+ };
4149
+ header?: never;
4150
+ path?: never;
4151
+ cookie?: never;
4152
+ };
4153
+ requestBody?: never;
4154
+ responses: {
4155
+ /** @description Token usage grouped by operation and dimension. */
4156
+ 200: {
4157
+ headers: {
4158
+ [name: string]: unknown;
4159
+ };
4160
+ content: {
4161
+ "application/json": {
4162
+ rows: components["schemas"]["ReadinessTokenUsageByDimensionRowDto"][];
4163
+ };
4164
+ };
4165
+ };
4166
+ /** @description Missing or invalid JWT. */
4167
+ 401: {
4168
+ headers: {
4169
+ [name: string]: unknown;
4170
+ };
4171
+ content: {
4172
+ "application/json": components["schemas"]["ErrorMessageDto"];
4173
+ };
4174
+ };
4175
+ /** @description Caller is not a platform admin. */
4176
+ 403: {
4177
+ headers: {
4178
+ [name: string]: unknown;
4179
+ };
4180
+ content: {
4181
+ /**
4182
+ * @example {
4183
+ * "error": "Forbidden",
4184
+ * "code": "forbidden"
4185
+ * }
4186
+ */
4187
+ "application/json": components["schemas"]["ErrorMessageDto"];
4188
+ };
4189
+ };
4190
+ };
4191
+ };
4055
4192
  getMe: {
4056
4193
  parameters: {
4057
4194
  query?: never;