@thinkai/tai-api-contract 2.175.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.175.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}/...`.
@@ -97,7 +97,7 @@ tags:
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
99
  path), an Insights surface for regressions and token efficiency, and platform
100
- starter packs (`/evals/packs`) that install as editable suites. Distinct
100
+ starter packs (`/evals/packs`) that install as editable suites; compare two succeeded runs and record promote/keep/reject decisions (`/compare`, `/decisions`). Distinct
101
101
  from AI Usage & Spend ingest and Agentic Foundation Token Efficiency (rubric I).
102
102
 
103
103
  paths:
@@ -12287,6 +12287,142 @@ paths:
12287
12287
  schema:
12288
12288
  $ref: "#/components/schemas/ErrorMessageDto"
12289
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
+
12290
12426
  /workspaces/{workspaceId}/evals/suites/{suiteId}/runs:
12291
12427
  get:
12292
12428
  tags: [Evals]
@@ -26234,6 +26370,14 @@ components:
26234
26370
  maxItems: 20
26235
26371
  items:
26236
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.
26237
26381
 
26238
26382
  EvalSuiteListDto:
26239
26383
  type: object
@@ -26653,3 +26797,244 @@ components:
26653
26797
  type: array
26654
26798
  items:
26655
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.175.0",
3
+ "version": "2.176.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",