@thinkai/tai-api-contract 2.174.0 → 2.176.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.173.0
4
+ version: 2.176.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}/...`.
@@ -96,7 +96,8 @@ tags:
96
96
  description: >
97
97
  Workspace prompt/model eval suites (`/evals/*`) — authored golden cases with
98
98
  deterministic expected-signal scoring, async runs (never scored on the request
99
- path), and an Insights surface for regressions and token efficiency. Distinct
99
+ path), an Insights surface for regressions and token efficiency, and platform
100
+ starter packs (`/evals/packs`) that install as editable suites; compare two succeeded runs and record promote/keep/reject decisions (`/compare`, `/decisions`). Distinct
100
101
  from AI Usage & Spend ingest and Agentic Foundation Token Efficiency (rubric I).
101
102
 
102
103
  paths:
@@ -11998,6 +11999,95 @@ paths:
11998
11999
  "403":
11999
12000
  $ref: "#/components/responses/Forbidden"
12000
12001
 
12002
+ /workspaces/{workspaceId}/evals/packs:
12003
+ get:
12004
+ tags: [Evals]
12005
+ summary: List platform eval starter packs
12006
+ description: >
12007
+ Returns the platform starter-pack catalog for Prompt & model evals.
12008
+ Packs are ThinkAI-authored templates (not workspace-owned and not a
12009
+ public marketplace). Requires workspace membership. Empty catalog is
12010
+ not expected in production builds; clients should still handle
12011
+ `{ "packs": [] }`.
12012
+ operationId: listEvalPacks
12013
+ parameters:
12014
+ - $ref: "#/components/parameters/WorkspaceId"
12015
+ responses:
12016
+ "200":
12017
+ description: Starter pack catalog
12018
+ content:
12019
+ application/json:
12020
+ schema:
12021
+ $ref: "#/components/schemas/EvalPackListDto"
12022
+ example:
12023
+ packs:
12024
+ - id: pr-review
12025
+ name: PR review comments
12026
+ description: Check review tone and clear blocking feedback
12027
+ workflow: pr-review
12028
+ caseCount: 3
12029
+ "401":
12030
+ $ref: "#/components/responses/Unauthorized"
12031
+ "403":
12032
+ $ref: "#/components/responses/Forbidden"
12033
+ "404":
12034
+ description: Workspace not found
12035
+ content:
12036
+ application/json:
12037
+ schema:
12038
+ $ref: "#/components/schemas/ErrorMessageDto"
12039
+
12040
+ /workspaces/{workspaceId}/evals/packs/{packId}/install:
12041
+ post:
12042
+ tags: [Evals]
12043
+ summary: Install an eval starter pack as a suite
12044
+ description: >
12045
+ Creates a new editable eval suite from a platform starter pack
12046
+ (`version: 1`). Sets `target.promptKey` to `pack:<packId>` for
12047
+ traceability. Requires workspace editor or admin. Pack cases include
12048
+ fixture completions so the first run can succeed without AI connectors.
12049
+ Does not score on the request path.
12050
+ operationId: installEvalPack
12051
+ parameters:
12052
+ - $ref: "#/components/parameters/WorkspaceId"
12053
+ - $ref: "#/components/parameters/EvalPackId"
12054
+ responses:
12055
+ "201":
12056
+ description: Suite created from pack
12057
+ content:
12058
+ application/json:
12059
+ schema:
12060
+ $ref: "#/components/schemas/EvalSuiteDto"
12061
+ "401":
12062
+ $ref: "#/components/responses/Unauthorized"
12063
+ "403":
12064
+ description: Viewer cannot install packs
12065
+ content:
12066
+ application/json:
12067
+ schema:
12068
+ $ref: "#/components/schemas/ErrorMessageDto"
12069
+ example:
12070
+ error: Workspace editor role required
12071
+ code: workspace_editor_required
12072
+ "404":
12073
+ description: Unknown pack id or workspace not found
12074
+ content:
12075
+ application/json:
12076
+ schema:
12077
+ $ref: "#/components/schemas/ErrorMessageDto"
12078
+ example:
12079
+ error: Eval starter pack not found
12080
+ code: eval_pack_not_found
12081
+ "409":
12082
+ description: Workspace already has the maximum number of suites (50)
12083
+ content:
12084
+ application/json:
12085
+ schema:
12086
+ $ref: "#/components/schemas/ErrorMessageDto"
12087
+ example:
12088
+ error: Maximum of 50 eval suites per workspace
12089
+ code: eval_suite_limit_reached
12090
+
12001
12091
  /workspaces/{workspaceId}/evals/suites:
12002
12092
  get:
12003
12093
  tags: [Evals]
@@ -12197,6 +12287,142 @@ paths:
12197
12287
  schema:
12198
12288
  $ref: "#/components/schemas/ErrorMessageDto"
12199
12289
 
12290
+ /workspaces/{workspaceId}/evals/suites/{suiteId}/compare:
12291
+ get:
12292
+ tags: [Evals]
12293
+ summary: Compare two succeeded eval runs on a suite
12294
+ description: >
12295
+ Side-by-side compare of a baseline run vs a candidate run on the same suite.
12296
+ Both runs must be `succeeded`. Aligns cases by `caseId` and reports suite- and
12297
+ case-level score/token/cost deltas when present. Requires workspace membership.
12298
+ Does not trigger scoring.
12299
+ operationId: compareEvalRuns
12300
+ parameters:
12301
+ - $ref: "#/components/parameters/WorkspaceId"
12302
+ - $ref: "#/components/parameters/EvalSuiteId"
12303
+ - name: baselineRunId
12304
+ in: query
12305
+ required: true
12306
+ schema:
12307
+ type: string
12308
+ format: uuid
12309
+ - name: candidateRunId
12310
+ in: query
12311
+ required: true
12312
+ schema:
12313
+ type: string
12314
+ format: uuid
12315
+ responses:
12316
+ "200":
12317
+ description: Compare result
12318
+ content:
12319
+ application/json:
12320
+ schema:
12321
+ $ref: "#/components/schemas/EvalCompareDto"
12322
+ "400":
12323
+ description: >
12324
+ Runs not comparable (e.g. not succeeded, same id, or invalid query).
12325
+ Codes: `eval_compare_runs_required`, `eval_compare_runs_not_succeeded`,
12326
+ `eval_compare_same_run`.
12327
+ content:
12328
+ application/json:
12329
+ schema:
12330
+ $ref: "#/components/schemas/ErrorMessageDto"
12331
+ "401":
12332
+ $ref: "#/components/responses/Unauthorized"
12333
+ "403":
12334
+ $ref: "#/components/responses/Forbidden"
12335
+ "404":
12336
+ description: Workspace, suite, or run not found
12337
+ content:
12338
+ application/json:
12339
+ schema:
12340
+ $ref: "#/components/schemas/ErrorMessageDto"
12341
+
12342
+ /workspaces/{workspaceId}/evals/suites/{suiteId}/decisions:
12343
+ get:
12344
+ tags: [Evals]
12345
+ summary: List eval promote/keep/reject decisions for a suite
12346
+ description: >
12347
+ Returns the last 50 decisions for the suite (newest first). Empty →
12348
+ `{ "decisions": [] }`. Requires workspace membership.
12349
+ operationId: listEvalDecisions
12350
+ parameters:
12351
+ - $ref: "#/components/parameters/WorkspaceId"
12352
+ - $ref: "#/components/parameters/EvalSuiteId"
12353
+ responses:
12354
+ "200":
12355
+ description: Decision history
12356
+ content:
12357
+ application/json:
12358
+ schema:
12359
+ $ref: "#/components/schemas/EvalDecisionListDto"
12360
+ example:
12361
+ decisions: []
12362
+ "401":
12363
+ $ref: "#/components/responses/Unauthorized"
12364
+ "403":
12365
+ $ref: "#/components/responses/Forbidden"
12366
+ "404":
12367
+ description: Workspace or suite not found
12368
+ content:
12369
+ application/json:
12370
+ schema:
12371
+ $ref: "#/components/schemas/ErrorMessageDto"
12372
+ post:
12373
+ tags: [Evals]
12374
+ summary: Record a promote, keep, or reject decision
12375
+ description: >
12376
+ Persists an audit decision for a baseline vs candidate run pair. Requires
12377
+ workspace editor or admin. Both runs must be `succeeded` on this suite.
12378
+ `promote` also applies the candidate run's `suiteSnapshot.target` to the
12379
+ live suite (version may bump). Promotion gate attach is deferred
12380
+ (`gateApplied: false`, `gateDetail.reason: deferred`) until
12381
+ thinkai-platform-workspace#492.
12382
+ operationId: createEvalDecision
12383
+ parameters:
12384
+ - $ref: "#/components/parameters/WorkspaceId"
12385
+ - $ref: "#/components/parameters/EvalSuiteId"
12386
+ requestBody:
12387
+ required: true
12388
+ content:
12389
+ application/json:
12390
+ schema:
12391
+ $ref: "#/components/schemas/CreateEvalDecisionBodyDto"
12392
+ responses:
12393
+ "201":
12394
+ description: Decision recorded
12395
+ content:
12396
+ application/json:
12397
+ schema:
12398
+ $ref: "#/components/schemas/EvalDecisionDto"
12399
+ "400":
12400
+ description: >
12401
+ Validation failed. Codes: `eval_decision_invalid`,
12402
+ `eval_compare_runs_not_succeeded`, `eval_compare_same_run`,
12403
+ `eval_promote_snapshot_missing`.
12404
+ content:
12405
+ application/json:
12406
+ schema:
12407
+ $ref: "#/components/schemas/ErrorMessageDto"
12408
+ "401":
12409
+ $ref: "#/components/responses/Unauthorized"
12410
+ "403":
12411
+ description: Authenticated but not a workspace editor/admin
12412
+ content:
12413
+ application/json:
12414
+ schema:
12415
+ $ref: "#/components/schemas/ErrorMessageDto"
12416
+ example:
12417
+ error: Workspace editor role required
12418
+ code: workspace_editor_required
12419
+ "404":
12420
+ description: Workspace, suite, or run not found
12421
+ content:
12422
+ application/json:
12423
+ schema:
12424
+ $ref: "#/components/schemas/ErrorMessageDto"
12425
+
12200
12426
  /workspaces/{workspaceId}/evals/suites/{suiteId}/runs:
12201
12427
  get:
12202
12428
  tags: [Evals]
@@ -12365,6 +12591,17 @@ components:
12365
12591
  type: string
12366
12592
  format: uuid
12367
12593
  description: Eval suite id (`tai_workspace_eval_suites.id`).
12594
+ EvalPackId:
12595
+ name: packId
12596
+ in: path
12597
+ required: true
12598
+ schema:
12599
+ type: string
12600
+ minLength: 1
12601
+ maxLength: 64
12602
+ pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$"
12603
+ description: >
12604
+ Platform starter pack id (kebab-case), e.g. `pr-review`. Not a UUID.
12368
12605
  EvalRunId:
12369
12606
  name: runId
12370
12607
  in: path
@@ -26133,6 +26370,14 @@ components:
26133
26370
  maxItems: 20
26134
26371
  items:
26135
26372
  $ref: "#/components/schemas/EvalCaseDto"
26373
+ latestDecision:
26374
+ type: object
26375
+ nullable: true
26376
+ allOf:
26377
+ - $ref: "#/components/schemas/EvalDecisionDto"
26378
+ description: >
26379
+ Most recent promote/keep/reject decision for this suite, when any exist.
26380
+ Omitted or null when none recorded.
26136
26381
 
26137
26382
  EvalSuiteListDto:
26138
26383
  type: object
@@ -26510,3 +26755,286 @@ components:
26510
26755
  type: array
26511
26756
  items:
26512
26757
  $ref: "#/components/schemas/EvalModelComparisonDto"
26758
+
26759
+ EvalPackSummaryDto:
26760
+ type: object
26761
+ additionalProperties: false
26762
+ required: [id, name, description, workflow, caseCount]
26763
+ description: >
26764
+ Platform starter pack summary for the hub catalog. Install materializes a
26765
+ full `EvalSuiteDto`; pack payloads are not returned on list.
26766
+ properties:
26767
+ id:
26768
+ type: string
26769
+ minLength: 1
26770
+ maxLength: 64
26771
+ pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$"
26772
+ description: Stable pack id (kebab-case).
26773
+ name:
26774
+ type: string
26775
+ minLength: 1
26776
+ maxLength: 120
26777
+ description:
26778
+ type: string
26779
+ maxLength: 2000
26780
+ workflow:
26781
+ type: string
26782
+ minLength: 1
26783
+ maxLength: 64
26784
+ description: Workflow bucket for UI grouping (e.g. `pr-review`).
26785
+ caseCount:
26786
+ type: integer
26787
+ minimum: 1
26788
+ maximum: 20
26789
+ description: Number of golden cases that will be created on install.
26790
+
26791
+ EvalPackListDto:
26792
+ type: object
26793
+ additionalProperties: false
26794
+ required: [packs]
26795
+ properties:
26796
+ packs:
26797
+ type: array
26798
+ items:
26799
+ $ref: "#/components/schemas/EvalPackSummaryDto"
26800
+
26801
+ EvalCompareRunSummaryDto:
26802
+ type: object
26803
+ additionalProperties: false
26804
+ required: [id, suiteVersion, score, finishedAt, target, passCount, failCount, errorCount]
26805
+ properties:
26806
+ id:
26807
+ type: string
26808
+ format: uuid
26809
+ suiteVersion:
26810
+ type: integer
26811
+ minimum: 1
26812
+ score:
26813
+ type: number
26814
+ nullable: true
26815
+ minimum: 0
26816
+ maximum: 1
26817
+ finishedAt:
26818
+ type: string
26819
+ format: date-time
26820
+ nullable: true
26821
+ target:
26822
+ $ref: "#/components/schemas/EvalSuiteTargetDto"
26823
+ passCount:
26824
+ type: integer
26825
+ minimum: 0
26826
+ failCount:
26827
+ type: integer
26828
+ minimum: 0
26829
+ errorCount:
26830
+ type: integer
26831
+ minimum: 0
26832
+
26833
+ EvalCompareCaseDto:
26834
+ type: object
26835
+ additionalProperties: false
26836
+ required:
26837
+ - caseId
26838
+ - name
26839
+ - baselineStatus
26840
+ - candidateStatus
26841
+ - baselinePass
26842
+ - candidatePass
26843
+ - baselineFailedSignalIds
26844
+ - candidateFailedSignalIds
26845
+ properties:
26846
+ caseId:
26847
+ type: string
26848
+ name:
26849
+ type: string
26850
+ baselineStatus:
26851
+ type: string
26852
+ nullable: true
26853
+ allOf:
26854
+ - $ref: "#/components/schemas/EvalCaseResultStatusDto"
26855
+ candidateStatus:
26856
+ type: string
26857
+ nullable: true
26858
+ allOf:
26859
+ - $ref: "#/components/schemas/EvalCaseResultStatusDto"
26860
+ baselinePass:
26861
+ type: boolean
26862
+ nullable: true
26863
+ candidatePass:
26864
+ type: boolean
26865
+ nullable: true
26866
+ baselineFailedSignalIds:
26867
+ type: array
26868
+ items:
26869
+ type: string
26870
+ candidateFailedSignalIds:
26871
+ type: array
26872
+ items:
26873
+ type: string
26874
+ baselineInputTokens:
26875
+ type: integer
26876
+ nullable: true
26877
+ minimum: 0
26878
+ candidateInputTokens:
26879
+ type: integer
26880
+ nullable: true
26881
+ minimum: 0
26882
+ baselineOutputTokens:
26883
+ type: integer
26884
+ nullable: true
26885
+ minimum: 0
26886
+ candidateOutputTokens:
26887
+ type: integer
26888
+ nullable: true
26889
+ minimum: 0
26890
+ baselineCostCents:
26891
+ type: number
26892
+ nullable: true
26893
+ minimum: 0
26894
+ candidateCostCents:
26895
+ type: number
26896
+ nullable: true
26897
+ minimum: 0
26898
+ scoreDelta:
26899
+ type: number
26900
+ nullable: true
26901
+ description: Candidate pass (1/0) minus baseline pass when both scored.
26902
+ inputTokensDelta:
26903
+ type: integer
26904
+ nullable: true
26905
+ outputTokensDelta:
26906
+ type: integer
26907
+ nullable: true
26908
+ costCentsDelta:
26909
+ type: number
26910
+ nullable: true
26911
+
26912
+ EvalCompareDto:
26913
+ type: object
26914
+ additionalProperties: false
26915
+ required:
26916
+ - suiteId
26917
+ - baseline
26918
+ - candidate
26919
+ - scoreDelta
26920
+ - cases
26921
+ - unpairedCaseIds
26922
+ properties:
26923
+ suiteId:
26924
+ type: string
26925
+ format: uuid
26926
+ baseline:
26927
+ $ref: "#/components/schemas/EvalCompareRunSummaryDto"
26928
+ candidate:
26929
+ $ref: "#/components/schemas/EvalCompareRunSummaryDto"
26930
+ scoreDelta:
26931
+ type: number
26932
+ nullable: true
26933
+ description: candidate.score − baseline.score when both present.
26934
+ avgInputTokensDelta:
26935
+ type: number
26936
+ nullable: true
26937
+ avgOutputTokensDelta:
26938
+ type: number
26939
+ nullable: true
26940
+ avgCostCentsDelta:
26941
+ type: number
26942
+ nullable: true
26943
+ cases:
26944
+ type: array
26945
+ items:
26946
+ $ref: "#/components/schemas/EvalCompareCaseDto"
26947
+ unpairedCaseIds:
26948
+ type: array
26949
+ items:
26950
+ type: string
26951
+ description: Case ids present on only one run's results/snapshot.
26952
+
26953
+ EvalDecisionKindDto:
26954
+ type: string
26955
+ enum: [promote, keep, reject]
26956
+
26957
+ EvalGateDetailDto:
26958
+ type: object
26959
+ additionalProperties: false
26960
+ required: [reason]
26961
+ properties:
26962
+ reason:
26963
+ type: string
26964
+ description: >
26965
+ Machine-readable gate outcome. `deferred` until promotion-gate attach
26966
+ (thinkai-platform-workspace#492) ships.
26967
+
26968
+ EvalDecisionDto:
26969
+ type: object
26970
+ additionalProperties: false
26971
+ required:
26972
+ - id
26973
+ - suiteId
26974
+ - decision
26975
+ - baselineRunId
26976
+ - candidateRunId
26977
+ - decidedByUserId
26978
+ - decidedAt
26979
+ - gateApplied
26980
+ properties:
26981
+ id:
26982
+ type: string
26983
+ format: uuid
26984
+ suiteId:
26985
+ type: string
26986
+ format: uuid
26987
+ decision:
26988
+ $ref: "#/components/schemas/EvalDecisionKindDto"
26989
+ baselineRunId:
26990
+ type: string
26991
+ format: uuid
26992
+ candidateRunId:
26993
+ type: string
26994
+ format: uuid
26995
+ decidedByUserId:
26996
+ type: string
26997
+ format: uuid
26998
+ decidedAt:
26999
+ type: string
27000
+ format: date-time
27001
+ note:
27002
+ type: string
27003
+ maxLength: 2000
27004
+ nullable: true
27005
+ gateApplied:
27006
+ type: boolean
27007
+ description: True when a promotion gate attach point enforced this decision.
27008
+ gateDetail:
27009
+ type: object
27010
+ nullable: true
27011
+ allOf:
27012
+ - $ref: "#/components/schemas/EvalGateDetailDto"
27013
+
27014
+ EvalDecisionListDto:
27015
+ type: object
27016
+ additionalProperties: false
27017
+ required: [decisions]
27018
+ properties:
27019
+ decisions:
27020
+ type: array
27021
+ maxItems: 50
27022
+ items:
27023
+ $ref: "#/components/schemas/EvalDecisionDto"
27024
+
27025
+ CreateEvalDecisionBodyDto:
27026
+ type: object
27027
+ additionalProperties: false
27028
+ required: [decision, baselineRunId, candidateRunId]
27029
+ properties:
27030
+ decision:
27031
+ $ref: "#/components/schemas/EvalDecisionKindDto"
27032
+ baselineRunId:
27033
+ type: string
27034
+ format: uuid
27035
+ candidateRunId:
27036
+ type: string
27037
+ format: uuid
27038
+ note:
27039
+ type: string
27040
+ maxLength: 2000
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.174.0",
3
+ "version": "2.176.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",