@thinkai/tai-api-contract 2.185.0 → 2.186.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.
@@ -222,6 +222,79 @@ export interface paths {
222
222
  patch?: never;
223
223
  trace?: never;
224
224
  };
225
+ "/admin/automation-cost/summary": {
226
+ parameters: {
227
+ query?: never;
228
+ header?: never;
229
+ path?: never;
230
+ cookie?: never;
231
+ };
232
+ /**
233
+ * Estimated Agent automation spend by workspace and operation
234
+ * @description Rolls up `tai_readiness_token_usage` for the given UTC range (defaults to the current UTC calendar month when `from`/`to` are omitted). Each row is one `(workspaceId, operation)` with token totals, invocation count, and `estimatedSpendCents` from `workers.automationCost.pricing` (Cursor Auto pool list-rate defaults when keys are missing). Portfolio `totals` are sums of the returned rows.
235
+ * **Authorization:** Bearer JWT required. Caller email must appear in `PLATFORM_ADMIN_EMAILS`. Separate from customer Insights AI Usage & Spend / `ai_cost_budget`.
236
+ */
237
+ get: operations["adminGetAutomationCostSummary"];
238
+ put?: never;
239
+ post?: never;
240
+ delete?: never;
241
+ options?: never;
242
+ head?: never;
243
+ patch?: never;
244
+ trace?: never;
245
+ };
246
+ "/admin/workspaces/{workspaceId}/automation-cost/budget": {
247
+ parameters: {
248
+ query?: never;
249
+ header?: never;
250
+ path?: never;
251
+ cookie?: never;
252
+ };
253
+ /**
254
+ * Get automation-cost budget and month status for a workspace
255
+ * @description Returns budget rows for `readiness_analysis` and/or `readiness_fix` with `monthSpendCents` (estimated from token rows in the current UTC month) and `status` (`ok` | `warn` | `hard_stopped` | `paused`). When no budget is configured, `monthlyBudgetCents` is null and status is `ok` (unlimited) unless paused.
256
+ * **Authorization:** Bearer JWT + `PLATFORM_ADMIN_EMAILS`.
257
+ */
258
+ get: operations["adminGetAutomationCostBudget"];
259
+ /**
260
+ * Upsert automation-cost budget for one operation
261
+ * @description Upserts `{ operation, monthlyBudgetCents, warnThresholdPct, hardEnabled }` into workspace `automation_cost_budget` (not `ai_cost_budget`). Default `warnThresholdPct` is 80. `monthlyBudgetCents: 0` with `hardEnabled: true` is an immediate hard stop. Returns the refreshed budget view for that operation.
262
+ * **Authorization:** Bearer JWT + `PLATFORM_ADMIN_EMAILS`.
263
+ */
264
+ put: operations["adminPutAutomationCostBudget"];
265
+ post?: never;
266
+ delete?: never;
267
+ options?: never;
268
+ head?: never;
269
+ patch?: never;
270
+ trace?: never;
271
+ };
272
+ "/admin/workspaces/{workspaceId}/automation-cost/pause": {
273
+ parameters: {
274
+ query?: never;
275
+ header?: never;
276
+ path?: never;
277
+ cookie?: never;
278
+ };
279
+ get?: never;
280
+ put?: never;
281
+ /**
282
+ * Pause Agent automation for selected operations
283
+ * @description Sets a per-workspace pause kill-switch for the listed operations. Workers honor pause the same as a hard budget stop (enforcement is a follow-up slice). Empty `operations` → `400`.
284
+ * **Authorization:** Bearer JWT + `PLATFORM_ADMIN_EMAILS`.
285
+ */
286
+ post: operations["adminPostAutomationCostPause"];
287
+ /**
288
+ * Clear automation-cost pause for a workspace
289
+ * @description Clears `automation_cost_pause` for the workspace so workers may resume when under hard cap.
290
+ * **Authorization:** Bearer JWT + `PLATFORM_ADMIN_EMAILS`.
291
+ */
292
+ delete: operations["adminDeleteAutomationCostPause"];
293
+ options?: never;
294
+ head?: never;
295
+ patch?: never;
296
+ trace?: never;
297
+ };
225
298
  "/privacy-requests": {
226
299
  parameters: {
227
300
  query?: never;
@@ -10541,6 +10614,83 @@ export interface components {
10541
10614
  ActivityLogPageDto: components["schemas"]["PageMetaDto"] & {
10542
10615
  items: components["schemas"]["ActivityLogEntryDto"][];
10543
10616
  };
10617
+ /**
10618
+ * @description Platform Agent job type in the readiness token ledger.
10619
+ * @enum {string}
10620
+ */
10621
+ AutomationCostOperationDto: "readiness_analysis" | "readiness_fix";
10622
+ AutomationCostSummaryRowDto: {
10623
+ /** Format: uuid */
10624
+ workspaceId: string;
10625
+ operation: components["schemas"]["AutomationCostOperationDto"];
10626
+ /** Format: int64 */
10627
+ inputTokens: number;
10628
+ /** Format: int64 */
10629
+ outputTokens: number;
10630
+ /** Format: int64 */
10631
+ cacheReadTokens: number;
10632
+ /** Format: int64 */
10633
+ cacheWriteTokens: number;
10634
+ /** @description Ops estimate from token totals × runtime-config pricing (integer cents). */
10635
+ estimatedSpendCents: number;
10636
+ invocationCount: number;
10637
+ };
10638
+ AutomationCostSummaryTotalsDto: {
10639
+ /** Format: int64 */
10640
+ inputTokens: number;
10641
+ /** Format: int64 */
10642
+ outputTokens: number;
10643
+ /** Format: int64 */
10644
+ cacheReadTokens: number;
10645
+ /** Format: int64 */
10646
+ cacheWriteTokens: number;
10647
+ estimatedSpendCents: number;
10648
+ invocationCount: number;
10649
+ };
10650
+ AutomationCostSummaryDto: {
10651
+ rows: components["schemas"]["AutomationCostSummaryRowDto"][];
10652
+ totals: components["schemas"]["AutomationCostSummaryTotalsDto"];
10653
+ };
10654
+ /** @enum {string} */
10655
+ AutomationCostBudgetStatusDto: "ok" | "warn" | "hard_stopped" | "paused";
10656
+ AutomationCostBudgetViewDto: {
10657
+ operation: components["schemas"]["AutomationCostOperationDto"];
10658
+ /** @description Null when no budget is configured (unlimited). */
10659
+ monthlyBudgetCents: number | null;
10660
+ warnThresholdPct: number;
10661
+ hardEnabled: boolean;
10662
+ /** @description Estimated spend for this operation in the current UTC calendar month. */
10663
+ monthSpendCents: number;
10664
+ status: components["schemas"]["AutomationCostBudgetStatusDto"];
10665
+ paused: boolean;
10666
+ pauseReason?: string | null;
10667
+ };
10668
+ AutomationCostBudgetListDto: {
10669
+ budgets: components["schemas"]["AutomationCostBudgetViewDto"][];
10670
+ };
10671
+ AutomationCostBudgetUpsertDto: {
10672
+ operation: components["schemas"]["AutomationCostOperationDto"];
10673
+ monthlyBudgetCents: number;
10674
+ /** @default 80 */
10675
+ warnThresholdPct: number;
10676
+ /** @default false */
10677
+ hardEnabled: boolean;
10678
+ };
10679
+ AutomationCostPauseBodyDto: {
10680
+ operations: components["schemas"]["AutomationCostOperationDto"][];
10681
+ reason: string;
10682
+ };
10683
+ AutomationCostPauseStateDto: {
10684
+ operations: components["schemas"]["AutomationCostOperationDto"][];
10685
+ reason: string;
10686
+ /** Format: date-time */
10687
+ pausedAt: string;
10688
+ /** @description Platform admin email that set the pause, when known. */
10689
+ pausedBy?: string | null;
10690
+ };
10691
+ AutomationCostPauseResponseDto: {
10692
+ pause: components["schemas"]["AutomationCostPauseStateDto"];
10693
+ };
10544
10694
  ReadinessTokenUsageRowDto: {
10545
10695
  /**
10546
10696
  * Format: uuid
@@ -13074,6 +13224,17 @@ export type ZenHrBranchSelectionResultDto = components['schemas']['ZenHrBranchSe
13074
13224
  export type HrisTriggerSyncResultDto = components['schemas']['HrisTriggerSyncResultDto'];
13075
13225
  export type HrisProviderSyncResultDto = components['schemas']['HrisProviderSyncResultDto'];
13076
13226
  export type ActivityLogPageDto = components['schemas']['ActivityLogPageDto'];
13227
+ export type AutomationCostOperationDto = components['schemas']['AutomationCostOperationDto'];
13228
+ export type AutomationCostSummaryRowDto = components['schemas']['AutomationCostSummaryRowDto'];
13229
+ export type AutomationCostSummaryTotalsDto = components['schemas']['AutomationCostSummaryTotalsDto'];
13230
+ export type AutomationCostSummaryDto = components['schemas']['AutomationCostSummaryDto'];
13231
+ export type AutomationCostBudgetStatusDto = components['schemas']['AutomationCostBudgetStatusDto'];
13232
+ export type AutomationCostBudgetViewDto = components['schemas']['AutomationCostBudgetViewDto'];
13233
+ export type AutomationCostBudgetListDto = components['schemas']['AutomationCostBudgetListDto'];
13234
+ export type AutomationCostBudgetUpsertDto = components['schemas']['AutomationCostBudgetUpsertDto'];
13235
+ export type AutomationCostPauseBodyDto = components['schemas']['AutomationCostPauseBodyDto'];
13236
+ export type AutomationCostPauseStateDto = components['schemas']['AutomationCostPauseStateDto'];
13237
+ export type AutomationCostPauseResponseDto = components['schemas']['AutomationCostPauseResponseDto'];
13077
13238
  export type ReadinessTokenUsageRowDto = components['schemas']['ReadinessTokenUsageRowDto'];
13078
13239
  export type ReadinessTokenUsageByDimensionRowDto = components['schemas']['ReadinessTokenUsageByDimensionRowDto'];
13079
13240
  export type SdlcModuleId = components['schemas']['SdlcModuleId'];
@@ -14107,6 +14268,328 @@ export interface operations {
14107
14268
  };
14108
14269
  };
14109
14270
  };
14271
+ adminGetAutomationCostSummary: {
14272
+ parameters: {
14273
+ query?: {
14274
+ /** @description Filter by workspace UUID. */
14275
+ workspaceId?: string;
14276
+ /** @description Inclusive start (ISO-8601). Defaults to start of current UTC month. */
14277
+ from?: string;
14278
+ /** @description Inclusive end (ISO-8601). Defaults to end of current UTC month. */
14279
+ to?: string;
14280
+ };
14281
+ header?: never;
14282
+ path?: never;
14283
+ cookie?: never;
14284
+ };
14285
+ requestBody?: never;
14286
+ responses: {
14287
+ /** @description Summary rows and portfolio totals (empty rows / zero totals when no usage). */
14288
+ 200: {
14289
+ headers: {
14290
+ [name: string]: unknown;
14291
+ };
14292
+ content: {
14293
+ "application/json": components["schemas"]["AutomationCostSummaryDto"];
14294
+ };
14295
+ };
14296
+ /** @description Missing or invalid JWT. */
14297
+ 401: {
14298
+ headers: {
14299
+ [name: string]: unknown;
14300
+ };
14301
+ content: {
14302
+ "application/json": components["schemas"]["ErrorMessageDto"];
14303
+ };
14304
+ };
14305
+ /** @description Caller is not a platform admin. */
14306
+ 403: {
14307
+ headers: {
14308
+ [name: string]: unknown;
14309
+ };
14310
+ content: {
14311
+ /**
14312
+ * @example {
14313
+ * "error": "Forbidden",
14314
+ * "code": "forbidden"
14315
+ * }
14316
+ */
14317
+ "application/json": components["schemas"]["ErrorMessageDto"];
14318
+ };
14319
+ };
14320
+ };
14321
+ };
14322
+ adminGetAutomationCostBudget: {
14323
+ parameters: {
14324
+ query?: {
14325
+ /** @description Limit to one operation; omit for both. */
14326
+ operation?: "readiness_analysis" | "readiness_fix";
14327
+ };
14328
+ header?: never;
14329
+ path: {
14330
+ workspaceId: components["parameters"]["WorkspaceId"];
14331
+ };
14332
+ cookie?: never;
14333
+ };
14334
+ requestBody?: never;
14335
+ responses: {
14336
+ /** @description Budget views for the requested operations. */
14337
+ 200: {
14338
+ headers: {
14339
+ [name: string]: unknown;
14340
+ };
14341
+ content: {
14342
+ "application/json": components["schemas"]["AutomationCostBudgetListDto"];
14343
+ };
14344
+ };
14345
+ /** @description Missing or invalid JWT. */
14346
+ 401: {
14347
+ headers: {
14348
+ [name: string]: unknown;
14349
+ };
14350
+ content: {
14351
+ "application/json": components["schemas"]["ErrorMessageDto"];
14352
+ };
14353
+ };
14354
+ /** @description Caller is not a platform admin. */
14355
+ 403: {
14356
+ headers: {
14357
+ [name: string]: unknown;
14358
+ };
14359
+ content: {
14360
+ /**
14361
+ * @example {
14362
+ * "error": "Forbidden",
14363
+ * "code": "forbidden"
14364
+ * }
14365
+ */
14366
+ "application/json": components["schemas"]["ErrorMessageDto"];
14367
+ };
14368
+ };
14369
+ /** @description Workspace not found. */
14370
+ 404: {
14371
+ headers: {
14372
+ [name: string]: unknown;
14373
+ };
14374
+ content: {
14375
+ /**
14376
+ * @example {
14377
+ * "error": "Workspace not found",
14378
+ * "code": "workspace_not_found"
14379
+ * }
14380
+ */
14381
+ "application/json": components["schemas"]["ErrorMessageDto"];
14382
+ };
14383
+ };
14384
+ };
14385
+ };
14386
+ adminPutAutomationCostBudget: {
14387
+ parameters: {
14388
+ query?: never;
14389
+ header?: never;
14390
+ path: {
14391
+ workspaceId: components["parameters"]["WorkspaceId"];
14392
+ };
14393
+ cookie?: never;
14394
+ };
14395
+ requestBody: {
14396
+ content: {
14397
+ "application/json": components["schemas"]["AutomationCostBudgetUpsertDto"];
14398
+ };
14399
+ };
14400
+ responses: {
14401
+ /** @description Updated budget view(s). */
14402
+ 200: {
14403
+ headers: {
14404
+ [name: string]: unknown;
14405
+ };
14406
+ content: {
14407
+ "application/json": components["schemas"]["AutomationCostBudgetListDto"];
14408
+ };
14409
+ };
14410
+ /** @description Invalid body. */
14411
+ 400: {
14412
+ headers: {
14413
+ [name: string]: unknown;
14414
+ };
14415
+ content: {
14416
+ "application/json": components["schemas"]["ErrorMessageDto"];
14417
+ };
14418
+ };
14419
+ /** @description Missing or invalid JWT. */
14420
+ 401: {
14421
+ headers: {
14422
+ [name: string]: unknown;
14423
+ };
14424
+ content: {
14425
+ "application/json": components["schemas"]["ErrorMessageDto"];
14426
+ };
14427
+ };
14428
+ /** @description Caller is not a platform admin. */
14429
+ 403: {
14430
+ headers: {
14431
+ [name: string]: unknown;
14432
+ };
14433
+ content: {
14434
+ /**
14435
+ * @example {
14436
+ * "error": "Forbidden",
14437
+ * "code": "forbidden"
14438
+ * }
14439
+ */
14440
+ "application/json": components["schemas"]["ErrorMessageDto"];
14441
+ };
14442
+ };
14443
+ /** @description Workspace not found. */
14444
+ 404: {
14445
+ headers: {
14446
+ [name: string]: unknown;
14447
+ };
14448
+ content: {
14449
+ /**
14450
+ * @example {
14451
+ * "error": "Workspace not found",
14452
+ * "code": "workspace_not_found"
14453
+ * }
14454
+ */
14455
+ "application/json": components["schemas"]["ErrorMessageDto"];
14456
+ };
14457
+ };
14458
+ };
14459
+ };
14460
+ adminPostAutomationCostPause: {
14461
+ parameters: {
14462
+ query?: never;
14463
+ header?: never;
14464
+ path: {
14465
+ workspaceId: components["parameters"]["WorkspaceId"];
14466
+ };
14467
+ cookie?: never;
14468
+ };
14469
+ requestBody: {
14470
+ content: {
14471
+ "application/json": components["schemas"]["AutomationCostPauseBodyDto"];
14472
+ };
14473
+ };
14474
+ responses: {
14475
+ /** @description Pause state stored. */
14476
+ 200: {
14477
+ headers: {
14478
+ [name: string]: unknown;
14479
+ };
14480
+ content: {
14481
+ "application/json": components["schemas"]["AutomationCostPauseResponseDto"];
14482
+ };
14483
+ };
14484
+ /** @description Empty or invalid operations list. */
14485
+ 400: {
14486
+ headers: {
14487
+ [name: string]: unknown;
14488
+ };
14489
+ content: {
14490
+ "application/json": components["schemas"]["ErrorMessageDto"];
14491
+ };
14492
+ };
14493
+ /** @description Missing or invalid JWT. */
14494
+ 401: {
14495
+ headers: {
14496
+ [name: string]: unknown;
14497
+ };
14498
+ content: {
14499
+ "application/json": components["schemas"]["ErrorMessageDto"];
14500
+ };
14501
+ };
14502
+ /** @description Caller is not a platform admin. */
14503
+ 403: {
14504
+ headers: {
14505
+ [name: string]: unknown;
14506
+ };
14507
+ content: {
14508
+ /**
14509
+ * @example {
14510
+ * "error": "Forbidden",
14511
+ * "code": "forbidden"
14512
+ * }
14513
+ */
14514
+ "application/json": components["schemas"]["ErrorMessageDto"];
14515
+ };
14516
+ };
14517
+ /** @description Workspace not found. */
14518
+ 404: {
14519
+ headers: {
14520
+ [name: string]: unknown;
14521
+ };
14522
+ content: {
14523
+ /**
14524
+ * @example {
14525
+ * "error": "Workspace not found",
14526
+ * "code": "workspace_not_found"
14527
+ * }
14528
+ */
14529
+ "application/json": components["schemas"]["ErrorMessageDto"];
14530
+ };
14531
+ };
14532
+ };
14533
+ };
14534
+ adminDeleteAutomationCostPause: {
14535
+ parameters: {
14536
+ query?: never;
14537
+ header?: never;
14538
+ path: {
14539
+ workspaceId: components["parameters"]["WorkspaceId"];
14540
+ };
14541
+ cookie?: never;
14542
+ };
14543
+ requestBody?: never;
14544
+ responses: {
14545
+ /** @description Pause cleared. */
14546
+ 204: {
14547
+ headers: {
14548
+ [name: string]: unknown;
14549
+ };
14550
+ content?: never;
14551
+ };
14552
+ /** @description Missing or invalid JWT. */
14553
+ 401: {
14554
+ headers: {
14555
+ [name: string]: unknown;
14556
+ };
14557
+ content: {
14558
+ "application/json": components["schemas"]["ErrorMessageDto"];
14559
+ };
14560
+ };
14561
+ /** @description Caller is not a platform admin. */
14562
+ 403: {
14563
+ headers: {
14564
+ [name: string]: unknown;
14565
+ };
14566
+ content: {
14567
+ /**
14568
+ * @example {
14569
+ * "error": "Forbidden",
14570
+ * "code": "forbidden"
14571
+ * }
14572
+ */
14573
+ "application/json": components["schemas"]["ErrorMessageDto"];
14574
+ };
14575
+ };
14576
+ /** @description Workspace not found. */
14577
+ 404: {
14578
+ headers: {
14579
+ [name: string]: unknown;
14580
+ };
14581
+ content: {
14582
+ /**
14583
+ * @example {
14584
+ * "error": "Workspace not found",
14585
+ * "code": "workspace_not_found"
14586
+ * }
14587
+ */
14588
+ "application/json": components["schemas"]["ErrorMessageDto"];
14589
+ };
14590
+ };
14591
+ };
14592
+ };
14110
14593
  submitPublicPrivacyRequest: {
14111
14594
  parameters: {
14112
14595
  query?: never;