@thinkai/tai-api-contract 2.120.0 → 2.123.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.120.0
4
+ version: 2.123.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}/...`.
@@ -3121,6 +3121,107 @@ paths:
3121
3121
  "404":
3122
3122
  description: Workspace does not exist or malformed workspaceId
3123
3123
 
3124
+ /workspaces/{workspaceId}/ingest/sdlc/rollups/rebuild:
3125
+ post:
3126
+ tags: [SdlcInsights]
3127
+ summary: Rebuild SDLC DORA/CI daily rollups for a day range
3128
+ operationId: rebuildSdlcRollups
3129
+ description: >
3130
+ Queues a rebuild of DORA/CI daily rollups for this workspace from stored dashboard
3131
+ productivity history for the inclusive `from`/`to` UTC day range (max 90 days).
3132
+ Does not re-pull GitHub. Returns immediately with `{ ok: true }` while the rebuild
3133
+ runs under an advisory lock; ingest-coverage reports `sdlc_github` as `in_progress`
3134
+ until the lock is released. Returns 409 when another rebuild holds the advisory lock.
3135
+ parameters:
3136
+ - $ref: "#/components/parameters/WorkspaceId"
3137
+ - name: from
3138
+ in: query
3139
+ required: true
3140
+ description: Inclusive UTC start day (`YYYY-MM-DD`).
3141
+ schema:
3142
+ type: string
3143
+ format: date
3144
+ - name: to
3145
+ in: query
3146
+ required: true
3147
+ description: Inclusive UTC end day (`YYYY-MM-DD`).
3148
+ schema:
3149
+ type: string
3150
+ format: date
3151
+ responses:
3152
+ "200":
3153
+ description: Rebuild accepted and running asynchronously
3154
+ content:
3155
+ application/json:
3156
+ schema:
3157
+ type: object
3158
+ required: [ok]
3159
+ properties:
3160
+ ok:
3161
+ type: boolean
3162
+ enum: [true]
3163
+ rollupRows:
3164
+ type: integer
3165
+ minimum: 0
3166
+ description: >
3167
+ Optional. Omitted when the rebuild is queued asynchronously
3168
+ (current behavior).
3169
+ example:
3170
+ ok: true
3171
+ "400":
3172
+ description: >
3173
+ Invalid range. Stable `error` codes: `invalid_day_range` (missing pair,
3174
+ bad calendar date, or from > to) and `range_too_large` (more than 90 days).
3175
+ content:
3176
+ application/json:
3177
+ schema:
3178
+ type: object
3179
+ required: [ok, error]
3180
+ properties:
3181
+ ok:
3182
+ type: boolean
3183
+ enum: [false]
3184
+ error:
3185
+ type: string
3186
+ enum: [invalid_day_range, range_too_large]
3187
+ "401":
3188
+ $ref: "#/components/responses/Unauthorized"
3189
+ "403":
3190
+ $ref: "#/components/responses/Forbidden"
3191
+ "404":
3192
+ description: >
3193
+ Feature off or no dashboard metrics source. Stable `error` codes:
3194
+ `feature_off`, `no_source`.
3195
+ content:
3196
+ application/json:
3197
+ schema:
3198
+ type: object
3199
+ required: [ok, error]
3200
+ properties:
3201
+ ok:
3202
+ type: boolean
3203
+ enum: [false]
3204
+ error:
3205
+ type: string
3206
+ enum: [feature_off, no_source]
3207
+ "409":
3208
+ description: Rebuild already in progress
3209
+ content:
3210
+ application/json:
3211
+ schema:
3212
+ type: object
3213
+ required: [ok, error]
3214
+ properties:
3215
+ ok:
3216
+ type: boolean
3217
+ enum: [false]
3218
+ error:
3219
+ type: string
3220
+ enum: [already_in_progress]
3221
+ example:
3222
+ ok: false
3223
+ error: already_in_progress
3224
+
3124
3225
  /workspaces/{workspaceId}/insights/sdlc/overview:
3125
3226
  get:
3126
3227
  tags: [SdlcInsights]
@@ -4446,8 +4547,11 @@ paths:
4446
4547
  summary: Refresh AI tool integration snapshots
4447
4548
  operationId: refreshWorkspaceAiTool
4448
4549
  description: >
4449
- Provider-agnostic refresh. Returns 409 when an advisory-lock refresh is already in progress.
4450
- On upstream auth/rate/network failures, returns `200` with `{ ok:false, error }` so the SPA can render inline error.
4550
+ Provider-agnostic refresh. Queues work for `ai-tool-refresher` and returns immediately
4551
+ with `{ ok: true }` when accepted. Progress is visible via ingest-coverage
4552
+ (`ai.refreshInProgress`) and the provider status endpoint while the on-demand flag
4553
+ (or advisory lock) is held. Returns 409 when an advisory-lock refresh is already in
4554
+ progress. Returns 404 when the provider source is missing.
4451
4555
  Pass `full=true` to force a full re-sync that re-pulls the full history instead of the
4452
4556
  incremental window, used to backfill historical months. Provider-specific behavior:
4453
4557
  Claude Enterprise re-pulls six calendar months of daily usage; Claude Team widens its
@@ -4455,6 +4559,14 @@ paths:
4455
4559
  Cursor resets its spend/model/daily backfill cursors so the full `spendHistoryDays` window
4456
4560
  re-ingests from the retention floor even when the backfill was already complete.
4457
4561
  Omitted/false performs a normal incremental refresh.
4562
+ Pass `from` and `to` (UTC `YYYY-MM-DD`) together to re-ingest only that
4563
+ inclusive day range without resetting incremental watermarks; mutually
4564
+ exclusive with `full`. Day-range behavior is provider-specific: all providers
4565
+ re-pull generic daily usage for the window (Cursor does this via the spend-daily
4566
+ path instead of a duplicate top-level poll); Cursor additionally re-ingests
4567
+ spend/model daily for the window without resetting backfill cursors. Claude
4568
+ Enterprise model/product/engagement ingest paths are not day-range scoped and
4569
+ continue to use their normal refresh windows.
4458
4570
  parameters:
4459
4571
  - $ref: "#/components/parameters/WorkspaceId"
4460
4572
  - name: provider
@@ -4473,9 +4585,32 @@ paths:
4473
4585
  schema:
4474
4586
  type: string
4475
4587
  enum: ["true", "1"]
4588
+ - name: from
4589
+ in: query
4590
+ required: false
4591
+ description: >
4592
+ Inclusive UTC start day (`YYYY-MM-DD`) for a targeted re-ingest window.
4593
+ Must be paired with `to`. Mutually exclusive with `full`. Clamped to the
4594
+ configured retention floor (`spendHistoryDays`). Cursor also re-ingests
4595
+ spend/model daily for the window; Claude Enterprise model/product/engagement
4596
+ paths are not day-range scoped.
4597
+ schema:
4598
+ type: string
4599
+ format: date
4600
+ - name: to
4601
+ in: query
4602
+ required: false
4603
+ description: >
4604
+ Inclusive UTC end day (`YYYY-MM-DD`) for a targeted re-ingest window.
4605
+ Must be paired with `from`. Mutually exclusive with `full`.
4606
+ schema:
4607
+ type: string
4608
+ format: date
4476
4609
  responses:
4477
4610
  "200":
4478
- description: Refresh result
4611
+ description: >
4612
+ Refresh accepted and queued for `ai-tool-refresher`. Upstream auth/rate/network
4613
+ failures are reported later via refresh status / ingest-coverage, not on this response.
4479
4614
  content:
4480
4615
  application/json:
4481
4616
  schema:
@@ -4483,8 +4618,23 @@ paths:
4483
4618
  examples:
4484
4619
  ok:
4485
4620
  value: { ok: true }
4486
- invalid_token:
4487
- value: { ok: false, error: "invalid_token" }
4621
+ "400":
4622
+ description: >
4623
+ Invalid request. Stable `error` codes: `invalid_day_range` (missing pair,
4624
+ bad calendar date, or from > to), `full_and_day_range_conflict` (`full`
4625
+ combined with `from`/`to`), and `invalid_provider` (path provider is not
4626
+ a supported AI-tool integration id).
4627
+ content:
4628
+ application/json:
4629
+ schema:
4630
+ $ref: "#/components/schemas/AiToolRefreshResponseDto"
4631
+ examples:
4632
+ invalid_day_range:
4633
+ value: { ok: false, error: "invalid_day_range" }
4634
+ full_and_day_range_conflict:
4635
+ value: { ok: false, error: "full_and_day_range_conflict" }
4636
+ invalid_provider:
4637
+ value: { ok: false, error: "invalid_provider" }
4488
4638
  "401":
4489
4639
  $ref: "#/components/responses/Unauthorized"
4490
4640
  "403":
@@ -4499,7 +4649,9 @@ paths:
4499
4649
  ok: false
4500
4650
  error: "no_source"
4501
4651
  "409":
4502
- description: Refresh already in progress
4652
+ description: >
4653
+ Refresh already in progress — advisory lock held, or an on-demand refresh
4654
+ is already queued for this workspace/provider.
4503
4655
  content:
4504
4656
  application/json:
4505
4657
  schema:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.120.0",
3
+ "version": "2.123.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1110,6 +1110,26 @@ export interface paths {
1110
1110
  patch?: never;
1111
1111
  trace?: never;
1112
1112
  };
1113
+ "/workspaces/{workspaceId}/ingest/sdlc/rollups/rebuild": {
1114
+ parameters: {
1115
+ query?: never;
1116
+ header?: never;
1117
+ path?: never;
1118
+ cookie?: never;
1119
+ };
1120
+ get?: never;
1121
+ put?: never;
1122
+ /**
1123
+ * Rebuild SDLC DORA/CI daily rollups for a day range
1124
+ * @description Queues a rebuild of DORA/CI daily rollups for this workspace from stored dashboard productivity history for the inclusive `from`/`to` UTC day range (max 90 days). Does not re-pull GitHub. Returns immediately with `{ ok: true }` while the rebuild runs under an advisory lock; ingest-coverage reports `sdlc_github` as `in_progress` until the lock is released. Returns 409 when another rebuild holds the advisory lock.
1125
+ */
1126
+ post: operations["rebuildSdlcRollups"];
1127
+ delete?: never;
1128
+ options?: never;
1129
+ head?: never;
1130
+ patch?: never;
1131
+ trace?: never;
1132
+ };
1113
1133
  "/workspaces/{workspaceId}/insights/sdlc/overview": {
1114
1134
  parameters: {
1115
1135
  query?: never;
@@ -1630,7 +1650,7 @@ export interface paths {
1630
1650
  put?: never;
1631
1651
  /**
1632
1652
  * Refresh AI tool integration snapshots
1633
- * @description Provider-agnostic refresh. Returns 409 when an advisory-lock refresh is already in progress. On upstream auth/rate/network failures, returns `200` with `{ ok:false, error }` so the SPA can render inline error. Pass `full=true` to force a full re-sync that re-pulls the full history instead of the incremental window, used to backfill historical months. Provider-specific behavior: Claude Enterprise re-pulls six calendar months of daily usage; Claude Team widens its daily-usage window to the configured history depth (`spendHistoryDays`, default 180 days); Cursor resets its spend/model/daily backfill cursors so the full `spendHistoryDays` window re-ingests from the retention floor even when the backfill was already complete. Omitted/false performs a normal incremental refresh.
1653
+ * @description Provider-agnostic refresh. Queues work for `ai-tool-refresher` and returns immediately with `{ ok: true }` when accepted. Progress is visible via ingest-coverage (`ai.refreshInProgress`) and the provider status endpoint while the on-demand flag (or advisory lock) is held. Returns 409 when an advisory-lock refresh is already in progress. Returns 404 when the provider source is missing. Pass `full=true` to force a full re-sync that re-pulls the full history instead of the incremental window, used to backfill historical months. Provider-specific behavior: Claude Enterprise re-pulls six calendar months of daily usage; Claude Team widens its daily-usage window to the configured history depth (`spendHistoryDays`, default 180 days); Cursor resets its spend/model/daily backfill cursors so the full `spendHistoryDays` window re-ingests from the retention floor even when the backfill was already complete. Omitted/false performs a normal incremental refresh. Pass `from` and `to` (UTC `YYYY-MM-DD`) together to re-ingest only that inclusive day range without resetting incremental watermarks; mutually exclusive with `full`. Day-range behavior is provider-specific: all providers re-pull generic daily usage for the window (Cursor does this via the spend-daily path instead of a duplicate top-level poll); Cursor additionally re-ingests spend/model daily for the window without resetting backfill cursors. Claude Enterprise model/product/engagement ingest paths are not day-range scoped and continue to use their normal refresh windows.
1634
1654
  */
1635
1655
  post: operations["refreshWorkspaceAiTool"];
1636
1656
  delete?: never;
@@ -13002,6 +13022,93 @@ export interface operations {
13002
13022
  };
13003
13023
  };
13004
13024
  };
13025
+ rebuildSdlcRollups: {
13026
+ parameters: {
13027
+ query: {
13028
+ /** @description Inclusive UTC start day (`YYYY-MM-DD`). */
13029
+ from: string;
13030
+ /** @description Inclusive UTC end day (`YYYY-MM-DD`). */
13031
+ to: string;
13032
+ };
13033
+ header?: never;
13034
+ path: {
13035
+ workspaceId: components["parameters"]["WorkspaceId"];
13036
+ };
13037
+ cookie?: never;
13038
+ };
13039
+ requestBody?: never;
13040
+ responses: {
13041
+ /** @description Rebuild accepted and running asynchronously */
13042
+ 200: {
13043
+ headers: {
13044
+ [name: string]: unknown;
13045
+ };
13046
+ content: {
13047
+ /**
13048
+ * @example {
13049
+ * "ok": true
13050
+ * }
13051
+ */
13052
+ "application/json": {
13053
+ /** @enum {boolean} */
13054
+ ok: true;
13055
+ /** @description Optional. Omitted when the rebuild is queued asynchronously (current behavior). */
13056
+ rollupRows?: number;
13057
+ };
13058
+ };
13059
+ };
13060
+ /** @description Invalid range. Stable `error` codes: `invalid_day_range` (missing pair, bad calendar date, or from > to) and `range_too_large` (more than 90 days). */
13061
+ 400: {
13062
+ headers: {
13063
+ [name: string]: unknown;
13064
+ };
13065
+ content: {
13066
+ "application/json": {
13067
+ /** @enum {boolean} */
13068
+ ok: false;
13069
+ /** @enum {string} */
13070
+ error: "invalid_day_range" | "range_too_large";
13071
+ };
13072
+ };
13073
+ };
13074
+ 401: components["responses"]["Unauthorized"];
13075
+ 403: components["responses"]["Forbidden"];
13076
+ /** @description Feature off or no dashboard metrics source. Stable `error` codes: `feature_off`, `no_source`. */
13077
+ 404: {
13078
+ headers: {
13079
+ [name: string]: unknown;
13080
+ };
13081
+ content: {
13082
+ "application/json": {
13083
+ /** @enum {boolean} */
13084
+ ok: false;
13085
+ /** @enum {string} */
13086
+ error: "feature_off" | "no_source";
13087
+ };
13088
+ };
13089
+ };
13090
+ /** @description Rebuild already in progress */
13091
+ 409: {
13092
+ headers: {
13093
+ [name: string]: unknown;
13094
+ };
13095
+ content: {
13096
+ /**
13097
+ * @example {
13098
+ * "ok": false,
13099
+ * "error": "already_in_progress"
13100
+ * }
13101
+ */
13102
+ "application/json": {
13103
+ /** @enum {boolean} */
13104
+ ok: false;
13105
+ /** @enum {string} */
13106
+ error: "already_in_progress";
13107
+ };
13108
+ };
13109
+ };
13110
+ };
13111
+ };
13005
13112
  getSdlcInsightsOverview: {
13006
13113
  parameters: {
13007
13114
  query?: {
@@ -14420,6 +14527,10 @@ export interface operations {
14420
14527
  query?: {
14421
14528
  /** @description Force a full history re-sync instead of the incremental window (Enterprise: 6 months; Team: `spendHistoryDays`-day daily-usage window; Cursor: spend/model/daily backfill reset over `spendHistoryDays`). Truthy only for `true` or `1`. */
14422
14529
  full?: "true" | "1";
14530
+ /** @description Inclusive UTC start day (`YYYY-MM-DD`) for a targeted re-ingest window. Must be paired with `to`. Mutually exclusive with `full`. Clamped to the configured retention floor (`spendHistoryDays`). Cursor also re-ingests spend/model daily for the window; Claude Enterprise model/product/engagement paths are not day-range scoped. */
14531
+ from?: string;
14532
+ /** @description Inclusive UTC end day (`YYYY-MM-DD`) for a targeted re-ingest window. Must be paired with `from`. Mutually exclusive with `full`. */
14533
+ to?: string;
14423
14534
  };
14424
14535
  header?: never;
14425
14536
  path: {
@@ -14430,7 +14541,7 @@ export interface operations {
14430
14541
  };
14431
14542
  requestBody?: never;
14432
14543
  responses: {
14433
- /** @description Refresh result */
14544
+ /** @description Refresh accepted and queued for `ai-tool-refresher`. Upstream auth/rate/network failures are reported later via refresh status / ingest-coverage, not on this response. */
14434
14545
  200: {
14435
14546
  headers: {
14436
14547
  [name: string]: unknown;
@@ -14439,6 +14550,15 @@ export interface operations {
14439
14550
  "application/json": components["schemas"]["AiToolRefreshResponseDto"];
14440
14551
  };
14441
14552
  };
14553
+ /** @description Invalid request. Stable `error` codes: `invalid_day_range` (missing pair, bad calendar date, or from > to), `full_and_day_range_conflict` (`full` combined with `from`/`to`), and `invalid_provider` (path provider is not a supported AI-tool integration id). */
14554
+ 400: {
14555
+ headers: {
14556
+ [name: string]: unknown;
14557
+ };
14558
+ content: {
14559
+ "application/json": components["schemas"]["AiToolRefreshResponseDto"];
14560
+ };
14561
+ };
14442
14562
  401: components["responses"]["Unauthorized"];
14443
14563
  403: components["responses"]["Forbidden"];
14444
14564
  /** @description Provider source missing for this workspace */
@@ -14456,7 +14576,7 @@ export interface operations {
14456
14576
  "application/json": components["schemas"]["AiToolRefreshResponseDto"];
14457
14577
  };
14458
14578
  };
14459
- /** @description Refresh already in progress */
14579
+ /** @description Refresh already in progress — advisory lock held, or an on-demand refresh is already queued for this workspace/provider. */
14460
14580
  409: {
14461
14581
  headers: {
14462
14582
  [name: string]: unknown;