@thinkai/tai-api-contract 2.186.0 → 2.188.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.186.0
4
+ version: 2.188.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}/...`.
@@ -9326,6 +9326,143 @@ paths:
9326
9326
  schema:
9327
9327
  $ref: "#/components/schemas/GithubPermissionsCheckFailedErrorDto"
9328
9328
 
9329
+ /workspaces/{workspaceId}/rules-skills/validate:
9330
+ post:
9331
+ tags: [AgenticFoundation]
9332
+ summary: Validate agent rules and skills for a repository
9333
+ description: >
9334
+ Clones the connected GitHub repository via the workspace GitHub App installation
9335
+ and runs the shared Rules & Skills validate engine (structural + soft quality).
9336
+ Assessed tools come from the latest **succeeded** readiness scan
9337
+ (`agent_tool_assessed`: `cursor` | `claude-code` | `both`). Returns draft
9338
+ `proposedFiles` for review (not committed). Workspace member auth; write
9339
+ permissions are not required for validate-only.
9340
+ operationId: postRulesSkillsValidate
9341
+ parameters:
9342
+ - $ref: "#/components/parameters/WorkspaceId"
9343
+ requestBody:
9344
+ required: true
9345
+ content:
9346
+ application/json:
9347
+ schema:
9348
+ $ref: "#/components/schemas/RulesSkillsValidateRequestDto"
9349
+ examples:
9350
+ validate:
9351
+ value:
9352
+ repoId: "11111111-1111-4111-8111-111111111111"
9353
+ pathPrefixes:
9354
+ - ".cursor"
9355
+ responses:
9356
+ "200":
9357
+ description: Validation result with findings and draft proposed files
9358
+ content:
9359
+ application/json:
9360
+ schema:
9361
+ $ref: "#/components/schemas/RulesSkillsValidateResponseDto"
9362
+ "400":
9363
+ description: Invalid body (e.g. malformed repoId)
9364
+ content:
9365
+ application/json:
9366
+ schema:
9367
+ $ref: "#/components/schemas/ErrorMessageDto"
9368
+ "401":
9369
+ $ref: "#/components/responses/Unauthorized"
9370
+ "403":
9371
+ $ref: "#/components/responses/Forbidden"
9372
+ "404":
9373
+ description: Workspace or repository not found / not connected
9374
+ content:
9375
+ application/json:
9376
+ schema:
9377
+ $ref: "#/components/schemas/ErrorMessageDto"
9378
+ "422":
9379
+ description: >
9380
+ No succeeded readiness scan for the repo (`code: readiness_scan_required`),
9381
+ or repository is not a GitHub-connected readiness repo.
9382
+ content:
9383
+ application/json:
9384
+ schema:
9385
+ $ref: "#/components/schemas/ErrorMessageDto"
9386
+ examples:
9387
+ readiness_scan_required:
9388
+ value:
9389
+ error: Run an Agentic Foundation readiness scan before validating rules and skills
9390
+ code: readiness_scan_required
9391
+ "503":
9392
+ description: Clone or GitHub App configuration failed
9393
+ content:
9394
+ application/json:
9395
+ schema:
9396
+ $ref: "#/components/schemas/ErrorMessageDto"
9397
+
9398
+ /workspaces/{workspaceId}/rules-skills/pull-requests:
9399
+ post:
9400
+ tags: [AgenticFoundation]
9401
+ summary: Open a Rules & Skills remediation pull request
9402
+ description: >
9403
+ Applies `proposedFiles` (or a future create-mode session) onto a non-default
9404
+ branch via the Automations GitHub App installation and opens a pull request.
9405
+ Never pushes to the default branch. PR title/body identify the change as
9406
+ platform-generated and link back to `/agentic-foundation/rules-skills`.
9407
+ Requires workspace editor or admin. Same write-permission gate as readiness fixes.
9408
+ operationId: postRulesSkillsPullRequest
9409
+ parameters:
9410
+ - $ref: "#/components/parameters/WorkspaceId"
9411
+ requestBody:
9412
+ required: true
9413
+ content:
9414
+ application/json:
9415
+ schema:
9416
+ $ref: "#/components/schemas/RulesSkillsOpenPullRequestRequestDto"
9417
+ examples:
9418
+ validateMode:
9419
+ value:
9420
+ repoId: "11111111-1111-4111-8111-111111111111"
9421
+ mode: validate
9422
+ proposedFiles:
9423
+ - path: ".cursor/rules/foo.mdc"
9424
+ action: rename
9425
+ previousPath: ".cursor/rules/foo.md"
9426
+ content: "---\ndescription: example\nglobs: \"**/*\"\n---\n"
9427
+ responses:
9428
+ "200":
9429
+ description: Pull request created
9430
+ content:
9431
+ application/json:
9432
+ schema:
9433
+ $ref: "#/components/schemas/RulesSkillsOpenPullRequestResponseDto"
9434
+ "400":
9435
+ description: >
9436
+ Missing proposed files or invalid body (`code: proposed_files_required`).
9437
+ content:
9438
+ application/json:
9439
+ schema:
9440
+ $ref: "#/components/schemas/ErrorMessageDto"
9441
+ "401":
9442
+ $ref: "#/components/responses/Unauthorized"
9443
+ "403":
9444
+ $ref: "#/components/responses/Forbidden"
9445
+ "404":
9446
+ description: Workspace or repository not found
9447
+ content:
9448
+ application/json:
9449
+ schema:
9450
+ $ref: "#/components/schemas/ErrorMessageDto"
9451
+ "422":
9452
+ description: GitHub installation lacks write permissions required for automated PRs
9453
+ content:
9454
+ application/json:
9455
+ schema:
9456
+ $ref: "#/components/schemas/GithubWritePermissionsRequiredErrorDto"
9457
+ "503":
9458
+ description: GitHub installation permissions could not be verified, or PR create failed
9459
+ content:
9460
+ application/json:
9461
+ schema:
9462
+ oneOf:
9463
+ - $ref: "#/components/schemas/GithubPermissionsCheckFailedErrorDto"
9464
+ - $ref: "#/components/schemas/ErrorMessageDto"
9465
+
9329
9466
  /workspaces/{workspaceId}/readiness/issues/{issueId}/fix-guide:
9330
9467
  get:
9331
9468
  tags: [RepositoryReadiness]
@@ -17428,20 +17565,107 @@ components:
17428
17565
  items:
17429
17566
  $ref: "#/components/schemas/AiUsageSpendAggregatedContributorRowDto"
17430
17567
 
17568
+ AiUsageSpendKeyInsightModelRightSizingEvidenceDto:
17569
+ type: object
17570
+ additionalProperties: false
17571
+ description: >
17572
+ Numeric evidence for `id=model_right_sizing` (Cost-to-Value insight #2).
17573
+ Premium share is `premiumSpendCents / totalModelSpendCents` against
17574
+ `thresholdPct` (Phase A default 40).
17575
+ required:
17576
+ - premiumSharePct
17577
+ - premiumSpendCents
17578
+ - totalModelSpendCents
17579
+ - thresholdPct
17580
+ - personCount
17581
+ properties:
17582
+ premiumSharePct:
17583
+ type: number
17584
+ description: Premium-model share of model spend in the window (0–100).
17585
+ premiumSpendCents:
17586
+ type: integer
17587
+ description: Sum of spend_cents on premium-classified models (cents).
17588
+ totalModelSpendCents:
17589
+ type: integer
17590
+ description: Sum of spend_cents across all models in the window (cents).
17591
+ thresholdPct:
17592
+ type: number
17593
+ description: Effective premium-share threshold used for this card (0–100).
17594
+ personCount:
17595
+ type: integer
17596
+ description: >
17597
+ Distinct mapped person_id rows contributing to this card's sample
17598
+ (workspace rollup or the single person for a person-scoped card).
17599
+
17600
+ AiUsageSpendKeyInsightDrilldownDto:
17601
+ type: object
17602
+ additionalProperties: false
17603
+ description: >
17604
+ Optional member drill-down for person-scoped `model_right_sizing` cards.
17605
+ Links to `GET …/integrations/ai-tool/{provider}/members/{externalId}`.
17606
+ required: [provider, externalId]
17607
+ properties:
17608
+ provider:
17609
+ type: string
17610
+ enum: [cursor, claude]
17611
+ description: AI tool provider for the member detail route.
17612
+ externalId:
17613
+ type: string
17614
+ description: Provider member external id for the member detail route.
17615
+
17431
17616
  AiUsageSpendKeyInsightItemDto:
17432
17617
  type: object
17433
17618
  additionalProperties: false
17434
17619
  required: [id, tone, text]
17620
+ description: >
17621
+ One Key Insights panel card. Base fields (`id`, `tone`, `text`) apply to
17622
+ all insights. When `id` is `model_right_sizing`, clients MUST treat
17623
+ `dataQuality`, `limitation`, `recommendedAction`, and `evidence` as
17624
+ required; `scope` and `drilldown` are optional (person cards may set both).
17435
17625
  properties:
17436
17626
  id:
17437
17627
  type: string
17438
- description: Stable insight key (e.g. spend-leader, spend-vs-output).
17628
+ description: >
17629
+ Stable insight key (e.g. spend-leader, spend-vs-output,
17630
+ model_right_sizing).
17439
17631
  tone:
17440
17632
  type: string
17441
17633
  enum: [positive, warning, neutral]
17442
17634
  text:
17443
17635
  type: string
17444
17636
  description: Human-readable insight sentence for the UI panel.
17637
+ dataQuality:
17638
+ allOf:
17639
+ - $ref: "#/components/schemas/AiAssistedCodeDataQuality"
17640
+ description: >
17641
+ Required when `id=model_right_sizing`. Phase A/B always `estimated`
17642
+ (model-mix heuristic; no task-complexity telemetry until Phase 3).
17643
+ limitation:
17644
+ type: string
17645
+ description: >
17646
+ Required when `id=model_right_sizing`. Fixed honesty string that the
17647
+ model mix is heuristic and does not encode task complexity.
17648
+ recommendedAction:
17649
+ type: string
17650
+ description: >
17651
+ Required when `id=model_right_sizing`. Coaching copy for the card CTA
17652
+ (advisory only; not vendor enforcement).
17653
+ evidence:
17654
+ allOf:
17655
+ - $ref: "#/components/schemas/AiUsageSpendKeyInsightModelRightSizingEvidenceDto"
17656
+ description: Required when `id=model_right_sizing`.
17657
+ scope:
17658
+ type: string
17659
+ enum: [workspace, person]
17660
+ description: >
17661
+ Optional scope for `model_right_sizing` cards. Workspace default vs
17662
+ per-person personalized item.
17663
+ drilldown:
17664
+ allOf:
17665
+ - $ref: "#/components/schemas/AiUsageSpendKeyInsightDrilldownDto"
17666
+ description: >
17667
+ Optional when `scope=person` for `model_right_sizing`; omitted on
17668
+ workspace cards.
17445
17669
 
17446
17670
  AiUsageSpendKeyInsightsDto:
17447
17671
  type: object
@@ -22455,6 +22679,170 @@ components:
22455
22679
  Required when the issue has unresolvedChoices. Must be one of those labels.
22456
22680
  Stored on the fix row and stated in the worker prompt.
22457
22681
 
22682
+ RulesSkillsAssessedTools:
22683
+ type: string
22684
+ enum: [cursor, claude-code, both]
22685
+ description: >
22686
+ From the latest succeeded readiness scan (`agent_tool_assessed`). Never invent
22687
+ `both` without scan evidence.
22688
+
22689
+ RulesSkillsValidateRequestDto:
22690
+ type: object
22691
+ additionalProperties: false
22692
+ required: [repoId]
22693
+ properties:
22694
+ repoId:
22695
+ type: string
22696
+ format: uuid
22697
+ pathPrefixes:
22698
+ type: array
22699
+ maxItems: 32
22700
+ items:
22701
+ type: string
22702
+ maxLength: 512
22703
+ description: Optional relative path prefixes limiting the validate walk.
22704
+
22705
+ RulesSkillsFindingDto:
22706
+ type: object
22707
+ additionalProperties: false
22708
+ required: [id, kind, severity, code, path, message, criterionIds]
22709
+ properties:
22710
+ id:
22711
+ type: string
22712
+ kind:
22713
+ type: string
22714
+ enum: [structural, soft]
22715
+ severity:
22716
+ type: string
22717
+ enum: [fail, warn]
22718
+ code:
22719
+ type: string
22720
+ path:
22721
+ type: string
22722
+ message:
22723
+ type: string
22724
+ criterionIds:
22725
+ type: array
22726
+ items:
22727
+ type: string
22728
+ enum: [A1, A2, A3, A3a, A3b, A3c, A11]
22729
+ description: Empty when unmapped structural noise.
22730
+
22731
+ RulesSkillsSoftQualityCheckDto:
22732
+ type: object
22733
+ additionalProperties: false
22734
+ required: [code, status]
22735
+ properties:
22736
+ code:
22737
+ type: string
22738
+ status:
22739
+ type: string
22740
+ enum: [pass, fail, warn, skip]
22741
+ message:
22742
+ type: string
22743
+ path:
22744
+ type: string
22745
+
22746
+ RulesSkillsSoftQualitySummaryDto:
22747
+ type: object
22748
+ additionalProperties: false
22749
+ required: [passed, failCount, warnCount, checks]
22750
+ properties:
22751
+ passed:
22752
+ type: boolean
22753
+ description: True when there are no soft-quality fail findings (warns allowed).
22754
+ failCount:
22755
+ type: integer
22756
+ minimum: 0
22757
+ warnCount:
22758
+ type: integer
22759
+ minimum: 0
22760
+ checks:
22761
+ type: array
22762
+ items:
22763
+ $ref: "#/components/schemas/RulesSkillsSoftQualityCheckDto"
22764
+
22765
+ RulesSkillsProposedFileDto:
22766
+ type: object
22767
+ additionalProperties: false
22768
+ required: [path, action]
22769
+ properties:
22770
+ path:
22771
+ type: string
22772
+ maxLength: 1024
22773
+ action:
22774
+ type: string
22775
+ enum: [create, update, delete, rename]
22776
+ content:
22777
+ type: string
22778
+ description: Full file contents for create/update/rename target.
22779
+ previousPath:
22780
+ type: string
22781
+ maxLength: 1024
22782
+ description: Source path when action is rename.
22783
+
22784
+ RulesSkillsValidateResponseDto:
22785
+ type: object
22786
+ additionalProperties: false
22787
+ required: [assessedTools, findings, softQualitySummary, proposedFiles]
22788
+ properties:
22789
+ assessedTools:
22790
+ $ref: "#/components/schemas/RulesSkillsAssessedTools"
22791
+ findings:
22792
+ type: array
22793
+ items:
22794
+ $ref: "#/components/schemas/RulesSkillsFindingDto"
22795
+ softQualitySummary:
22796
+ $ref: "#/components/schemas/RulesSkillsSoftQualitySummaryDto"
22797
+ proposedFiles:
22798
+ type: array
22799
+ items:
22800
+ $ref: "#/components/schemas/RulesSkillsProposedFileDto"
22801
+ note:
22802
+ type: string
22803
+ description: Quiet-case note (e.g. empty tree under pathPrefixes).
22804
+
22805
+ RulesSkillsOpenPullRequestRequestDto:
22806
+ type: object
22807
+ additionalProperties: false
22808
+ required: [repoId, mode]
22809
+ properties:
22810
+ repoId:
22811
+ type: string
22812
+ format: uuid
22813
+ mode:
22814
+ type: string
22815
+ enum: [validate, create]
22816
+ sessionId:
22817
+ type: string
22818
+ format: uuid
22819
+ description: Reserved for Create-mode sessions; validate mode uses proposedFiles.
22820
+ proposedFiles:
22821
+ type: array
22822
+ minItems: 1
22823
+ maxItems: 200
22824
+ items:
22825
+ $ref: "#/components/schemas/RulesSkillsProposedFileDto"
22826
+ title:
22827
+ type: string
22828
+ maxLength: 200
22829
+ body:
22830
+ type: string
22831
+ maxLength: 8000
22832
+
22833
+ RulesSkillsOpenPullRequestResponseDto:
22834
+ type: object
22835
+ additionalProperties: false
22836
+ required: [prUrl, prNumber, branchName]
22837
+ properties:
22838
+ prUrl:
22839
+ type: string
22840
+ format: uri
22841
+ prNumber:
22842
+ type: integer
22843
+ branchName:
22844
+ type: string
22845
+
22458
22846
  PhaseRoleDto:
22459
22847
  type: object
22460
22848
  required: [phase, assignment]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.186.0",
3
+ "version": "2.188.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",