@thinkai/tai-api-contract 2.5.17 → 2.6.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.5.17
4
+ version: 2.6.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}/...`.
@@ -50,6 +50,8 @@ tags:
50
50
  description: Org chart import via storage path (§14)
51
51
  - name: AgenticFoundation
52
52
  description: Agentic Foundation pillars (epic #278); reads stored repository readiness snapshots
53
+ - name: YourAiJourney
54
+ description: Your AI Journey dashboard aggregators (epic #267); composes readiness, metrics, and AI-spend data for the /dashboard page
53
55
 
54
56
  paths:
55
57
  /me:
@@ -3062,6 +3064,272 @@ paths:
3062
3064
  schema:
3063
3065
  $ref: "#/components/schemas/ErrorMessageDto"
3064
3066
 
3067
+ # ── Your AI Journey (/dashboard) — epic #267 ─────────────────────────────
3068
+
3069
+ /workspaces/{workspaceId}/your-ai-journey/analytics:
3070
+ get:
3071
+ tags: [YourAiJourney]
3072
+ summary: Combined analytics summary for the /dashboard page
3073
+ description: >
3074
+ Returns a single aggregated payload combining journey step progress, readiness summary,
3075
+ and PR-signal headline metrics. Covers issue #268. Results are cached for 60 seconds.
3076
+ operationId: getYourAiJourneyAnalytics
3077
+ parameters:
3078
+ - $ref: "#/components/parameters/WorkspaceId"
3079
+ responses:
3080
+ "200":
3081
+ description: Analytics summary
3082
+ content:
3083
+ application/json:
3084
+ schema:
3085
+ $ref: "#/components/schemas/YourAiJourneyAnalyticsDto"
3086
+ "401":
3087
+ $ref: "#/components/responses/Unauthorized"
3088
+ "403":
3089
+ $ref: "#/components/responses/Forbidden"
3090
+ "404":
3091
+ description: Workspace does not exist
3092
+ content:
3093
+ application/json:
3094
+ schema:
3095
+ $ref: "#/components/schemas/ErrorMessageDto"
3096
+
3097
+ /workspaces/{workspaceId}/your-ai-journey/pr-signals:
3098
+ get:
3099
+ tags: [YourAiJourney]
3100
+ summary: Weekly PR velocity and change-failure-rate time series
3101
+ description: >
3102
+ Returns a per-week time series of PR throughput and DORA change-failure-rate metrics,
3103
+ sourced from stored dashboard metrics. Covers issue #269. Results are cached for 60 seconds.
3104
+ operationId: getYourAiJourneyPrSignals
3105
+ parameters:
3106
+ - $ref: "#/components/parameters/WorkspaceId"
3107
+ - name: limit
3108
+ in: query
3109
+ schema:
3110
+ type: integer
3111
+ minimum: 1
3112
+ maximum: 52
3113
+ default: 8
3114
+ description: Number of weekly buckets to return (1–52; default 8).
3115
+ responses:
3116
+ "200":
3117
+ description: Weekly PR signals
3118
+ content:
3119
+ application/json:
3120
+ schema:
3121
+ $ref: "#/components/schemas/YourAiJourneyPrSignalsDto"
3122
+ "400":
3123
+ description: Invalid query parameter (limit out of range)
3124
+ content:
3125
+ application/json:
3126
+ schema:
3127
+ $ref: "#/components/schemas/ErrorMessageDto"
3128
+ "401":
3129
+ $ref: "#/components/responses/Unauthorized"
3130
+ "403":
3131
+ $ref: "#/components/responses/Forbidden"
3132
+ "404":
3133
+ description: Workspace does not exist
3134
+ content:
3135
+ application/json:
3136
+ schema:
3137
+ $ref: "#/components/schemas/ErrorMessageDto"
3138
+
3139
+ /workspaces/{workspaceId}/your-ai-journey/readiness/aggregate:
3140
+ get:
3141
+ tags: [YourAiJourney]
3142
+ summary: Per-dimension readiness aggregate across all repos
3143
+ description: >
3144
+ Aggregates stored readiness scores across all workspace repos by dimension.
3145
+ Covers issue #270. Results are cached for 60 seconds.
3146
+ operationId: getYourAiJourneyReadinessAggregate
3147
+ parameters:
3148
+ - $ref: "#/components/parameters/WorkspaceId"
3149
+ responses:
3150
+ "200":
3151
+ description: Readiness aggregate
3152
+ content:
3153
+ application/json:
3154
+ schema:
3155
+ $ref: "#/components/schemas/YourAiJourneyReadinessAggregateDto"
3156
+ "401":
3157
+ $ref: "#/components/responses/Unauthorized"
3158
+ "403":
3159
+ $ref: "#/components/responses/Forbidden"
3160
+ "404":
3161
+ description: Workspace does not exist
3162
+ content:
3163
+ application/json:
3164
+ schema:
3165
+ $ref: "#/components/schemas/ErrorMessageDto"
3166
+
3167
+ /workspaces/{workspaceId}/your-ai-journey/journey/progress:
3168
+ get:
3169
+ tags: [YourAiJourney]
3170
+ summary: Workspace journey step completion
3171
+ description: >
3172
+ Returns the workspace-scoped journey progress state. Returns an empty `completedSteps`
3173
+ list with a synthetic `updatedAt` if no row exists yet. Covers issue #271.
3174
+ operationId: getYourAiJourneyProgress
3175
+ parameters:
3176
+ - $ref: "#/components/parameters/WorkspaceId"
3177
+ responses:
3178
+ "200":
3179
+ description: Journey progress
3180
+ content:
3181
+ application/json:
3182
+ schema:
3183
+ $ref: "#/components/schemas/JourneyProgressDto"
3184
+ "401":
3185
+ $ref: "#/components/responses/Unauthorized"
3186
+ "403":
3187
+ $ref: "#/components/responses/Forbidden"
3188
+ "404":
3189
+ description: Workspace does not exist
3190
+ content:
3191
+ application/json:
3192
+ schema:
3193
+ $ref: "#/components/schemas/ErrorMessageDto"
3194
+ put:
3195
+ tags: [YourAiJourney]
3196
+ summary: Replace workspace journey completed steps
3197
+ description: >
3198
+ Idempotent replace-all of completed route strings for the workspace journey.
3199
+ Requires editor role. Covers issue #271.
3200
+ operationId: putYourAiJourneyProgress
3201
+ parameters:
3202
+ - $ref: "#/components/parameters/WorkspaceId"
3203
+ requestBody:
3204
+ required: true
3205
+ content:
3206
+ application/json:
3207
+ schema:
3208
+ $ref: "#/components/schemas/JourneyProgressUpdateDto"
3209
+ responses:
3210
+ "200":
3211
+ description: Saved progress
3212
+ content:
3213
+ application/json:
3214
+ schema:
3215
+ $ref: "#/components/schemas/JourneyProgressDto"
3216
+ "400":
3217
+ description: Body fails validation (non-array, invalid entries, too many steps)
3218
+ content:
3219
+ application/json:
3220
+ schema:
3221
+ $ref: "#/components/schemas/ErrorMessageDto"
3222
+ "401":
3223
+ $ref: "#/components/responses/Unauthorized"
3224
+ "403":
3225
+ $ref: "#/components/responses/Forbidden"
3226
+ "404":
3227
+ description: Workspace does not exist
3228
+ content:
3229
+ application/json:
3230
+ schema:
3231
+ $ref: "#/components/schemas/ErrorMessageDto"
3232
+
3233
+ /workspaces/{workspaceId}/your-ai-journey/agentic-foundation:
3234
+ get:
3235
+ tags: [YourAiJourney]
3236
+ summary: Agentic foundation dashboard slice for /dashboard
3237
+ description: >
3238
+ Returns the same `AgenticFoundationDashboardDto` payload as
3239
+ `GET /agentic-foundation/dashboard`, scoped to the /dashboard page context.
3240
+ Covers issue #272. Results are cached for 60 seconds.
3241
+ operationId: getYourAiJourneyAgenticFoundation
3242
+ parameters:
3243
+ - $ref: "#/components/parameters/WorkspaceId"
3244
+ responses:
3245
+ "200":
3246
+ description: Agentic foundation dashboard
3247
+ content:
3248
+ application/json:
3249
+ schema:
3250
+ $ref: "#/components/schemas/AgenticFoundationDashboardDto"
3251
+ "401":
3252
+ $ref: "#/components/responses/Unauthorized"
3253
+ "403":
3254
+ $ref: "#/components/responses/Forbidden"
3255
+ "404":
3256
+ description: Workspace does not exist
3257
+ content:
3258
+ application/json:
3259
+ schema:
3260
+ $ref: "#/components/schemas/ErrorMessageDto"
3261
+
3262
+ /workspaces/{workspaceId}/your-ai-journey/productivity:
3263
+ get:
3264
+ tags: [YourAiJourney]
3265
+ summary: Workspace productivity metrics for /dashboard
3266
+ description: >
3267
+ Returns the most recent stored dashboard productivity metrics snapshot that overlaps the
3268
+ requested window (defaults to the trailing 7 days). Same schema as
3269
+ `GET /dashboard/productivity`. Covers issue #273. Results are cached for 60 seconds.
3270
+ operationId: getYourAiJourneyProductivity
3271
+ parameters:
3272
+ - $ref: "#/components/parameters/WorkspaceId"
3273
+ - name: windowEnd
3274
+ in: query
3275
+ schema:
3276
+ type: string
3277
+ format: date-time
3278
+ description: Upper bound of the requested window (ISO 8601; defaults to now).
3279
+ responses:
3280
+ "200":
3281
+ description: Productivity metrics snapshot
3282
+ content:
3283
+ application/json:
3284
+ schema:
3285
+ $ref: "#/components/schemas/DashboardProductivityDto"
3286
+ "401":
3287
+ $ref: "#/components/responses/Unauthorized"
3288
+ "403":
3289
+ $ref: "#/components/responses/Forbidden"
3290
+ "404":
3291
+ description: Workspace does not exist
3292
+ content:
3293
+ application/json:
3294
+ schema:
3295
+ $ref: "#/components/schemas/ErrorMessageDto"
3296
+
3297
+ /workspaces/{workspaceId}/your-ai-journey/ai-spend:
3298
+ get:
3299
+ tags: [YourAiJourney]
3300
+ summary: AI tool spend and usage aggregated by week and provider
3301
+ description: >
3302
+ Returns token usage and spend aggregated from connected AI tool sources (e.g. Cursor)
3303
+ over the requested range, broken down by week and provider. Covers issue #274.
3304
+ Results are cached for 60 seconds.
3305
+ operationId: getYourAiJourneyAiSpend
3306
+ parameters:
3307
+ - $ref: "#/components/parameters/WorkspaceId"
3308
+ - name: rangeId
3309
+ in: query
3310
+ schema:
3311
+ type: string
3312
+ enum: [4w, 8w, q]
3313
+ default: 4w
3314
+ description: Time range — `4w` (4 weeks), `8w` (8 weeks), or `q` (quarter, 12 weeks).
3315
+ responses:
3316
+ "200":
3317
+ description: AI spend aggregation
3318
+ content:
3319
+ application/json:
3320
+ schema:
3321
+ $ref: "#/components/schemas/YourAiJourneyAiSpendDto"
3322
+ "401":
3323
+ $ref: "#/components/responses/Unauthorized"
3324
+ "403":
3325
+ $ref: "#/components/responses/Forbidden"
3326
+ "404":
3327
+ description: Workspace does not exist
3328
+ content:
3329
+ application/json:
3330
+ schema:
3331
+ $ref: "#/components/schemas/ErrorMessageDto"
3332
+
3065
3333
  components:
3066
3334
  securitySchemes:
3067
3335
  bearerAuth:
@@ -3624,6 +3892,12 @@ components:
3624
3892
  type: string
3625
3893
  teamName:
3626
3894
  type: string
3895
+ notInOrgChart:
3896
+ type: boolean
3897
+ description: True when the contributor GitHub login is not mapped in the org chart.
3898
+ githubLogin:
3899
+ type: string
3900
+ description: GitHub login for unattributed contributors (when notInOrgChart is true).
3627
3901
  weeks:
3628
3902
  type: array
3629
3903
  items:
@@ -3647,7 +3921,7 @@ components:
3647
3921
  format: date-time
3648
3922
  weeks:
3649
3923
  type: array
3650
- description: Portfolio aggregate merged PR counts (sum of filtered contributors per week).
3924
+ description: Portfolio aggregate merged PR counts from org-scope metrics (all merged PRs in window).
3651
3925
  items:
3652
3926
  $ref: "#/components/schemas/ProductivityInsightsMergedPrTrendWeekDto"
3653
3927
  contributors:
@@ -5613,3 +5887,219 @@ components:
5613
5887
  storagePath:
5614
5888
  type: string
5615
5889
  description: Path in `org-charts` bucket after Supabase upload
5890
+
5891
+ # ── Your AI Journey schemas ─────────────────────────────────────────────
5892
+
5893
+ YourAiJourneyPrSignalsWeekDto:
5894
+ type: object
5895
+ required: [bucketStart, bucketEnd, weekLabel, prsPerDeveloperPerWeek, changeFailureRatePercent]
5896
+ properties:
5897
+ bucketStart:
5898
+ type: string
5899
+ format: date-time
5900
+ bucketEnd:
5901
+ type: string
5902
+ format: date-time
5903
+ weekLabel:
5904
+ type: string
5905
+ description: Display label in MM/DD format.
5906
+ prsPerDeveloperPerWeek:
5907
+ type: number
5908
+ changeFailureRatePercent:
5909
+ type: number
5910
+
5911
+ YourAiJourneyPrSignalsDto:
5912
+ type: object
5913
+ required: [workspaceId, generatedAt, windowStart, windowEnd, weeks, summary]
5914
+ properties:
5915
+ workspaceId:
5916
+ type: string
5917
+ format: uuid
5918
+ generatedAt:
5919
+ type: string
5920
+ format: date-time
5921
+ windowStart:
5922
+ type: string
5923
+ format: date-time
5924
+ windowEnd:
5925
+ type: string
5926
+ format: date-time
5927
+ weeks:
5928
+ type: array
5929
+ items:
5930
+ $ref: "#/components/schemas/YourAiJourneyPrSignalsWeekDto"
5931
+ summary:
5932
+ type: object
5933
+ required: [avgPrsPerDeveloperPerWeek, avgFailureRatePercent, prVelocityDeltaPercent]
5934
+ properties:
5935
+ avgPrsPerDeveloperPerWeek:
5936
+ type: number
5937
+ avgFailureRatePercent:
5938
+ type: number
5939
+ prVelocityDeltaPercent:
5940
+ type: number
5941
+
5942
+ YourAiJourneyReadinessDimensionDto:
5943
+ type: object
5944
+ required: [dimensionId, name, totalScore, maxScore, percent]
5945
+ properties:
5946
+ dimensionId:
5947
+ type: string
5948
+ name:
5949
+ type: string
5950
+ totalScore:
5951
+ type: number
5952
+ maxScore:
5953
+ type: number
5954
+ percent:
5955
+ type: number
5956
+ description: Rounded percentage 0–100.
5957
+
5958
+ YourAiJourneyReadinessAggregateDto:
5959
+ type: object
5960
+ required: [workspaceId, generatedAt, dimensions, summary]
5961
+ properties:
5962
+ workspaceId:
5963
+ type: string
5964
+ format: uuid
5965
+ generatedAt:
5966
+ type: string
5967
+ format: date-time
5968
+ dimensions:
5969
+ type: array
5970
+ items:
5971
+ $ref: "#/components/schemas/YourAiJourneyReadinessDimensionDto"
5972
+ summary:
5973
+ type: object
5974
+ required: [avgScore, repoCount, fixRate, totalOpenIssues, totalFixedIssues]
5975
+ properties:
5976
+ avgScore:
5977
+ type: number
5978
+ repoCount:
5979
+ type: integer
5980
+ fixRate:
5981
+ type: number
5982
+ totalOpenIssues:
5983
+ type: integer
5984
+ totalFixedIssues:
5985
+ type: integer
5986
+
5987
+ YourAiJourneyAnalyticsDto:
5988
+ type: object
5989
+ required: [workspaceId, generatedAt, windowStart, windowEnd, journey, readiness, prSignals]
5990
+ properties:
5991
+ workspaceId:
5992
+ type: string
5993
+ format: uuid
5994
+ generatedAt:
5995
+ type: string
5996
+ format: date-time
5997
+ windowStart:
5998
+ type: string
5999
+ format: date-time
6000
+ windowEnd:
6001
+ type: string
6002
+ format: date-time
6003
+ journey:
6004
+ type: object
6005
+ required: [completedSteps, updatedAt]
6006
+ properties:
6007
+ completedSteps:
6008
+ type: array
6009
+ items:
6010
+ type: string
6011
+ updatedAt:
6012
+ type: string
6013
+ format: date-time
6014
+ nullable: true
6015
+ readiness:
6016
+ type: object
6017
+ required: [avgScore, repoCount, fixRate, totalOpenIssues, totalFixedIssues]
6018
+ properties:
6019
+ avgScore:
6020
+ type: number
6021
+ repoCount:
6022
+ type: integer
6023
+ fixRate:
6024
+ type: number
6025
+ totalOpenIssues:
6026
+ type: integer
6027
+ totalFixedIssues:
6028
+ type: integer
6029
+ prSignals:
6030
+ type: object
6031
+ required: [avgPrsPerDeveloperPerWeek, prVelocityDeltaPercent, avgFailureRatePercent]
6032
+ properties:
6033
+ avgPrsPerDeveloperPerWeek:
6034
+ type: number
6035
+ prVelocityDeltaPercent:
6036
+ type: number
6037
+ avgFailureRatePercent:
6038
+ type: number
6039
+
6040
+ YourAiJourneyAiSpendWeekDto:
6041
+ type: object
6042
+ required: [bucketStart, bucketEnd, weekLabel, mergedPrCount, tokenCount]
6043
+ properties:
6044
+ bucketStart:
6045
+ type: string
6046
+ format: date-time
6047
+ bucketEnd:
6048
+ type: string
6049
+ format: date-time
6050
+ weekLabel:
6051
+ type: string
6052
+ mergedPrCount:
6053
+ type: integer
6054
+ tokenCount:
6055
+ type: integer
6056
+
6057
+ YourAiJourneyAiSpendDto:
6058
+ type: object
6059
+ required: [workspaceId, generatedAt, windowStart, windowEnd, totalSpendCents, totalTokenCount, activeUsers, aiAssistedPrRatio, prThroughputDeltaPercent, usageDeltaPercent, weeks, providers]
6060
+ properties:
6061
+ workspaceId:
6062
+ type: string
6063
+ format: uuid
6064
+ generatedAt:
6065
+ type: string
6066
+ format: date-time
6067
+ windowStart:
6068
+ type: string
6069
+ format: date-time
6070
+ windowEnd:
6071
+ type: string
6072
+ format: date-time
6073
+ totalSpendCents:
6074
+ type: integer
6075
+ totalTokenCount:
6076
+ type: integer
6077
+ activeUsers:
6078
+ type: integer
6079
+ aiAssistedPrRatio:
6080
+ type: number
6081
+ description: Fraction 0–1 of PRs that are AI-assisted.
6082
+ prThroughputDeltaPercent:
6083
+ type: number
6084
+ usageDeltaPercent:
6085
+ type: number
6086
+ weeks:
6087
+ type: array
6088
+ items:
6089
+ $ref: "#/components/schemas/YourAiJourneyAiSpendWeekDto"
6090
+ providers:
6091
+ type: array
6092
+ items:
6093
+ type: object
6094
+ required: [providerId, providerName, tokenCount, spendCents, activeUsers]
6095
+ properties:
6096
+ providerId:
6097
+ type: string
6098
+ providerName:
6099
+ type: string
6100
+ tokenCount:
6101
+ type: integer
6102
+ spendCents:
6103
+ type: integer
6104
+ activeUsers:
6105
+ type: integer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.5.17",
3
+ "version": "2.6.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",