@thinkai/tai-api-contract 2.185.0 → 2.187.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;
@@ -6883,13 +6956,52 @@ export interface components {
6883
6956
  generatedAt: string;
6884
6957
  contributors: components["schemas"]["AiUsageSpendAggregatedContributorRowDto"][];
6885
6958
  };
6959
+ /** @description Numeric evidence for `id=model_right_sizing` (Cost-to-Value insight #2). Premium share is `premiumSpendCents / totalModelSpendCents` against `thresholdPct` (Phase A default 40). */
6960
+ AiUsageSpendKeyInsightModelRightSizingEvidenceDto: {
6961
+ /** @description Premium-model share of model spend in the window (0–100). */
6962
+ premiumSharePct: number;
6963
+ /** @description Sum of spend_cents on premium-classified models (cents). */
6964
+ premiumSpendCents: number;
6965
+ /** @description Sum of spend_cents across all models in the window (cents). */
6966
+ totalModelSpendCents: number;
6967
+ /** @description Effective premium-share threshold used for this card (0–100). */
6968
+ thresholdPct: number;
6969
+ /** @description Distinct mapped person_id rows contributing to this card's sample (workspace rollup or the single person for a person-scoped card). */
6970
+ personCount: number;
6971
+ };
6972
+ /** @description Optional member drill-down for person-scoped `model_right_sizing` cards. Links to `GET …/integrations/ai-tool/{provider}/members/{externalId}`. */
6973
+ AiUsageSpendKeyInsightDrilldownDto: {
6974
+ /**
6975
+ * @description AI tool provider for the member detail route.
6976
+ * @enum {string}
6977
+ */
6978
+ provider: "cursor" | "claude";
6979
+ /** @description Provider member external id for the member detail route. */
6980
+ externalId: string;
6981
+ };
6982
+ /** @description One Key Insights panel card. Base fields (`id`, `tone`, `text`) apply to all insights. When `id` is `model_right_sizing`, clients MUST treat `dataQuality`, `limitation`, `recommendedAction`, and `evidence` as required; `scope` and `drilldown` are optional (person cards may set both). */
6886
6983
  AiUsageSpendKeyInsightItemDto: {
6887
- /** @description Stable insight key (e.g. spend-leader, spend-vs-output). */
6984
+ /** @description Stable insight key (e.g. spend-leader, spend-vs-output, model_right_sizing). */
6888
6985
  id: string;
6889
6986
  /** @enum {string} */
6890
6987
  tone: "positive" | "warning" | "neutral";
6891
6988
  /** @description Human-readable insight sentence for the UI panel. */
6892
6989
  text: string;
6990
+ /** @description Required when `id=model_right_sizing`. Phase A/B always `estimated` (model-mix heuristic; no task-complexity telemetry until Phase 3). */
6991
+ dataQuality?: components["schemas"]["AiAssistedCodeDataQuality"];
6992
+ /** @description Required when `id=model_right_sizing`. Fixed honesty string that the model mix is heuristic and does not encode task complexity. */
6993
+ limitation?: string;
6994
+ /** @description Required when `id=model_right_sizing`. Coaching copy for the card CTA (advisory only; not vendor enforcement). */
6995
+ recommendedAction?: string;
6996
+ /** @description Required when `id=model_right_sizing`. */
6997
+ evidence?: components["schemas"]["AiUsageSpendKeyInsightModelRightSizingEvidenceDto"];
6998
+ /**
6999
+ * @description Optional scope for `model_right_sizing` cards. Workspace default vs per-person personalized item.
7000
+ * @enum {string}
7001
+ */
7002
+ scope?: "workspace" | "person";
7003
+ /** @description Optional when `scope=person` for `model_right_sizing`; omitted on workspace cards. */
7004
+ drilldown?: components["schemas"]["AiUsageSpendKeyInsightDrilldownDto"];
6893
7005
  };
6894
7006
  AiUsageSpendKeyInsightsDto: {
6895
7007
  /** Format: uuid */
@@ -10541,6 +10653,83 @@ export interface components {
10541
10653
  ActivityLogPageDto: components["schemas"]["PageMetaDto"] & {
10542
10654
  items: components["schemas"]["ActivityLogEntryDto"][];
10543
10655
  };
10656
+ /**
10657
+ * @description Platform Agent job type in the readiness token ledger.
10658
+ * @enum {string}
10659
+ */
10660
+ AutomationCostOperationDto: "readiness_analysis" | "readiness_fix";
10661
+ AutomationCostSummaryRowDto: {
10662
+ /** Format: uuid */
10663
+ workspaceId: string;
10664
+ operation: components["schemas"]["AutomationCostOperationDto"];
10665
+ /** Format: int64 */
10666
+ inputTokens: number;
10667
+ /** Format: int64 */
10668
+ outputTokens: number;
10669
+ /** Format: int64 */
10670
+ cacheReadTokens: number;
10671
+ /** Format: int64 */
10672
+ cacheWriteTokens: number;
10673
+ /** @description Ops estimate from token totals × runtime-config pricing (integer cents). */
10674
+ estimatedSpendCents: number;
10675
+ invocationCount: number;
10676
+ };
10677
+ AutomationCostSummaryTotalsDto: {
10678
+ /** Format: int64 */
10679
+ inputTokens: number;
10680
+ /** Format: int64 */
10681
+ outputTokens: number;
10682
+ /** Format: int64 */
10683
+ cacheReadTokens: number;
10684
+ /** Format: int64 */
10685
+ cacheWriteTokens: number;
10686
+ estimatedSpendCents: number;
10687
+ invocationCount: number;
10688
+ };
10689
+ AutomationCostSummaryDto: {
10690
+ rows: components["schemas"]["AutomationCostSummaryRowDto"][];
10691
+ totals: components["schemas"]["AutomationCostSummaryTotalsDto"];
10692
+ };
10693
+ /** @enum {string} */
10694
+ AutomationCostBudgetStatusDto: "ok" | "warn" | "hard_stopped" | "paused";
10695
+ AutomationCostBudgetViewDto: {
10696
+ operation: components["schemas"]["AutomationCostOperationDto"];
10697
+ /** @description Null when no budget is configured (unlimited). */
10698
+ monthlyBudgetCents: number | null;
10699
+ warnThresholdPct: number;
10700
+ hardEnabled: boolean;
10701
+ /** @description Estimated spend for this operation in the current UTC calendar month. */
10702
+ monthSpendCents: number;
10703
+ status: components["schemas"]["AutomationCostBudgetStatusDto"];
10704
+ paused: boolean;
10705
+ pauseReason?: string | null;
10706
+ };
10707
+ AutomationCostBudgetListDto: {
10708
+ budgets: components["schemas"]["AutomationCostBudgetViewDto"][];
10709
+ };
10710
+ AutomationCostBudgetUpsertDto: {
10711
+ operation: components["schemas"]["AutomationCostOperationDto"];
10712
+ monthlyBudgetCents: number;
10713
+ /** @default 80 */
10714
+ warnThresholdPct: number;
10715
+ /** @default false */
10716
+ hardEnabled: boolean;
10717
+ };
10718
+ AutomationCostPauseBodyDto: {
10719
+ operations: components["schemas"]["AutomationCostOperationDto"][];
10720
+ reason: string;
10721
+ };
10722
+ AutomationCostPauseStateDto: {
10723
+ operations: components["schemas"]["AutomationCostOperationDto"][];
10724
+ reason: string;
10725
+ /** Format: date-time */
10726
+ pausedAt: string;
10727
+ /** @description Platform admin email that set the pause, when known. */
10728
+ pausedBy?: string | null;
10729
+ };
10730
+ AutomationCostPauseResponseDto: {
10731
+ pause: components["schemas"]["AutomationCostPauseStateDto"];
10732
+ };
10544
10733
  ReadinessTokenUsageRowDto: {
10545
10734
  /**
10546
10735
  * Format: uuid
@@ -12751,6 +12940,8 @@ export type AiUsageSpendAggregatedTeamsDto = components['schemas']['AiUsageSpend
12751
12940
  export type AiUsageSpendAggregatedContributorRowDto = components['schemas']['AiUsageSpendAggregatedContributorRowDto'];
12752
12941
  export type AiUsageSpendAggregatedContributorsDto = components['schemas']['AiUsageSpendAggregatedContributorsDto'];
12753
12942
  export type AiUsageSpendContributorToolHeatmapDto = components['schemas']['AiUsageSpendContributorToolHeatmapDto'];
12943
+ export type AiUsageSpendKeyInsightModelRightSizingEvidenceDto = components['schemas']['AiUsageSpendKeyInsightModelRightSizingEvidenceDto'];
12944
+ export type AiUsageSpendKeyInsightDrilldownDto = components['schemas']['AiUsageSpendKeyInsightDrilldownDto'];
12754
12945
  export type AiUsageSpendKeyInsightItemDto = components['schemas']['AiUsageSpendKeyInsightItemDto'];
12755
12946
  export type AiUsageSpendKeyInsightsDto = components['schemas']['AiUsageSpendKeyInsightsDto'];
12756
12947
  export type AiAssistedCodeDataQuality = components['schemas']['AiAssistedCodeDataQuality'];
@@ -13074,6 +13265,17 @@ export type ZenHrBranchSelectionResultDto = components['schemas']['ZenHrBranchSe
13074
13265
  export type HrisTriggerSyncResultDto = components['schemas']['HrisTriggerSyncResultDto'];
13075
13266
  export type HrisProviderSyncResultDto = components['schemas']['HrisProviderSyncResultDto'];
13076
13267
  export type ActivityLogPageDto = components['schemas']['ActivityLogPageDto'];
13268
+ export type AutomationCostOperationDto = components['schemas']['AutomationCostOperationDto'];
13269
+ export type AutomationCostSummaryRowDto = components['schemas']['AutomationCostSummaryRowDto'];
13270
+ export type AutomationCostSummaryTotalsDto = components['schemas']['AutomationCostSummaryTotalsDto'];
13271
+ export type AutomationCostSummaryDto = components['schemas']['AutomationCostSummaryDto'];
13272
+ export type AutomationCostBudgetStatusDto = components['schemas']['AutomationCostBudgetStatusDto'];
13273
+ export type AutomationCostBudgetViewDto = components['schemas']['AutomationCostBudgetViewDto'];
13274
+ export type AutomationCostBudgetListDto = components['schemas']['AutomationCostBudgetListDto'];
13275
+ export type AutomationCostBudgetUpsertDto = components['schemas']['AutomationCostBudgetUpsertDto'];
13276
+ export type AutomationCostPauseBodyDto = components['schemas']['AutomationCostPauseBodyDto'];
13277
+ export type AutomationCostPauseStateDto = components['schemas']['AutomationCostPauseStateDto'];
13278
+ export type AutomationCostPauseResponseDto = components['schemas']['AutomationCostPauseResponseDto'];
13077
13279
  export type ReadinessTokenUsageRowDto = components['schemas']['ReadinessTokenUsageRowDto'];
13078
13280
  export type ReadinessTokenUsageByDimensionRowDto = components['schemas']['ReadinessTokenUsageByDimensionRowDto'];
13079
13281
  export type SdlcModuleId = components['schemas']['SdlcModuleId'];
@@ -14107,6 +14309,328 @@ export interface operations {
14107
14309
  };
14108
14310
  };
14109
14311
  };
14312
+ adminGetAutomationCostSummary: {
14313
+ parameters: {
14314
+ query?: {
14315
+ /** @description Filter by workspace UUID. */
14316
+ workspaceId?: string;
14317
+ /** @description Inclusive start (ISO-8601). Defaults to start of current UTC month. */
14318
+ from?: string;
14319
+ /** @description Inclusive end (ISO-8601). Defaults to end of current UTC month. */
14320
+ to?: string;
14321
+ };
14322
+ header?: never;
14323
+ path?: never;
14324
+ cookie?: never;
14325
+ };
14326
+ requestBody?: never;
14327
+ responses: {
14328
+ /** @description Summary rows and portfolio totals (empty rows / zero totals when no usage). */
14329
+ 200: {
14330
+ headers: {
14331
+ [name: string]: unknown;
14332
+ };
14333
+ content: {
14334
+ "application/json": components["schemas"]["AutomationCostSummaryDto"];
14335
+ };
14336
+ };
14337
+ /** @description Missing or invalid JWT. */
14338
+ 401: {
14339
+ headers: {
14340
+ [name: string]: unknown;
14341
+ };
14342
+ content: {
14343
+ "application/json": components["schemas"]["ErrorMessageDto"];
14344
+ };
14345
+ };
14346
+ /** @description Caller is not a platform admin. */
14347
+ 403: {
14348
+ headers: {
14349
+ [name: string]: unknown;
14350
+ };
14351
+ content: {
14352
+ /**
14353
+ * @example {
14354
+ * "error": "Forbidden",
14355
+ * "code": "forbidden"
14356
+ * }
14357
+ */
14358
+ "application/json": components["schemas"]["ErrorMessageDto"];
14359
+ };
14360
+ };
14361
+ };
14362
+ };
14363
+ adminGetAutomationCostBudget: {
14364
+ parameters: {
14365
+ query?: {
14366
+ /** @description Limit to one operation; omit for both. */
14367
+ operation?: "readiness_analysis" | "readiness_fix";
14368
+ };
14369
+ header?: never;
14370
+ path: {
14371
+ workspaceId: components["parameters"]["WorkspaceId"];
14372
+ };
14373
+ cookie?: never;
14374
+ };
14375
+ requestBody?: never;
14376
+ responses: {
14377
+ /** @description Budget views for the requested operations. */
14378
+ 200: {
14379
+ headers: {
14380
+ [name: string]: unknown;
14381
+ };
14382
+ content: {
14383
+ "application/json": components["schemas"]["AutomationCostBudgetListDto"];
14384
+ };
14385
+ };
14386
+ /** @description Missing or invalid JWT. */
14387
+ 401: {
14388
+ headers: {
14389
+ [name: string]: unknown;
14390
+ };
14391
+ content: {
14392
+ "application/json": components["schemas"]["ErrorMessageDto"];
14393
+ };
14394
+ };
14395
+ /** @description Caller is not a platform admin. */
14396
+ 403: {
14397
+ headers: {
14398
+ [name: string]: unknown;
14399
+ };
14400
+ content: {
14401
+ /**
14402
+ * @example {
14403
+ * "error": "Forbidden",
14404
+ * "code": "forbidden"
14405
+ * }
14406
+ */
14407
+ "application/json": components["schemas"]["ErrorMessageDto"];
14408
+ };
14409
+ };
14410
+ /** @description Workspace not found. */
14411
+ 404: {
14412
+ headers: {
14413
+ [name: string]: unknown;
14414
+ };
14415
+ content: {
14416
+ /**
14417
+ * @example {
14418
+ * "error": "Workspace not found",
14419
+ * "code": "workspace_not_found"
14420
+ * }
14421
+ */
14422
+ "application/json": components["schemas"]["ErrorMessageDto"];
14423
+ };
14424
+ };
14425
+ };
14426
+ };
14427
+ adminPutAutomationCostBudget: {
14428
+ parameters: {
14429
+ query?: never;
14430
+ header?: never;
14431
+ path: {
14432
+ workspaceId: components["parameters"]["WorkspaceId"];
14433
+ };
14434
+ cookie?: never;
14435
+ };
14436
+ requestBody: {
14437
+ content: {
14438
+ "application/json": components["schemas"]["AutomationCostBudgetUpsertDto"];
14439
+ };
14440
+ };
14441
+ responses: {
14442
+ /** @description Updated budget view(s). */
14443
+ 200: {
14444
+ headers: {
14445
+ [name: string]: unknown;
14446
+ };
14447
+ content: {
14448
+ "application/json": components["schemas"]["AutomationCostBudgetListDto"];
14449
+ };
14450
+ };
14451
+ /** @description Invalid body. */
14452
+ 400: {
14453
+ headers: {
14454
+ [name: string]: unknown;
14455
+ };
14456
+ content: {
14457
+ "application/json": components["schemas"]["ErrorMessageDto"];
14458
+ };
14459
+ };
14460
+ /** @description Missing or invalid JWT. */
14461
+ 401: {
14462
+ headers: {
14463
+ [name: string]: unknown;
14464
+ };
14465
+ content: {
14466
+ "application/json": components["schemas"]["ErrorMessageDto"];
14467
+ };
14468
+ };
14469
+ /** @description Caller is not a platform admin. */
14470
+ 403: {
14471
+ headers: {
14472
+ [name: string]: unknown;
14473
+ };
14474
+ content: {
14475
+ /**
14476
+ * @example {
14477
+ * "error": "Forbidden",
14478
+ * "code": "forbidden"
14479
+ * }
14480
+ */
14481
+ "application/json": components["schemas"]["ErrorMessageDto"];
14482
+ };
14483
+ };
14484
+ /** @description Workspace not found. */
14485
+ 404: {
14486
+ headers: {
14487
+ [name: string]: unknown;
14488
+ };
14489
+ content: {
14490
+ /**
14491
+ * @example {
14492
+ * "error": "Workspace not found",
14493
+ * "code": "workspace_not_found"
14494
+ * }
14495
+ */
14496
+ "application/json": components["schemas"]["ErrorMessageDto"];
14497
+ };
14498
+ };
14499
+ };
14500
+ };
14501
+ adminPostAutomationCostPause: {
14502
+ parameters: {
14503
+ query?: never;
14504
+ header?: never;
14505
+ path: {
14506
+ workspaceId: components["parameters"]["WorkspaceId"];
14507
+ };
14508
+ cookie?: never;
14509
+ };
14510
+ requestBody: {
14511
+ content: {
14512
+ "application/json": components["schemas"]["AutomationCostPauseBodyDto"];
14513
+ };
14514
+ };
14515
+ responses: {
14516
+ /** @description Pause state stored. */
14517
+ 200: {
14518
+ headers: {
14519
+ [name: string]: unknown;
14520
+ };
14521
+ content: {
14522
+ "application/json": components["schemas"]["AutomationCostPauseResponseDto"];
14523
+ };
14524
+ };
14525
+ /** @description Empty or invalid operations list. */
14526
+ 400: {
14527
+ headers: {
14528
+ [name: string]: unknown;
14529
+ };
14530
+ content: {
14531
+ "application/json": components["schemas"]["ErrorMessageDto"];
14532
+ };
14533
+ };
14534
+ /** @description Missing or invalid JWT. */
14535
+ 401: {
14536
+ headers: {
14537
+ [name: string]: unknown;
14538
+ };
14539
+ content: {
14540
+ "application/json": components["schemas"]["ErrorMessageDto"];
14541
+ };
14542
+ };
14543
+ /** @description Caller is not a platform admin. */
14544
+ 403: {
14545
+ headers: {
14546
+ [name: string]: unknown;
14547
+ };
14548
+ content: {
14549
+ /**
14550
+ * @example {
14551
+ * "error": "Forbidden",
14552
+ * "code": "forbidden"
14553
+ * }
14554
+ */
14555
+ "application/json": components["schemas"]["ErrorMessageDto"];
14556
+ };
14557
+ };
14558
+ /** @description Workspace not found. */
14559
+ 404: {
14560
+ headers: {
14561
+ [name: string]: unknown;
14562
+ };
14563
+ content: {
14564
+ /**
14565
+ * @example {
14566
+ * "error": "Workspace not found",
14567
+ * "code": "workspace_not_found"
14568
+ * }
14569
+ */
14570
+ "application/json": components["schemas"]["ErrorMessageDto"];
14571
+ };
14572
+ };
14573
+ };
14574
+ };
14575
+ adminDeleteAutomationCostPause: {
14576
+ parameters: {
14577
+ query?: never;
14578
+ header?: never;
14579
+ path: {
14580
+ workspaceId: components["parameters"]["WorkspaceId"];
14581
+ };
14582
+ cookie?: never;
14583
+ };
14584
+ requestBody?: never;
14585
+ responses: {
14586
+ /** @description Pause cleared. */
14587
+ 204: {
14588
+ headers: {
14589
+ [name: string]: unknown;
14590
+ };
14591
+ content?: never;
14592
+ };
14593
+ /** @description Missing or invalid JWT. */
14594
+ 401: {
14595
+ headers: {
14596
+ [name: string]: unknown;
14597
+ };
14598
+ content: {
14599
+ "application/json": components["schemas"]["ErrorMessageDto"];
14600
+ };
14601
+ };
14602
+ /** @description Caller is not a platform admin. */
14603
+ 403: {
14604
+ headers: {
14605
+ [name: string]: unknown;
14606
+ };
14607
+ content: {
14608
+ /**
14609
+ * @example {
14610
+ * "error": "Forbidden",
14611
+ * "code": "forbidden"
14612
+ * }
14613
+ */
14614
+ "application/json": components["schemas"]["ErrorMessageDto"];
14615
+ };
14616
+ };
14617
+ /** @description Workspace not found. */
14618
+ 404: {
14619
+ headers: {
14620
+ [name: string]: unknown;
14621
+ };
14622
+ content: {
14623
+ /**
14624
+ * @example {
14625
+ * "error": "Workspace not found",
14626
+ * "code": "workspace_not_found"
14627
+ * }
14628
+ */
14629
+ "application/json": components["schemas"]["ErrorMessageDto"];
14630
+ };
14631
+ };
14632
+ };
14633
+ };
14110
14634
  submitPublicPrivacyRequest: {
14111
14635
  parameters: {
14112
14636
  query?: never;
package/src/index.ts CHANGED
@@ -884,11 +884,45 @@ export interface AiUsageSpendContributorToolHeatmapDto {
884
884
  contributors: AiUsageSpendAggregatedContributorRowDto[];
885
885
  }
886
886
 
887
- /** One card in the AI usage & spend key insights panel. */
887
+ /**
888
+ * Numeric evidence for `id=model_right_sizing` (Cost-to-Value insight #2).
889
+ * Premium share is premiumSpendCents / totalModelSpendCents against thresholdPct.
890
+ */
891
+ export interface AiUsageSpendKeyInsightModelRightSizingEvidenceDto {
892
+ premiumSharePct: number;
893
+ premiumSpendCents: number;
894
+ totalModelSpendCents: number;
895
+ thresholdPct: number;
896
+ personCount: number;
897
+ }
898
+
899
+ /** Optional member drill-down for person-scoped model_right_sizing cards. */
900
+ export interface AiUsageSpendKeyInsightDrilldownDto {
901
+ provider: "cursor" | "claude";
902
+ externalId: string;
903
+ }
904
+
905
+ /**
906
+ * One card in the AI usage & spend key insights panel.
907
+ * When `id` is `model_right_sizing`, `dataQuality`, `limitation`,
908
+ * `recommendedAction`, and `evidence` are required; `scope` / `drilldown` optional.
909
+ */
888
910
  export interface AiUsageSpendKeyInsightItemDto {
889
911
  id: string;
890
912
  tone: "positive" | "warning" | "neutral";
891
913
  text: string;
914
+ /** Required when id=model_right_sizing; Phase A/B always `estimated`. */
915
+ dataQuality?: AiAssistedCodeDataQuality;
916
+ /** Required when id=model_right_sizing; heuristic honesty string. */
917
+ limitation?: string;
918
+ /** Required when id=model_right_sizing; advisory coaching CTA copy. */
919
+ recommendedAction?: string;
920
+ /** Required when id=model_right_sizing. */
921
+ evidence?: AiUsageSpendKeyInsightModelRightSizingEvidenceDto;
922
+ /** Optional scope for model_right_sizing (workspace default vs person). */
923
+ scope?: "workspace" | "person";
924
+ /** Optional person drill-down when scope=person. */
925
+ drilldown?: AiUsageSpendKeyInsightDrilldownDto;
892
926
  }
893
927
 
894
928
  /** Response for GET /workspaces/:workspaceId/insights/ai-usage-spend/key-insights */