@thinkai/tai-api-contract 2.78.0 → 2.80.0-pr.976.4c124f8a

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.
@@ -1202,6 +1202,66 @@ export interface paths {
1202
1202
  patch?: never;
1203
1203
  trace?: never;
1204
1204
  };
1205
+ "/workspaces/{workspaceId}/insights/code/summary": {
1206
+ parameters: {
1207
+ query?: never;
1208
+ header?: never;
1209
+ path?: never;
1210
+ cookie?: never;
1211
+ };
1212
+ /**
1213
+ * Code Insights — org summary
1214
+ * @description Org-level Code Insights summary for `/insights/code`. Aggregates each active repo's **latest** deterministic metrics row (unweighted medians — mega-repos are not down-weighted, by design), findings counts by severity across latest scans, the org top-10 complexity hotspots, and org-level SonarQube coverage/tech-debt-ratio when a SonarQube source is connected (per-repo Sonar mapping is v2). Reads stored scan outputs only — never recomputes on request.
1215
+ */
1216
+ get: operations["getCodeInsightsSummary"];
1217
+ put?: never;
1218
+ post?: never;
1219
+ delete?: never;
1220
+ options?: never;
1221
+ head?: never;
1222
+ patch?: never;
1223
+ trace?: never;
1224
+ };
1225
+ "/workspaces/{workspaceId}/insights/code/repos": {
1226
+ parameters: {
1227
+ query?: never;
1228
+ header?: never;
1229
+ path?: never;
1230
+ cookie?: never;
1231
+ };
1232
+ /**
1233
+ * Code Insights — per-repo metrics list (paginated)
1234
+ * @description Page of active (not user-archived) repos with their latest code-quality metrics, threshold badges, and finding counts. Repos without a completed metrics scan appear with `metricsStatus` absent/`null` ("pending first scan").
1235
+ */
1236
+ get: operations["listCodeInsightsRepos"];
1237
+ put?: never;
1238
+ post?: never;
1239
+ delete?: never;
1240
+ options?: never;
1241
+ head?: never;
1242
+ patch?: never;
1243
+ trace?: never;
1244
+ };
1245
+ "/workspaces/{workspaceId}/insights/code/repos/{repoId}": {
1246
+ parameters: {
1247
+ query?: never;
1248
+ header?: never;
1249
+ path?: never;
1250
+ cookie?: never;
1251
+ };
1252
+ /**
1253
+ * Code Insights — repo detail (metrics, hotspots, findings)
1254
+ * @description Single-repo Code Insights detail: latest metrics row with per-metric provenance, current hotspot snapshot (top-N worst files), and the findings computed by the latest scan. `metrics` is `null` when the repo is pending its first metrics scan.
1255
+ */
1256
+ get: operations["getCodeInsightsRepoDetail"];
1257
+ put?: never;
1258
+ post?: never;
1259
+ delete?: never;
1260
+ options?: never;
1261
+ head?: never;
1262
+ patch?: never;
1263
+ trace?: never;
1264
+ };
1205
1265
  "/workspaces/{workspaceId}/integrations/ai-tool/{provider}/members": {
1206
1266
  parameters: {
1207
1267
  query?: never;
@@ -7519,6 +7579,172 @@ export interface components {
7519
7579
  }[];
7520
7580
  snippets: string[];
7521
7581
  };
7582
+ /**
7583
+ * @description Where a metric value came from: `measured` (direct tool output), `derived` (computed from measured inputs, e.g. the maintainability band), `estimated` (heuristic proxy, e.g. test-to-source ratio), or `unavailable` (tool missing/failed, or the language is unsupported). Keyed per metric in `CodeInsightsMetricsDto.provenance`.
7584
+ * @enum {string}
7585
+ */
7586
+ CodeInsightsMetricProvenance: "measured" | "derived" | "estimated" | "unavailable";
7587
+ /**
7588
+ * @description CC/LOC-derived maintainability band (documented heuristic, not Halstead MI).
7589
+ * @enum {string}
7590
+ */
7591
+ CodeInsightsMaintainabilityBand: "green" | "yellow" | "red";
7592
+ /**
7593
+ * @description Outcome of the repo's latest metrics scan: `ok` (at least one tool measured), `failed` (every tool failed — metric fields are null with `unavailable` provenance), `skipped` (stage ran but found no measurable source).
7594
+ * @enum {string}
7595
+ */
7596
+ CodeInsightsMetricsStatus: "ok" | "failed" | "skipped";
7597
+ /** @enum {string} */
7598
+ CodeInsightsFindingSeverity: "critical" | "high" | "medium" | "low";
7599
+ /**
7600
+ * @description Deterministic categories (`duplication`, `complexity`, `proliferation`, `coverage`) plus LLM semantic detectors (`anemic_domain`, `context_leak`, `tx_boundary`, `error_handling`).
7601
+ * @enum {string}
7602
+ */
7603
+ CodeInsightsFindingCategory: "duplication" | "complexity" | "proliferation" | "coverage" | "anemic_domain" | "context_leak" | "tx_boundary" | "error_handling";
7604
+ /**
7605
+ * @description `deterministic` = measured Code Insights rules; `llm` = AI-detected semantic findings (separate agent pass; never blended in scoring).
7606
+ * @enum {string}
7607
+ */
7608
+ CodeInsightsFindingSource: "deterministic" | "llm";
7609
+ CodeInsightsMetricsDto: {
7610
+ /** @description Readiness run that produced this metrics row. */
7611
+ runId: string;
7612
+ /** Format: date-time */
7613
+ measuredAt: string;
7614
+ metricsStatus: components["schemas"]["CodeInsightsMetricsStatus"];
7615
+ locTotal?: number | null;
7616
+ filesTotal?: number | null;
7617
+ /** @description Mean cyclomatic complexity across analyzed functions. */
7618
+ ccAvg?: number | null;
7619
+ ccMax?: number | null;
7620
+ /** @description 90th percentile function cyclomatic complexity (nearest-rank). */
7621
+ ccP90?: number | null;
7622
+ /** @description Duplicated lines as a percentage of analyzed lines (0–100). */
7623
+ dupPct?: number | null;
7624
+ maintainabilityBand?: components["schemas"]["CodeInsightsMaintainabilityBand"] | null;
7625
+ /** @description Reserved for per-repo SonarQube enrichment (v2); null in v1. */
7626
+ coveragePct?: number | null;
7627
+ /** @description Reserved for per-repo SonarQube enrichment (v2); null in v1. */
7628
+ debtRatio?: number | null;
7629
+ /** @description Heuristic structure counters: dto/mapper/config/exception file + LOC counts, test/source LOC split, per-language LOC, functions_analyzed, test_ratio, dto_mapper_share_pct. */
7630
+ structureCounts: {
7631
+ [key: string]: unknown;
7632
+ };
7633
+ /** @description Per-metric provenance keyed by DTO field name (e.g. `ccAvg`, `dupPct`, `testRatio`). */
7634
+ provenance: {
7635
+ [key: string]: components["schemas"]["CodeInsightsMetricProvenance"];
7636
+ };
7637
+ /** @description Tool name → version string for the tools that produced this row. */
7638
+ toolVersions: {
7639
+ [key: string]: string;
7640
+ };
7641
+ };
7642
+ CodeInsightsHotspotDto: {
7643
+ /** @description Repo-relative file path. */
7644
+ filePath: string;
7645
+ loc?: number | null;
7646
+ /** @description Max function cyclomatic complexity in the file. */
7647
+ ccMax?: number | null;
7648
+ paramsMax?: number | null;
7649
+ /** @description Max nested control structures (null when the analyzer does not report nesting). */
7650
+ nestingMax?: number | null;
7651
+ /** @description Estimated per-file duplicated line share (0–100). */
7652
+ dupPct?: number | null;
7653
+ /** @description Subset of `god_file`, `high_cc`, `long_params`, `deep_nesting`. */
7654
+ flags: string[];
7655
+ };
7656
+ CodeInsightsFindingDto: {
7657
+ /** Format: uuid */
7658
+ id: string;
7659
+ severity: components["schemas"]["CodeInsightsFindingSeverity"];
7660
+ category: components["schemas"]["CodeInsightsFindingCategory"];
7661
+ title: string;
7662
+ explanation: string;
7663
+ /** @description Measured values and thresholds backing the finding. */
7664
+ evidence: {
7665
+ [key: string]: unknown;
7666
+ };
7667
+ remediation?: string | null;
7668
+ source: components["schemas"]["CodeInsightsFindingSource"];
7669
+ runId: string;
7670
+ /** Format: date-time */
7671
+ createdAt: string;
7672
+ };
7673
+ CodeInsightsFindingsBySeverityDto: {
7674
+ critical: number;
7675
+ high: number;
7676
+ medium: number;
7677
+ low: number;
7678
+ };
7679
+ CodeInsightsRepoListItemDto: {
7680
+ /** Format: uuid */
7681
+ repoId: string;
7682
+ repoName: string;
7683
+ language: string;
7684
+ /** @description owner/repo on the VCS provider. */
7685
+ providerSlug: string;
7686
+ webUrl: string;
7687
+ /**
7688
+ * Format: date-time
7689
+ * @description Null when the repo is pending its first metrics scan.
7690
+ */
7691
+ lastMeasuredAt?: string | null;
7692
+ metricsStatus?: components["schemas"]["CodeInsightsMetricsStatus"] | null;
7693
+ locTotal?: number | null;
7694
+ ccAvg?: number | null;
7695
+ ccMax?: number | null;
7696
+ dupPct?: number | null;
7697
+ maintainabilityBand?: components["schemas"]["CodeInsightsMaintainabilityBand"] | null;
7698
+ /** @description Active threshold badges from the latest scan: subset of `god_files`, `high_complexity`, `duplication`, `proliferation`, `low_test_ratio`. */
7699
+ badges: string[];
7700
+ findingsBySeverity: components["schemas"]["CodeInsightsFindingsBySeverityDto"];
7701
+ provenance: {
7702
+ [key: string]: components["schemas"]["CodeInsightsMetricProvenance"];
7703
+ };
7704
+ };
7705
+ CodeInsightsRepoListDto: components["schemas"]["PageMetaDto"] & {
7706
+ items: components["schemas"]["CodeInsightsRepoListItemDto"][];
7707
+ };
7708
+ CodeInsightsRepoDetailDto: {
7709
+ /** Format: uuid */
7710
+ repoId: string;
7711
+ repoName: string;
7712
+ language: string;
7713
+ providerSlug: string;
7714
+ webUrl: string;
7715
+ /** @description Null when the repo is pending its first metrics scan. */
7716
+ metrics: components["schemas"]["CodeInsightsMetricsDto"] | null;
7717
+ hotspots: components["schemas"]["CodeInsightsHotspotDto"][];
7718
+ /** @description Findings from the latest scan only (history is retention-bounded). */
7719
+ findings: components["schemas"]["CodeInsightsFindingDto"][];
7720
+ };
7721
+ CodeInsightsOrgHotspotDto: components["schemas"]["CodeInsightsHotspotDto"] & {
7722
+ /** Format: uuid */
7723
+ repoId: string;
7724
+ repoName: string;
7725
+ };
7726
+ CodeInsightsSonarDto: {
7727
+ /** @description Whether a SonarQube source is configured for the workspace. */
7728
+ connected: boolean;
7729
+ /** @description Org-level SonarQube coverage from the latest precomputed quality snapshot. */
7730
+ coveragePct?: number | null;
7731
+ /** @description Org-level SonarQube SQALE technical debt ratio from the latest quality snapshot. */
7732
+ techDebtRatioPct?: number | null;
7733
+ };
7734
+ CodeInsightsSummaryDto: {
7735
+ /** @description Active repos whose latest metrics scan completed (`ok`). */
7736
+ reposMeasured: number;
7737
+ /** @description Active repos without a completed metrics scan (never scanned, or only failed/skipped). */
7738
+ reposPending: number;
7739
+ /** @description Unweighted median of latest `ccAvg` across measured repos (null when none measured). */
7740
+ ccAvgMedian?: number | null;
7741
+ /** @description Unweighted median of latest `dupPct` across measured repos (null when none measured). */
7742
+ dupPctMedian?: number | null;
7743
+ findingsBySeverity: components["schemas"]["CodeInsightsFindingsBySeverityDto"];
7744
+ /** @description Org top-10 complexity hotspots by `ccMax` (current per-repo snapshots). */
7745
+ topHotspots: components["schemas"]["CodeInsightsOrgHotspotDto"][];
7746
+ sonar: components["schemas"]["CodeInsightsSonarDto"];
7747
+ };
7522
7748
  };
7523
7749
  responses: {
7524
7750
  /** @description Missing or invalid bearer token */
@@ -7602,6 +7828,10 @@ export interface components {
7602
7828
  PaginationOrder: "asc" | "desc";
7603
7829
  /** @description Allowlisted repository sort field. */
7604
7830
  ReadinessRepoSort: "repoName" | "overallScore" | "lastAnalyzed" | "language";
7831
+ /** @description Allowlisted Code Insights repo sort field. */
7832
+ CodeInsightsRepoSort: "repoName" | "locTotal" | "ccAvg" | "dupPct" | "lastMeasuredAt";
7833
+ /** @description Case-insensitive substring filter on repo name / provider slug. */
7834
+ CodeInsightsRepoSearch: string;
7605
7835
  /** @description Case-insensitive filter on repository name, language, or provider slug. */
7606
7836
  ReadinessRepoSearch: string;
7607
7837
  /** @description Exact language filter (e.g. `typescript`). */
@@ -8012,6 +8242,22 @@ export type CodeChatCrossEdgesBodyDto = components['schemas']['CodeChatCrossEdge
8012
8242
  export type CodeChatCrossEdgesResultDto = components['schemas']['CodeChatCrossEdgesResultDto'];
8013
8243
  export type CodeChatContextPackBodyDto = components['schemas']['CodeChatContextPackBodyDto'];
8014
8244
  export type CodeChatContextPackDto = components['schemas']['CodeChatContextPackDto'];
8245
+ export type CodeInsightsMetricProvenance = components['schemas']['CodeInsightsMetricProvenance'];
8246
+ export type CodeInsightsMaintainabilityBand = components['schemas']['CodeInsightsMaintainabilityBand'];
8247
+ export type CodeInsightsMetricsStatus = components['schemas']['CodeInsightsMetricsStatus'];
8248
+ export type CodeInsightsFindingSeverity = components['schemas']['CodeInsightsFindingSeverity'];
8249
+ export type CodeInsightsFindingCategory = components['schemas']['CodeInsightsFindingCategory'];
8250
+ export type CodeInsightsFindingSource = components['schemas']['CodeInsightsFindingSource'];
8251
+ export type CodeInsightsMetricsDto = components['schemas']['CodeInsightsMetricsDto'];
8252
+ export type CodeInsightsHotspotDto = components['schemas']['CodeInsightsHotspotDto'];
8253
+ export type CodeInsightsFindingDto = components['schemas']['CodeInsightsFindingDto'];
8254
+ export type CodeInsightsFindingsBySeverityDto = components['schemas']['CodeInsightsFindingsBySeverityDto'];
8255
+ export type CodeInsightsRepoListItemDto = components['schemas']['CodeInsightsRepoListItemDto'];
8256
+ export type CodeInsightsRepoListDto = components['schemas']['CodeInsightsRepoListDto'];
8257
+ export type CodeInsightsRepoDetailDto = components['schemas']['CodeInsightsRepoDetailDto'];
8258
+ export type CodeInsightsOrgHotspotDto = components['schemas']['CodeInsightsOrgHotspotDto'];
8259
+ export type CodeInsightsSonarDto = components['schemas']['CodeInsightsSonarDto'];
8260
+ export type CodeInsightsSummaryDto = components['schemas']['CodeInsightsSummaryDto'];
8015
8261
  export type ResponseUnauthorized = components['responses']['Unauthorized'];
8016
8262
  export type ResponseForbidden = components['responses']['Forbidden'];
8017
8263
  export type ResponseZenHrSyncInProgress = components['responses']['ZenHrSyncInProgress'];
@@ -8041,6 +8287,8 @@ export type ParameterPaginationLimit = components['parameters']['PaginationLimit
8041
8287
  export type ParameterPaginationOffset = components['parameters']['PaginationOffset'];
8042
8288
  export type ParameterPaginationOrder = components['parameters']['PaginationOrder'];
8043
8289
  export type ParameterReadinessRepoSort = components['parameters']['ReadinessRepoSort'];
8290
+ export type ParameterCodeInsightsRepoSort = components['parameters']['CodeInsightsRepoSort'];
8291
+ export type ParameterCodeInsightsRepoSearch = components['parameters']['CodeInsightsRepoSearch'];
8044
8292
  export type ParameterReadinessRepoSearch = components['parameters']['ReadinessRepoSearch'];
8045
8293
  export type ParameterReadinessRepoLanguage = components['parameters']['ReadinessRepoLanguage'];
8046
8294
  export type ParameterReadinessFixSort = components['parameters']['ReadinessFixSort'];
@@ -11383,6 +11631,135 @@ export interface operations {
11383
11631
  };
11384
11632
  };
11385
11633
  };
11634
+ getCodeInsightsSummary: {
11635
+ parameters: {
11636
+ query?: never;
11637
+ header?: never;
11638
+ path: {
11639
+ workspaceId: components["parameters"]["WorkspaceId"];
11640
+ };
11641
+ cookie?: never;
11642
+ };
11643
+ requestBody?: never;
11644
+ responses: {
11645
+ /** @description Code Insights org summary payload */
11646
+ 200: {
11647
+ headers: {
11648
+ [name: string]: unknown;
11649
+ };
11650
+ content: {
11651
+ "application/json": components["schemas"]["CodeInsightsSummaryDto"];
11652
+ };
11653
+ };
11654
+ 401: components["responses"]["Unauthorized"];
11655
+ 403: components["responses"]["Forbidden"];
11656
+ /** @description Workspace does not exist or malformed workspaceId */
11657
+ 404: {
11658
+ headers: {
11659
+ [name: string]: unknown;
11660
+ };
11661
+ content?: never;
11662
+ };
11663
+ };
11664
+ };
11665
+ listCodeInsightsRepos: {
11666
+ parameters: {
11667
+ query?: {
11668
+ /** @description Page size (default 25, max 100). */
11669
+ limit?: components["parameters"]["PaginationLimit"];
11670
+ /** @description Zero-based row offset into the filtered, sorted result set. */
11671
+ offset?: components["parameters"]["PaginationOffset"];
11672
+ /** @description Allowlisted Code Insights repo sort field. */
11673
+ sort?: components["parameters"]["CodeInsightsRepoSort"];
11674
+ /** @description Sort direction. */
11675
+ order?: components["parameters"]["PaginationOrder"];
11676
+ /** @description Case-insensitive substring filter on repo name / provider slug. */
11677
+ search?: components["parameters"]["CodeInsightsRepoSearch"];
11678
+ };
11679
+ header?: never;
11680
+ path: {
11681
+ workspaceId: components["parameters"]["WorkspaceId"];
11682
+ };
11683
+ cookie?: never;
11684
+ };
11685
+ requestBody?: never;
11686
+ responses: {
11687
+ /** @description Paginated repo code-quality metrics */
11688
+ 200: {
11689
+ headers: {
11690
+ [name: string]: unknown;
11691
+ };
11692
+ content: {
11693
+ "application/json": components["schemas"]["CodeInsightsRepoListDto"];
11694
+ };
11695
+ };
11696
+ /** @description Invalid pagination or sort query */
11697
+ 400: {
11698
+ headers: {
11699
+ [name: string]: unknown;
11700
+ };
11701
+ content: {
11702
+ "application/json": components["schemas"]["ErrorMessageDto"];
11703
+ };
11704
+ };
11705
+ 401: components["responses"]["Unauthorized"];
11706
+ 403: components["responses"]["Forbidden"];
11707
+ /** @description Workspace does not exist or malformed workspaceId */
11708
+ 404: {
11709
+ headers: {
11710
+ [name: string]: unknown;
11711
+ };
11712
+ content?: never;
11713
+ };
11714
+ };
11715
+ };
11716
+ getCodeInsightsRepoDetail: {
11717
+ parameters: {
11718
+ query?: {
11719
+ /** @description Optional filter for findings by source. Omit to return both deterministic and llm findings. */
11720
+ source?: components["schemas"]["CodeInsightsFindingSource"];
11721
+ };
11722
+ header?: never;
11723
+ path: {
11724
+ workspaceId: components["parameters"]["WorkspaceId"];
11725
+ /** @description Internal repo UUID (`tai_workspace_repos.id`). */
11726
+ repoId: string;
11727
+ };
11728
+ cookie?: never;
11729
+ };
11730
+ requestBody?: never;
11731
+ responses: {
11732
+ /** @description Repo code-quality detail payload */
11733
+ 200: {
11734
+ headers: {
11735
+ [name: string]: unknown;
11736
+ };
11737
+ content: {
11738
+ "application/json": components["schemas"]["CodeInsightsRepoDetailDto"];
11739
+ };
11740
+ };
11741
+ /** @description Malformed repoId */
11742
+ 400: {
11743
+ headers: {
11744
+ [name: string]: unknown;
11745
+ };
11746
+ content: {
11747
+ "application/json": components["schemas"]["ErrorMessageDto"];
11748
+ };
11749
+ };
11750
+ 401: components["responses"]["Unauthorized"];
11751
+ 403: components["responses"]["Forbidden"];
11752
+ /** @description Workspace or repo does not exist */
11753
+ 404: {
11754
+ headers: {
11755
+ [name: string]: unknown;
11756
+ };
11757
+ content: {
11758
+ "application/json": components["schemas"]["ErrorMessageDto"];
11759
+ };
11760
+ };
11761
+ };
11762
+ };
11386
11763
  getAiToolMembers: {
11387
11764
  parameters: {
11388
11765
  query?: {