@thinkai/tai-api-contract 2.214.0 → 2.216.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.214.0
4
+ version: 2.216.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}/...`.
@@ -23,6 +23,10 @@ info:
23
23
  security:
24
24
  - bearerAuth: []
25
25
  tags:
26
+ - name: TeamEfficiency
27
+ description: >
28
+ Team Efficiency insights (Shine). SurveyMonkey DevEx (`devex-score`) and related
29
+ routes are gated by `backend-api.teamEfficiency.enabled` (404 when off).
26
30
  - name: Workspace
27
31
  description: Workspace bootstrap (§13)
28
32
  - name: CompanyProfile
@@ -3075,6 +3079,119 @@ paths:
3075
3079
  schema:
3076
3080
  $ref: "#/components/schemas/ErrorMessageDto"
3077
3081
 
3082
+ /workspaces/{workspaceId}/team-ownership:
3083
+ get:
3084
+ tags: [Workspace]
3085
+ summary: List team ownership mappings (Team Efficiency T1)
3086
+ description: >
3087
+ Returns org-chart team ownership of repos, services, and tracker teams, plus
3088
+ unmapped workspace repos and (when Datadog is connected) unmapped catalog services.
3089
+ Requires `backend-api.teamEfficiency.enabled` (or workspace allowlist); otherwise `404`
3090
+ with `code: team_efficiency_disabled`. Member read.
3091
+ operationId: getWorkspaceTeamOwnership
3092
+ parameters:
3093
+ - $ref: "#/components/parameters/WorkspaceId"
3094
+ responses:
3095
+ "200":
3096
+ description: Current mappings and unmapped inventory
3097
+ content:
3098
+ application/json:
3099
+ schema:
3100
+ $ref: "#/components/schemas/TeamOwnershipListDto"
3101
+ "401":
3102
+ $ref: "#/components/responses/Unauthorized"
3103
+ "403":
3104
+ $ref: "#/components/responses/Forbidden"
3105
+ "404":
3106
+ description: Workspace missing or Team Efficiency disabled
3107
+ content:
3108
+ application/json:
3109
+ schema:
3110
+ $ref: "#/components/schemas/ErrorMessageDto"
3111
+ put:
3112
+ tags: [Workspace]
3113
+ summary: Replace team ownership mappings (Team Efficiency T1)
3114
+ description: >
3115
+ Full-replace ownership rows. Requires workspace **admin**. Flag-gated like GET
3116
+ (`404` `team_efficiency_disabled` when off).
3117
+ operationId: putWorkspaceTeamOwnership
3118
+ parameters:
3119
+ - $ref: "#/components/parameters/WorkspaceId"
3120
+ requestBody:
3121
+ required: true
3122
+ content:
3123
+ application/json:
3124
+ schema:
3125
+ $ref: "#/components/schemas/TeamOwnershipReplaceDto"
3126
+ responses:
3127
+ "200":
3128
+ description: Replaced mappings
3129
+ content:
3130
+ application/json:
3131
+ schema:
3132
+ $ref: "#/components/schemas/TeamOwnershipListDto"
3133
+ "400":
3134
+ description: Invalid payload
3135
+ content:
3136
+ application/json:
3137
+ schema:
3138
+ $ref: "#/components/schemas/ErrorMessageDto"
3139
+ "401":
3140
+ $ref: "#/components/responses/Unauthorized"
3141
+ "403":
3142
+ description: Forbidden — workspace admin required
3143
+ content:
3144
+ application/json:
3145
+ schema:
3146
+ $ref: "#/components/schemas/ErrorMessageDto"
3147
+ "404":
3148
+ description: Workspace missing or Team Efficiency disabled
3149
+ content:
3150
+ application/json:
3151
+ schema:
3152
+ $ref: "#/components/schemas/ErrorMessageDto"
3153
+
3154
+ /workspaces/{workspaceId}/team-ownership/import-datadog-catalog:
3155
+ post:
3156
+ tags: [Workspace]
3157
+ summary: Import Datadog service-catalog team ownership
3158
+ description: >
3159
+ Reads Datadog service definitions (`team` / `dd-team`), matches labels to org-chart
3160
+ team id or name (case-insensitive), and upserts `kind=service` rows with
3161
+ `provider=datadog`. Admin only; flag-gated.
3162
+ operationId: importDatadogTeamOwnershipCatalog
3163
+ parameters:
3164
+ - $ref: "#/components/parameters/WorkspaceId"
3165
+ responses:
3166
+ "200":
3167
+ description: Import result
3168
+ content:
3169
+ application/json:
3170
+ schema:
3171
+ $ref: "#/components/schemas/TeamOwnershipDatadogImportResultDto"
3172
+ "401":
3173
+ $ref: "#/components/responses/Unauthorized"
3174
+ "403":
3175
+ $ref: "#/components/responses/Forbidden"
3176
+ "404":
3177
+ description: Workspace missing or Team Efficiency disabled
3178
+ content:
3179
+ application/json:
3180
+ schema:
3181
+ $ref: "#/components/schemas/ErrorMessageDto"
3182
+ "422":
3183
+ description: Datadog not connected
3184
+ content:
3185
+ application/json:
3186
+ schema:
3187
+ $ref: "#/components/schemas/ErrorMessageDto"
3188
+ "503":
3189
+ description: Datadog catalog fetch failed
3190
+ content:
3191
+ application/json:
3192
+ schema:
3193
+ $ref: "#/components/schemas/ErrorMessageDto"
3194
+
3078
3195
  /workspaces/{workspaceId}/productivity-targets:
3079
3196
  get:
3080
3197
  tags: [Workspace]
@@ -3305,6 +3422,7 @@ paths:
3305
3422
  - $ref: "#/components/schemas/GrafanaSourceDto"
3306
3423
  - $ref: "#/components/schemas/SonarQubeSourceDto"
3307
3424
  - $ref: "#/components/schemas/PagerDutySourceDto"
3425
+ - $ref: "#/components/schemas/SurveyMonkeySourceDto"
3308
3426
  - $ref: "#/components/schemas/IncidentIoSourceDto"
3309
3427
  - $ref: "#/components/schemas/SentrySourceDto"
3310
3428
  - $ref: "#/components/schemas/JiraSourceDto"
@@ -3444,6 +3562,7 @@ paths:
3444
3562
  - $ref: "#/components/schemas/GrafanaSourceDto"
3445
3563
  - $ref: "#/components/schemas/SonarQubeSourceDto"
3446
3564
  - $ref: "#/components/schemas/PagerDutySourceDto"
3565
+ - $ref: "#/components/schemas/SurveyMonkeySourceDto"
3447
3566
  - $ref: "#/components/schemas/IncidentIoSourceDto"
3448
3567
  - $ref: "#/components/schemas/SentrySourceDto"
3449
3568
  - $ref: "#/components/schemas/JiraSourceDto"
@@ -4831,6 +4950,101 @@ paths:
4831
4950
  ok: false
4832
4951
  error: already_in_progress
4833
4952
 
4953
+ /workspaces/{workspaceId}/insights/devex/results:
4954
+ get:
4955
+ tags: [TeamEfficiency]
4956
+ summary: DevEx survey aggregates (SurveyMonkey)
4957
+ description: >
4958
+ Persisted DevEx aggregates (`devex-score`) for a workspace. Aggregates only —
4959
+ never email or free text. Returns 404 when `backend-api.teamEfficiency.enabled`
4960
+ is false (unless the workspace is on the optional allowlist).
4961
+ operationId: getDevexResults
4962
+ parameters:
4963
+ - $ref: "#/components/parameters/WorkspaceId"
4964
+ - name: quarter
4965
+ in: query
4966
+ schema: { type: string, example: "2026-Q1" }
4967
+ - name: team
4968
+ in: query
4969
+ schema: { type: string }
4970
+ - name: department
4971
+ in: query
4972
+ schema: { type: string }
4973
+ responses:
4974
+ "200":
4975
+ description: DevEx aggregate rows
4976
+ content:
4977
+ application/json:
4978
+ schema:
4979
+ $ref: "#/components/schemas/DevexResultsResponseDto"
4980
+ "401":
4981
+ $ref: "#/components/responses/Unauthorized"
4982
+ "403":
4983
+ $ref: "#/components/responses/Forbidden"
4984
+ "404":
4985
+ description: Feature flag off or workspace not found
4986
+
4987
+ /workspaces/{workspaceId}/insights/devex/sync:
4988
+ post:
4989
+ tags: [TeamEfficiency]
4990
+ summary: Sync DevEx aggregates from SurveyMonkey
4991
+ description: >
4992
+ Pull SurveyMonkey responses, score dimensions (% favourable after reverse-score),
4993
+ apply team min-response rollup and response-rate flags, and persist aggregates only.
4994
+ Admin only. 404 when Team Efficiency is disabled.
4995
+ operationId: syncDevexSurvey
4996
+ parameters:
4997
+ - $ref: "#/components/parameters/WorkspaceId"
4998
+ requestBody:
4999
+ required: false
5000
+ content:
5001
+ application/json:
5002
+ schema:
5003
+ $ref: "#/components/schemas/DevexSyncRequestDto"
5004
+ responses:
5005
+ "200":
5006
+ description: Sync completed
5007
+ content:
5008
+ application/json:
5009
+ schema:
5010
+ $ref: "#/components/schemas/DevexSyncResultDto"
5011
+ "401":
5012
+ $ref: "#/components/responses/Unauthorized"
5013
+ "403":
5014
+ $ref: "#/components/responses/Forbidden"
5015
+ "404":
5016
+ description: Feature flag off
5017
+ "422":
5018
+ description: SurveyMonkey not connected or mapping incomplete
5019
+ "502":
5020
+ description: SurveyMonkey API failure
5021
+
5022
+ /workspaces/{workspaceId}/connectors/surveymonkey/verify:
5023
+ post:
5024
+ tags: [TeamEfficiency]
5025
+ summary: Re-verify SurveyMonkey connection
5026
+ description: >
5027
+ Re-tests the stored SurveyMonkey token and returns an anonymity warning when the
5028
+ collector is not anonymous (when the API exposes that setting). 404 when flag off.
5029
+ operationId: verifySurveyMonkeyConnector
5030
+ parameters:
5031
+ - $ref: "#/components/parameters/WorkspaceId"
5032
+ responses:
5033
+ "200":
5034
+ description: Connection test result
5035
+ content:
5036
+ application/json:
5037
+ schema:
5038
+ $ref: "#/components/schemas/TestConnectionResponseDto"
5039
+ "401":
5040
+ $ref: "#/components/responses/Unauthorized"
5041
+ "403":
5042
+ $ref: "#/components/responses/Forbidden"
5043
+ "404":
5044
+ description: Feature flag off
5045
+ "422":
5046
+ description: SurveyMonkey not connected
5047
+
4834
5048
  /workspaces/{workspaceId}/insights/sdlc/overview:
4835
5049
  get:
4836
5050
  tags: [SdlcInsights]
@@ -16758,6 +16972,177 @@ components:
16758
16972
  type: string
16759
16973
  description: PagerDuty user email when known from the last successful verify.
16760
16974
 
16975
+ SurveyMonkeySourceDto:
16976
+ type: object
16977
+ description: >
16978
+ SurveyMonkey DevEx survey source for Team Efficiency (`devex-score`).
16979
+ Requires a private-app access token with Responses API read.
16980
+ Plan tier: Advantage (or Premier / Enterprise) with API access.
16981
+ Hidden when `backend-api.teamEfficiency.enabled` is false (404 on PUT/test).
16982
+ required: [type, token, surveyId]
16983
+ additionalProperties: false
16984
+ properties:
16985
+ type:
16986
+ type: string
16987
+ enum: [surveymonkey]
16988
+ token:
16989
+ type: string
16990
+ minLength: 1
16991
+ maxLength: 2048
16992
+ description: SurveyMonkey private app access token (Bearer, write-only on PUT).
16993
+ surveyId:
16994
+ type: string
16995
+ minLength: 1
16996
+ maxLength: 128
16997
+ description: SurveyMonkey survey id to score.
16998
+ collectorId:
16999
+ type: string
17000
+ maxLength: 128
17001
+ description: Optional collector id for anonymity checks.
17002
+ baseUrl:
17003
+ type: string
17004
+ description: Optional API base URL override. Default `https://api.surveymonkey.com/v3`.
17005
+ teamQuestionId:
17006
+ type: string
17007
+ description: Required choice question whose options map to org-chart teams.
17008
+ teamOptionMap:
17009
+ type: object
17010
+ additionalProperties:
17011
+ type: string
17012
+ description: SurveyMonkey choice id → org-chart team id.
17013
+ teamDepartmentMap:
17014
+ type: object
17015
+ additionalProperties:
17016
+ type: string
17017
+ description: SurveyMonkey choice id → department id (for <5 response rollup).
17018
+ questions:
17019
+ type: array
17020
+ items:
17021
+ type: object
17022
+ required: [questionId, dimension]
17023
+ additionalProperties: false
17024
+ properties:
17025
+ questionId: { type: string }
17026
+ dimension:
17027
+ type: string
17028
+ enum: [feedback_loops, cognitive_load, flow_state]
17029
+ reverse:
17030
+ type: boolean
17031
+ description: Negatively worded questions are reverse-scored before % favourable.
17032
+ userName:
17033
+ type: string
17034
+ description: Optional display name from a successful connection test (echo-after-test).
17035
+
17036
+ SurveyMonkeySourceConfigDto:
17037
+ type: object
17038
+ description: >
17039
+ Redacted SurveyMonkey source returned by `GET /workspaces/{workspaceId}/config`
17040
+ when Team Efficiency is enabled. Raw token is never returned. Omitted from sources
17041
+ when the feature flag is off.
17042
+ required: [type, hasToken]
17043
+ additionalProperties: false
17044
+ properties:
17045
+ type:
17046
+ type: string
17047
+ enum: [surveymonkey]
17048
+ hasToken:
17049
+ type: boolean
17050
+ surveyId: { type: string }
17051
+ collectorId: { type: string }
17052
+ baseUrl: { type: string }
17053
+ teamQuestionId: { type: string }
17054
+ teamOptionMap:
17055
+ type: object
17056
+ additionalProperties: { type: string }
17057
+ teamDepartmentMap:
17058
+ type: object
17059
+ additionalProperties: { type: string }
17060
+ questions:
17061
+ type: array
17062
+ items:
17063
+ type: object
17064
+ required: [questionId, dimension]
17065
+ additionalProperties: false
17066
+ properties:
17067
+ questionId: { type: string }
17068
+ dimension:
17069
+ type: string
17070
+ enum: [feedback_loops, cognitive_load, flow_state]
17071
+ reverse: { type: boolean }
17072
+ userName: { type: string }
17073
+
17074
+ DevexResultDto:
17075
+ type: object
17076
+ description: One persisted DevEx aggregate row (never email / free text).
17077
+ required:
17078
+ [
17079
+ quarter,
17080
+ feedbackLoopsScore,
17081
+ cognitiveLoadScore,
17082
+ flowStateScore,
17083
+ devexScore,
17084
+ responseCount,
17085
+ lowResponseRate,
17086
+ rolledUp,
17087
+ updatedAt,
17088
+ ]
17089
+ additionalProperties: false
17090
+ properties:
17091
+ teamId: { type: string, nullable: true }
17092
+ departmentId: { type: string, nullable: true }
17093
+ quarter: { type: string, example: "2026-Q1" }
17094
+ feedbackLoopsScore: { type: number }
17095
+ cognitiveLoadScore: { type: number }
17096
+ flowStateScore: { type: number }
17097
+ devexScore: { type: number, description: Average of the three dimension scores (0–100). }
17098
+ responseCount: { type: integer, minimum: 0 }
17099
+ rosterSize: { type: integer, nullable: true, minimum: 0 }
17100
+ responseRate: { type: number, nullable: true }
17101
+ lowResponseRate: { type: boolean }
17102
+ rolledUp:
17103
+ type: boolean
17104
+ description: True when the team had fewer than 5 responses and rolled to department.
17105
+ updatedAt: { type: string, format: date-time }
17106
+
17107
+ DevexResultsResponseDto:
17108
+ type: object
17109
+ required: [metricId, results]
17110
+ additionalProperties: false
17111
+ properties:
17112
+ metricId:
17113
+ type: string
17114
+ enum: [devex-score]
17115
+ results:
17116
+ type: array
17117
+ items:
17118
+ $ref: "#/components/schemas/DevexResultDto"
17119
+
17120
+ DevexSyncRequestDto:
17121
+ type: object
17122
+ additionalProperties: false
17123
+ properties:
17124
+ quarter: { type: string, example: "2026-Q1" }
17125
+ rosterByTeam:
17126
+ type: object
17127
+ additionalProperties: { type: number }
17128
+ rosterByDepartment:
17129
+ type: object
17130
+ additionalProperties: { type: number }
17131
+
17132
+ DevexSyncResultDto:
17133
+ type: object
17134
+ additionalProperties: false
17135
+ properties:
17136
+ status:
17137
+ type: string
17138
+ enum: [ok, skipped, error]
17139
+ quarter: { type: string }
17140
+ responseCount: { type: integer }
17141
+ resultCount: { type: integer }
17142
+ code: { type: string }
17143
+ reason: { type: string }
17144
+ error: { type: string }
17145
+
16761
17146
  IncidentIoSourceDto:
16762
17147
  type: object
16763
17148
  description: >
@@ -17251,6 +17636,7 @@ components:
17251
17636
  - $ref: "#/components/schemas/GrafanaSourceConfigDto"
17252
17637
  - $ref: "#/components/schemas/SonarQubeSourceConfigDto"
17253
17638
  - $ref: "#/components/schemas/PagerDutySourceConfigDto"
17639
+ - $ref: "#/components/schemas/SurveyMonkeySourceConfigDto"
17254
17640
  - $ref: "#/components/schemas/IncidentIoSourceConfigDto"
17255
17641
  - $ref: "#/components/schemas/SentrySourceConfigDto"
17256
17642
  - $ref: "#/components/schemas/JiraSourceConfigDto"
@@ -17704,6 +18090,132 @@ components:
17704
18090
  enum: [okta, entra, saml]
17705
18091
  nullable: true
17706
18092
 
18093
+ TeamOwnershipKindDto:
18094
+ type: string
18095
+ enum: [repo, service, tracker_team]
18096
+
18097
+ TeamOwnershipMappingDto:
18098
+ type: object
18099
+ additionalProperties: false
18100
+ required: [id, teamId, kind, provider, key, createdAt, updatedAt]
18101
+ properties:
18102
+ id:
18103
+ type: string
18104
+ format: uuid
18105
+ teamId:
18106
+ type: string
18107
+ description: Org-chart team node id
18108
+ kind:
18109
+ $ref: "#/components/schemas/TeamOwnershipKindDto"
18110
+ provider:
18111
+ type: string
18112
+ description: e.g. github, datadog, linear
18113
+ key:
18114
+ type: string
18115
+ description: Repo slug, service name, or tracker team key
18116
+ createdAt:
18117
+ type: string
18118
+ format: date-time
18119
+ updatedAt:
18120
+ type: string
18121
+ format: date-time
18122
+
18123
+ TeamOwnershipUnmappedDto:
18124
+ type: object
18125
+ additionalProperties: false
18126
+ required: [repos, services]
18127
+ properties:
18128
+ repos:
18129
+ type: array
18130
+ items:
18131
+ type: string
18132
+ description: Workspace repo provider_slugs with no kind=repo mapping
18133
+ services:
18134
+ type: array
18135
+ items:
18136
+ type: string
18137
+ description: Datadog catalog services with no kind=service mapping (empty when Datadog disconnected)
18138
+
18139
+ TeamOwnershipListDto:
18140
+ type: object
18141
+ additionalProperties: false
18142
+ required: [mappings, unmapped]
18143
+ properties:
18144
+ mappings:
18145
+ type: array
18146
+ items:
18147
+ $ref: "#/components/schemas/TeamOwnershipMappingDto"
18148
+ unmapped:
18149
+ $ref: "#/components/schemas/TeamOwnershipUnmappedDto"
18150
+
18151
+ TeamOwnershipMappingInputDto:
18152
+ type: object
18153
+ additionalProperties: false
18154
+ required: [teamId, kind, provider, key]
18155
+ properties:
18156
+ teamId:
18157
+ type: string
18158
+ kind:
18159
+ $ref: "#/components/schemas/TeamOwnershipKindDto"
18160
+ provider:
18161
+ type: string
18162
+ key:
18163
+ type: string
18164
+
18165
+ TeamOwnershipReplaceDto:
18166
+ type: object
18167
+ additionalProperties: false
18168
+ required: [mappings]
18169
+ properties:
18170
+ mappings:
18171
+ type: array
18172
+ maxItems: 2000
18173
+ items:
18174
+ $ref: "#/components/schemas/TeamOwnershipMappingInputDto"
18175
+
18176
+ TeamOwnershipDatadogImportMatchDto:
18177
+ type: object
18178
+ additionalProperties: false
18179
+ required: [teamId, service, catalogTeam]
18180
+ properties:
18181
+ teamId:
18182
+ type: string
18183
+ service:
18184
+ type: string
18185
+ catalogTeam:
18186
+ type: string
18187
+
18188
+ TeamOwnershipDatadogImportUnmatchedDto:
18189
+ type: object
18190
+ additionalProperties: false
18191
+ required: [service, catalogTeam]
18192
+ properties:
18193
+ service:
18194
+ type: string
18195
+ catalogTeam:
18196
+ type: string
18197
+ nullable: true
18198
+
18199
+ TeamOwnershipDatadogImportResultDto:
18200
+ type: object
18201
+ additionalProperties: false
18202
+ required: [importedCount, upserted, unmatchedCount, imported, unmatched]
18203
+ properties:
18204
+ importedCount:
18205
+ type: integer
18206
+ upserted:
18207
+ type: integer
18208
+ unmatchedCount:
18209
+ type: integer
18210
+ imported:
18211
+ type: array
18212
+ items:
18213
+ $ref: "#/components/schemas/TeamOwnershipDatadogImportMatchDto"
18214
+ unmatched:
18215
+ type: array
18216
+ items:
18217
+ $ref: "#/components/schemas/TeamOwnershipDatadogImportUnmatchedDto"
18218
+
17707
18219
  ProductivityTargetsDto:
17708
18220
  type: object
17709
18221
  description: >
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.214.0",
3
+ "version": "2.216.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",