@thinkai/tai-api-contract 2.175.0 → 2.177.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.177.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:
@@ -481,18 +481,75 @@ paths:
481
481
  enum: ["NOT VALIDATED", "SAMPLE · SYNTHETIC DATA"]
482
482
  scope:
483
483
  type: object
484
+ required: [repositories, excluded]
485
+ properties:
486
+ repositories:
487
+ type: array
488
+ items:
489
+ type: object
490
+ required: [id, name]
491
+ properties:
492
+ id: { type: string }
493
+ name: { type: string }
494
+ excluded:
495
+ type: array
496
+ items:
497
+ type: object
498
+ required: [id, name, reason]
499
+ properties:
500
+ id: { type: string }
501
+ name: { type: string }
502
+ reason: { type: string }
484
503
  windows:
485
504
  type: object
505
+ required: [pre, post, transitionDays]
506
+ properties:
507
+ pre:
508
+ type: object
509
+ nullable: true
510
+ required: [start, end]
511
+ properties:
512
+ start: { type: string }
513
+ end: { type: string }
514
+ post:
515
+ type: object
516
+ nullable: true
517
+ required: [start, end]
518
+ properties:
519
+ start: { type: string }
520
+ end: { type: string }
521
+ transitionDays:
522
+ type: integer
486
523
  sources:
487
524
  type: array
488
525
  items:
489
526
  type: object
527
+ required: [provider, status, freshAt]
528
+ properties:
529
+ provider: { type: string }
530
+ status: { type: string }
531
+ freshAt: { type: string, nullable: true }
490
532
  consent:
491
533
  type: object
534
+ required: [aggregateUse, recordedAt]
535
+ properties:
536
+ aggregateUse:
537
+ type: string
538
+ enum: [opt_in, opt_out, unset]
539
+ recordedAt:
540
+ type: string
541
+ nullable: true
492
542
  sections:
493
543
  type: array
494
544
  items:
495
545
  type: object
546
+ required: [id, status]
547
+ properties:
548
+ id: { type: string }
549
+ status:
550
+ type: string
551
+ enum: [ok, failed, omitted]
552
+ reason: { type: string }
496
553
  workspaceId:
497
554
  type: string
498
555
  expectedWorkspaceId:
@@ -12287,6 +12344,142 @@ paths:
12287
12344
  schema:
12288
12345
  $ref: "#/components/schemas/ErrorMessageDto"
12289
12346
 
12347
+ /workspaces/{workspaceId}/evals/suites/{suiteId}/compare:
12348
+ get:
12349
+ tags: [Evals]
12350
+ summary: Compare two succeeded eval runs on a suite
12351
+ description: >
12352
+ Side-by-side compare of a baseline run vs a candidate run on the same suite.
12353
+ Both runs must be `succeeded`. Aligns cases by `caseId` and reports suite- and
12354
+ case-level score/token/cost deltas when present. Requires workspace membership.
12355
+ Does not trigger scoring.
12356
+ operationId: compareEvalRuns
12357
+ parameters:
12358
+ - $ref: "#/components/parameters/WorkspaceId"
12359
+ - $ref: "#/components/parameters/EvalSuiteId"
12360
+ - name: baselineRunId
12361
+ in: query
12362
+ required: true
12363
+ schema:
12364
+ type: string
12365
+ format: uuid
12366
+ - name: candidateRunId
12367
+ in: query
12368
+ required: true
12369
+ schema:
12370
+ type: string
12371
+ format: uuid
12372
+ responses:
12373
+ "200":
12374
+ description: Compare result
12375
+ content:
12376
+ application/json:
12377
+ schema:
12378
+ $ref: "#/components/schemas/EvalCompareDto"
12379
+ "400":
12380
+ description: >
12381
+ Runs not comparable (e.g. not succeeded, same id, or invalid query).
12382
+ Codes: `eval_compare_runs_required`, `eval_compare_runs_not_succeeded`,
12383
+ `eval_compare_same_run`.
12384
+ content:
12385
+ application/json:
12386
+ schema:
12387
+ $ref: "#/components/schemas/ErrorMessageDto"
12388
+ "401":
12389
+ $ref: "#/components/responses/Unauthorized"
12390
+ "403":
12391
+ $ref: "#/components/responses/Forbidden"
12392
+ "404":
12393
+ description: Workspace, suite, or run not found
12394
+ content:
12395
+ application/json:
12396
+ schema:
12397
+ $ref: "#/components/schemas/ErrorMessageDto"
12398
+
12399
+ /workspaces/{workspaceId}/evals/suites/{suiteId}/decisions:
12400
+ get:
12401
+ tags: [Evals]
12402
+ summary: List eval promote/keep/reject decisions for a suite
12403
+ description: >
12404
+ Returns the last 50 decisions for the suite (newest first). Empty →
12405
+ `{ "decisions": [] }`. Requires workspace membership.
12406
+ operationId: listEvalDecisions
12407
+ parameters:
12408
+ - $ref: "#/components/parameters/WorkspaceId"
12409
+ - $ref: "#/components/parameters/EvalSuiteId"
12410
+ responses:
12411
+ "200":
12412
+ description: Decision history
12413
+ content:
12414
+ application/json:
12415
+ schema:
12416
+ $ref: "#/components/schemas/EvalDecisionListDto"
12417
+ example:
12418
+ decisions: []
12419
+ "401":
12420
+ $ref: "#/components/responses/Unauthorized"
12421
+ "403":
12422
+ $ref: "#/components/responses/Forbidden"
12423
+ "404":
12424
+ description: Workspace or suite not found
12425
+ content:
12426
+ application/json:
12427
+ schema:
12428
+ $ref: "#/components/schemas/ErrorMessageDto"
12429
+ post:
12430
+ tags: [Evals]
12431
+ summary: Record a promote, keep, or reject decision
12432
+ description: >
12433
+ Persists an audit decision for a baseline vs candidate run pair. Requires
12434
+ workspace editor or admin. Both runs must be `succeeded` on this suite.
12435
+ `promote` also applies the candidate run's `suiteSnapshot.target` to the
12436
+ live suite (version may bump). Promotion gate attach is deferred
12437
+ (`gateApplied: false`, `gateDetail.reason: deferred`) until
12438
+ thinkai-platform-workspace#492.
12439
+ operationId: createEvalDecision
12440
+ parameters:
12441
+ - $ref: "#/components/parameters/WorkspaceId"
12442
+ - $ref: "#/components/parameters/EvalSuiteId"
12443
+ requestBody:
12444
+ required: true
12445
+ content:
12446
+ application/json:
12447
+ schema:
12448
+ $ref: "#/components/schemas/CreateEvalDecisionBodyDto"
12449
+ responses:
12450
+ "201":
12451
+ description: Decision recorded
12452
+ content:
12453
+ application/json:
12454
+ schema:
12455
+ $ref: "#/components/schemas/EvalDecisionDto"
12456
+ "400":
12457
+ description: >
12458
+ Validation failed. Codes: `eval_decision_invalid`,
12459
+ `eval_compare_runs_not_succeeded`, `eval_compare_same_run`,
12460
+ `eval_promote_snapshot_missing`.
12461
+ content:
12462
+ application/json:
12463
+ schema:
12464
+ $ref: "#/components/schemas/ErrorMessageDto"
12465
+ "401":
12466
+ $ref: "#/components/responses/Unauthorized"
12467
+ "403":
12468
+ description: Authenticated but not a workspace editor/admin
12469
+ content:
12470
+ application/json:
12471
+ schema:
12472
+ $ref: "#/components/schemas/ErrorMessageDto"
12473
+ example:
12474
+ error: Workspace editor role required
12475
+ code: workspace_editor_required
12476
+ "404":
12477
+ description: Workspace, suite, or run not found
12478
+ content:
12479
+ application/json:
12480
+ schema:
12481
+ $ref: "#/components/schemas/ErrorMessageDto"
12482
+
12290
12483
  /workspaces/{workspaceId}/evals/suites/{suiteId}/runs:
12291
12484
  get:
12292
12485
  tags: [Evals]
@@ -21918,6 +22111,7 @@ components:
21918
22111
  - repairDays
21919
22112
  - secureLinkDays
21920
22113
  - accessDaysAfterDelivery
22114
+ - deliveryBusinessDays
21921
22115
  - maxRepositories
21922
22116
  - maxActiveEngineers
21923
22117
  - dataCoverageRefreshCapDays
@@ -21930,11 +22124,12 @@ components:
21930
22124
  - aiProviders
21931
22125
  - optionalProviders
21932
22126
  - selfManagedGit
22127
+ - rules
21933
22128
  - unresolved
21934
22129
  properties:
21935
22130
  version:
21936
22131
  type: string
21937
- enum: ["2026-10-18.1"]
22132
+ enum: ["2026-10-20.1"]
21938
22133
  periodDays:
21939
22134
  type: integer
21940
22135
  enum: [90]
@@ -21950,6 +22145,9 @@ components:
21950
22145
  accessDaysAfterDelivery:
21951
22146
  type: integer
21952
22147
  enum: [30]
22148
+ deliveryBusinessDays:
22149
+ type: integer
22150
+ enum: [5]
21953
22151
  maxRepositories:
21954
22152
  type: integer
21955
22153
  enum: [50]
@@ -22039,6 +22237,55 @@ components:
22039
22237
  items:
22040
22238
  type: string
22041
22239
  enum: [gitlab_self_managed, bitbucket_data_center]
22240
+ rules:
22241
+ type: object
22242
+ additionalProperties: false
22243
+ required:
22244
+ - windowCoverageRatio
22245
+ - repositoryMergedPullRequestsInBothWindows
22246
+ - freshness
22247
+ - tolerances
22248
+ - outputUnit
22249
+ - rolloutTimezone
22250
+ - rolloutBoundary
22251
+ - costAssessableCurrency
22252
+ properties:
22253
+ windowCoverageRatio:
22254
+ type: number
22255
+ enum: [1]
22256
+ repositoryMergedPullRequestsInBothWindows:
22257
+ type: integer
22258
+ enum: [1]
22259
+ freshness:
22260
+ type: object
22261
+ additionalProperties: false
22262
+ required: [gitHours, jiraHours, incidentHours, aiUsageDays, readinessScanDays]
22263
+ properties:
22264
+ gitHours: { type: integer, enum: [24] }
22265
+ jiraHours: { type: integer, enum: [24] }
22266
+ incidentHours: { type: integer, enum: [24] }
22267
+ aiUsageDays: { type: integer, enum: [7] }
22268
+ readinessScanDays: { type: integer, enum: [30] }
22269
+ tolerances:
22270
+ type: object
22271
+ additionalProperties: false
22272
+ required: [moneyUsd, ratioPercentagePoints, durationSeconds]
22273
+ properties:
22274
+ moneyUsd: { type: number, enum: [0.01] }
22275
+ ratioPercentagePoints: { type: number, enum: [0.01] }
22276
+ durationSeconds: { type: integer, enum: [1] }
22277
+ outputUnit:
22278
+ type: string
22279
+ enum: [normalized_ship_weight]
22280
+ rolloutTimezone:
22281
+ type: string
22282
+ enum: [America/New_York]
22283
+ rolloutBoundary:
22284
+ type: string
22285
+ enum: [midnight]
22286
+ costAssessableCurrency:
22287
+ type: string
22288
+ enum: [USD]
22042
22289
  unresolved:
22043
22290
  type: object
22044
22291
  additionalProperties: false
@@ -22058,17 +22305,66 @@ components:
22058
22305
  premiumPrice:
22059
22306
  $ref: "#/components/schemas/UnsetAssessmentDecisionDto"
22060
22307
  currency:
22061
- $ref: "#/components/schemas/UnsetAssessmentDecisionDto"
22308
+ type: object
22309
+ additionalProperties: false
22310
+ required: [status, code]
22311
+ properties:
22312
+ status: { type: string, enum: [set] }
22313
+ code: { type: string, enum: [USD] }
22062
22314
  creditWindowDays:
22063
- $ref: "#/components/schemas/UnsetAssessmentDecisionDto"
22315
+ type: object
22316
+ additionalProperties: false
22317
+ required: [status, days, eligibleSubscription]
22318
+ properties:
22319
+ status: { type: string, enum: [set] }
22320
+ days: { type: integer, enum: [90] }
22321
+ eligibleSubscription: { type: string, enum: [annual] }
22064
22322
  jiraLinkageMinimum:
22065
- $ref: "#/components/schemas/UnsetAssessmentDecisionDto"
22323
+ type: object
22324
+ additionalProperties: false
22325
+ required: [status, ratio]
22326
+ properties:
22327
+ status: { type: string, enum: [set] }
22328
+ ratio: { type: number, enum: [0.8] }
22066
22329
  confounderRules:
22067
- $ref: "#/components/schemas/UnsetAssessmentDecisionDto"
22330
+ type: object
22331
+ additionalProperties: false
22332
+ required: [status, headcountChangeRatio, repositoryScopeChangeRatio, namedEvents]
22333
+ properties:
22334
+ status: { type: string, enum: [set] }
22335
+ headcountChangeRatio: { type: number, enum: [0.1] }
22336
+ repositoryScopeChangeRatio: { type: number, enum: [0.1] }
22337
+ namedEvents:
22338
+ type: array
22339
+ items:
22340
+ type: string
22341
+ enum: [major_release, migration, acquisition, policy_change]
22068
22342
  activeEngineerRule:
22069
- $ref: "#/components/schemas/UnsetAssessmentDecisionDto"
22343
+ type: object
22344
+ additionalProperties: false
22345
+ required: [status, activity, window, exclude]
22346
+ properties:
22347
+ status: { type: string, enum: [set] }
22348
+ activity: { type: string, enum: [authored_commit_or_merged_pr] }
22349
+ window: { type: string, enum: [measured_period] }
22350
+ exclude:
22351
+ type: array
22352
+ items:
22353
+ type: string
22354
+ enum: [bot, service_account, unmapped, read_only]
22070
22355
  workingDayCalendar:
22071
- $ref: "#/components/schemas/UnsetAssessmentDecisionDto"
22356
+ type: object
22357
+ additionalProperties: false
22358
+ required: [status, timezone, weekdays, holidays]
22359
+ properties:
22360
+ status: { type: string, enum: [set] }
22361
+ timezone: { type: string, enum: [America/New_York] }
22362
+ weekdays:
22363
+ type: array
22364
+ items:
22365
+ type: string
22366
+ enum: [monday, tuesday, wednesday, thursday, friday]
22367
+ holidays: { type: string, enum: [none] }
22072
22368
  countryAllowList:
22073
22369
  $ref: "#/components/schemas/UnsetAssessmentDecisionDto"
22074
22370
 
@@ -26234,6 +26530,14 @@ components:
26234
26530
  maxItems: 20
26235
26531
  items:
26236
26532
  $ref: "#/components/schemas/EvalCaseDto"
26533
+ latestDecision:
26534
+ type: object
26535
+ nullable: true
26536
+ allOf:
26537
+ - $ref: "#/components/schemas/EvalDecisionDto"
26538
+ description: >
26539
+ Most recent promote/keep/reject decision for this suite, when any exist.
26540
+ Omitted or null when none recorded.
26237
26541
 
26238
26542
  EvalSuiteListDto:
26239
26543
  type: object
@@ -26653,3 +26957,244 @@ components:
26653
26957
  type: array
26654
26958
  items:
26655
26959
  $ref: "#/components/schemas/EvalPackSummaryDto"
26960
+
26961
+ EvalCompareRunSummaryDto:
26962
+ type: object
26963
+ additionalProperties: false
26964
+ required: [id, suiteVersion, score, finishedAt, target, passCount, failCount, errorCount]
26965
+ properties:
26966
+ id:
26967
+ type: string
26968
+ format: uuid
26969
+ suiteVersion:
26970
+ type: integer
26971
+ minimum: 1
26972
+ score:
26973
+ type: number
26974
+ nullable: true
26975
+ minimum: 0
26976
+ maximum: 1
26977
+ finishedAt:
26978
+ type: string
26979
+ format: date-time
26980
+ nullable: true
26981
+ target:
26982
+ $ref: "#/components/schemas/EvalSuiteTargetDto"
26983
+ passCount:
26984
+ type: integer
26985
+ minimum: 0
26986
+ failCount:
26987
+ type: integer
26988
+ minimum: 0
26989
+ errorCount:
26990
+ type: integer
26991
+ minimum: 0
26992
+
26993
+ EvalCompareCaseDto:
26994
+ type: object
26995
+ additionalProperties: false
26996
+ required:
26997
+ - caseId
26998
+ - name
26999
+ - baselineStatus
27000
+ - candidateStatus
27001
+ - baselinePass
27002
+ - candidatePass
27003
+ - baselineFailedSignalIds
27004
+ - candidateFailedSignalIds
27005
+ properties:
27006
+ caseId:
27007
+ type: string
27008
+ name:
27009
+ type: string
27010
+ baselineStatus:
27011
+ type: string
27012
+ nullable: true
27013
+ allOf:
27014
+ - $ref: "#/components/schemas/EvalCaseResultStatusDto"
27015
+ candidateStatus:
27016
+ type: string
27017
+ nullable: true
27018
+ allOf:
27019
+ - $ref: "#/components/schemas/EvalCaseResultStatusDto"
27020
+ baselinePass:
27021
+ type: boolean
27022
+ nullable: true
27023
+ candidatePass:
27024
+ type: boolean
27025
+ nullable: true
27026
+ baselineFailedSignalIds:
27027
+ type: array
27028
+ items:
27029
+ type: string
27030
+ candidateFailedSignalIds:
27031
+ type: array
27032
+ items:
27033
+ type: string
27034
+ baselineInputTokens:
27035
+ type: integer
27036
+ nullable: true
27037
+ minimum: 0
27038
+ candidateInputTokens:
27039
+ type: integer
27040
+ nullable: true
27041
+ minimum: 0
27042
+ baselineOutputTokens:
27043
+ type: integer
27044
+ nullable: true
27045
+ minimum: 0
27046
+ candidateOutputTokens:
27047
+ type: integer
27048
+ nullable: true
27049
+ minimum: 0
27050
+ baselineCostCents:
27051
+ type: number
27052
+ nullable: true
27053
+ minimum: 0
27054
+ candidateCostCents:
27055
+ type: number
27056
+ nullable: true
27057
+ minimum: 0
27058
+ scoreDelta:
27059
+ type: number
27060
+ nullable: true
27061
+ description: Candidate pass (1/0) minus baseline pass when both scored.
27062
+ inputTokensDelta:
27063
+ type: integer
27064
+ nullable: true
27065
+ outputTokensDelta:
27066
+ type: integer
27067
+ nullable: true
27068
+ costCentsDelta:
27069
+ type: number
27070
+ nullable: true
27071
+
27072
+ EvalCompareDto:
27073
+ type: object
27074
+ additionalProperties: false
27075
+ required:
27076
+ - suiteId
27077
+ - baseline
27078
+ - candidate
27079
+ - scoreDelta
27080
+ - cases
27081
+ - unpairedCaseIds
27082
+ properties:
27083
+ suiteId:
27084
+ type: string
27085
+ format: uuid
27086
+ baseline:
27087
+ $ref: "#/components/schemas/EvalCompareRunSummaryDto"
27088
+ candidate:
27089
+ $ref: "#/components/schemas/EvalCompareRunSummaryDto"
27090
+ scoreDelta:
27091
+ type: number
27092
+ nullable: true
27093
+ description: candidate.score − baseline.score when both present.
27094
+ avgInputTokensDelta:
27095
+ type: number
27096
+ nullable: true
27097
+ avgOutputTokensDelta:
27098
+ type: number
27099
+ nullable: true
27100
+ avgCostCentsDelta:
27101
+ type: number
27102
+ nullable: true
27103
+ cases:
27104
+ type: array
27105
+ items:
27106
+ $ref: "#/components/schemas/EvalCompareCaseDto"
27107
+ unpairedCaseIds:
27108
+ type: array
27109
+ items:
27110
+ type: string
27111
+ description: Case ids present on only one run's results/snapshot.
27112
+
27113
+ EvalDecisionKindDto:
27114
+ type: string
27115
+ enum: [promote, keep, reject]
27116
+
27117
+ EvalGateDetailDto:
27118
+ type: object
27119
+ additionalProperties: false
27120
+ required: [reason]
27121
+ properties:
27122
+ reason:
27123
+ type: string
27124
+ description: >
27125
+ Machine-readable gate outcome. `deferred` until promotion-gate attach
27126
+ (thinkai-platform-workspace#492) ships.
27127
+
27128
+ EvalDecisionDto:
27129
+ type: object
27130
+ additionalProperties: false
27131
+ required:
27132
+ - id
27133
+ - suiteId
27134
+ - decision
27135
+ - baselineRunId
27136
+ - candidateRunId
27137
+ - decidedByUserId
27138
+ - decidedAt
27139
+ - gateApplied
27140
+ properties:
27141
+ id:
27142
+ type: string
27143
+ format: uuid
27144
+ suiteId:
27145
+ type: string
27146
+ format: uuid
27147
+ decision:
27148
+ $ref: "#/components/schemas/EvalDecisionKindDto"
27149
+ baselineRunId:
27150
+ type: string
27151
+ format: uuid
27152
+ candidateRunId:
27153
+ type: string
27154
+ format: uuid
27155
+ decidedByUserId:
27156
+ type: string
27157
+ format: uuid
27158
+ decidedAt:
27159
+ type: string
27160
+ format: date-time
27161
+ note:
27162
+ type: string
27163
+ maxLength: 2000
27164
+ nullable: true
27165
+ gateApplied:
27166
+ type: boolean
27167
+ description: True when a promotion gate attach point enforced this decision.
27168
+ gateDetail:
27169
+ type: object
27170
+ nullable: true
27171
+ allOf:
27172
+ - $ref: "#/components/schemas/EvalGateDetailDto"
27173
+
27174
+ EvalDecisionListDto:
27175
+ type: object
27176
+ additionalProperties: false
27177
+ required: [decisions]
27178
+ properties:
27179
+ decisions:
27180
+ type: array
27181
+ maxItems: 50
27182
+ items:
27183
+ $ref: "#/components/schemas/EvalDecisionDto"
27184
+
27185
+ CreateEvalDecisionBodyDto:
27186
+ type: object
27187
+ additionalProperties: false
27188
+ required: [decision, baselineRunId, candidateRunId]
27189
+ properties:
27190
+ decision:
27191
+ $ref: "#/components/schemas/EvalDecisionKindDto"
27192
+ baselineRunId:
27193
+ type: string
27194
+ format: uuid
27195
+ candidateRunId:
27196
+ type: string
27197
+ format: uuid
27198
+ note:
27199
+ type: string
27200
+ 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.177.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",