@thinkai/tai-api-contract 2.35.0 → 2.37.0-pr.798.0cc49094

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.
@@ -426,6 +426,26 @@ export interface paths {
426
426
  patch?: never;
427
427
  trace?: never;
428
428
  };
429
+ "/workspaces/{workspaceId}/insights/persons/{personId}/erase": {
430
+ parameters: {
431
+ query?: never;
432
+ header?: never;
433
+ path?: never;
434
+ cookie?: never;
435
+ };
436
+ get?: never;
437
+ put?: never;
438
+ /**
439
+ * Erase person-level insights data (workspace admin)
440
+ * @description Workspace admin only. Deletes or anonymizes a person's developer-insights rows for the workspace: org-chart node, person-scope dashboard metrics, AI-tool fact rows, HRIS absences, and readiness run requester linkage. Granular categories default to all enabled when the body is omitted. `personId` is the org-chart `person_id` (typically work email); URL-encode the path segment (e.g. `alice%40example.com`).
441
+ */
442
+ post: operations["eraseInsightsPerson"];
443
+ delete?: never;
444
+ options?: never;
445
+ head?: never;
446
+ patch?: never;
447
+ trace?: never;
448
+ };
429
449
  "/workspaces/{workspaceId}/insights/ai-usage-spend/aggregated-teams": {
430
450
  parameters: {
431
451
  query?: never;
@@ -2085,6 +2105,27 @@ export interface components {
2085
2105
  /** @enum {string} */
2086
2106
  role: "admin" | "editor" | "viewer";
2087
2107
  };
2108
+ /** @description Granular person erasure categories. All default to true when omitted. */
2109
+ EraseInsightsPersonBodyDto: {
2110
+ /** @description Remove the person node from `tai_workspace_config.org_chart`. */
2111
+ orgChart?: boolean;
2112
+ /** @description Delete person-scope rows in `tai_workspace_dashboard_metrics`. */
2113
+ dashboardMetrics?: boolean;
2114
+ /** @description Delete AI-tool seats and fact rows keyed to the person. */
2115
+ aiToolData?: boolean;
2116
+ /** @description Delete HRIS absence rows for the person's email. */
2117
+ absences?: boolean;
2118
+ /** @description Clear `requested_by_user_id` on readiness runs for matching app users. */
2119
+ readinessAnonymize?: boolean;
2120
+ };
2121
+ EraseInsightsPersonResultDto: {
2122
+ /** @enum {boolean} */
2123
+ deleted: true;
2124
+ aiToolRowsDeleted: number;
2125
+ absencesDeleted: number;
2126
+ readinessRunsAnonymized: number;
2127
+ auditEntriesAnonymized: number;
2128
+ };
2088
2129
  OrgChartNodeDto: {
2089
2130
  id: string;
2090
2131
  name: string;
@@ -2394,7 +2435,12 @@ export interface components {
2394
2435
  /** @description Short label for the week column (MM/DD), aligned with Measure charts. */
2395
2436
  weekLabel?: string;
2396
2437
  mergedPrCount: number;
2438
+ /** @description DORA change failure rate (deployments/incidents), not CI build failures. */
2397
2439
  failRatePercent: number;
2440
+ /** @description GitHub Actions / Checks CI build failure rate for the week bucket (failed runs / (failed + passed) * 100). Zero when GitHub Actions CI is disabled. */
2441
+ ciFailRatePercent?: number;
2442
+ /** @description Count of build.failed events in the week bucket when CI ingest is enabled. */
2443
+ ciBuildFailuresCount?: number;
2398
2444
  /** @description Mean hours from PR creation to first review in this week bucket. */
2399
2445
  avgReviewWaitHours?: number;
2400
2446
  /** @description Mean hours from first review to first approval in this week bucket. */
@@ -2427,6 +2473,8 @@ export interface components {
2427
2473
  scope: components["schemas"]["ProductivityInsightsAggregatedTeamsScopeDto"];
2428
2474
  /** Format: date-time */
2429
2475
  generatedAt: string;
2476
+ /** @description True when the workspace has opted in to GitHub Actions CI ingest. */
2477
+ githubActionsCiEnabled?: boolean;
2430
2478
  teams: components["schemas"]["ProductivityInsightsAggregatedTeamRowDto"][];
2431
2479
  };
2432
2480
  ProductivityInsightsMergedPrTrendWeekDto: {
@@ -2471,11 +2519,16 @@ export interface components {
2471
2519
  periodAvgMergedPrs: number;
2472
2520
  /** @description Average change failure rate over the range when available. */
2473
2521
  avgFailRatePercent?: number;
2522
+ /** @description Average GitHub Actions CI build failure rate over the range when CI ingest is enabled. */
2523
+ avgCiFailRatePercent?: number;
2474
2524
  };
2475
2525
  ProductivityInsightsTeamSummaryDto: {
2476
2526
  totalMergedPrs: number;
2477
2527
  avgMergedPrsPerWeek: number;
2528
+ /** @description Average DORA change failure rate over the range when available. */
2478
2529
  avgFailRatePercent: number;
2530
+ /** @description Average GitHub Actions CI build failure rate over the range when CI ingest is enabled. */
2531
+ avgCiFailRatePercent?: number;
2479
2532
  headcount: number;
2480
2533
  };
2481
2534
  ProductivityInsightsTeamDetailDto: {
@@ -2502,6 +2555,8 @@ export interface components {
2502
2555
  scope: components["schemas"]["ProductivityInsightsAggregatedTeamsScopeDto"];
2503
2556
  /** Format: date-time */
2504
2557
  generatedAt: string;
2558
+ /** @description True when the workspace has opted in to GitHub Actions CI ingest. */
2559
+ githubActionsCiEnabled?: boolean;
2505
2560
  /** @description Present when `teamId` query is omitted — top-ranked teams. */
2506
2561
  items?: components["schemas"]["ProductivityInsightsTeamLeaderItemDto"][];
2507
2562
  /** @description Present when `teamId` query is set — single-team drilldown. */
@@ -2529,6 +2584,8 @@ export interface components {
2529
2584
  absenceType?: string;
2530
2585
  failureSignal: boolean;
2531
2586
  failures: string[];
2587
+ /** @description Failed GitHub Actions workflow runs for this UTC day when CI ingest is enabled. */
2588
+ failureItems?: components["schemas"]["ProductivityInsightsContributorFailureItemDto"][];
2532
2589
  /** @description Optional PR rows with GitHub links when ingest stored URLs. */
2533
2590
  mergedPrItems?: components["schemas"]["ProductivityInsightsContributorMergedPrItemDto"][];
2534
2591
  };
@@ -2537,6 +2594,17 @@ export interface components {
2537
2594
  /** Format: uri */
2538
2595
  url?: string;
2539
2596
  };
2597
+ ProductivityInsightsContributorFailureItemDto: {
2598
+ label: string;
2599
+ /** Format: uri */
2600
+ url?: string;
2601
+ workflowName?: string;
2602
+ /** @description GitHub repository slug (owner/repo). */
2603
+ repo?: string;
2604
+ branch?: string;
2605
+ /** Format: date-time */
2606
+ occurredAt?: string;
2607
+ };
2540
2608
  ProductivityInsightsContributorActivityWeekDto: {
2541
2609
  label: string;
2542
2610
  /** Format: date-time */
@@ -2549,11 +2617,16 @@ export interface components {
2549
2617
  totalMergedPrs: number;
2550
2618
  avgMergedPrsPerWeek: number;
2551
2619
  totalAbsenceDays: number;
2620
+ /** @description CI failure rate (%) over the selected range when GitHub Actions CI ingest is enabled (failures / runs × 100); otherwise average DORA change failure rate when available. */
2552
2621
  avgFailRate: number;
2622
+ /** @description Average GitHub Actions CI build failure rate over the range when CI ingest is enabled. */
2623
+ avgCiFailRate?: number;
2553
2624
  mergedPrDelta: number;
2554
2625
  avgMergedPrsPerWeekDelta: number;
2555
2626
  totalAbsenceDaysDelta: number;
2556
2627
  avgFailRateDelta: number;
2628
+ /** @description Change in average CI build failure rate vs the prior comparison window. */
2629
+ avgCiFailRateDelta?: number;
2557
2630
  };
2558
2631
  ProductivityInsightsContributorDetailDto: {
2559
2632
  /** Format: uuid */
@@ -2565,6 +2638,8 @@ export interface components {
2565
2638
  scope: components["schemas"]["ProductivityInsightsAggregatedTeamsScopeDto"];
2566
2639
  /** Format: date-time */
2567
2640
  generatedAt: string;
2641
+ /** @description True when the workspace has opted in to GitHub Actions CI ingest. */
2642
+ githubActionsCiEnabled?: boolean;
2568
2643
  contributor: components["schemas"]["ProductivityInsightsContributorProfileDto"];
2569
2644
  weeks: components["schemas"]["ProductivityInsightsContributorActivityWeekDto"][];
2570
2645
  summary: components["schemas"]["ProductivityInsightsContributorActivitySummaryDto"];
@@ -2583,6 +2658,8 @@ export interface components {
2583
2658
  periodAvgMergedPrs: number;
2584
2659
  /** @description Mean weekly change-failure rate when available. */
2585
2660
  avgFailRatePercent?: number;
2661
+ /** @description Mean weekly GitHub Actions CI build failure rate when CI ingest is enabled. */
2662
+ avgCiFailRatePercent?: number;
2586
2663
  };
2587
2664
  ProductivityInsightsNeedsAttentionDto: {
2588
2665
  /** Format: uuid */
@@ -2593,6 +2670,8 @@ export interface components {
2593
2670
  entityType: "teams" | "contributors";
2594
2671
  /** Format: date-time */
2595
2672
  generatedAt: string;
2673
+ /** @description True when GitHub Actions CI ingest is enabled for this workspace. */
2674
+ githubActionsCiEnabled?: boolean;
2596
2675
  items: components["schemas"]["ProductivityInsightsNeedsAttentionItemDto"][];
2597
2676
  };
2598
2677
  AiUsageSpendAggregatedTeamWeekDto: {
@@ -4303,6 +4382,8 @@ export type TeamMemberDto = components['schemas']['TeamMemberDto'];
4303
4382
  export type TeamMemberListDto = components['schemas']['TeamMemberListDto'];
4304
4383
  export type InviteTeamMemberBodyDto = components['schemas']['InviteTeamMemberBodyDto'];
4305
4384
  export type UpdateTeamMemberRoleBodyDto = components['schemas']['UpdateTeamMemberRoleBodyDto'];
4385
+ export type EraseInsightsPersonBodyDto = components['schemas']['EraseInsightsPersonBodyDto'];
4386
+ export type EraseInsightsPersonResultDto = components['schemas']['EraseInsightsPersonResultDto'];
4306
4387
  export type OrgChartNodeDto = components['schemas']['OrgChartNodeDto'];
4307
4388
  export type OrgChartTreeNodeDto = components['schemas']['OrgChartTreeNodeDto'];
4308
4389
  export type ScoringOrgChartDto = components['schemas']['ScoringOrgChartDto'];
@@ -4345,6 +4426,7 @@ export type ProductivityInsightsTeamsResponseDto = components['schemas']['Produc
4345
4426
  export type ProductivityInsightsContributorProfileDto = components['schemas']['ProductivityInsightsContributorProfileDto'];
4346
4427
  export type ProductivityInsightsContributorActivityDayDto = components['schemas']['ProductivityInsightsContributorActivityDayDto'];
4347
4428
  export type ProductivityInsightsContributorMergedPrItemDto = components['schemas']['ProductivityInsightsContributorMergedPrItemDto'];
4429
+ export type ProductivityInsightsContributorFailureItemDto = components['schemas']['ProductivityInsightsContributorFailureItemDto'];
4348
4430
  export type ProductivityInsightsContributorActivityWeekDto = components['schemas']['ProductivityInsightsContributorActivityWeekDto'];
4349
4431
  export type ProductivityInsightsContributorActivitySummaryDto = components['schemas']['ProductivityInsightsContributorActivitySummaryDto'];
4350
4432
  export type ProductivityInsightsContributorDetailDto = components['schemas']['ProductivityInsightsContributorDetailDto'];
@@ -5648,6 +5730,63 @@ export interface operations {
5648
5730
  };
5649
5731
  };
5650
5732
  };
5733
+ eraseInsightsPerson: {
5734
+ parameters: {
5735
+ query?: never;
5736
+ header?: never;
5737
+ path: {
5738
+ workspaceId: components["parameters"]["WorkspaceId"];
5739
+ /** @description Org-chart person_id (URL-encoded when it contains `@`). */
5740
+ personId: string;
5741
+ };
5742
+ cookie?: never;
5743
+ };
5744
+ requestBody?: {
5745
+ content: {
5746
+ /**
5747
+ * @example {
5748
+ * "orgChart": true,
5749
+ * "dashboardMetrics": true,
5750
+ * "aiToolData": true,
5751
+ * "absences": true,
5752
+ * "readinessAnonymize": true
5753
+ * }
5754
+ */
5755
+ "application/json": components["schemas"]["EraseInsightsPersonBodyDto"];
5756
+ };
5757
+ };
5758
+ responses: {
5759
+ /** @description Person data erased or anonymized */
5760
+ 200: {
5761
+ headers: {
5762
+ [name: string]: unknown;
5763
+ };
5764
+ content: {
5765
+ "application/json": components["schemas"]["EraseInsightsPersonResultDto"];
5766
+ };
5767
+ };
5768
+ /** @description Invalid body or personId */
5769
+ 400: {
5770
+ headers: {
5771
+ [name: string]: unknown;
5772
+ };
5773
+ content: {
5774
+ "application/json": components["schemas"]["ErrorMessageDto"];
5775
+ };
5776
+ };
5777
+ 401: components["responses"]["Unauthorized"];
5778
+ 403: components["responses"]["Forbidden"];
5779
+ /** @description Workspace not found, malformed workspaceId, or person not in org chart */
5780
+ 404: {
5781
+ headers: {
5782
+ [name: string]: unknown;
5783
+ };
5784
+ content: {
5785
+ "application/json": components["schemas"]["ErrorMessageDto"];
5786
+ };
5787
+ };
5788
+ };
5789
+ };
5651
5790
  getAiUsageSpendAggregatedTeams: {
5652
5791
  parameters: {
5653
5792
  query?: {
package/src/index.ts CHANGED
@@ -302,6 +302,26 @@ export interface DashboardProductivityMetricsDto {
302
302
  quality?: {
303
303
  codeReviewHoursPerWeek?: number;
304
304
  buildFailuresPerWeek?: number;
305
+ /** Share of completed CI runs that failed (GitHub Actions / Checks). */
306
+ ciBuildFailRatePercent?: number;
307
+ /** Count of build.failed events in the bucket window. */
308
+ ciBuildFailuresCount?: number;
309
+ /** Share of completed CI runs that failed (GitHub Actions / Checks). Alias of ciFailureRatePercent. */
310
+ ciFailureRatePercent?: number;
311
+ /** Count of build.passed + build.failed events in the bucket window. */
312
+ ciRunsTotal?: number;
313
+ /** Count of build.failed events in the bucket window. Alias of ciBuildFailuresCount. */
314
+ ciFailuresTotal?: number;
315
+ /** Failed CI workflow runs in the bucket window (for contributor day mapping). */
316
+ ciFailureRuns?: {
317
+ occurredAt: string;
318
+ label: string;
319
+ url?: string;
320
+ workflowName?: string;
321
+ repo?: string;
322
+ branch?: string;
323
+ prNumber?: number;
324
+ }[];
305
325
  avgTimeToFixBuildHours?: number;
306
326
  testCoveragePercent?: number;
307
327
  escapedBugsCount?: number;
@@ -460,6 +480,10 @@ export interface ProductivityInsightsAggregatedTeamWeekDto {
460
480
  weekLabel?: string;
461
481
  mergedPrCount: number;
462
482
  failRatePercent: number;
483
+ /** GitHub Actions CI build failure rate (failed / (failed + passed) * 100). */
484
+ ciFailRatePercent?: number;
485
+ /** Count of build.failed events in the bucket when CI ingest is enabled. */
486
+ ciBuildFailuresCount?: number;
463
487
  avgReviewWaitHours?: number;
464
488
  avgApprovalHours?: number;
465
489
  avgTimeToMergeHours?: number;
@@ -484,6 +508,8 @@ export interface ProductivityInsightsAggregatedTeamsDto {
484
508
  range: "4w" | "8w" | "q" | "12w" | "16w";
485
509
  scope: ProductivityInsightsAggregatedTeamsScopeDto;
486
510
  generatedAt: string;
511
+ /** True when the workspace has opted in to GitHub Actions CI ingest. */
512
+ githubActionsCiEnabled?: boolean;
487
513
  teams: ProductivityInsightsAggregatedTeamRowDto[];
488
514
  }
489
515
 
@@ -525,6 +551,7 @@ export interface ProductivityInsightsTeamLeaderItemDto {
525
551
  subtitle?: string;
526
552
  periodAvgMergedPrs: number;
527
553
  avgFailRatePercent?: number;
554
+ avgCiFailRatePercent?: number;
528
555
  }
529
556
 
530
557
  /** Period summary for a single-team drilldown. */
@@ -532,6 +559,8 @@ export interface ProductivityInsightsTeamSummaryDto {
532
559
  totalMergedPrs: number;
533
560
  avgMergedPrsPerWeek: number;
534
561
  avgFailRatePercent: number;
562
+ /** Average GitHub Actions CI build failure rate over the range when CI ingest is enabled. */
563
+ avgCiFailRatePercent?: number;
535
564
  headcount: number;
536
565
  }
537
566
 
@@ -560,6 +589,8 @@ export interface ProductivityInsightsTeamsResponseDto {
560
589
  year?: number;
561
590
  scope: ProductivityInsightsAggregatedTeamsScopeDto;
562
591
  generatedAt: string;
592
+ /** True when the workspace has opted in to GitHub Actions CI ingest. */
593
+ githubActionsCiEnabled?: boolean;
563
594
  /** Top-ranked teams when `teamId` query is omitted. */
564
595
  items?: ProductivityInsightsTeamLeaderItemDto[];
565
596
  /** Single-team drilldown when `teamId` query is set. */
@@ -585,6 +616,18 @@ export interface ProductivityInsightsContributorMergedPrItemDto {
585
616
  url?: string;
586
617
  }
587
618
 
619
+ /** One failed GitHub Actions workflow run on a contributor activity day. */
620
+ export interface ProductivityInsightsContributorFailureItemDto {
621
+ label: string;
622
+ url?: string;
623
+ workflowName?: string;
624
+ repo?: string;
625
+ branch?: string;
626
+ occurredAt?: string;
627
+ /** GitHub pull request number when CI ingest captured it on the failed run. */
628
+ prNumber?: number;
629
+ }
630
+
588
631
  /** One calendar day in contributor activity heatmap. */
589
632
  export interface ProductivityInsightsContributorActivityDayDto {
590
633
  date: string;
@@ -597,6 +640,8 @@ export interface ProductivityInsightsContributorActivityDayDto {
597
640
  absenceType?: string;
598
641
  failureSignal: boolean;
599
642
  failures: string[];
643
+ /** Failed CI workflow runs for this UTC day when GitHub Actions CI ingest is enabled. */
644
+ failureItems?: ProductivityInsightsContributorFailureItemDto[];
600
645
  }
601
646
 
602
647
  /** One weekly row in contributor activity heatmap. */
@@ -612,11 +657,16 @@ export interface ProductivityInsightsContributorActivitySummaryDto {
612
657
  totalMergedPrs: number;
613
658
  avgMergedPrsPerWeek: number;
614
659
  totalAbsenceDays: number;
660
+ /** CI failure rate (%) over the range when GitHub Actions CI ingest is enabled; otherwise DORA change failure rate when available. */
615
661
  avgFailRate: number;
662
+ /** Average GitHub Actions CI build failure rate over the range when CI ingest is enabled. */
663
+ avgCiFailRate?: number;
616
664
  mergedPrDelta: number;
617
665
  avgMergedPrsPerWeekDelta: number;
618
666
  totalAbsenceDaysDelta: number;
619
667
  avgFailRateDelta: number;
668
+ /** Change in average CI build failure rate vs the prior comparison window. */
669
+ avgCiFailRateDelta?: number;
620
670
  }
621
671
 
622
672
  /** Response for GET /workspaces/:workspaceId/insights/productivity-insights/contributors/:contributorId */
@@ -628,6 +678,8 @@ export interface ProductivityInsightsContributorDetailDto {
628
678
  year?: number;
629
679
  scope: ProductivityInsightsAggregatedTeamsScopeDto;
630
680
  generatedAt: string;
681
+ /** True when the workspace has opted in to GitHub Actions CI ingest. */
682
+ githubActionsCiEnabled?: boolean;
631
683
  contributor: ProductivityInsightsContributorProfileDto;
632
684
  weeks: ProductivityInsightsContributorActivityWeekDto[];
633
685
  summary: ProductivityInsightsContributorActivitySummaryDto;
@@ -642,6 +694,7 @@ export interface ProductivityInsightsNeedsAttentionItemDto {
642
694
  subtitle?: string;
643
695
  periodAvgMergedPrs: number;
644
696
  avgFailRatePercent?: number;
697
+ avgCiFailRatePercent?: number;
645
698
  }
646
699
 
647
700
  /** Response for GET /workspaces/:workspaceId/insights/productivity-insights/needs-attention */
@@ -651,6 +704,7 @@ export interface ProductivityInsightsNeedsAttentionDto {
651
704
  scope: ProductivityInsightsAggregatedTeamsScopeDto;
652
705
  entityType: "teams" | "contributors";
653
706
  generatedAt: string;
707
+ githubActionsCiEnabled?: boolean;
654
708
  items: ProductivityInsightsNeedsAttentionItemDto[];
655
709
  }
656
710