@thinkai/tai-api-contract 2.127.0 → 2.128.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.
@@ -1,7 +1,7 @@
1
1
  openapi: 3.0.3
2
2
  info:
3
3
  title: ThinkAI API
4
- version: 2.127.0
4
+ version: 2.128.0
5
5
  description: >
6
6
  Contract surface for the AI Driven SDLC backend used by ThinkAI.
7
7
  Workspace-scoped routes use `/workspaces/{workspaceId}/...`.
@@ -3844,12 +3844,15 @@ paths:
3844
3844
  operationId: getInsightsTestPyramidSummary
3845
3845
  description: >
3846
3846
  Org-level Test pyramid assessment for `/insights/test-pyramid`. Aggregates each
3847
- active repo's **latest** readiness-scan test-pyramid snapshot. Layer **presence
3848
- is count-based** (`fileCount > 0`); CI/dependency-only AF `present` flags are
3849
- ignored. Shape uses fixed advisory targets (base ~70% unit, middle ~20%
3850
- integration+contract+acceptance/BDD, top ~10% E2E) and returns
3851
- `insufficient_data` when total classified test files < 10. Does not change
3852
- Agentic Foundation `/readiness/test-pyramid*` responses.
3847
+ active repo's **latest** readiness-scan test-pyramid snapshot and the immediately
3848
+ previous succeeded/partial_failed/failed point when present (`limitPerRepo: 2`).
3849
+ Layer **presence is count-based** (`fileCount > 0`); CI/dependency-only AF
3850
+ `present` flags are ignored. Shape uses fixed advisory targets (base ~70% unit,
3851
+ middle ~20% integration+contract+acceptance/BDD, top ~10% E2E) and returns
3852
+ `insufficient_data` when total classified test files < 10. Also returns
3853
+ maturity trend, coverage overlay, confidence, applicability, E2E-cross/hotspot
3854
+ risk, and workspace-only `ciQuality` from the latest org dashboard snapshot.
3855
+ Does not change Agentic Foundation `/readiness/test-pyramid*` responses.
3853
3856
  parameters:
3854
3857
  - $ref: "#/components/parameters/WorkspaceId"
3855
3858
  responses:
@@ -3879,7 +3882,9 @@ paths:
3879
3882
  operationId: listInsightsTestPyramidRepos
3880
3883
  description: >
3881
3884
  Page of repos with latest classified test-file counts, count-based presence,
3882
- presence maturity, and shape assessment. Use `gapsByLayer` on the summary
3885
+ presence maturity, shape, trend vs the previous pyramid point, coverage
3886
+ overlay, confidence/evidence, layer applicability, and risk signals
3887
+ (`e2eCrossRepoCandidate`, `hotspotCount`). Use `gapsByLayer` on the summary
3883
3888
  endpoint (or filter this list via layerPresent) to answer “who lacks layer X?”.
3884
3889
  No v1 repo-detail Insights route — link repo names to AF readiness inventory.
3885
3890
  parameters:
@@ -21740,6 +21745,66 @@ components:
21740
21745
  contract: { $ref: "#/components/schemas/InsightsTestPyramidLayerPresenceDto" }
21741
21746
  e2e: { $ref: "#/components/schemas/InsightsTestPyramidLayerPresenceDto" }
21742
21747
 
21748
+ InsightsTestPyramidMaturityDeltaDto:
21749
+ type: string
21750
+ enum: [up, down, unchanged, none]
21751
+ description: >
21752
+ Insights maturity rank change vs the immediately previous pyramid point
21753
+ (missing 0, emerging 1, established 2, mature 3). `none` when the repo
21754
+ has no previous succeeded/partial_failed/failed point.
21755
+
21756
+ InsightsTestPyramidConfidenceDto:
21757
+ type: string
21758
+ enum: [high, medium, low]
21759
+
21760
+ InsightsTestPyramidLayerConfidenceDto:
21761
+ type: object
21762
+ required: [unit, integration, acceptance_bdd, contract, e2e]
21763
+ properties:
21764
+ unit: { $ref: "#/components/schemas/InsightsTestPyramidConfidenceDto" }
21765
+ integration: { $ref: "#/components/schemas/InsightsTestPyramidConfidenceDto" }
21766
+ acceptance_bdd: { $ref: "#/components/schemas/InsightsTestPyramidConfidenceDto" }
21767
+ contract: { $ref: "#/components/schemas/InsightsTestPyramidConfidenceDto" }
21768
+ e2e: { $ref: "#/components/schemas/InsightsTestPyramidConfidenceDto" }
21769
+
21770
+ InsightsTestPyramidCoverageRollupDto:
21771
+ type: object
21772
+ required: [reposWithCoverage, medianLinePercent]
21773
+ properties:
21774
+ reposWithCoverage:
21775
+ type: integer
21776
+ minimum: 0
21777
+ description: Repos whose overlaid `lineCoverage` is non-null.
21778
+ medianLinePercent:
21779
+ type: number
21780
+ nullable: true
21781
+ minimum: 0
21782
+ maximum: 100
21783
+ description: >
21784
+ Median of repo `linePercent` among repos that have coverage. Null when
21785
+ `reposWithCoverage` is 0.
21786
+
21787
+ InsightsTestPyramidCiQualityDto:
21788
+ type: object
21789
+ nullable: true
21790
+ required: [ciFailureRatePercent, bucketEnd]
21791
+ properties:
21792
+ ciFailureRatePercent:
21793
+ type: number
21794
+ minimum: 0
21795
+ maximum: 100
21796
+ description: >
21797
+ Latest org dashboard `quality.ciFailureRatePercent`, falling back to
21798
+ `quality.ciBuildFailRatePercent`.
21799
+ ciFlakinessPercent:
21800
+ type: number
21801
+ minimum: 0
21802
+ maximum: 100
21803
+ description: Included only when `quality.ciFlakinessPercent` is a finite number.
21804
+ bucketEnd:
21805
+ type: string
21806
+ description: Dashboard metrics bucket end for the org snapshot.
21807
+
21743
21808
  InsightsTestPyramidSummaryDto:
21744
21809
  type: object
21745
21810
  required:
@@ -21752,6 +21817,14 @@ components:
21752
21817
  - layerPresence
21753
21818
  - maturityCounts
21754
21819
  - gapsByLayer
21820
+ - newestScannedAt
21821
+ - maturedRepoCount
21822
+ - slippedRepoCount
21823
+ - previousShape
21824
+ - coverage
21825
+ - e2eCrossRepoCandidateCount
21826
+ - reposWithHotspots
21827
+ - ciQuality
21755
21828
  properties:
21756
21829
  workspaceId: { type: string, format: uuid }
21757
21830
  generatedAt: { type: string, format: date-time }
@@ -21772,6 +21845,37 @@ components:
21772
21845
  $ref: "#/components/schemas/InsightsTestPyramidMaturityCountsDto"
21773
21846
  gapsByLayer:
21774
21847
  $ref: "#/components/schemas/InsightsTestPyramidGapsByLayerDto"
21848
+ newestScannedAt:
21849
+ type: string
21850
+ format: date-time
21851
+ nullable: true
21852
+ description: Latest per-repo `scannedAt`. Null when `reposWithPyramid` is 0.
21853
+ maturedRepoCount:
21854
+ type: integer
21855
+ minimum: 0
21856
+ description: Repos whose Insights maturity rank increased vs the previous point.
21857
+ slippedRepoCount:
21858
+ type: integer
21859
+ minimum: 0
21860
+ description: Repos whose Insights maturity rank decreased vs the previous point.
21861
+ previousShape:
21862
+ allOf:
21863
+ - $ref: "#/components/schemas/InsightsTestPyramidShapeDto"
21864
+ nullable: true
21865
+ description: >
21866
+ Insights workspace shape from previous-point file totals for repos that
21867
+ have a previous point. Null when no repo has a previous point.
21868
+ coverage:
21869
+ $ref: "#/components/schemas/InsightsTestPyramidCoverageRollupDto"
21870
+ e2eCrossRepoCandidateCount:
21871
+ type: integer
21872
+ minimum: 0
21873
+ reposWithHotspots:
21874
+ type: integer
21875
+ minimum: 0
21876
+ description: Repos whose latest Code Insights snapshot has `hotspotCount` > 0.
21877
+ ciQuality:
21878
+ $ref: "#/components/schemas/InsightsTestPyramidCiQualityDto"
21775
21879
 
21776
21880
  InsightsTestPyramidRepoItemDto:
21777
21881
  type: object
@@ -21785,6 +21889,17 @@ components:
21785
21889
  - layerPresent
21786
21890
  - totalClassifiedFiles
21787
21891
  - shape
21892
+ - previousMaturity
21893
+ - maturityDelta
21894
+ - previousShapeLabel
21895
+ - lineCoverage
21896
+ - lowestConfidence
21897
+ - layerConfidence
21898
+ - evidenceCount
21899
+ - frameworks
21900
+ - layerApplicable
21901
+ - e2eCrossRepoCandidate
21902
+ - hotspotCount
21788
21903
  properties:
21789
21904
  repoId: { type: string, format: uuid }
21790
21905
  repoName: { type: string }
@@ -21793,13 +21908,59 @@ components:
21793
21908
  $ref: "#/components/schemas/TestPyramidRunStatusDto"
21794
21909
  maturity:
21795
21910
  $ref: "#/components/schemas/InsightsTestPyramidMaturityDto"
21911
+ previousMaturity:
21912
+ allOf:
21913
+ - $ref: "#/components/schemas/InsightsTestPyramidMaturityDto"
21914
+ nullable: true
21915
+ maturityDelta:
21916
+ $ref: "#/components/schemas/InsightsTestPyramidMaturityDeltaDto"
21917
+ previousShapeLabel:
21918
+ allOf:
21919
+ - $ref: "#/components/schemas/InsightsTestPyramidShapeLabelDto"
21920
+ nullable: true
21796
21921
  layerFileCounts:
21797
21922
  $ref: "#/components/schemas/InsightsTestPyramidLayerCountsDto"
21798
21923
  layerPresent:
21799
21924
  $ref: "#/components/schemas/InsightsTestPyramidLayerPresentDto"
21925
+ layerApplicable:
21926
+ allOf:
21927
+ - $ref: "#/components/schemas/InsightsTestPyramidLayerPresentDto"
21928
+ description: Snapshot `layers.*.applicable` for each layer.
21800
21929
  totalClassifiedFiles: { type: integer, minimum: 0 }
21801
21930
  shape:
21802
21931
  $ref: "#/components/schemas/InsightsTestPyramidShapeDto"
21932
+ lineCoverage:
21933
+ allOf:
21934
+ - $ref: "#/components/schemas/TestPyramidLineCoverageDto"
21935
+ description: >
21936
+ Same overlay as AF progress — latest Sonar row first, else snapshot
21937
+ `testPyramid.lineCoverage`. Null when both are missing. Not Code Insights
21938
+ `coveragePct`.
21939
+ lowestConfidence:
21940
+ allOf:
21941
+ - $ref: "#/components/schemas/InsightsTestPyramidConfidenceDto"
21942
+ description: >
21943
+ Minimum confidence among layers with Insights presence (`fileCount > 0`);
21944
+ if none present, minimum of applicable layers. Order low < medium < high.
21945
+ layerConfidence:
21946
+ $ref: "#/components/schemas/InsightsTestPyramidLayerConfidenceDto"
21947
+ evidenceCount:
21948
+ type: integer
21949
+ minimum: 0
21950
+ description: Sum of layer `evidence[]` lengths on the latest snapshot.
21951
+ frameworks:
21952
+ type: array
21953
+ maxItems: 8
21954
+ items: { type: string }
21955
+ description: Unique framework names across layers, capped at 8.
21956
+ e2eCrossRepoCandidate: { type: boolean }
21957
+ hotspotCount:
21958
+ type: integer
21959
+ nullable: true
21960
+ minimum: 0
21961
+ description: >
21962
+ Row count in `tai_workspace_repo_code_hotspots` for the repo's latest
21963
+ Code Insights metrics snapshot. Null when the repo has no metrics snapshot.
21803
21964
 
21804
21965
  InsightsTestPyramidRepoListDto:
21805
21966
  type: object
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.127.0",
3
+ "version": "2.128.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "devDependencies": {
22
22
  "@stoplight/spectral-cli": "^6.16.3",
23
- "@types/node": "^26.4.1",
23
+ "@types/node": "^26.5.1",
24
24
  "jsonpath-plus": "^10.3.0",
25
25
  "openapi-typescript": "^7.13.0",
26
26
  "typescript": "~6.0.3"
@@ -1403,7 +1403,7 @@ export interface paths {
1403
1403
  };
1404
1404
  /**
1405
1405
  * Test pyramid assessment — workspace summary
1406
- * @description Org-level Test pyramid assessment for `/insights/test-pyramid`. Aggregates each active repo's **latest** readiness-scan test-pyramid snapshot. Layer **presence is count-based** (`fileCount > 0`); CI/dependency-only AF `present` flags are ignored. Shape uses fixed advisory targets (base ~70% unit, middle ~20% integration+contract+acceptance/BDD, top ~10% E2E) and returns `insufficient_data` when total classified test files < 10. Does not change Agentic Foundation `/readiness/test-pyramid*` responses.
1406
+ * @description Org-level Test pyramid assessment for `/insights/test-pyramid`. Aggregates each active repo's **latest** readiness-scan test-pyramid snapshot and the immediately previous succeeded/partial_failed/failed point when present (`limitPerRepo: 2`). Layer **presence is count-based** (`fileCount > 0`); CI/dependency-only AF `present` flags are ignored. Shape uses fixed advisory targets (base ~70% unit, middle ~20% integration+contract+acceptance/BDD, top ~10% E2E) and returns `insufficient_data` when total classified test files < 10. Also returns maturity trend, coverage overlay, confidence, applicability, E2E-cross/hotspot risk, and workspace-only `ciQuality` from the latest org dashboard snapshot. Does not change Agentic Foundation `/readiness/test-pyramid*` responses.
1407
1407
  */
1408
1408
  get: operations["getInsightsTestPyramidSummary"];
1409
1409
  put?: never;
@@ -1423,7 +1423,7 @@ export interface paths {
1423
1423
  };
1424
1424
  /**
1425
1425
  * Test pyramid assessment — per-repo list (paginated)
1426
- * @description Page of repos with latest classified test-file counts, count-based presence, presence maturity, and shape assessment. Use `gapsByLayer` on the summary endpoint (or filter this list via layerPresent) to answer “who lacks layer X?”. No v1 repo-detail Insights route — link repo names to AF readiness inventory.
1426
+ * @description Page of repos with latest classified test-file counts, count-based presence, presence maturity, shape, trend vs the previous pyramid point, coverage overlay, confidence/evidence, layer applicability, and risk signals (`e2eCrossRepoCandidate`, `hotspotCount`). Use `gapsByLayer` on the summary endpoint (or filter this list via layerPresent) to answer “who lacks layer X?”. No v1 repo-detail Insights route — link repo names to AF readiness inventory.
1427
1427
  */
1428
1428
  get: operations["listInsightsTestPyramidRepos"];
1429
1429
  put?: never;
@@ -9659,6 +9659,34 @@ export interface components {
9659
9659
  contract: components["schemas"]["InsightsTestPyramidLayerPresenceDto"];
9660
9660
  e2e: components["schemas"]["InsightsTestPyramidLayerPresenceDto"];
9661
9661
  };
9662
+ /**
9663
+ * @description Insights maturity rank change vs the immediately previous pyramid point (missing 0, emerging 1, established 2, mature 3). `none` when the repo has no previous succeeded/partial_failed/failed point.
9664
+ * @enum {string}
9665
+ */
9666
+ InsightsTestPyramidMaturityDeltaDto: "up" | "down" | "unchanged" | "none";
9667
+ /** @enum {string} */
9668
+ InsightsTestPyramidConfidenceDto: "high" | "medium" | "low";
9669
+ InsightsTestPyramidLayerConfidenceDto: {
9670
+ unit: components["schemas"]["InsightsTestPyramidConfidenceDto"];
9671
+ integration: components["schemas"]["InsightsTestPyramidConfidenceDto"];
9672
+ acceptance_bdd: components["schemas"]["InsightsTestPyramidConfidenceDto"];
9673
+ contract: components["schemas"]["InsightsTestPyramidConfidenceDto"];
9674
+ e2e: components["schemas"]["InsightsTestPyramidConfidenceDto"];
9675
+ };
9676
+ InsightsTestPyramidCoverageRollupDto: {
9677
+ /** @description Repos whose overlaid `lineCoverage` is non-null. */
9678
+ reposWithCoverage: number;
9679
+ /** @description Median of repo `linePercent` among repos that have coverage. Null when `reposWithCoverage` is 0. */
9680
+ medianLinePercent: number | null;
9681
+ };
9682
+ InsightsTestPyramidCiQualityDto: {
9683
+ /** @description Latest org dashboard `quality.ciFailureRatePercent`, falling back to `quality.ciBuildFailRatePercent`. */
9684
+ ciFailureRatePercent: number;
9685
+ /** @description Included only when `quality.ciFlakinessPercent` is a finite number. */
9686
+ ciFlakinessPercent?: number;
9687
+ /** @description Dashboard metrics bucket end for the org snapshot. */
9688
+ bucketEnd: string;
9689
+ } | null;
9662
9690
  InsightsTestPyramidSummaryDto: {
9663
9691
  /** Format: uuid */
9664
9692
  workspaceId: string;
@@ -9673,6 +9701,22 @@ export interface components {
9673
9701
  layerPresence: components["schemas"]["InsightsTestPyramidLayerPresenceMapDto"];
9674
9702
  maturityCounts: components["schemas"]["InsightsTestPyramidMaturityCountsDto"];
9675
9703
  gapsByLayer: components["schemas"]["InsightsTestPyramidGapsByLayerDto"];
9704
+ /**
9705
+ * Format: date-time
9706
+ * @description Latest per-repo `scannedAt`. Null when `reposWithPyramid` is 0.
9707
+ */
9708
+ newestScannedAt: string | null;
9709
+ /** @description Repos whose Insights maturity rank increased vs the previous point. */
9710
+ maturedRepoCount: number;
9711
+ /** @description Repos whose Insights maturity rank decreased vs the previous point. */
9712
+ slippedRepoCount: number;
9713
+ /** @description Insights workspace shape from previous-point file totals for repos that have a previous point. Null when no repo has a previous point. */
9714
+ previousShape: components["schemas"]["InsightsTestPyramidShapeDto"] | null;
9715
+ coverage: components["schemas"]["InsightsTestPyramidCoverageRollupDto"];
9716
+ e2eCrossRepoCandidateCount: number;
9717
+ /** @description Repos whose latest Code Insights snapshot has `hotspotCount` > 0. */
9718
+ reposWithHotspots: number;
9719
+ ciQuality: components["schemas"]["InsightsTestPyramidCiQualityDto"];
9676
9720
  };
9677
9721
  InsightsTestPyramidRepoItemDto: {
9678
9722
  /** Format: uuid */
@@ -9682,10 +9726,27 @@ export interface components {
9682
9726
  scannedAt: string;
9683
9727
  currentRunStatus: components["schemas"]["TestPyramidRunStatusDto"];
9684
9728
  maturity: components["schemas"]["InsightsTestPyramidMaturityDto"];
9729
+ previousMaturity: components["schemas"]["InsightsTestPyramidMaturityDto"] | null;
9730
+ maturityDelta: components["schemas"]["InsightsTestPyramidMaturityDeltaDto"];
9731
+ previousShapeLabel: components["schemas"]["InsightsTestPyramidShapeLabelDto"] | null;
9685
9732
  layerFileCounts: components["schemas"]["InsightsTestPyramidLayerCountsDto"];
9686
9733
  layerPresent: components["schemas"]["InsightsTestPyramidLayerPresentDto"];
9734
+ /** @description Snapshot `layers.*.applicable` for each layer. */
9735
+ layerApplicable: components["schemas"]["InsightsTestPyramidLayerPresentDto"];
9687
9736
  totalClassifiedFiles: number;
9688
9737
  shape: components["schemas"]["InsightsTestPyramidShapeDto"];
9738
+ /** @description Same overlay as AF progress — latest Sonar row first, else snapshot `testPyramid.lineCoverage`. Null when both are missing. Not Code Insights `coveragePct`. */
9739
+ lineCoverage: components["schemas"]["TestPyramidLineCoverageDto"];
9740
+ /** @description Minimum confidence among layers with Insights presence (`fileCount > 0`); if none present, minimum of applicable layers. Order low < medium < high. */
9741
+ lowestConfidence: components["schemas"]["InsightsTestPyramidConfidenceDto"];
9742
+ layerConfidence: components["schemas"]["InsightsTestPyramidLayerConfidenceDto"];
9743
+ /** @description Sum of layer `evidence[]` lengths on the latest snapshot. */
9744
+ evidenceCount: number;
9745
+ /** @description Unique framework names across layers, capped at 8. */
9746
+ frameworks: string[];
9747
+ e2eCrossRepoCandidate: boolean;
9748
+ /** @description Row count in `tai_workspace_repo_code_hotspots` for the repo's latest Code Insights metrics snapshot. Null when the repo has no metrics snapshot. */
9749
+ hotspotCount: number | null;
9689
9750
  };
9690
9751
  InsightsTestPyramidRepoListDto: {
9691
9752
  items: components["schemas"]["InsightsTestPyramidRepoItemDto"][];
@@ -10317,6 +10378,11 @@ export type InsightsTestPyramidGapRepoDto = components['schemas']['InsightsTestP
10317
10378
  export type InsightsTestPyramidGapsByLayerDto = components['schemas']['InsightsTestPyramidGapsByLayerDto'];
10318
10379
  export type InsightsTestPyramidMaturityCountsDto = components['schemas']['InsightsTestPyramidMaturityCountsDto'];
10319
10380
  export type InsightsTestPyramidLayerPresenceMapDto = components['schemas']['InsightsTestPyramidLayerPresenceMapDto'];
10381
+ export type InsightsTestPyramidMaturityDeltaDto = components['schemas']['InsightsTestPyramidMaturityDeltaDto'];
10382
+ export type InsightsTestPyramidConfidenceDto = components['schemas']['InsightsTestPyramidConfidenceDto'];
10383
+ export type InsightsTestPyramidLayerConfidenceDto = components['schemas']['InsightsTestPyramidLayerConfidenceDto'];
10384
+ export type InsightsTestPyramidCoverageRollupDto = components['schemas']['InsightsTestPyramidCoverageRollupDto'];
10385
+ export type InsightsTestPyramidCiQualityDto = components['schemas']['InsightsTestPyramidCiQualityDto'];
10320
10386
  export type InsightsTestPyramidSummaryDto = components['schemas']['InsightsTestPyramidSummaryDto'];
10321
10387
  export type InsightsTestPyramidRepoItemDto = components['schemas']['InsightsTestPyramidRepoItemDto'];
10322
10388
  export type InsightsTestPyramidRepoListDto = components['schemas']['InsightsTestPyramidRepoListDto'];