@thinkai/tai-api-contract 2.3.1 → 2.4.1

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.3.0
4
+ version: 2.4.1
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:
@@ -1308,10 +1310,98 @@ paths:
1308
1310
  schema:
1309
1311
  $ref: "#/components/schemas/ErrorMessageDto"
1310
1312
 
1313
+ /workspaces/{workspaceId}/readiness/analyze:
1314
+ post:
1315
+ tags: [RepositoryReadiness]
1316
+ summary: Enqueue AI readiness analysis for one repository
1317
+ description: >
1318
+ User-triggered "Run now" path. Requires workspace editor/admin access and an active GitHub App
1319
+ connection. Prefer `repoId`; `providerSlug` is accepted for compatibility only when it resolves
1320
+ to a repository in the workspace.
1321
+ operationId: postReadinessAnalyze
1322
+ parameters:
1323
+ - $ref: "#/components/parameters/WorkspaceId"
1324
+ requestBody:
1325
+ required: true
1326
+ content:
1327
+ application/json:
1328
+ schema:
1329
+ $ref: "#/components/schemas/ReadinessAnalyzeBodyDto"
1330
+ examples:
1331
+ byRepoId:
1332
+ value:
1333
+ repoId: "11111111-1111-4111-8111-111111111111"
1334
+ byProviderSlug:
1335
+ value:
1336
+ providerSlug: "thinkai-llc/thinkai-platform-backend"
1337
+ responses:
1338
+ "202":
1339
+ description: Run queued
1340
+ content:
1341
+ application/json:
1342
+ schema:
1343
+ $ref: "#/components/schemas/ReadinessAnalyzeResponseDto"
1344
+ "400":
1345
+ description: Invalid body, missing GitHub connection, unsupported provider, or active run conflict inputs
1346
+ content:
1347
+ application/json:
1348
+ schema:
1349
+ $ref: "#/components/schemas/ErrorMessageDto"
1350
+ "401":
1351
+ $ref: "#/components/responses/Unauthorized"
1352
+ "403":
1353
+ $ref: "#/components/responses/Forbidden"
1354
+ "404":
1355
+ description: Workspace or repository not found
1356
+ content:
1357
+ application/json:
1358
+ schema:
1359
+ $ref: "#/components/schemas/ErrorMessageDto"
1360
+ "409":
1361
+ description: A queued/running readiness analysis already exists for this repository slug
1362
+ content:
1363
+ application/json:
1364
+ schema:
1365
+ $ref: "#/components/schemas/ErrorMessageDto"
1366
+
1367
+ /workspaces/{workspaceId}/readiness/runs/{runId}:
1368
+ get:
1369
+ tags: [RepositoryReadiness]
1370
+ summary: Get readiness analysis run status
1371
+ operationId: getReadinessRun
1372
+ parameters:
1373
+ - $ref: "#/components/parameters/WorkspaceId"
1374
+ - name: runId
1375
+ in: path
1376
+ required: true
1377
+ schema:
1378
+ type: string
1379
+ format: uuid
1380
+ responses:
1381
+ "200":
1382
+ description: Run status
1383
+ content:
1384
+ application/json:
1385
+ schema:
1386
+ $ref: "#/components/schemas/ReadinessRunSummaryDto"
1387
+ "401":
1388
+ $ref: "#/components/responses/Unauthorized"
1389
+ "403":
1390
+ $ref: "#/components/responses/Forbidden"
1391
+ "404":
1392
+ description: Workspace or run not found
1393
+ content:
1394
+ application/json:
1395
+ schema:
1396
+ $ref: "#/components/schemas/ErrorMessageDto"
1397
+
1311
1398
  /workspaces/{workspaceId}/readiness/repos/{repoId}:
1312
1399
  get:
1313
1400
  tags: [RepositoryReadiness]
1314
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).
1315
1405
  operationId: getReadinessRepo
1316
1406
  parameters:
1317
1407
  - $ref: "#/components/parameters/WorkspaceId"
@@ -1323,8 +1413,343 @@ paths:
1323
1413
  application/json:
1324
1414
  schema:
1325
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
+ "401":
1518
+ $ref: "#/components/responses/Unauthorized"
1519
+ "403":
1520
+ $ref: "#/components/responses/Forbidden"
1521
+ "404":
1522
+ description: Workspace does not exist
1523
+ content:
1524
+ application/json:
1525
+ schema:
1526
+ $ref: "#/components/schemas/ErrorMessageDto"
1527
+
1528
+ /workspaces/{workspaceId}/agentic-foundation/repository-health:
1529
+ get:
1530
+ tags: [AgenticFoundation]
1531
+ summary: Repository health pillar (repo-hygiene slice)
1532
+ description: Returns per-repo `repo-hygiene` dimension only (issue #281).
1533
+ operationId: getAgenticFoundationRepositoryHealth
1534
+ parameters:
1535
+ - $ref: "#/components/parameters/WorkspaceId"
1536
+ responses:
1537
+ "200":
1538
+ description: Repositories with repo-hygiene slice
1539
+ content:
1540
+ application/json:
1541
+ schema:
1542
+ type: array
1543
+ items:
1544
+ $ref: "#/components/schemas/RepoReadinessScoreDto"
1545
+ "401":
1546
+ $ref: "#/components/responses/Unauthorized"
1547
+ "403":
1548
+ $ref: "#/components/responses/Forbidden"
1549
+ "404":
1550
+ description: Workspace does not exist
1551
+ content:
1552
+ application/json:
1553
+ schema:
1554
+ $ref: "#/components/schemas/ErrorMessageDto"
1555
+
1556
+ /workspaces/{workspaceId}/agentic-foundation/codebase-quality:
1557
+ get:
1558
+ tags: [AgenticFoundation]
1559
+ summary: Codebase quality pillar (stack-quality slice)
1560
+ description: Returns per-repo `stack-quality` dimension only (issue #282).
1561
+ operationId: getAgenticFoundationCodebaseQuality
1562
+ parameters:
1563
+ - $ref: "#/components/parameters/WorkspaceId"
1564
+ responses:
1565
+ "200":
1566
+ description: Repositories with stack-quality slice
1567
+ content:
1568
+ application/json:
1569
+ schema:
1570
+ type: array
1571
+ items:
1572
+ $ref: "#/components/schemas/RepoReadinessScoreDto"
1573
+ "401":
1574
+ $ref: "#/components/responses/Unauthorized"
1575
+ "403":
1576
+ $ref: "#/components/responses/Forbidden"
1577
+ "404":
1578
+ description: Workspace does not exist
1579
+ content:
1580
+ application/json:
1581
+ schema:
1582
+ $ref: "#/components/schemas/ErrorMessageDto"
1583
+
1584
+ /workspaces/{workspaceId}/agentic-foundation/test-qa:
1585
+ get:
1586
+ tags: [AgenticFoundation]
1587
+ summary: Test and QA pillar (tests-qa slice)
1588
+ description: Returns per-repo `tests-qa` dimension only (issue #283).
1589
+ operationId: getAgenticFoundationTestQa
1590
+ parameters:
1591
+ - $ref: "#/components/parameters/WorkspaceId"
1592
+ responses:
1593
+ "200":
1594
+ description: Repositories with tests-qa slice
1595
+ content:
1596
+ application/json:
1597
+ schema:
1598
+ type: array
1599
+ items:
1600
+ $ref: "#/components/schemas/RepoReadinessScoreDto"
1601
+ "401":
1602
+ $ref: "#/components/responses/Unauthorized"
1603
+ "403":
1604
+ $ref: "#/components/responses/Forbidden"
1605
+ "404":
1606
+ description: Workspace does not exist
1607
+ content:
1608
+ application/json:
1609
+ schema:
1610
+ $ref: "#/components/schemas/ErrorMessageDto"
1611
+
1612
+ /workspaces/{workspaceId}/agentic-foundation/observability:
1613
+ get:
1614
+ tags: [AgenticFoundation]
1615
+ summary: Observability pillar (observability slice)
1616
+ description: Returns per-repo `observability` dimension only (issue #284).
1617
+ operationId: getAgenticFoundationObservability
1618
+ parameters:
1619
+ - $ref: "#/components/parameters/WorkspaceId"
1620
+ responses:
1621
+ "200":
1622
+ description: Repositories with observability slice
1623
+ content:
1624
+ application/json:
1625
+ schema:
1626
+ type: array
1627
+ items:
1628
+ $ref: "#/components/schemas/RepoReadinessScoreDto"
1629
+ "401":
1630
+ $ref: "#/components/responses/Unauthorized"
1631
+ "403":
1632
+ $ref: "#/components/responses/Forbidden"
1633
+ "404":
1634
+ description: Workspace does not exist
1635
+ content:
1636
+ application/json:
1637
+ schema:
1638
+ $ref: "#/components/schemas/ErrorMessageDto"
1639
+
1640
+ /workspaces/{workspaceId}/agentic-foundation/api-contract:
1641
+ get:
1642
+ tags: [AgenticFoundation]
1643
+ summary: API contract pillar (api-contracts slice)
1644
+ description: Returns per-repo `api-contracts` dimension only (issue #285).
1645
+ operationId: getAgenticFoundationApiContract
1646
+ parameters:
1647
+ - $ref: "#/components/parameters/WorkspaceId"
1648
+ responses:
1649
+ "200":
1650
+ description: Repositories with api-contracts slice
1651
+ content:
1652
+ application/json:
1653
+ schema:
1654
+ type: array
1655
+ items:
1656
+ $ref: "#/components/schemas/RepoReadinessScoreDto"
1657
+ "401":
1658
+ $ref: "#/components/responses/Unauthorized"
1659
+ "403":
1660
+ $ref: "#/components/responses/Forbidden"
1661
+ "404":
1662
+ description: Workspace does not exist
1663
+ content:
1664
+ application/json:
1665
+ schema:
1666
+ $ref: "#/components/schemas/ErrorMessageDto"
1667
+
1668
+ /workspaces/{workspaceId}/agentic-foundation/platform-governance:
1669
+ get:
1670
+ tags: [AgenticFoundation]
1671
+ summary: Platform governance pillar (platform-governance slice)
1672
+ description: Returns per-repo `platform-governance` dimension only (issue #286).
1673
+ operationId: getAgenticFoundationPlatformGovernance
1674
+ parameters:
1675
+ - $ref: "#/components/parameters/WorkspaceId"
1676
+ responses:
1677
+ "200":
1678
+ description: Repositories with platform-governance slice
1679
+ content:
1680
+ application/json:
1681
+ schema:
1682
+ type: array
1683
+ items:
1684
+ $ref: "#/components/schemas/RepoReadinessScoreDto"
1685
+ "401":
1686
+ $ref: "#/components/responses/Unauthorized"
1687
+ "403":
1688
+ $ref: "#/components/responses/Forbidden"
1689
+ "404":
1690
+ description: Workspace does not exist
1691
+ content:
1692
+ application/json:
1693
+ schema:
1694
+ $ref: "#/components/schemas/ErrorMessageDto"
1695
+
1696
+ /workspaces/{workspaceId}/agentic-foundation/delivery-governance:
1697
+ get:
1698
+ tags: [AgenticFoundation]
1699
+ summary: Delivery governance pillar (delivery slice)
1700
+ description: Returns per-repo `delivery` dimension only (issue #287).
1701
+ operationId: getAgenticFoundationDeliveryGovernance
1702
+ parameters:
1703
+ - $ref: "#/components/parameters/WorkspaceId"
1704
+ responses:
1705
+ "200":
1706
+ description: Repositories with delivery slice
1707
+ content:
1708
+ application/json:
1709
+ schema:
1710
+ type: array
1711
+ items:
1712
+ $ref: "#/components/schemas/RepoReadinessScoreDto"
1713
+ "401":
1714
+ $ref: "#/components/responses/Unauthorized"
1715
+ "403":
1716
+ $ref: "#/components/responses/Forbidden"
1717
+ "404":
1718
+ description: Workspace does not exist
1719
+ content:
1720
+ application/json:
1721
+ schema:
1722
+ $ref: "#/components/schemas/ErrorMessageDto"
1723
+
1724
+ /workspaces/{workspaceId}/agentic-foundation/ai-resolution-hub:
1725
+ get:
1726
+ tags: [AgenticFoundation]
1727
+ summary: AI resolution hub (full readiness scorecards)
1728
+ description: >
1729
+ Returns the same payload as `GET .../readiness/repos` (all dimensions per repo) for
1730
+ cross-pillar hub views (issue #288).
1731
+ operationId: getAgenticFoundationAiResolutionHub
1732
+ parameters:
1733
+ - $ref: "#/components/parameters/WorkspaceId"
1734
+ responses:
1735
+ "200":
1736
+ description: Full repository readiness scorecards
1737
+ content:
1738
+ application/json:
1739
+ schema:
1740
+ type: array
1741
+ items:
1742
+ $ref: "#/components/schemas/RepoReadinessScoreDto"
1326
1743
  "401":
1327
1744
  $ref: "#/components/responses/Unauthorized"
1745
+ "403":
1746
+ $ref: "#/components/responses/Forbidden"
1747
+ "404":
1748
+ description: Workspace does not exist
1749
+ content:
1750
+ application/json:
1751
+ schema:
1752
+ $ref: "#/components/schemas/ErrorMessageDto"
1328
1753
 
1329
1754
  /workspaces/{workspaceId}/readiness/dimensions:
1330
1755
  get:
@@ -1710,6 +2135,7 @@ components:
1710
2135
  required: true
1711
2136
  schema:
1712
2137
  type: string
2138
+ format: uuid
1713
2139
  ProjectId:
1714
2140
  name: projectId
1715
2141
  in: path
@@ -2482,6 +2908,67 @@ components:
2482
2908
  nullable: true
2483
2909
  description: Required for bitbucket_server (self-hosted); null for cloud providers
2484
2910
 
2911
+ ReadinessAnalyzeBodyDto:
2912
+ type: object
2913
+ additionalProperties: false
2914
+ description: >
2915
+ Prefer `repoId`; `providerSlug` exists for backwards-compatible callers and must resolve
2916
+ to a repository in the workspace. Send exactly one of the two fields.
2917
+ properties:
2918
+ repoId:
2919
+ type: string
2920
+ format: uuid
2921
+ providerSlug:
2922
+ type: string
2923
+ minLength: 1
2924
+ maxLength: 512
2925
+ description: GitHub owner/repo slug; compatibility path only
2926
+ oneOf:
2927
+ - required: [repoId]
2928
+ - required: [providerSlug]
2929
+
2930
+ ReadinessAnalyzeResponseDto:
2931
+ type: object
2932
+ required: [runId]
2933
+ properties:
2934
+ runId:
2935
+ type: string
2936
+ format: uuid
2937
+
2938
+ ReadinessRunStatusDto:
2939
+ type: string
2940
+ enum: [queued, running, succeeded, failed, partial_failed]
2941
+
2942
+ ReadinessRunSummaryDto:
2943
+ type: object
2944
+ required: [runId, status, providerSlug, errorCode, errorDetail, repoId, createdAt, finishedAt]
2945
+ properties:
2946
+ runId:
2947
+ type: string
2948
+ format: uuid
2949
+ status:
2950
+ $ref: "#/components/schemas/ReadinessRunStatusDto"
2951
+ providerSlug:
2952
+ type: string
2953
+ maxLength: 512
2954
+ errorCode:
2955
+ type: string
2956
+ nullable: true
2957
+ errorDetail:
2958
+ type: string
2959
+ nullable: true
2960
+ repoId:
2961
+ type: string
2962
+ format: uuid
2963
+ nullable: true
2964
+ createdAt:
2965
+ type: string
2966
+ format: date-time
2967
+ finishedAt:
2968
+ type: string
2969
+ format: date-time
2970
+ nullable: true
2971
+
2485
2972
  ReadinessIssueDto:
2486
2973
  type: object
2487
2974
  required: [id, dimensionId, severity, title, description, fixStatus]
@@ -2557,6 +3044,80 @@ components:
2557
3044
  provider:
2558
3045
  $ref: "#/components/schemas/RepoProviderDto"
2559
3046
 
3047
+ AgenticFoundationDashboardSummaryDto:
3048
+ type: object
3049
+ required: [repoCount, averageOverallScore, issueCount, criticalIssueCount]
3050
+ properties:
3051
+ repoCount:
3052
+ type: integer
3053
+ minimum: 0
3054
+ averageOverallScore:
3055
+ type: integer
3056
+ minimum: 0
3057
+ maximum: 100
3058
+ issueCount:
3059
+ type: integer
3060
+ minimum: 0
3061
+ criticalIssueCount:
3062
+ type: integer
3063
+ minimum: 0
3064
+
3065
+ AgenticFoundationDashboardIssueDto:
3066
+ type: object
3067
+ required:
3068
+ [id, repoId, repoName, provider, dimensionId, severity, title, description, filePath, fixStatus]
3069
+ properties:
3070
+ id:
3071
+ type: string
3072
+ format: uuid
3073
+ repoId:
3074
+ type: string
3075
+ format: uuid
3076
+ repoName:
3077
+ type: string
3078
+ maxLength: 256
3079
+ provider:
3080
+ $ref: "#/components/schemas/RepoProviderDto"
3081
+ dimensionId:
3082
+ $ref: "#/components/schemas/ReadinessDimensionId"
3083
+ severity:
3084
+ type: string
3085
+ enum: [critical, high, medium, low]
3086
+ title:
3087
+ type: string
3088
+ maxLength: 256
3089
+ description:
3090
+ type: string
3091
+ maxLength: 2048
3092
+ filePath:
3093
+ type: string
3094
+ maxLength: 512
3095
+ nullable: true
3096
+ fixStatus:
3097
+ type: string
3098
+ enum: [open, pr-pending, fixed]
3099
+
3100
+ AgenticFoundationDashboardDto:
3101
+ type: object
3102
+ required: [workspaceId, generatedAt, summary, repos, issueQueue]
3103
+ properties:
3104
+ workspaceId:
3105
+ type: string
3106
+ format: uuid
3107
+ generatedAt:
3108
+ type: string
3109
+ format: date-time
3110
+ summary:
3111
+ $ref: "#/components/schemas/AgenticFoundationDashboardSummaryDto"
3112
+ repos:
3113
+ type: array
3114
+ items:
3115
+ $ref: "#/components/schemas/RepoReadinessScoreDto"
3116
+ issueQueue:
3117
+ type: array
3118
+ items:
3119
+ $ref: "#/components/schemas/AgenticFoundationDashboardIssueDto"
3120
+
2560
3121
  FixRequestDto:
2561
3122
  type: object
2562
3123
  required: [id, issueId, repoId, repoName, issueTitle, dimensionId, severity, status, createdAt]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.3.1",
3
+ "version": "2.4.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",