@thinkai/tai-api-contract 2.180.0 → 2.182.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.180.0
4
+ version: 2.182.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}/...`.
@@ -419,6 +419,235 @@ paths:
419
419
  error: Forbidden
420
420
  code: forbidden
421
421
 
422
+ /admin/workspaces/{workspaceId}/assessment-preflight:
423
+ post:
424
+ tags: [PlatformAdmin]
425
+ summary: Evaluate assessment preflight from server-loaded evidence
426
+ operationId: runLiveAssessmentPreflight
427
+ description: >
428
+ Loads repository scope, readiness scan age, and window coverage for one
429
+ workspace. Client fields for scope, scans, windows, and engineer counts
430
+ are ignored, so an unscanned source cannot be marked fresh. The
431
+ five-business-day clock uses Monday–Friday in America/New_York and is
432
+ stored on the first passing result. A later blocker does not clear it.
433
+ Active-engineer counts stay unloaded until stored activity can be counted.
434
+
435
+ **Authorization:** Bearer JWT required. Caller email must appear in `PLATFORM_ADMIN_EMAILS`.
436
+ parameters:
437
+ - $ref: "#/components/parameters/WorkspaceId"
438
+ requestBody:
439
+ required: true
440
+ content:
441
+ application/json:
442
+ schema:
443
+ type: object
444
+ required:
445
+ - offerId
446
+ - sourceControl
447
+ - platformExecutionReady
448
+ - premiumAi
449
+ - jiraSelected
450
+ - incidentSelected
451
+ - incidentAvailable
452
+ properties:
453
+ offerId:
454
+ type: string
455
+ enum: [engineering_readiness_baseline, agentic_ai_roi]
456
+ sourceControl:
457
+ type: string
458
+ enum: [connected, pending_approval, setup_in_progress, revoked, stale, missing]
459
+ platformExecutionReady:
460
+ type: boolean
461
+ premiumAi:
462
+ type: object
463
+ required: [cursor, claude, copilot]
464
+ properties:
465
+ cursor:
466
+ type: boolean
467
+ claude:
468
+ type: boolean
469
+ copilot:
470
+ type: boolean
471
+ jiraSelected:
472
+ type: boolean
473
+ incidentSelected:
474
+ type: boolean
475
+ incidentAvailable:
476
+ type: boolean
477
+ owner:
478
+ type: string
479
+ nullable: true
480
+ responses:
481
+ "200":
482
+ description: >
483
+ Preflight result. `dueDate` is set once the clock has started and stays
484
+ set if a later check is blocked.
485
+ content:
486
+ application/json:
487
+ schema:
488
+ type: object
489
+ required:
490
+ [ready, clockStarted, dueDate, owner, blocker, nextAction, failures, chapters]
491
+ properties:
492
+ ready:
493
+ type: boolean
494
+ clockStarted:
495
+ type: boolean
496
+ dueDate:
497
+ type: string
498
+ nullable: true
499
+ format: date
500
+ owner:
501
+ type: string
502
+ nullable: true
503
+ blocker:
504
+ type: string
505
+ nullable: true
506
+ nextAction:
507
+ type: object
508
+ nullable: true
509
+ required: [label, href]
510
+ properties:
511
+ label:
512
+ type: string
513
+ href:
514
+ type: string
515
+ nullable: true
516
+ failures:
517
+ type: array
518
+ items:
519
+ type: object
520
+ required: [code, blocker, nextAction]
521
+ properties:
522
+ code:
523
+ type: string
524
+ blocker:
525
+ type: string
526
+ nextAction:
527
+ type: object
528
+ required: [label, href]
529
+ properties:
530
+ label:
531
+ type: string
532
+ href:
533
+ type: string
534
+ nullable: true
535
+ chapters:
536
+ type: array
537
+ items:
538
+ type: object
539
+ required: [id, status, reason]
540
+ properties:
541
+ id:
542
+ type: string
543
+ enum: [jira, incidents]
544
+ status:
545
+ type: string
546
+ enum: [unavailable]
547
+ reason:
548
+ type: string
549
+ "400":
550
+ description: Body or workspace id failed validation.
551
+ content:
552
+ application/json:
553
+ schema:
554
+ $ref: "#/components/schemas/ErrorMessageDto"
555
+ example:
556
+ error: offerId is not a known assessment offer
557
+ code: invalid_body
558
+ "401":
559
+ description: Missing or invalid JWT.
560
+ content:
561
+ application/json:
562
+ schema:
563
+ $ref: "#/components/schemas/ErrorMessageDto"
564
+ "403":
565
+ description: Caller is not a platform admin.
566
+ content:
567
+ application/json:
568
+ schema:
569
+ $ref: "#/components/schemas/ErrorMessageDto"
570
+ example:
571
+ error: Forbidden
572
+ code: forbidden
573
+ "503":
574
+ description: Evidence store is unavailable.
575
+ content:
576
+ application/json:
577
+ schema:
578
+ $ref: "#/components/schemas/ErrorMessageDto"
579
+
580
+ /admin/assessment-queue:
581
+ get:
582
+ tags: [PlatformAdmin]
583
+ summary: List operator assessment records
584
+ operationId: listAssessmentQueue
585
+ description: >
586
+ Returns the stored assessment record for each workspace an operator has
587
+ evaluated. The next blocker is on this list. A second workspace is not
588
+ required.
589
+
590
+ **Authorization:** Bearer JWT required. Caller email must appear in `PLATFORM_ADMIN_EMAILS`.
591
+ responses:
592
+ "200":
593
+ description: Operator queue.
594
+ content:
595
+ application/json:
596
+ schema:
597
+ type: object
598
+ required: [records]
599
+ properties:
600
+ records:
601
+ type: array
602
+ items:
603
+ type: object
604
+ required:
605
+ [workspaceId, offerId, ready, blocker, nextAction, dueDate, evaluatedAt]
606
+ properties:
607
+ workspaceId:
608
+ type: string
609
+ format: uuid
610
+ offerId:
611
+ type: string
612
+ enum: [engineering_readiness_baseline, agentic_ai_roi]
613
+ ready:
614
+ type: boolean
615
+ blocker:
616
+ type: string
617
+ nullable: true
618
+ nextAction:
619
+ type: object
620
+ nullable: true
621
+ required: [label, href]
622
+ properties:
623
+ label:
624
+ type: string
625
+ href:
626
+ type: string
627
+ nullable: true
628
+ dueDate:
629
+ type: string
630
+ nullable: true
631
+ format: date
632
+ evaluatedAt:
633
+ type: string
634
+ format: date-time
635
+ "401":
636
+ description: Missing or invalid JWT.
637
+ content:
638
+ application/json:
639
+ schema:
640
+ $ref: "#/components/schemas/ErrorMessageDto"
641
+ "403":
642
+ description: Caller is not a platform admin.
643
+ content:
644
+ application/json:
645
+ schema:
646
+ $ref: "#/components/schemas/ErrorMessageDto"
647
+ example:
648
+ error: Forbidden
649
+ code: forbidden
650
+
422
651
  /admin/assessment-manifest-validation:
423
652
  post:
424
653
  tags: [PlatformAdmin]
@@ -8925,7 +9154,10 @@ paths:
8925
9154
  description: >
8926
9155
  Any workspace member when chat is ready. Validates size/type against the active
8927
9156
  provider profile (`attachmentLimits` from readiness). Returns metadata; pass `id`
8928
- as `attachmentIds` on the next POST message. Max 5 MB per file.
9157
+ as `attachmentIds` on the next POST message. Max 5 MB per file (JSON bodyLimit is
9158
+ raised for `contentBase64`). When unbound uploads already sit at the per-message
9159
+ file cap (e.g. after an aborted send), the oldest unbound rows are pruned so a new
9160
+ attach can proceed.
8929
9161
  operationId: postCodeChatAttachment
8930
9162
  x-test-coverage-skip: thin HTTP over validateAttachment + store insert
8931
9163
  parameters:
@@ -8944,7 +9176,11 @@ paths:
8944
9176
  schema:
8945
9177
  $ref: "#/components/schemas/CodeChatAttachmentMetaDto"
8946
9178
  "400":
8947
- description: Validation failed (size, type, totals)
9179
+ description: >
9180
+ Validation failed after decode (size, type, totals). Stable codes include
9181
+ `attachment_too_large`, `attachment_total_too_large`, `attachment_too_many`,
9182
+ `attachment_type_unsupported`, `attachment_pdf_too_long`, `attachment_failed`,
9183
+ `invalid_input`.
8948
9184
  content:
8949
9185
  application/json:
8950
9186
  schema:
@@ -8963,6 +9199,19 @@ paths:
8963
9199
  application/json:
8964
9200
  schema:
8965
9201
  $ref: "#/components/schemas/ErrorMessageDto"
9202
+ "413":
9203
+ description: >
9204
+ Fastify rejected the JSON body before the handler (`request_body_too_large`).
9205
+ Typical when `contentBase64` exceeds the route bodyLimit (aligned with the
9206
+ 5 MB per-file cap after base64 expansion). Decoded-size overruns still return
9207
+ `400` `attachment_too_large`.
9208
+ content:
9209
+ application/json:
9210
+ schema:
9211
+ $ref: "#/components/schemas/ErrorMessageDto"
9212
+ example:
9213
+ error: Request body is too large.
9214
+ code: request_body_too_large
8966
9215
  "422":
8967
9216
  description: Could not process the file
8968
9217
  content:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.180.0",
3
+ "version": "2.182.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "devDependencies": {
22
22
  "@stoplight/spectral-cli": "^6.17.0",
23
23
  "@types/node": "^26.6.5",
24
- "jsonpath-plus": "^11.1.1",
24
+ "jsonpath-plus": "^11.2.1",
25
25
  "openapi-typescript": "^7.13.0",
26
26
  "typescript": "~6.0.3"
27
27
  },
@@ -67,6 +67,48 @@ export interface paths {
67
67
  patch?: never;
68
68
  trace?: never;
69
69
  };
70
+ "/admin/workspaces/{workspaceId}/assessment-preflight": {
71
+ parameters: {
72
+ query?: never;
73
+ header?: never;
74
+ path?: never;
75
+ cookie?: never;
76
+ };
77
+ get?: never;
78
+ put?: never;
79
+ /**
80
+ * Evaluate assessment preflight from server-loaded evidence
81
+ * @description Loads repository scope, readiness scan age, and window coverage for one workspace. Client fields for scope, scans, windows, and engineer counts are ignored, so an unscanned source cannot be marked fresh. The five-business-day clock uses Monday–Friday in America/New_York and is stored on the first passing result. A later blocker does not clear it. Active-engineer counts stay unloaded until stored activity can be counted.
82
+ * **Authorization:** Bearer JWT required. Caller email must appear in `PLATFORM_ADMIN_EMAILS`.
83
+ */
84
+ post: operations["runLiveAssessmentPreflight"];
85
+ delete?: never;
86
+ options?: never;
87
+ head?: never;
88
+ patch?: never;
89
+ trace?: never;
90
+ };
91
+ "/admin/assessment-queue": {
92
+ parameters: {
93
+ query?: never;
94
+ header?: never;
95
+ path?: never;
96
+ cookie?: never;
97
+ };
98
+ /**
99
+ * List operator assessment records
100
+ * @description Returns the stored assessment record for each workspace an operator has evaluated. The next blocker is on this list. A second workspace is not required.
101
+ * **Authorization:** Bearer JWT required. Caller email must appear in `PLATFORM_ADMIN_EMAILS`.
102
+ */
103
+ get: operations["listAssessmentQueue"];
104
+ put?: never;
105
+ post?: never;
106
+ delete?: never;
107
+ options?: never;
108
+ head?: never;
109
+ patch?: never;
110
+ trace?: never;
111
+ };
70
112
  "/admin/assessment-manifest-validation": {
71
113
  parameters: {
72
114
  query?: never;
@@ -3301,7 +3343,7 @@ export interface paths {
3301
3343
  put?: never;
3302
3344
  /**
3303
3345
  * Upload a Conversations attachment
3304
- * @description Any workspace member when chat is ready. Validates size/type against the active provider profile (`attachmentLimits` from readiness). Returns metadata; pass `id` as `attachmentIds` on the next POST message. Max 5 MB per file.
3346
+ * @description Any workspace member when chat is ready. Validates size/type against the active provider profile (`attachmentLimits` from readiness). Returns metadata; pass `id` as `attachmentIds` on the next POST message. Max 5 MB per file (JSON bodyLimit is raised for `contentBase64`). When unbound uploads already sit at the per-message file cap (e.g. after an aborted send), the oldest unbound rows are pruned so a new attach can proceed.
3305
3347
  */
3306
3348
  post: operations["postCodeChatAttachment"];
3307
3349
  delete?: never;
@@ -12735,6 +12777,182 @@ export interface operations {
12735
12777
  };
12736
12778
  };
12737
12779
  };
12780
+ runLiveAssessmentPreflight: {
12781
+ parameters: {
12782
+ query?: never;
12783
+ header?: never;
12784
+ path: {
12785
+ workspaceId: components["parameters"]["WorkspaceId"];
12786
+ };
12787
+ cookie?: never;
12788
+ };
12789
+ requestBody: {
12790
+ content: {
12791
+ "application/json": {
12792
+ /** @enum {string} */
12793
+ offerId: "engineering_readiness_baseline" | "agentic_ai_roi";
12794
+ /** @enum {string} */
12795
+ sourceControl: "connected" | "pending_approval" | "setup_in_progress" | "revoked" | "stale" | "missing";
12796
+ platformExecutionReady: boolean;
12797
+ premiumAi: {
12798
+ cursor: boolean;
12799
+ claude: boolean;
12800
+ copilot: boolean;
12801
+ };
12802
+ jiraSelected: boolean;
12803
+ incidentSelected: boolean;
12804
+ incidentAvailable: boolean;
12805
+ owner?: string | null;
12806
+ };
12807
+ };
12808
+ };
12809
+ responses: {
12810
+ /** @description Preflight result. `dueDate` is set once the clock has started and stays set if a later check is blocked. */
12811
+ 200: {
12812
+ headers: {
12813
+ [name: string]: unknown;
12814
+ };
12815
+ content: {
12816
+ "application/json": {
12817
+ ready: boolean;
12818
+ clockStarted: boolean;
12819
+ /** Format: date */
12820
+ dueDate: string | null;
12821
+ owner: string | null;
12822
+ blocker: string | null;
12823
+ nextAction: {
12824
+ label: string;
12825
+ href: string | null;
12826
+ } | null;
12827
+ failures: {
12828
+ code: string;
12829
+ blocker: string;
12830
+ nextAction: {
12831
+ label: string;
12832
+ href: string | null;
12833
+ };
12834
+ }[];
12835
+ chapters: {
12836
+ /** @enum {string} */
12837
+ id: "jira" | "incidents";
12838
+ /** @enum {string} */
12839
+ status: "unavailable";
12840
+ reason: string;
12841
+ }[];
12842
+ };
12843
+ };
12844
+ };
12845
+ /** @description Body or workspace id failed validation. */
12846
+ 400: {
12847
+ headers: {
12848
+ [name: string]: unknown;
12849
+ };
12850
+ content: {
12851
+ /**
12852
+ * @example {
12853
+ * "error": "offerId is not a known assessment offer",
12854
+ * "code": "invalid_body"
12855
+ * }
12856
+ */
12857
+ "application/json": components["schemas"]["ErrorMessageDto"];
12858
+ };
12859
+ };
12860
+ /** @description Missing or invalid JWT. */
12861
+ 401: {
12862
+ headers: {
12863
+ [name: string]: unknown;
12864
+ };
12865
+ content: {
12866
+ "application/json": components["schemas"]["ErrorMessageDto"];
12867
+ };
12868
+ };
12869
+ /** @description Caller is not a platform admin. */
12870
+ 403: {
12871
+ headers: {
12872
+ [name: string]: unknown;
12873
+ };
12874
+ content: {
12875
+ /**
12876
+ * @example {
12877
+ * "error": "Forbidden",
12878
+ * "code": "forbidden"
12879
+ * }
12880
+ */
12881
+ "application/json": components["schemas"]["ErrorMessageDto"];
12882
+ };
12883
+ };
12884
+ /** @description Evidence store is unavailable. */
12885
+ 503: {
12886
+ headers: {
12887
+ [name: string]: unknown;
12888
+ };
12889
+ content: {
12890
+ "application/json": components["schemas"]["ErrorMessageDto"];
12891
+ };
12892
+ };
12893
+ };
12894
+ };
12895
+ listAssessmentQueue: {
12896
+ parameters: {
12897
+ query?: never;
12898
+ header?: never;
12899
+ path?: never;
12900
+ cookie?: never;
12901
+ };
12902
+ requestBody?: never;
12903
+ responses: {
12904
+ /** @description Operator queue. */
12905
+ 200: {
12906
+ headers: {
12907
+ [name: string]: unknown;
12908
+ };
12909
+ content: {
12910
+ "application/json": {
12911
+ records: {
12912
+ /** Format: uuid */
12913
+ workspaceId: string;
12914
+ /** @enum {string} */
12915
+ offerId: "engineering_readiness_baseline" | "agentic_ai_roi";
12916
+ ready: boolean;
12917
+ blocker: string | null;
12918
+ nextAction: {
12919
+ label: string;
12920
+ href: string | null;
12921
+ } | null;
12922
+ /** Format: date */
12923
+ dueDate: string | null;
12924
+ /** Format: date-time */
12925
+ evaluatedAt: string;
12926
+ }[];
12927
+ };
12928
+ };
12929
+ };
12930
+ /** @description Missing or invalid JWT. */
12931
+ 401: {
12932
+ headers: {
12933
+ [name: string]: unknown;
12934
+ };
12935
+ content: {
12936
+ "application/json": components["schemas"]["ErrorMessageDto"];
12937
+ };
12938
+ };
12939
+ /** @description Caller is not a platform admin. */
12940
+ 403: {
12941
+ headers: {
12942
+ [name: string]: unknown;
12943
+ };
12944
+ content: {
12945
+ /**
12946
+ * @example {
12947
+ * "error": "Forbidden",
12948
+ * "code": "forbidden"
12949
+ * }
12950
+ */
12951
+ "application/json": components["schemas"]["ErrorMessageDto"];
12952
+ };
12953
+ };
12954
+ };
12955
+ };
12738
12956
  runAssessmentManifestValidation: {
12739
12957
  parameters: {
12740
12958
  query?: never;
@@ -21362,7 +21580,7 @@ export interface operations {
21362
21580
  "application/json": components["schemas"]["CodeChatAttachmentMetaDto"];
21363
21581
  };
21364
21582
  };
21365
- /** @description Validation failed (size, type, totals) */
21583
+ /** @description Validation failed after decode (size, type, totals). Stable codes include `attachment_too_large`, `attachment_total_too_large`, `attachment_too_many`, `attachment_type_unsupported`, `attachment_pdf_too_long`, `attachment_failed`, `invalid_input`. */
21366
21584
  400: {
21367
21585
  headers: {
21368
21586
  [name: string]: unknown;
@@ -21390,6 +21608,21 @@ export interface operations {
21390
21608
  "application/json": components["schemas"]["ErrorMessageDto"];
21391
21609
  };
21392
21610
  };
21611
+ /** @description Fastify rejected the JSON body before the handler (`request_body_too_large`). Typical when `contentBase64` exceeds the route bodyLimit (aligned with the 5 MB per-file cap after base64 expansion). Decoded-size overruns still return `400` `attachment_too_large`. */
21612
+ 413: {
21613
+ headers: {
21614
+ [name: string]: unknown;
21615
+ };
21616
+ content: {
21617
+ /**
21618
+ * @example {
21619
+ * "error": "Request body is too large.",
21620
+ * "code": "request_body_too_large"
21621
+ * }
21622
+ */
21623
+ "application/json": components["schemas"]["ErrorMessageDto"];
21624
+ };
21625
+ };
21393
21626
  /** @description Could not process the file */
21394
21627
  422: {
21395
21628
  headers: {