@thinkai/tai-api-contract 2.1.0 → 2.2.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.
@@ -6,7 +6,6 @@ info:
6
6
  Contract surface for the Performance Intelligence Platform backend used by ThinkAI.
7
7
  Workspace-scoped routes use `/workspaces/{workspaceId}/...`.
8
8
  Legacy tenant-scoped routes (`/tenants/{tenantId}/...`, `/me/tenants`) were removed from runtime.
9
- Admin routes use `/admin/...` and require role `admin`.
10
9
  Legacy HTTP routes that exist on the server but are not listed here (for example
11
10
  `PUT /workspaces/{workspaceId}/dashboard-settings`) remain supported for existing PIP clients;
12
11
  prefer OpenAPI-documented equivalents where available. Removal will be coordinated with ThinkAI releases.
@@ -31,8 +30,6 @@ tags:
31
30
  description: Squad and projects (§6)
32
31
  - name: Notifications
33
32
  description: Notifications (§7)
34
- - name: AdminReviewer
35
- description: Admin review queue (§8)
36
33
  - name: AIStrategy
37
34
  description: AI strategy recommendations (§9)
38
35
  - name: Journey
@@ -365,6 +362,15 @@ paths:
365
362
  application/json:
366
363
  schema:
367
364
  $ref: "#/components/schemas/DashboardProductivityDto"
365
+ "400":
366
+ description: Invalid query parameters
367
+ content:
368
+ application/json:
369
+ schema:
370
+ type: object
371
+ required: [error]
372
+ properties:
373
+ error: { type: string, example: invalid_query }
368
374
  "401":
369
375
  $ref: "#/components/responses/Unauthorized"
370
376
 
@@ -377,10 +383,10 @@ paths:
377
383
  - $ref: "#/components/parameters/WorkspaceId"
378
384
  - name: bucket
379
385
  in: query
380
- schema: { type: string, enum: [day, week, month] }
386
+ schema: { type: string, enum: [day, week, month], default: week }
381
387
  - name: limit
382
388
  in: query
383
- schema: { type: integer, minimum: 1 }
389
+ schema: { type: integer, minimum: 1, maximum: 52, default: 8 }
384
390
  - name: scope
385
391
  in: query
386
392
  schema:
@@ -402,167 +408,17 @@ paths:
402
408
  application/json:
403
409
  schema:
404
410
  $ref: "#/components/schemas/DashboardProductivityHistoryDto"
405
- "401":
406
- $ref: "#/components/responses/Unauthorized"
407
-
408
- /admin/reviews:
409
- get:
410
- tags: [AdminReviewer]
411
- summary: Admin review queue
412
- operationId: listAdminReviews
413
- parameters:
414
- - name: status
415
- in: query
416
- schema: { type: string }
417
- - name: priority
418
- in: query
419
- schema: { type: string }
420
- - name: reviewer
421
- in: query
422
- schema: { type: string }
423
- responses:
424
- "200":
425
- description: Queue and reviewer list
426
- content:
427
- application/json:
428
- schema:
429
- $ref: "#/components/schemas/AdminDashboardDto"
430
- "401":
431
- $ref: "#/components/responses/Unauthorized"
432
- "403":
433
- $ref: "#/components/responses/Forbidden"
434
-
435
- /admin/reviews/{id}:
436
- get:
437
- tags: [AdminReviewer]
438
- summary: Single review submission
439
- operationId: getAdminReview
440
- parameters:
441
- - $ref: "#/components/parameters/ReviewId"
442
- responses:
443
- "200":
444
- description: Review detail
445
- content:
446
- application/json:
447
- schema:
448
- $ref: "#/components/schemas/ReviewSubmissionDto"
449
- "401":
450
- $ref: "#/components/responses/Unauthorized"
451
- "403":
452
- $ref: "#/components/responses/Forbidden"
453
- patch:
454
- tags: [AdminReviewer]
455
- summary: Update review metadata
456
- operationId: patchAdminReview
457
- parameters:
458
- - $ref: "#/components/parameters/ReviewId"
459
- requestBody:
460
- required: true
461
- content:
462
- application/json:
463
- schema:
464
- $ref: "#/components/schemas/PatchAdminReviewBodyDto"
465
- responses:
466
- "200":
467
- description: Updated review
468
- content:
469
- application/json:
470
- schema:
471
- $ref: "#/components/schemas/ReviewSubmissionDto"
472
- "401":
473
- $ref: "#/components/responses/Unauthorized"
474
- "403":
475
- $ref: "#/components/responses/Forbidden"
476
-
477
- /admin/reviews/{id}/sections/{sectionId}/comments:
478
- post:
479
- tags: [AdminReviewer]
480
- summary: Add section comment
481
- operationId: postAdminReviewComment
482
- parameters:
483
- - $ref: "#/components/parameters/ReviewId"
484
- - $ref: "#/components/parameters/SectionId"
485
- requestBody:
486
- required: true
487
- content:
488
- application/json:
489
- schema:
490
- $ref: "#/components/schemas/AdminCommentBodyDto"
491
- responses:
492
- "200":
493
- description: Created comment
411
+ "400":
412
+ description: Invalid query parameters
494
413
  content:
495
414
  application/json:
496
415
  schema:
497
- $ref: "#/components/schemas/CommentDto"
498
- "401":
499
- $ref: "#/components/responses/Unauthorized"
500
- "403":
501
- $ref: "#/components/responses/Forbidden"
502
-
503
- /admin/reviews/{id}/sections/{sectionId}/decision:
504
- put:
505
- tags: [AdminReviewer]
506
- summary: Set section decision
507
- operationId: putAdminReviewSectionDecision
508
- parameters:
509
- - $ref: "#/components/parameters/ReviewId"
510
- - $ref: "#/components/parameters/SectionId"
511
- requestBody:
512
- required: true
513
- content:
514
- application/json:
515
- schema:
516
- $ref: "#/components/schemas/SectionDecisionBodyDto"
517
- responses:
518
- "204":
519
- description: Saved
520
- "401":
521
- $ref: "#/components/responses/Unauthorized"
522
- "403":
523
- $ref: "#/components/responses/Forbidden"
524
-
525
- /admin/reviews/{id}/pricing:
526
- put:
527
- tags: [AdminReviewer]
528
- summary: Update pricing lines
529
- operationId: putAdminReviewPricing
530
- parameters:
531
- - $ref: "#/components/parameters/ReviewId"
532
- requestBody:
533
- required: true
534
- content:
535
- application/json:
536
- schema:
537
- $ref: "#/components/schemas/PricingUpdateBodyDto"
538
- responses:
539
- "204":
540
- description: Saved
541
- "401":
542
- $ref: "#/components/responses/Unauthorized"
543
- "403":
544
- $ref: "#/components/responses/Forbidden"
545
-
546
- /admin/reviews/{id}/deployment:
547
- put:
548
- tags: [AdminReviewer]
549
- summary: Update deployment plan
550
- operationId: putAdminReviewDeployment
551
- parameters:
552
- - $ref: "#/components/parameters/ReviewId"
553
- requestBody:
554
- required: true
555
- content:
556
- application/json:
557
- schema:
558
- $ref: "#/components/schemas/DeploymentPlanDto"
559
- responses:
560
- "204":
561
- description: Saved
416
+ type: object
417
+ required: [error]
418
+ properties:
419
+ error: { type: string, example: invalid_query }
562
420
  "401":
563
421
  $ref: "#/components/responses/Unauthorized"
564
- "403":
565
- $ref: "#/components/responses/Forbidden"
566
422
 
567
423
  /workspaces/{workspaceId}/company-profile:
568
424
  get:
@@ -680,6 +536,143 @@ paths:
680
536
  schema:
681
537
  $ref: "#/components/schemas/ErrorMessageDto"
682
538
 
539
+ /workspaces/{workspaceId}/integrations/github/install-url:
540
+ post:
541
+ tags: [Integrations]
542
+ summary: Create GitHub App installation URL
543
+ operationId: postGithubInstallUrl
544
+ description: >
545
+ Creates a GitHub App installation URL scoped to the workspace and caller.
546
+ Body is optional; when omitted, defaults to `/phase-a/p3` return path.
547
+ security:
548
+ - bearerAuth: []
549
+ parameters:
550
+ - $ref: "#/components/parameters/WorkspaceId"
551
+ requestBody:
552
+ required: false
553
+ content:
554
+ application/json:
555
+ schema:
556
+ $ref: "#/components/schemas/GithubInstallUrlRequestDto"
557
+ responses:
558
+ "200":
559
+ description: Installation URL + signed state
560
+ content:
561
+ application/json:
562
+ schema:
563
+ $ref: "#/components/schemas/GithubInstallUrlResponseDto"
564
+ "400":
565
+ description: Request validation failed
566
+ content:
567
+ application/json:
568
+ schema:
569
+ $ref: "#/components/schemas/ErrorMessageDto"
570
+ "401":
571
+ $ref: "#/components/responses/Unauthorized"
572
+ "403":
573
+ $ref: "#/components/responses/Forbidden"
574
+ "404":
575
+ description: Workspace does not exist or malformed workspaceId
576
+ content:
577
+ application/json:
578
+ schema:
579
+ $ref: "#/components/schemas/ErrorMessageDto"
580
+
581
+ /integrations/github/callback:
582
+ get:
583
+ tags: [Integrations]
584
+ summary: GitHub App installation callback
585
+ operationId: getGithubInstallCallback
586
+ description: >
587
+ Public callback endpoint used by GitHub App installation flow.
588
+ Resolves and consumes install state, persists workspace installation linkage,
589
+ then redirects to configured SPA origin with status markers.
590
+ parameters:
591
+ - name: state
592
+ in: query
593
+ required: true
594
+ schema:
595
+ type: string
596
+ - name: installation_id
597
+ in: query
598
+ required: true
599
+ schema:
600
+ type: string
601
+ - name: setup_action
602
+ in: query
603
+ required: false
604
+ schema:
605
+ type: string
606
+ responses:
607
+ "302":
608
+ description: Redirect to ThinkAI SPA return path with GitHub connection status
609
+ "501":
610
+ description: Workspace store not configured
611
+ content:
612
+ application/json:
613
+ schema:
614
+ $ref: "#/components/schemas/ErrorMessageDto"
615
+ "503":
616
+ description: SPA origin configuration missing
617
+ content:
618
+ application/json:
619
+ schema:
620
+ $ref: "#/components/schemas/ErrorMessageDto"
621
+
622
+ /integrations/github/webhook:
623
+ post:
624
+ tags: [Integrations]
625
+ summary: GitHub App webhook receiver
626
+ operationId: postGithubWebhook
627
+ description: >
628
+ Public webhook endpoint that verifies `X-Hub-Signature-256` and updates or
629
+ removes workspace GitHub integration/cache state for installation events.
630
+ parameters:
631
+ - name: X-Hub-Signature-256
632
+ in: header
633
+ required: true
634
+ schema:
635
+ type: string
636
+ - name: X-GitHub-Event
637
+ in: header
638
+ required: true
639
+ schema:
640
+ type: string
641
+ requestBody:
642
+ required: true
643
+ content:
644
+ application/json:
645
+ schema:
646
+ type: object
647
+ additionalProperties: true
648
+ responses:
649
+ "200":
650
+ description: Webhook accepted
651
+ "400":
652
+ description: Invalid payload
653
+ content:
654
+ application/json:
655
+ schema:
656
+ $ref: "#/components/schemas/ErrorMessageDto"
657
+ "401":
658
+ description: Invalid webhook signature
659
+ content:
660
+ application/json:
661
+ schema:
662
+ $ref: "#/components/schemas/ErrorMessageDto"
663
+ "501":
664
+ description: Workspace store not configured
665
+ content:
666
+ application/json:
667
+ schema:
668
+ $ref: "#/components/schemas/ErrorMessageDto"
669
+ "503":
670
+ description: Missing GitHub webhook secret or GitHub App configuration
671
+ content:
672
+ application/json:
673
+ schema:
674
+ $ref: "#/components/schemas/ErrorMessageDto"
675
+
683
676
  /workspaces/{workspaceId}/ai-readiness:
684
677
  get:
685
678
  tags: [AIReadiness]
@@ -1311,18 +1304,6 @@ components:
1311
1304
  required: true
1312
1305
  schema:
1313
1306
  type: string
1314
- ReviewId:
1315
- name: id
1316
- in: path
1317
- required: true
1318
- schema:
1319
- type: string
1320
- SectionId:
1321
- name: sectionId
1322
- in: path
1323
- required: true
1324
- schema:
1325
- type: string
1326
1307
  NotificationId:
1327
1308
  name: id
1328
1309
  in: path
@@ -1471,6 +1452,11 @@ components:
1471
1452
  properties:
1472
1453
  workspaceId:
1473
1454
  type: string
1455
+ format: uuid
1456
+ generatedAt:
1457
+ type: string
1458
+ format: date-time
1459
+ description: Response generation time (RFC 3339).
1474
1460
  windowStart:
1475
1461
  type: string
1476
1462
  format: date-time
@@ -1488,8 +1474,14 @@ components:
1488
1474
 
1489
1475
  DashboardProductivityHistoryDto:
1490
1476
  type: object
1491
- required: [buckets]
1477
+ required: [workspaceId, bucket, buckets]
1492
1478
  properties:
1479
+ workspaceId:
1480
+ type: string
1481
+ format: uuid
1482
+ bucket:
1483
+ type: string
1484
+ enum: [day, week, month]
1493
1485
  buckets:
1494
1486
  type: array
1495
1487
  items:
@@ -1653,6 +1645,29 @@ components:
1653
1645
  format: date-time
1654
1646
  nullable: true
1655
1647
 
1648
+ GithubInstallUrlRequestDto:
1649
+ type: object
1650
+ additionalProperties: false
1651
+ properties:
1652
+ returnPath:
1653
+ type: string
1654
+ pattern: '^/[A-Za-z0-9/_\-\?\=&]*$'
1655
+ maxLength: 256
1656
+
1657
+ GithubInstallUrlResponseDto:
1658
+ type: object
1659
+ additionalProperties: false
1660
+ required: [url, state]
1661
+ properties:
1662
+ url:
1663
+ type: string
1664
+ format: uri
1665
+ maxLength: 2048
1666
+ state:
1667
+ type: string
1668
+ minLength: 16
1669
+ maxLength: 128
1670
+
1656
1671
  AIReadinessDto:
1657
1672
  type: object
1658
1673
  required:
@@ -2186,200 +2201,6 @@ components:
2186
2201
  total:
2187
2202
  type: integer
2188
2203
 
2189
- ReviewQueueItemDto:
2190
- type: object
2191
- required: [id, client, project, workflows, submittedAt, reviewer, status, priority]
2192
- properties:
2193
- id:
2194
- type: string
2195
- client:
2196
- type: string
2197
- project:
2198
- type: string
2199
- workflows:
2200
- type: array
2201
- items:
2202
- type: string
2203
- enum: [greenfield, brownfield]
2204
- submittedAt:
2205
- type: string
2206
- format: date-time
2207
- reviewer:
2208
- type: string
2209
- nullable: true
2210
- status:
2211
- type: string
2212
- enum: [pending, in_review, approved, changes_requested]
2213
- priority:
2214
- type: string
2215
- enum: [high, medium, low]
2216
-
2217
- AdminDashboardDto:
2218
- type: object
2219
- required: [queue, reviewers]
2220
- properties:
2221
- queue:
2222
- type: array
2223
- items:
2224
- $ref: "#/components/schemas/ReviewQueueItemDto"
2225
- reviewers:
2226
- type: array
2227
- items:
2228
- type: string
2229
-
2230
- PatchAdminReviewBodyDto:
2231
- type: object
2232
- properties:
2233
- status:
2234
- type: string
2235
- enum: [pending, in_review, approved, changes_requested]
2236
- reviewer:
2237
- type: string
2238
- priority:
2239
- type: string
2240
- enum: [high, medium, low]
2241
-
2242
- CommentDto:
2243
- type: object
2244
- required: [id, sectionId, author, text, timestamp]
2245
- properties:
2246
- id:
2247
- type: string
2248
- sectionId:
2249
- type: string
2250
- author:
2251
- type: string
2252
- text:
2253
- type: string
2254
- timestamp:
2255
- type: string
2256
- format: date-time
2257
-
2258
- AdminCommentBodyDto:
2259
- type: object
2260
- required: [text]
2261
- properties:
2262
- text:
2263
- type: string
2264
-
2265
- SectionDecisionBodyDto:
2266
- type: object
2267
- required: [decision]
2268
- properties:
2269
- decision:
2270
- type: string
2271
- enum: [pending, approved, changes_requested, rejected]
2272
-
2273
- PricingLineDto:
2274
- type: object
2275
- required: [id, label, rate, hours]
2276
- properties:
2277
- id:
2278
- type: string
2279
- label:
2280
- type: string
2281
- rate:
2282
- type: number
2283
- hours:
2284
- type: number
2285
-
2286
- PricingUpdateBodyDto:
2287
- type: object
2288
- required: [items]
2289
- properties:
2290
- items:
2291
- type: array
2292
- items:
2293
- type: object
2294
- required: [id, rate, hours]
2295
- properties:
2296
- id:
2297
- type: string
2298
- rate:
2299
- type: number
2300
- hours:
2301
- type: number
2302
-
2303
- DeploymentPlanDto:
2304
- type: object
2305
- required: [startDate, endDate, milestones]
2306
- properties:
2307
- startDate:
2308
- type: string
2309
- endDate:
2310
- type: string
2311
- milestones:
2312
- type: array
2313
- items:
2314
- type: string
2315
-
2316
- ReviewSectionDto:
2317
- type: object
2318
- required: [id, label, detail, decision, comments]
2319
- properties:
2320
- id:
2321
- type: string
2322
- label:
2323
- type: string
2324
- detail:
2325
- type: string
2326
- decision:
2327
- type: string
2328
- enum: [pending, approved, changes_requested, rejected]
2329
- comments:
2330
- type: array
2331
- items:
2332
- $ref: "#/components/schemas/CommentDto"
2333
-
2334
- ReviewSubmissionDto:
2335
- type: object
2336
- required:
2337
- - id
2338
- - client
2339
- - project
2340
- - workflows
2341
- - status
2342
- - isResubmission
2343
- - context
2344
- - sections
2345
- - pricing
2346
- - deployment
2347
- properties:
2348
- id:
2349
- type: string
2350
- client:
2351
- type: string
2352
- project:
2353
- type: string
2354
- workflows:
2355
- type: array
2356
- items:
2357
- type: string
2358
- enum: [greenfield, brownfield]
2359
- status:
2360
- type: string
2361
- enum: [pending, in_review, approved, changes_requested]
2362
- isResubmission:
2363
- type: boolean
2364
- context:
2365
- type: array
2366
- items:
2367
- type: object
2368
- required: [text]
2369
- properties:
2370
- text:
2371
- type: string
2372
- sections:
2373
- type: array
2374
- items:
2375
- $ref: "#/components/schemas/ReviewSectionDto"
2376
- pricing:
2377
- type: array
2378
- items:
2379
- $ref: "#/components/schemas/PricingLineDto"
2380
- deployment:
2381
- $ref: "#/components/schemas/DeploymentPlanDto"
2382
-
2383
2204
  EffectiveTaskRowDto:
2384
2205
  type: object
2385
2206
  required: [id, name, summary, source]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.1.0",
3
+ "version": "2.2.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",