@thinkai/tai-api-contract 2.98.0 → 2.100.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.98.0
4
+ version: 2.100.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}/...`.
@@ -3539,6 +3539,53 @@ paths:
3539
3539
  application/json:
3540
3540
  schema:
3541
3541
  $ref: "#/components/schemas/ErrorMessageDto"
3542
+ post:
3543
+ tags: [CodeInsights]
3544
+ summary: Code Insights — enqueue Design risks analysis
3545
+ operationId: postCodeInsightsDesignAnalyze
3546
+ description: >
3547
+ Enqueues an on-demand Design risks run (`run_kind=code_insights_design`) for the
3548
+ repository. Reuses the readiness worker queue but never grades the readiness rubric.
3549
+ Editor/admin only. Returns `409` when a design run is already queued or running for
3550
+ the same provider slug (independent of readiness runs).
3551
+ parameters:
3552
+ - $ref: "#/components/parameters/WorkspaceId"
3553
+ - name: repoId
3554
+ in: path
3555
+ required: true
3556
+ description: Internal repo UUID (`tai_workspace_repos.id`).
3557
+ schema:
3558
+ type: string
3559
+ format: uuid
3560
+ responses:
3561
+ "202":
3562
+ description: Design risks analysis enqueued
3563
+ content:
3564
+ application/json:
3565
+ schema:
3566
+ $ref: "#/components/schemas/CodeInsightsDesignAnalyzeResponseDto"
3567
+ "400":
3568
+ description: Malformed repoId, unsupported provider, or GitHub not connected
3569
+ content:
3570
+ application/json:
3571
+ schema:
3572
+ $ref: "#/components/schemas/ErrorMessageDto"
3573
+ "401":
3574
+ $ref: "#/components/responses/Unauthorized"
3575
+ "403":
3576
+ $ref: "#/components/responses/Forbidden"
3577
+ "404":
3578
+ description: Workspace or repo does not exist
3579
+ content:
3580
+ application/json:
3581
+ schema:
3582
+ $ref: "#/components/schemas/ErrorMessageDto"
3583
+ "409":
3584
+ description: An active Design risks run already exists for this repo slug
3585
+ content:
3586
+ application/json:
3587
+ schema:
3588
+ $ref: "#/components/schemas/ErrorMessageDto"
3542
3589
 
3543
3590
  /workspaces/{workspaceId}/integrations/ai-tool/{provider}/members:
3544
3591
  get:
@@ -7234,7 +7281,6 @@ paths:
7234
7281
  "401":
7235
7282
  $ref: "#/components/responses/Unauthorized"
7236
7283
 
7237
-
7238
7284
  /workspaces/{workspaceId}/code-chat/indexes:
7239
7285
  get:
7240
7286
  tags: [CodeChat]
@@ -8886,7 +8932,7 @@ components:
8886
8932
  type: string
8887
8933
  minLength: 1
8888
8934
  maxLength: 512
8889
- pattern: '^[^/]+/[^/]+$'
8935
+ pattern: "^[^/]+/[^/]+$"
8890
8936
  example: thinkai-llc/thinkai-platform-backend
8891
8937
  ProjectId:
8892
8938
  name: projectId
@@ -9281,8 +9327,7 @@ components:
9281
9327
  WorkspaceInvitationDto:
9282
9328
  type: object
9283
9329
  description: Workspace invitation as seen by an authenticated admin or invitee.
9284
- required:
9285
- [id, workspaceId, workspaceName, email, role, status, expiresAt, createdAt]
9330
+ required: [id, workspaceId, workspaceName, email, role, status, expiresAt, createdAt]
9286
9331
  properties:
9287
9332
  id:
9288
9333
  type: string
@@ -10453,7 +10498,17 @@ components:
10453
10498
  properties:
10454
10499
  deliveryModel:
10455
10500
  type: string
10456
- enum: [auto, k8s_microservices, mobile_store, web_hosting, data_pipelines, monorepo, library, hybrid]
10501
+ enum:
10502
+ [
10503
+ auto,
10504
+ k8s_microservices,
10505
+ mobile_store,
10506
+ web_hosting,
10507
+ data_pipelines,
10508
+ monorepo,
10509
+ library,
10510
+ hybrid,
10511
+ ]
10457
10512
  roles:
10458
10513
  type: object
10459
10514
  additionalProperties:
@@ -10468,7 +10523,17 @@ components:
10468
10523
  properties:
10469
10524
  deliveryModel:
10470
10525
  type: string
10471
- enum: [auto, k8s_microservices, mobile_store, web_hosting, data_pipelines, monorepo, library, hybrid]
10526
+ enum:
10527
+ [
10528
+ auto,
10529
+ k8s_microservices,
10530
+ mobile_store,
10531
+ web_hosting,
10532
+ data_pipelines,
10533
+ monorepo,
10534
+ library,
10535
+ hybrid,
10536
+ ]
10472
10537
  ciProvider:
10473
10538
  type: string
10474
10539
  enum: [github_actions, jenkins, gitlab, bitbucket, hybrid, external_documented]
@@ -11026,8 +11091,7 @@ components:
11026
11091
  ProductivityInsightsTeamLeaderItemDto:
11027
11092
  type: object
11028
11093
  additionalProperties: false
11029
- required:
11030
- [rank, teamId, teamName, periodAvgMergedPrs]
11094
+ required: [rank, teamId, teamName, periodAvgMergedPrs]
11031
11095
  properties:
11032
11096
  rank:
11033
11097
  type: integer
@@ -11205,8 +11269,7 @@ components:
11205
11269
  ProductivityInsightsContributorActivityDayDto:
11206
11270
  type: object
11207
11271
  additionalProperties: false
11208
- required:
11209
- [date, dayIndex, mergedPrCount, mergedPrs, absent, failureSignal, failures]
11272
+ required: [date, dayIndex, mergedPrCount, mergedPrs, absent, failureSignal, failures]
11210
11273
  properties:
11211
11274
  date:
11212
11275
  type: string
@@ -11427,8 +11490,7 @@ components:
11427
11490
  ProductivityInsightsNeedsAttentionItemDto:
11428
11491
  type: object
11429
11492
  additionalProperties: false
11430
- required:
11431
- [rank, entityId, entityType, name, periodAvgMergedPrs]
11493
+ required: [rank, entityId, entityType, name, periodAvgMergedPrs]
11432
11494
  properties:
11433
11495
  rank:
11434
11496
  type: integer
@@ -11584,8 +11646,7 @@ components:
11584
11646
  AiUsageSpendAggregatedTeamsSummaryDto:
11585
11647
  type: object
11586
11648
  additionalProperties: false
11587
- required:
11588
- [totalTokenCount, totalSpendCents, activeUsers, activeTools, totalEngineers]
11649
+ required: [totalTokenCount, totalSpendCents, activeUsers, activeTools, totalEngineers]
11589
11650
  properties:
11590
11651
  totalTokenCount:
11591
11652
  type: integer
@@ -11796,8 +11857,7 @@ components:
11796
11857
  AiUsageSpendAiAssistedCodeDayDto:
11797
11858
  type: object
11798
11859
  additionalProperties: false
11799
- required:
11800
- [date, aiAssistedCodePercent, totalLoc, aiLoc, humanLoc, dataQuality]
11860
+ required: [date, aiAssistedCodePercent, totalLoc, aiLoc, humanLoc, dataQuality]
11801
11861
  properties:
11802
11862
  date:
11803
11863
  type: string
@@ -11832,15 +11892,7 @@ components:
11832
11892
  type: object
11833
11893
  additionalProperties: false
11834
11894
  required:
11835
- [
11836
- bucketStart,
11837
- bucketEnd,
11838
- aiAssistedCodePercent,
11839
- totalLoc,
11840
- aiLoc,
11841
- humanLoc,
11842
- dataQuality,
11843
- ]
11895
+ [bucketStart, bucketEnd, aiAssistedCodePercent, totalLoc, aiLoc, humanLoc, dataQuality]
11844
11896
  properties:
11845
11897
  bucketStart:
11846
11898
  type: string
@@ -12748,7 +12800,18 @@ components:
12748
12800
  AiToolMemberDetailDto:
12749
12801
  type: object
12750
12802
  additionalProperties: false
12751
- required: [externalId, email, isRemoved, spendCents, tokenCount, activeDays, modelBreakdown, productBreakdown, heatmap]
12803
+ required:
12804
+ [
12805
+ externalId,
12806
+ email,
12807
+ isRemoved,
12808
+ spendCents,
12809
+ tokenCount,
12810
+ activeDays,
12811
+ modelBreakdown,
12812
+ productBreakdown,
12813
+ heatmap,
12814
+ ]
12752
12815
  properties:
12753
12816
  externalId:
12754
12817
  type: string
@@ -12956,7 +13019,17 @@ components:
12956
13019
  PrivacyRequestDto:
12957
13020
  type: object
12958
13021
  required:
12959
- [id, referenceCode, requestType, status, intakeChannel, subjectEmail, createdAt, updatedAt, slaDueAt]
13022
+ [
13023
+ id,
13024
+ referenceCode,
13025
+ requestType,
13026
+ status,
13027
+ intakeChannel,
13028
+ subjectEmail,
13029
+ createdAt,
13030
+ updatedAt,
13031
+ slaDueAt,
13032
+ ]
12960
13033
  properties:
12961
13034
  id:
12962
13035
  type: string
@@ -13036,7 +13109,15 @@ components:
13036
13109
  eventType:
13037
13110
  type: string
13038
13111
  enum:
13039
- [submitted, identity_verified, status_changed, assigned, export_generated, fulfillment_noted, duplicate_rejected]
13112
+ [
13113
+ submitted,
13114
+ identity_verified,
13115
+ status_changed,
13116
+ assigned,
13117
+ export_generated,
13118
+ fulfillment_noted,
13119
+ duplicate_rejected,
13120
+ ]
13040
13121
  actorEmail:
13041
13122
  type: string
13042
13123
  nullable: true
@@ -13437,7 +13518,8 @@ components:
13437
13518
  of eligible repos. Lets the UI render per-repo "size / limit" (compare each repo's `size`
13438
13519
  in `GithubInstalledRepoDto` to `maxRepoSizeKb`) and workspace "N / cap" usage
13439
13520
  (`eligibleRepoCount` / `maxReposPerWorkspace`).
13440
- required: [maxRepoSizeKb, maxReposPerWorkspace, excludeArchived, excludeForks, eligibleRepoCount]
13521
+ required:
13522
+ [maxRepoSizeKb, maxReposPerWorkspace, excludeArchived, excludeForks, eligibleRepoCount]
13441
13523
  properties:
13442
13524
  maxRepoSizeKb:
13443
13525
  type: integer
@@ -14308,8 +14390,7 @@ components:
14308
14390
  TechStackDto:
14309
14391
  type: object
14310
14392
  additionalProperties: false
14311
- required:
14312
- [sourceControl, cicd, pm, monitoring, aiTools, security, knowledgeDocs, hrPeople]
14393
+ required: [sourceControl, cicd, pm, monitoring, aiTools, security, knowledgeDocs, hrPeople]
14313
14394
  properties:
14314
14395
  sourceControl:
14315
14396
  $ref: "#/components/schemas/TechCategoryDto"
@@ -14953,7 +15034,14 @@ components:
14953
15034
  archivedReason:
14954
15035
  type: string
14955
15036
  nullable: true
14956
- enum: [github_removed, installation_disconnected, installation_replaced, superseded, user_removed]
15037
+ enum:
15038
+ [
15039
+ github_removed,
15040
+ installation_disconnected,
15041
+ installation_replaced,
15042
+ superseded,
15043
+ user_removed,
15044
+ ]
14957
15045
  description: Why the repo was archived. `user_removed` means excluded from Agentic Foundation scope only. Only present when `archivedAt` is set.
14958
15046
  eligibilityStatus:
14959
15047
  type: string
@@ -15149,7 +15237,14 @@ components:
15149
15237
  archivedReason:
15150
15238
  type: string
15151
15239
  nullable: true
15152
- enum: [github_removed, installation_disconnected, installation_replaced, superseded, user_removed]
15240
+ enum:
15241
+ [
15242
+ github_removed,
15243
+ installation_disconnected,
15244
+ installation_replaced,
15245
+ superseded,
15246
+ user_removed,
15247
+ ]
15153
15248
  eligibilityStatus:
15154
15249
  type: string
15155
15250
  enum: [eligible, ineligible]
@@ -15213,14 +15308,7 @@ components:
15213
15308
 
15214
15309
  AgenticFoundationDashboardSummaryDto:
15215
15310
  type: object
15216
- required:
15217
- [
15218
- repoCount,
15219
- averageOverallScore,
15220
- issueCount,
15221
- criticalIssueCount,
15222
- issuesByFixStatus,
15223
- ]
15311
+ required: [repoCount, averageOverallScore, issueCount, criticalIssueCount, issuesByFixStatus]
15224
15312
  properties:
15225
15313
  repoCount:
15226
15314
  type: integer
@@ -15354,8 +15442,7 @@ components:
15354
15442
 
15355
15443
  ReadinessAuditEntryDto:
15356
15444
  type: object
15357
- required:
15358
- [id, occurredAt, eventType, actionLabel, actorName]
15445
+ required: [id, occurredAt, eventType, actionLabel, actorName]
15359
15446
  properties:
15360
15447
  id:
15361
15448
  type: string
@@ -15584,8 +15671,7 @@ components:
15584
15671
 
15585
15672
  ReadinessFixGuideDto:
15586
15673
  type: object
15587
- required:
15588
- [issueId, repoId, rubricId, sourceRunId, status, markdown, criterionTitle]
15674
+ required: [issueId, repoId, rubricId, sourceRunId, status, markdown, criterionTitle]
15589
15675
  properties:
15590
15676
  issueId:
15591
15677
  type: string
@@ -16191,7 +16277,8 @@ components:
16191
16277
 
16192
16278
  YourAiJourneyPrSignalsWeekDto:
16193
16279
  type: object
16194
- required: [bucketStart, bucketEnd, weekLabel, prsPerDeveloperPerWeek, changeFailureRatePercent]
16280
+ required:
16281
+ [bucketStart, bucketEnd, weekLabel, prsPerDeveloperPerWeek, changeFailureRatePercent]
16195
16282
  properties:
16196
16283
  bucketStart:
16197
16284
  type: string
@@ -16386,7 +16473,21 @@ components:
16386
16473
 
16387
16474
  YourAiJourneyAiSpendDto:
16388
16475
  type: object
16389
- required: [workspaceId, generatedAt, windowStart, windowEnd, totalSpendCents, totalTokenCount, activeUsers, aiAssistedPrRatio, prThroughputDeltaPercent, usageDeltaPercent, weeks, providers]
16476
+ required:
16477
+ [
16478
+ workspaceId,
16479
+ generatedAt,
16480
+ windowStart,
16481
+ windowEnd,
16482
+ totalSpendCents,
16483
+ totalTokenCount,
16484
+ activeUsers,
16485
+ aiAssistedPrRatio,
16486
+ prThroughputDeltaPercent,
16487
+ usageDeltaPercent,
16488
+ weeks,
16489
+ providers,
16490
+ ]
16390
16491
  properties:
16391
16492
  workspaceId:
16392
16493
  type: string
@@ -16554,6 +16655,7 @@ components:
16554
16655
  - readiness.scan_completed
16555
16656
  - readiness.scan_failed
16556
16657
  - readiness.scan_partial
16658
+ - code_insights.design_run_started
16557
16659
  - integrations.agent_execution.provider_changed
16558
16660
  - integrations.repo_eligibility.overrides_changed
16559
16661
  - integrations.repo_eligibility.languages_refresh_requested
@@ -16695,7 +16797,8 @@ components:
16695
16797
 
16696
16798
  WorkspaceAbsenceDto:
16697
16799
  type: object
16698
- required: [source, employeeEmail, absenceType, startDate, endDate, halfDayStart, halfDayEnd, status]
16800
+ required:
16801
+ [source, employeeEmail, absenceType, startDate, endDate, halfDayStart, halfDayEnd, status]
16699
16802
  properties:
16700
16803
  source:
16701
16804
  type: string
@@ -17367,7 +17470,11 @@ components:
17367
17470
  type: number
17368
17471
  description: Sum of ship-weight scores for merged PRs in this week bucket.
17369
17472
  ciFailRatePct: { type: number }
17370
- hasCiMetrics: { type: boolean, description: False when CI metrics were not available for this week bucket. }
17473
+ hasCiMetrics:
17474
+ {
17475
+ type: boolean,
17476
+ description: False when CI metrics were not available for this week bucket.,
17477
+ }
17371
17478
 
17372
17479
  InsightsRecommendationsVelocityQuality:
17373
17480
  type: object
@@ -17670,7 +17777,19 @@ components:
17670
17777
 
17671
17778
  CodeChatIndexDto:
17672
17779
  type: object
17673
- required: [id, workspaceId, repoId, providerSlug, repoName, status, nodeCount, edgeCount, createdAt, updatedAt]
17780
+ required:
17781
+ [
17782
+ id,
17783
+ workspaceId,
17784
+ repoId,
17785
+ providerSlug,
17786
+ repoName,
17787
+ status,
17788
+ nodeCount,
17789
+ edgeCount,
17790
+ createdAt,
17791
+ updatedAt,
17792
+ ]
17674
17793
  properties:
17675
17794
  id: { type: string, format: uuid }
17676
17795
  workspaceId: { type: string, format: uuid }
@@ -17897,7 +18016,19 @@ components:
17897
18016
 
17898
18017
  CodeChatWikiPageDto:
17899
18018
  type: object
17900
- required: [id, indexId, workspaceId, slug, title, bodyMd, sortOrder, sourcePaths, createdAt, updatedAt]
18019
+ required:
18020
+ [
18021
+ id,
18022
+ indexId,
18023
+ workspaceId,
18024
+ slug,
18025
+ title,
18026
+ bodyMd,
18027
+ sortOrder,
18028
+ sourcePaths,
18029
+ createdAt,
18030
+ updatedAt,
18031
+ ]
17901
18032
  properties:
17902
18033
  id: { type: string, format: uuid }
17903
18034
  indexId: { type: string, format: uuid }
@@ -18296,11 +18427,27 @@ components:
18296
18427
 
18297
18428
  CodeInsightsFindingCategory:
18298
18429
  type: string
18299
- enum: [duplication, complexity, proliferation, coverage, anemic_domain, context_leak, tx_boundary, error_handling, config_cohesion, resilience_patterns]
18430
+ enum:
18431
+ [
18432
+ duplication,
18433
+ complexity,
18434
+ proliferation,
18435
+ coverage,
18436
+ anemic_domain,
18437
+ context_leak,
18438
+ tx_boundary,
18439
+ error_handling,
18440
+ config_cohesion,
18441
+ resilience_patterns,
18442
+ circular_deps,
18443
+ fan_in_hotspot,
18444
+ ]
18300
18445
  description: >
18301
18446
  Deterministic categories (`duplication`, `complexity`, `proliferation`,
18302
- `coverage`) plus LLM semantic detectors (`anemic_domain`, `context_leak`,
18303
- `tx_boundary`, `error_handling`, `config_cohesion`, `resilience_patterns`).
18447
+ `coverage`, `circular_deps`, `fan_in_hotspot`) plus LLM semantic detectors
18448
+ (`anemic_domain`, `context_leak`, `tx_boundary`, `error_handling`,
18449
+ `config_cohesion`, `resilience_patterns`). Coupling categories are written
18450
+ only by Design risks runs (`source=deterministic` on the design run id).
18304
18451
 
18305
18452
  CodeInsightsFindingSource:
18306
18453
  type: string
@@ -18454,7 +18601,8 @@ components:
18454
18601
 
18455
18602
  CodeInsightsRepoListItemDto:
18456
18603
  type: object
18457
- required: [repoId, repoName, language, providerSlug, webUrl, badges, findingsBySeverity, provenance]
18604
+ required:
18605
+ [repoId, repoName, language, providerSlug, webUrl, badges, findingsBySeverity, provenance]
18458
18606
  properties:
18459
18607
  repoId:
18460
18608
  type: string
@@ -18519,7 +18667,18 @@ components:
18519
18667
 
18520
18668
  CodeInsightsRepoDetailDto:
18521
18669
  type: object
18522
- required: [repoId, repoName, language, providerSlug, webUrl, metrics, hotspots, findings]
18670
+ required:
18671
+ [
18672
+ repoId,
18673
+ repoName,
18674
+ language,
18675
+ providerSlug,
18676
+ webUrl,
18677
+ metrics,
18678
+ hotspots,
18679
+ findings,
18680
+ designAnalysis,
18681
+ ]
18523
18682
  properties:
18524
18683
  repoId:
18525
18684
  type: string
@@ -18545,7 +18704,47 @@ components:
18545
18704
  type: array
18546
18705
  items:
18547
18706
  $ref: "#/components/schemas/CodeInsightsFindingDto"
18548
- description: Findings from the latest scan only (history is retention-bounded).
18707
+ description: >
18708
+ Deterministic findings from the latest metrics scan plus LLM findings from the
18709
+ latest **succeeded** Design risks run only. Stale LLM rows from older design runs
18710
+ are not returned.
18711
+ designAnalysis:
18712
+ allOf:
18713
+ - $ref: "#/components/schemas/CodeInsightsDesignAnalysisDto"
18714
+ nullable: true
18715
+ description: >
18716
+ Latest Design risks run of any status (for UI polling). Null when Design risks
18717
+ has never been enqueued for this repo.
18718
+
18719
+ CodeInsightsDesignAnalysisDto:
18720
+ type: object
18721
+ required: [runId, status, finishedAt, errorCode, errorDetail]
18722
+ properties:
18723
+ runId:
18724
+ type: string
18725
+ format: uuid
18726
+ status:
18727
+ type: string
18728
+ enum: [queued, running, succeeded, failed, partial_failed]
18729
+ finishedAt:
18730
+ type: string
18731
+ format: date-time
18732
+ nullable: true
18733
+ errorCode:
18734
+ type: string
18735
+ nullable: true
18736
+ errorDetail:
18737
+ type: string
18738
+ nullable: true
18739
+
18740
+ CodeInsightsDesignAnalyzeResponseDto:
18741
+ type: object
18742
+ required: [runId]
18743
+ properties:
18744
+ runId:
18745
+ type: string
18746
+ format: uuid
18747
+ description: Enqueued Design risks run id (`tai_workspace_readiness_runs.id`).
18549
18748
 
18550
18749
  CodeInsightsOrgHotspotDto:
18551
18750
  allOf:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.98.0",
3
+ "version": "2.100.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -20,8 +20,8 @@
20
20
  },
21
21
  "dependencies": {},
22
22
  "devDependencies": {
23
- "@stoplight/spectral-cli": "^6.16.2",
24
- "@types/node": "^26.1.2",
23
+ "@stoplight/spectral-cli": "^6.16.3",
24
+ "@types/node": "^26.2.0",
25
25
  "jsonpath-plus": "^10.3.0",
26
26
  "openapi-typescript": "^7.13.0",
27
27
  "typescript": "~6.0.3"