@thinkai/tai-api-contract 2.4.0 → 2.4.3

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.4.0
4
+ version: 2.4.3
5
5
  description: >
6
6
  Contract surface for the AI Driven SDLC backend used by ThinkAI.
7
7
  Workspace-scoped routes use `/workspaces/{workspaceId}/...`.
@@ -48,6 +48,8 @@ tags:
48
48
  description: Per-user per-workspace preferences (§12)
49
49
  - name: OrgChartImport
50
50
  description: Org chart import via storage path (§14)
51
+ - name: AgenticFoundation
52
+ description: Agentic Foundation pillars (epic #278); reads stored repository readiness snapshots
51
53
 
52
54
  paths:
53
55
  /me:
@@ -1397,6 +1399,9 @@ paths:
1397
1399
  get:
1398
1400
  tags: [RepositoryReadiness]
1399
1401
  summary: Single repo readiness
1402
+ description: >
1403
+ Returns one stored repository scorecard with all eight dimensions and nested issues.
1404
+ Unknown `repoId` or a repo that belongs to another workspace returns `404` (no cross-tenant leakage).
1400
1405
  operationId: getReadinessRepo
1401
1406
  parameters:
1402
1407
  - $ref: "#/components/parameters/WorkspaceId"
@@ -1408,13 +1413,353 @@ paths:
1408
1413
  application/json:
1409
1414
  schema:
1410
1415
  $ref: "#/components/schemas/RepoReadinessScoreDto"
1416
+ "400":
1417
+ description: Malformed `repoId` (not a UUID)
1418
+ content:
1419
+ application/json:
1420
+ schema:
1421
+ $ref: "#/components/schemas/ErrorMessageDto"
1422
+ "401":
1423
+ $ref: "#/components/responses/Unauthorized"
1424
+ "403":
1425
+ $ref: "#/components/responses/Forbidden"
1426
+ "404":
1427
+ description: Workspace or repository not found
1428
+ content:
1429
+ application/json:
1430
+ schema:
1431
+ $ref: "#/components/schemas/ErrorMessageDto"
1432
+
1433
+ /workspaces/{workspaceId}/agentic-foundation/dashboard:
1434
+ get:
1435
+ tags: [AgenticFoundation]
1436
+ summary: Agentic Foundation dashboard
1437
+ description: >
1438
+ Returns stored repository readiness scorecards plus a flattened issue queue for the
1439
+ Agentic Foundation dashboard surfaces. This is read-only and does not run scoring on
1440
+ the request path (issue #279). Field `generatedAt` is the server timestamp when this JSON
1441
+ payload was assembled; it is not the same as per-repo `lastAnalyzed` on `RepoReadinessScoreDto`.
1442
+ operationId: getAgenticFoundationDashboard
1443
+ parameters:
1444
+ - $ref: "#/components/parameters/WorkspaceId"
1445
+ responses:
1446
+ "200":
1447
+ description: Dashboard scorecards and issue queue
1448
+ content:
1449
+ application/json:
1450
+ schema:
1451
+ $ref: "#/components/schemas/AgenticFoundationDashboardDto"
1452
+ examples:
1453
+ emptyWorkspace:
1454
+ summary: No repos analyzed yet
1455
+ value:
1456
+ workspaceId: 00000000-0000-0000-0000-000000000001
1457
+ generatedAt: "2026-05-12T12:00:00.000Z"
1458
+ summary:
1459
+ repoCount: 0
1460
+ averageOverallScore: 0
1461
+ issueCount: 0
1462
+ criticalIssueCount: 0
1463
+ repos: []
1464
+ issueQueue: []
1465
+ "401":
1466
+ $ref: "#/components/responses/Unauthorized"
1467
+ "403":
1468
+ $ref: "#/components/responses/Forbidden"
1469
+ "404":
1470
+ description: Workspace does not exist
1471
+ content:
1472
+ application/json:
1473
+ schema:
1474
+ $ref: "#/components/schemas/ErrorMessageDto"
1475
+
1476
+ /workspaces/{workspaceId}/agentic-foundation/agentic-readiness:
1477
+ get:
1478
+ tags: [AgenticFoundation]
1479
+ summary: Agentic readiness pillar (stored dimension slice)
1480
+ description: >
1481
+ Returns `RepoReadinessScoreDto` rows with only the `ai-agent-readiness` dimension populated
1482
+ per repo. Same auth and persistence source as `GET .../readiness/repos` (issue #280).
1483
+ operationId: getAgenticFoundationAgenticReadiness
1484
+ parameters:
1485
+ - $ref: "#/components/parameters/WorkspaceId"
1486
+ responses:
1487
+ "200":
1488
+ description: Repositories with ai-agent-readiness slice
1489
+ content:
1490
+ application/json:
1491
+ schema:
1492
+ type: array
1493
+ items:
1494
+ $ref: "#/components/schemas/RepoReadinessScoreDto"
1495
+ examples:
1496
+ singleRepoSlice:
1497
+ summary: One repo, single pillar dimension
1498
+ value:
1499
+ - repoId: 00000000-0000-0000-0000-000000000002
1500
+ repoName: api-gateway
1501
+ language: typescript
1502
+ overallScore: 67
1503
+ dimensions:
1504
+ - dimensionId: ai-agent-readiness
1505
+ score: 2
1506
+ maxScore: 3
1507
+ issues: []
1508
+ lastAnalyzed: "2026-05-12T12:00:00.000Z"
1509
+ teamId: null
1510
+ provider:
1511
+ kind: github
1512
+ slug: acme/api-gateway
1513
+ webUrl: https://github.com/acme/api-gateway
1514
+ defaultBranch: main
1515
+ externalId: null
1516
+ hostBaseUrl: null
1517
+ analysisStatus: idle
1518
+ activeRunId: null
1411
1519
  "401":
1412
1520
  $ref: "#/components/responses/Unauthorized"
1521
+ "403":
1522
+ $ref: "#/components/responses/Forbidden"
1523
+ "404":
1524
+ description: Workspace does not exist
1525
+ content:
1526
+ application/json:
1527
+ schema:
1528
+ $ref: "#/components/schemas/ErrorMessageDto"
1529
+
1530
+ /workspaces/{workspaceId}/agentic-foundation/repository-health:
1531
+ get:
1532
+ tags: [AgenticFoundation]
1533
+ summary: Repository health pillar (repo-hygiene slice)
1534
+ description: Returns per-repo `repo-hygiene` dimension only (issue #281).
1535
+ operationId: getAgenticFoundationRepositoryHealth
1536
+ parameters:
1537
+ - $ref: "#/components/parameters/WorkspaceId"
1538
+ responses:
1539
+ "200":
1540
+ description: Repositories with repo-hygiene slice
1541
+ content:
1542
+ application/json:
1543
+ schema:
1544
+ type: array
1545
+ items:
1546
+ $ref: "#/components/schemas/RepoReadinessScoreDto"
1547
+ "401":
1548
+ $ref: "#/components/responses/Unauthorized"
1549
+ "403":
1550
+ $ref: "#/components/responses/Forbidden"
1551
+ "404":
1552
+ description: Workspace does not exist
1553
+ content:
1554
+ application/json:
1555
+ schema:
1556
+ $ref: "#/components/schemas/ErrorMessageDto"
1557
+
1558
+ /workspaces/{workspaceId}/agentic-foundation/codebase-quality:
1559
+ get:
1560
+ tags: [AgenticFoundation]
1561
+ summary: Codebase quality pillar (stack-quality slice)
1562
+ description: Returns per-repo `stack-quality` dimension only (issue #282).
1563
+ operationId: getAgenticFoundationCodebaseQuality
1564
+ parameters:
1565
+ - $ref: "#/components/parameters/WorkspaceId"
1566
+ responses:
1567
+ "200":
1568
+ description: Repositories with stack-quality slice
1569
+ content:
1570
+ application/json:
1571
+ schema:
1572
+ type: array
1573
+ items:
1574
+ $ref: "#/components/schemas/RepoReadinessScoreDto"
1575
+ "401":
1576
+ $ref: "#/components/responses/Unauthorized"
1577
+ "403":
1578
+ $ref: "#/components/responses/Forbidden"
1579
+ "404":
1580
+ description: Workspace does not exist
1581
+ content:
1582
+ application/json:
1583
+ schema:
1584
+ $ref: "#/components/schemas/ErrorMessageDto"
1585
+
1586
+ /workspaces/{workspaceId}/agentic-foundation/test-qa:
1587
+ get:
1588
+ tags: [AgenticFoundation]
1589
+ summary: Test and QA pillar (tests-qa slice)
1590
+ description: Returns per-repo `tests-qa` dimension only (issue #283).
1591
+ operationId: getAgenticFoundationTestQa
1592
+ parameters:
1593
+ - $ref: "#/components/parameters/WorkspaceId"
1594
+ responses:
1595
+ "200":
1596
+ description: Repositories with tests-qa slice
1597
+ content:
1598
+ application/json:
1599
+ schema:
1600
+ type: array
1601
+ items:
1602
+ $ref: "#/components/schemas/RepoReadinessScoreDto"
1603
+ "401":
1604
+ $ref: "#/components/responses/Unauthorized"
1605
+ "403":
1606
+ $ref: "#/components/responses/Forbidden"
1607
+ "404":
1608
+ description: Workspace does not exist
1609
+ content:
1610
+ application/json:
1611
+ schema:
1612
+ $ref: "#/components/schemas/ErrorMessageDto"
1613
+
1614
+ /workspaces/{workspaceId}/agentic-foundation/observability:
1615
+ get:
1616
+ tags: [AgenticFoundation]
1617
+ summary: Observability pillar (observability slice)
1618
+ description: Returns per-repo `observability` dimension only (issue #284).
1619
+ operationId: getAgenticFoundationObservability
1620
+ parameters:
1621
+ - $ref: "#/components/parameters/WorkspaceId"
1622
+ responses:
1623
+ "200":
1624
+ description: Repositories with observability slice
1625
+ content:
1626
+ application/json:
1627
+ schema:
1628
+ type: array
1629
+ items:
1630
+ $ref: "#/components/schemas/RepoReadinessScoreDto"
1631
+ "401":
1632
+ $ref: "#/components/responses/Unauthorized"
1633
+ "403":
1634
+ $ref: "#/components/responses/Forbidden"
1635
+ "404":
1636
+ description: Workspace does not exist
1637
+ content:
1638
+ application/json:
1639
+ schema:
1640
+ $ref: "#/components/schemas/ErrorMessageDto"
1641
+
1642
+ /workspaces/{workspaceId}/agentic-foundation/api-contract:
1643
+ get:
1644
+ tags: [AgenticFoundation]
1645
+ summary: API contract pillar (api-contracts slice)
1646
+ description: Returns per-repo `api-contracts` dimension only (issue #285).
1647
+ operationId: getAgenticFoundationApiContract
1648
+ parameters:
1649
+ - $ref: "#/components/parameters/WorkspaceId"
1650
+ responses:
1651
+ "200":
1652
+ description: Repositories with api-contracts slice
1653
+ content:
1654
+ application/json:
1655
+ schema:
1656
+ type: array
1657
+ items:
1658
+ $ref: "#/components/schemas/RepoReadinessScoreDto"
1659
+ "401":
1660
+ $ref: "#/components/responses/Unauthorized"
1661
+ "403":
1662
+ $ref: "#/components/responses/Forbidden"
1663
+ "404":
1664
+ description: Workspace does not exist
1665
+ content:
1666
+ application/json:
1667
+ schema:
1668
+ $ref: "#/components/schemas/ErrorMessageDto"
1669
+
1670
+ /workspaces/{workspaceId}/agentic-foundation/platform-governance:
1671
+ get:
1672
+ tags: [AgenticFoundation]
1673
+ summary: Platform governance pillar (platform-governance slice)
1674
+ description: Returns per-repo `platform-governance` dimension only (issue #286).
1675
+ operationId: getAgenticFoundationPlatformGovernance
1676
+ parameters:
1677
+ - $ref: "#/components/parameters/WorkspaceId"
1678
+ responses:
1679
+ "200":
1680
+ description: Repositories with platform-governance slice
1681
+ content:
1682
+ application/json:
1683
+ schema:
1684
+ type: array
1685
+ items:
1686
+ $ref: "#/components/schemas/RepoReadinessScoreDto"
1687
+ "401":
1688
+ $ref: "#/components/responses/Unauthorized"
1689
+ "403":
1690
+ $ref: "#/components/responses/Forbidden"
1691
+ "404":
1692
+ description: Workspace does not exist
1693
+ content:
1694
+ application/json:
1695
+ schema:
1696
+ $ref: "#/components/schemas/ErrorMessageDto"
1697
+
1698
+ /workspaces/{workspaceId}/agentic-foundation/delivery-governance:
1699
+ get:
1700
+ tags: [AgenticFoundation]
1701
+ summary: Delivery governance pillar (delivery slice)
1702
+ description: Returns per-repo `delivery` dimension only (issue #287).
1703
+ operationId: getAgenticFoundationDeliveryGovernance
1704
+ parameters:
1705
+ - $ref: "#/components/parameters/WorkspaceId"
1706
+ responses:
1707
+ "200":
1708
+ description: Repositories with delivery slice
1709
+ content:
1710
+ application/json:
1711
+ schema:
1712
+ type: array
1713
+ items:
1714
+ $ref: "#/components/schemas/RepoReadinessScoreDto"
1715
+ "401":
1716
+ $ref: "#/components/responses/Unauthorized"
1717
+ "403":
1718
+ $ref: "#/components/responses/Forbidden"
1719
+ "404":
1720
+ description: Workspace does not exist
1721
+ content:
1722
+ application/json:
1723
+ schema:
1724
+ $ref: "#/components/schemas/ErrorMessageDto"
1725
+
1726
+ /workspaces/{workspaceId}/agentic-foundation/ai-resolution-hub:
1727
+ get:
1728
+ tags: [AgenticFoundation]
1729
+ summary: AI resolution hub (full readiness scorecards)
1730
+ description: >
1731
+ Returns the same payload as `GET .../readiness/repos` (all dimensions per repo) for
1732
+ cross-pillar hub views (issue #288).
1733
+ operationId: getAgenticFoundationAiResolutionHub
1734
+ parameters:
1735
+ - $ref: "#/components/parameters/WorkspaceId"
1736
+ responses:
1737
+ "200":
1738
+ description: Full repository readiness scorecards
1739
+ content:
1740
+ application/json:
1741
+ schema:
1742
+ type: array
1743
+ items:
1744
+ $ref: "#/components/schemas/RepoReadinessScoreDto"
1745
+ "401":
1746
+ $ref: "#/components/responses/Unauthorized"
1747
+ "403":
1748
+ $ref: "#/components/responses/Forbidden"
1749
+ "404":
1750
+ description: Workspace does not exist
1751
+ content:
1752
+ application/json:
1753
+ schema:
1754
+ $ref: "#/components/schemas/ErrorMessageDto"
1413
1755
 
1414
1756
  /workspaces/{workspaceId}/readiness/dimensions:
1415
1757
  get:
1416
1758
  tags: [RepositoryReadiness]
1417
1759
  summary: Readiness dimensions catalog
1760
+ description: >
1761
+ Returns static rubric metadata (id, name, description, maxScore) aligned with the readiness
1762
+ scanner dimensions. Does not run scoring on the request path.
1418
1763
  operationId: listReadinessDimensions
1419
1764
  parameters:
1420
1765
  - $ref: "#/components/parameters/WorkspaceId"
@@ -1429,11 +1774,21 @@ paths:
1429
1774
  $ref: "#/components/schemas/ReadinessDimensionDto"
1430
1775
  "401":
1431
1776
  $ref: "#/components/responses/Unauthorized"
1777
+ "403":
1778
+ $ref: "#/components/responses/Forbidden"
1779
+ "404":
1780
+ description: Workspace does not exist
1781
+ content:
1782
+ application/json:
1783
+ schema:
1784
+ $ref: "#/components/schemas/ErrorMessageDto"
1432
1785
 
1433
1786
  /workspaces/{workspaceId}/readiness/fixes:
1434
1787
  get:
1435
1788
  tags: [RepositoryReadiness]
1436
1789
  summary: List fix requests
1790
+ description: >
1791
+ Returns persisted fix-queue rows for the workspace (newest first). Empty array when none exist.
1437
1792
  operationId: listReadinessFixes
1438
1793
  parameters:
1439
1794
  - $ref: "#/components/parameters/WorkspaceId"
@@ -1448,9 +1803,21 @@ paths:
1448
1803
  $ref: "#/components/schemas/FixRequestDto"
1449
1804
  "401":
1450
1805
  $ref: "#/components/responses/Unauthorized"
1806
+ "403":
1807
+ $ref: "#/components/responses/Forbidden"
1808
+ "404":
1809
+ description: Workspace does not exist
1810
+ content:
1811
+ application/json:
1812
+ schema:
1813
+ $ref: "#/components/schemas/ErrorMessageDto"
1451
1814
  post:
1452
1815
  tags: [RepositoryReadiness]
1453
1816
  summary: Enqueue fix for an issue
1817
+ description: >
1818
+ Creates a fix request with `status: queued` when `issueId` belongs to `repoId` in this workspace.
1819
+ Requires workspace editor or admin. Re-posting the same `issueId` and `repoId` returns the
1820
+ existing row (idempotent).
1454
1821
  operationId: postReadinessFix
1455
1822
  parameters:
1456
1823
  - $ref: "#/components/parameters/WorkspaceId"
@@ -1460,15 +1827,34 @@ paths:
1460
1827
  application/json:
1461
1828
  schema:
1462
1829
  $ref: "#/components/schemas/CreateFixRequestBodyDto"
1830
+ examples:
1831
+ enqueue:
1832
+ value:
1833
+ issueId: "22222222-2222-2222-2222-222222222222"
1834
+ repoId: "11111111-1111-4111-8111-111111111111"
1463
1835
  responses:
1464
1836
  "200":
1465
- description: Fix request created
1837
+ description: Fix request created or existing row returned
1466
1838
  content:
1467
1839
  application/json:
1468
1840
  schema:
1469
1841
  $ref: "#/components/schemas/FixRequestDto"
1842
+ "400":
1843
+ description: Invalid body or malformed `repoId` (not a UUID)
1844
+ content:
1845
+ application/json:
1846
+ schema:
1847
+ $ref: "#/components/schemas/ErrorMessageDto"
1470
1848
  "401":
1471
1849
  $ref: "#/components/responses/Unauthorized"
1850
+ "403":
1851
+ $ref: "#/components/responses/Forbidden"
1852
+ "404":
1853
+ description: Workspace not found, or issue/repo pair not in workspace
1854
+ content:
1855
+ application/json:
1856
+ schema:
1857
+ $ref: "#/components/schemas/ErrorMessageDto"
1472
1858
 
1473
1859
  /workspaces/{workspaceId}/squad:
1474
1860
  get:
@@ -1795,6 +2181,7 @@ components:
1795
2181
  required: true
1796
2182
  schema:
1797
2183
  type: string
2184
+ format: uuid
1798
2185
  ProjectId:
1799
2186
  name: projectId
1800
2187
  in: path
@@ -2598,6 +2985,13 @@ components:
2598
2985
  type: string
2599
2986
  enum: [queued, running, succeeded, failed, partial_failed]
2600
2987
 
2988
+ ReadinessRepoAnalysisStatusDto:
2989
+ type: string
2990
+ enum: [idle, queued, running]
2991
+ description: >
2992
+ Whether an AI readiness analysis run is queued or in progress for this repository slug.
2993
+ `idle` means no `queued`/`running` row exists in `tai_workspace_readiness_runs`.
2994
+
2601
2995
  ReadinessRunSummaryDto:
2602
2996
  type: object
2603
2997
  required: [runId, status, providerSlug, errorCode, errorDetail, repoId, createdAt, finishedAt]
@@ -2673,7 +3067,15 @@ components:
2673
3067
 
2674
3068
  RepoReadinessScoreDto:
2675
3069
  type: object
2676
- required: [repoId, repoName, language, overallScore, dimensions, lastAnalyzed, provider]
3070
+ required:
3071
+ - repoId
3072
+ - repoName
3073
+ - language
3074
+ - overallScore
3075
+ - dimensions
3076
+ - lastAnalyzed
3077
+ - provider
3078
+ - analysisStatus
2677
3079
  properties:
2678
3080
  repoId:
2679
3081
  type: string
@@ -2702,6 +3104,87 @@ components:
2702
3104
  nullable: true
2703
3105
  provider:
2704
3106
  $ref: "#/components/schemas/RepoProviderDto"
3107
+ analysisStatus:
3108
+ $ref: "#/components/schemas/ReadinessRepoAnalysisStatusDto"
3109
+ activeRunId:
3110
+ type: string
3111
+ format: uuid
3112
+ nullable: true
3113
+ description: Present when `analysisStatus` is `queued` or `running`; use with `GET .../readiness/runs/{runId}`.
3114
+
3115
+ AgenticFoundationDashboardSummaryDto:
3116
+ type: object
3117
+ required: [repoCount, averageOverallScore, issueCount, criticalIssueCount]
3118
+ properties:
3119
+ repoCount:
3120
+ type: integer
3121
+ minimum: 0
3122
+ averageOverallScore:
3123
+ type: integer
3124
+ minimum: 0
3125
+ maximum: 100
3126
+ issueCount:
3127
+ type: integer
3128
+ minimum: 0
3129
+ criticalIssueCount:
3130
+ type: integer
3131
+ minimum: 0
3132
+
3133
+ AgenticFoundationDashboardIssueDto:
3134
+ type: object
3135
+ required:
3136
+ [id, repoId, repoName, provider, dimensionId, severity, title, description, filePath, fixStatus]
3137
+ properties:
3138
+ id:
3139
+ type: string
3140
+ format: uuid
3141
+ repoId:
3142
+ type: string
3143
+ format: uuid
3144
+ repoName:
3145
+ type: string
3146
+ maxLength: 256
3147
+ provider:
3148
+ $ref: "#/components/schemas/RepoProviderDto"
3149
+ dimensionId:
3150
+ $ref: "#/components/schemas/ReadinessDimensionId"
3151
+ severity:
3152
+ type: string
3153
+ enum: [critical, high, medium, low]
3154
+ title:
3155
+ type: string
3156
+ maxLength: 256
3157
+ description:
3158
+ type: string
3159
+ maxLength: 2048
3160
+ filePath:
3161
+ type: string
3162
+ maxLength: 512
3163
+ nullable: true
3164
+ fixStatus:
3165
+ type: string
3166
+ enum: [open, pr-pending, fixed]
3167
+
3168
+ AgenticFoundationDashboardDto:
3169
+ type: object
3170
+ required: [workspaceId, generatedAt, summary, repos, issueQueue]
3171
+ properties:
3172
+ workspaceId:
3173
+ type: string
3174
+ format: uuid
3175
+ generatedAt:
3176
+ type: string
3177
+ format: date-time
3178
+ summary:
3179
+ $ref: "#/components/schemas/AgenticFoundationDashboardSummaryDto"
3180
+ repos:
3181
+ type: array
3182
+ items:
3183
+ $ref: "#/components/schemas/RepoReadinessScoreDto"
3184
+ issueQueue:
3185
+ type: array
3186
+ items:
3187
+ $ref: "#/components/schemas/AgenticFoundationDashboardIssueDto"
2705
3188
 
2706
3189
  FixRequestDto:
2707
3190
  type: object
@@ -2737,8 +3220,12 @@ components:
2737
3220
  properties:
2738
3221
  issueId:
2739
3222
  type: string
3223
+ format: uuid
3224
+ description: Readiness issue id from stored scorecard data
2740
3225
  repoId:
2741
3226
  type: string
3227
+ format: uuid
3228
+ description: Workspace repository id that owns the issue
2742
3229
 
2743
3230
  PhaseRoleDto:
2744
3231
  type: object
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.4.0",
3
+ "version": "2.4.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",