@thinkai/tai-api-contract 2.5.1 → 2.5.16

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.
@@ -227,6 +227,266 @@ export interface paths {
227
227
  patch?: never;
228
228
  trace?: never;
229
229
  };
230
+ "/workspaces/{workspaceId}/insights/productivity-insights/aggregated-teams": {
231
+ parameters: {
232
+ query?: never;
233
+ header?: never;
234
+ path?: never;
235
+ cookie?: never;
236
+ };
237
+ /**
238
+ * Productivity insights — aggregated team weekly metrics
239
+ * @description Team-level rollup for Productivity insights (Aggregated Teams view on /phase-c/c4). Returns weekly merged PR counts and fail rates per engineering team, filtered by the same department, team, and range controls as the Measure UI.
240
+ */
241
+ get: operations["getProductivityInsightsAggregatedTeams"];
242
+ put?: never;
243
+ post?: never;
244
+ delete?: never;
245
+ options?: never;
246
+ head?: never;
247
+ patch?: never;
248
+ trace?: never;
249
+ };
250
+ "/workspaces/{workspaceId}/insights/productivity-insights/merged-pr-trends": {
251
+ parameters: {
252
+ query?: never;
253
+ header?: never;
254
+ path?: never;
255
+ cookie?: never;
256
+ };
257
+ /**
258
+ * Productivity insights — merged PR trends (portfolio + contributors)
259
+ * @description Weekly merged PR counts for the Measure "Merged PR Trends" widget on /phase-c/c4 Individual Contributors. Returns a portfolio aggregate series plus per-contributor weekly counts, filtered by the same department, team, and range controls as the Measure UI.
260
+ */
261
+ get: operations["getProductivityInsightsMergedPrTrends"];
262
+ put?: never;
263
+ post?: never;
264
+ delete?: never;
265
+ options?: never;
266
+ head?: never;
267
+ patch?: never;
268
+ trace?: never;
269
+ };
270
+ "/workspaces/{workspaceId}/insights/productivity-insights/teams": {
271
+ parameters: {
272
+ query?: never;
273
+ header?: never;
274
+ path?: never;
275
+ cookie?: never;
276
+ };
277
+ /**
278
+ * Productivity insights — top teams and team drilldown
279
+ * @description Without `teamId`: returns the top-ranked teams by average weekly merged PR count for the Measure **Top teams** widget on /phase-c/c4 and /phase-c/c7. With `teamId`: returns weekly rollup and summary for a single team (powers `/phase-c/c4/teams/:teamId` drilldown).
280
+ */
281
+ get: operations["getProductivityInsightsTeams"];
282
+ put?: never;
283
+ post?: never;
284
+ delete?: never;
285
+ options?: never;
286
+ head?: never;
287
+ patch?: never;
288
+ trace?: never;
289
+ };
290
+ "/workspaces/{workspaceId}/insights/productivity-insights/contributors/{contributorId}": {
291
+ parameters: {
292
+ query?: never;
293
+ header?: never;
294
+ path?: never;
295
+ cookie?: never;
296
+ };
297
+ /**
298
+ * Productivity insights — contributor drilldown
299
+ * @description Weekly and daily activity rollups for a single contributor on `/phase-c/c4/contributors/:id`. Distributes weekly merged PR counts from precomputed person metrics across weekdays; includes fail-rate signals and period-over-period summary deltas. Uses org-chart person ids (typically email).
300
+ */
301
+ get: operations["getProductivityInsightsContributor"];
302
+ put?: never;
303
+ post?: never;
304
+ delete?: never;
305
+ options?: never;
306
+ head?: never;
307
+ patch?: never;
308
+ trace?: never;
309
+ };
310
+ "/workspaces/{workspaceId}/insights/productivity-insights/needs-attention": {
311
+ parameters: {
312
+ query?: never;
313
+ header?: never;
314
+ path?: never;
315
+ cookie?: never;
316
+ };
317
+ /**
318
+ * Productivity insights — needs attention (bottom performers)
319
+ * @description Bottom performers for the Measure "Needs attention" widget on /phase-c/c4 (LeadersLaggards laggards column). Returns the lowest-ranked teams or contributors by average weekly merged PR count for the selected filters and range.
320
+ */
321
+ get: operations["getProductivityInsightsNeedsAttention"];
322
+ put?: never;
323
+ post?: never;
324
+ delete?: never;
325
+ options?: never;
326
+ head?: never;
327
+ patch?: never;
328
+ trace?: never;
329
+ };
330
+ "/workspaces/{workspaceId}/insights/ai-usage-spend/aggregated-teams": {
331
+ parameters: {
332
+ query?: never;
333
+ header?: never;
334
+ path?: never;
335
+ cookie?: never;
336
+ };
337
+ /**
338
+ * AI usage & spend insights — aggregated team weekly rollups
339
+ * @description Team-level AI adoption, token volume, and spend for the Measure **Aggregated Teams** view on `/phase-c/c7` and the dashboard AI Usage & Spend card. Aggregates stored AI-tool integration snapshots (daily usage + billing spend) by org-chart team using member email. Same filter params as other Measure insights routes.
340
+ */
341
+ get: operations["getAiUsageSpendAggregatedTeams"];
342
+ put?: never;
343
+ post?: never;
344
+ delete?: never;
345
+ options?: never;
346
+ head?: never;
347
+ patch?: never;
348
+ trace?: never;
349
+ };
350
+ "/workspaces/{workspaceId}/insights/ai-usage-spend/aggregated-contributors": {
351
+ parameters: {
352
+ query?: never;
353
+ header?: never;
354
+ path?: never;
355
+ cookie?: never;
356
+ };
357
+ /**
358
+ * AI usage & spend insights — aggregated contributor weekly rollups
359
+ * @description Per-contributor AI adoption, token volume, and spend for the Measure **Individual Contributors** view on `/phase-c/c7`. Aggregates stored AI-tool integration snapshots (daily usage + billing spend) by org-chart person id (typically email). Same filter params as other Measure insights routes.
360
+ */
361
+ get: operations["getAiUsageSpendAggregatedContributors"];
362
+ put?: never;
363
+ post?: never;
364
+ delete?: never;
365
+ options?: never;
366
+ head?: never;
367
+ patch?: never;
368
+ trace?: never;
369
+ };
370
+ "/workspaces/{workspaceId}/insights/ai-usage-spend/contributor-tool-heatmap": {
371
+ parameters: {
372
+ query?: never;
373
+ header?: never;
374
+ path?: never;
375
+ cookie?: never;
376
+ };
377
+ /**
378
+ * AI usage & spend insights — contributor × week heatmap rows
379
+ * @description Contributor × week heatmap rows for the Measure **Individual Contributors** tool heatmap on `/phase-c/c7`. Same aggregation as aggregated-contributors; returns weekly token, spend, and active-user counts per org-chart person.
380
+ */
381
+ get: operations["getAiUsageSpendContributorToolHeatmap"];
382
+ put?: never;
383
+ post?: never;
384
+ delete?: never;
385
+ options?: never;
386
+ head?: never;
387
+ patch?: never;
388
+ trace?: never;
389
+ };
390
+ "/workspaces/{workspaceId}/insights/ai-usage-spend/key-insights": {
391
+ parameters: {
392
+ query?: never;
393
+ header?: never;
394
+ path?: never;
395
+ cookie?: never;
396
+ };
397
+ /**
398
+ * AI usage & spend insights — key insights panel
399
+ * @description Narrative insight cards for the Measure **Key insights** panel on `/phase-c/c7` (AI Usage & Spend). Derived from scoped AI-tool usage/spend snapshots and productivity metrics for the selected filters and range.
400
+ */
401
+ get: operations["getAiUsageSpendKeyInsights"];
402
+ put?: never;
403
+ post?: never;
404
+ delete?: never;
405
+ options?: never;
406
+ head?: never;
407
+ patch?: never;
408
+ trace?: never;
409
+ };
410
+ "/workspaces/{workspaceId}/insights/ai-usage-spend/ai-assisted-code-percentage": {
411
+ parameters: {
412
+ query?: never;
413
+ header?: never;
414
+ path?: never;
415
+ cookie?: never;
416
+ };
417
+ /**
418
+ * AI usage & spend insights — AI-assisted code percentage
419
+ * @description Period and weekly AI-assisted code percentage for the Measure **AI-assisted code** card on `/phase-c/c7` and the **AI impact** curve on `/phase-c/c4`. When scoped productivity metrics include `aiAssistedContributionRatioPercent`, values are **measured** from ingest; otherwise the API falls back to token→LOC heuristics and sets `dataQuality` to **estimated**. Clients should not present estimated series as Cursor-measured signal.
420
+ */
421
+ get: operations["getAiUsageSpendAiAssistedCodePercentage"];
422
+ put?: never;
423
+ post?: never;
424
+ delete?: never;
425
+ options?: never;
426
+ head?: never;
427
+ patch?: never;
428
+ trace?: never;
429
+ };
430
+ "/workspaces/{workspaceId}/insights/ai-usage-spend/ai-tool-usage-spend": {
431
+ parameters: {
432
+ query?: never;
433
+ header?: never;
434
+ path?: never;
435
+ cookie?: never;
436
+ };
437
+ /**
438
+ * AI usage & spend insights — AI tool usage and spend by provider/model
439
+ * @description Scoped portfolio rollups of AI-tool token usage and spend by registered provider and by model (from daily usage `mostUsedModel`) for the **Provider / Model usage + spend** chart on `/phase-c/c4` and `/phase-c/c7`. Reads stored AI-tool integration snapshots (`tai_workspace_ai_tool_daily_usage`, `tai_workspace_ai_tool_spend`).
440
+ */
441
+ get: operations["getAiUsageSpendAiToolUsageSpend"];
442
+ put?: never;
443
+ post?: never;
444
+ delete?: never;
445
+ options?: never;
446
+ head?: never;
447
+ patch?: never;
448
+ trace?: never;
449
+ };
450
+ "/workspaces/{workspaceId}/insights/ai-usage-spend/team-tool-heatmap": {
451
+ parameters: {
452
+ query?: never;
453
+ header?: never;
454
+ path?: never;
455
+ cookie?: never;
456
+ };
457
+ /**
458
+ * AI usage & spend insights — team weekly heatmap
459
+ * @description Team × week rollups of AI-tool token volume, spend, and active users for the **Team tool heatmap** on `/phase-c/c4` and `/phase-c/c7`. Aggregates stored AI-tool integration snapshots by org-chart team. Same filter params as other Measure insights routes.
460
+ */
461
+ get: operations["getAiUsageSpendTeamToolHeatmap"];
462
+ put?: never;
463
+ post?: never;
464
+ delete?: never;
465
+ options?: never;
466
+ head?: never;
467
+ patch?: never;
468
+ trace?: never;
469
+ };
470
+ "/workspaces/{workspaceId}/insights/ai-usage-spend/roi-productivity-signal": {
471
+ parameters: {
472
+ query?: never;
473
+ header?: never;
474
+ path?: never;
475
+ cookie?: never;
476
+ };
477
+ /**
478
+ * AI usage & spend insights — ROI and productivity signal
479
+ * @description Connects scoped AI-tool usage and spend to engineering throughput (merged PRs) for the **ROI & Productivity Signal** panel on `/phase-c/c4` and `/phase-c/c7`. Returns spend efficiency metrics, adoption counts, and weekly usage vs PR series. Same filter params as other Measure insights routes.
480
+ */
481
+ get: operations["getAiUsageSpendRoiProductivitySignal"];
482
+ put?: never;
483
+ post?: never;
484
+ delete?: never;
485
+ options?: never;
486
+ head?: never;
487
+ patch?: never;
488
+ trace?: never;
489
+ };
230
490
  "/workspaces/{workspaceId}/company-profile": {
231
491
  parameters: {
232
492
  query?: never;
@@ -1053,7 +1313,7 @@ export interface paths {
1053
1313
  put?: never;
1054
1314
  /**
1055
1315
  * Import org chart from Supabase storage path
1056
- * @description Parse-only. Downloads the CSV at `storagePath` from the `org-charts` bucket and returns `persons` and `errors`. Does not persist to `spa_org_chart` or `org_chart`. The SPA derives teams client-side and saves the org structure via `POST /workspaces/{workspaceId}/org-chart`.
1316
+ * @description Parse-only. Downloads the CSV at `storagePath` from the `org-charts` bucket and returns `persons` and `errors`. Does not persist to `spa_org_chart` or `org_chart`. The SPA derives teams client-side and saves the org structure via `POST /workspaces/{workspaceId}/org-chart`. Required columns: employee_id, name, email, title, department, team, manager_id, location. Optional: github_username (GitHub login for productivity ingest). Saving the SPA snapshot also materializes a scoring `org_chart` tree for team/person metrics when import members are present.
1057
1317
  */
1058
1318
  post: operations["postOrgChartImport"];
1059
1319
  delete?: never;
@@ -1118,14 +1378,22 @@ export interface components {
1118
1378
  root: components["schemas"]["OrgChartNodeDto"];
1119
1379
  };
1120
1380
  OrgChartPersonDto: {
1381
+ /** @description Stable HR identifier; referenced by manager_id for reporting lines. */
1121
1382
  employeeId: string;
1122
1383
  name: string;
1384
+ /** @description Work email; used as canonical person_id in productivity ingest when present. */
1123
1385
  email: string;
1386
+ /** @description Job title; used for contributor rows and leadership (enabler) hints. */
1124
1387
  title: string;
1388
+ /** @description Department filter on Productivity insights. */
1125
1389
  department: string;
1390
+ /** @description Engineering team name for Aggregated Teams and team drill-downs. */
1126
1391
  team: string;
1392
+ /** @description employee_id of the person's manager; leave empty for top-level leaders. */
1127
1393
  managerId: string;
1128
1394
  location: string;
1395
+ /** @description GitHub login (no @) to map merged PRs and reviews to this person in productivity ingest. */
1396
+ githubUsername?: string;
1129
1397
  };
1130
1398
  OrgChartImportResultDto: {
1131
1399
  persons: components["schemas"]["OrgChartPersonDto"][];
@@ -1249,36 +1517,414 @@ export interface components {
1249
1517
  metrics: components["schemas"]["DashboardProductivityMetricsDto"];
1250
1518
  }[];
1251
1519
  };
1252
- MeProfileDto: {
1253
- id: string;
1254
- email: string;
1255
- name: string;
1256
- roles: string[];
1257
- defaultWorkspaceId?: string | null;
1258
- };
1259
- UpdateMeBodyDto: {
1260
- name?: string;
1261
- email?: string;
1262
- defaultWorkspaceId?: string | null;
1520
+ ProductivityInsightsAggregatedTeamsScopeDto: {
1521
+ /** @description Applied department filter from the Measure UI. Backend scopes via CSV import (`thinkai_org_structure`) or SPA `department` nodes; unknown departments yield empty scoped results rather than org-wide rollups. */
1522
+ department: string;
1523
+ /** @description Applied team name filter from the Measure UI. */
1524
+ team: string;
1263
1525
  };
1264
- WorkspaceSummaryDto: {
1265
- id: string;
1266
- slug: string;
1267
- name: string;
1268
- status: string;
1526
+ ProductivityInsightsAggregatedTeamWeekDto: {
1527
+ /** Format: date-time */
1528
+ bucketStart: string;
1529
+ /** Format: date-time */
1530
+ bucketEnd: string;
1531
+ /** @description Short label for the week column (MM/DD), aligned with Measure charts. */
1532
+ weekLabel?: string;
1533
+ mergedPrCount: number;
1534
+ failRatePercent: number;
1535
+ };
1536
+ ProductivityInsightsAggregatedTeamRowDto: {
1537
+ teamId: string;
1538
+ teamName: string;
1539
+ headcount: number;
1540
+ managerLabel?: string;
1541
+ weeks: components["schemas"]["ProductivityInsightsAggregatedTeamWeekDto"][];
1542
+ };
1543
+ ProductivityInsightsAggregatedTeamsDto: {
1544
+ /** Format: uuid */
1545
+ workspaceId: string;
1546
+ /** @enum {string} */
1547
+ range: "4w" | "8w" | "q";
1548
+ scope: components["schemas"]["ProductivityInsightsAggregatedTeamsScopeDto"];
1549
+ /** Format: date-time */
1550
+ generatedAt: string;
1551
+ teams: components["schemas"]["ProductivityInsightsAggregatedTeamRowDto"][];
1269
1552
  };
1270
- WorkspacesForUserDto: {
1271
- workspaces: components["schemas"]["WorkspaceSummaryDto"][];
1553
+ ProductivityInsightsMergedPrTrendWeekDto: {
1554
+ /** Format: date-time */
1555
+ bucketStart: string;
1556
+ /** Format: date-time */
1557
+ bucketEnd: string;
1558
+ /** @description Short label for the week column (MM/DD), aligned with Measure charts. */
1559
+ weekLabel?: string;
1560
+ mergedPrCount: number;
1561
+ };
1562
+ ProductivityInsightsMergedPrContributorRowDto: {
1563
+ /** @description Canonical person identifier (matches org chart person_id / employeeId). */
1564
+ personId: string;
1565
+ personName: string;
1566
+ teamName?: string;
1567
+ weeks: components["schemas"]["ProductivityInsightsMergedPrTrendWeekDto"][];
1568
+ };
1569
+ ProductivityInsightsMergedPrTrendsDto: {
1570
+ /** Format: uuid */
1571
+ workspaceId: string;
1572
+ /** @enum {string} */
1573
+ range: "4w" | "8w" | "q";
1574
+ scope: components["schemas"]["ProductivityInsightsAggregatedTeamsScopeDto"];
1575
+ /** Format: date-time */
1576
+ generatedAt: string;
1577
+ /** @description Portfolio aggregate merged PR counts (sum of filtered contributors per week). */
1578
+ weeks: components["schemas"]["ProductivityInsightsMergedPrTrendWeekDto"][];
1579
+ contributors: components["schemas"]["ProductivityInsightsMergedPrContributorRowDto"][];
1580
+ };
1581
+ ProductivityInsightsTeamLeaderItemDto: {
1582
+ /** @description 1-based rank within the top-teams list (1 = highest performer). */
1583
+ rank: number;
1584
+ teamId: string;
1585
+ teamName: string;
1586
+ /** @description Optional context line (e.g. headcount or manager). */
1587
+ subtitle?: string;
1588
+ /** @description Average weekly merged PR count over the selected range. */
1589
+ periodAvgMergedPrs: number;
1590
+ /** @description Percent change of the latest week vs the period average. */
1591
+ deltaVsPeriodAvgPercent: number;
1592
+ /** @description Average change failure rate over the range when available. */
1593
+ avgFailRatePercent?: number;
1594
+ };
1595
+ ProductivityInsightsTeamSummaryDto: {
1596
+ totalMergedPrs: number;
1597
+ avgMergedPrsPerWeek: number;
1598
+ avgFailRatePercent: number;
1599
+ headcount: number;
1600
+ };
1601
+ ProductivityInsightsTeamDetailDto: {
1602
+ teamId: string;
1603
+ teamName: string;
1604
+ headcount: number;
1605
+ managerLabel?: string;
1606
+ weeks: components["schemas"]["ProductivityInsightsAggregatedTeamWeekDto"][];
1607
+ summary: components["schemas"]["ProductivityInsightsTeamSummaryDto"];
1608
+ };
1609
+ ProductivityInsightsTeamsResponseDto: {
1610
+ /** Format: uuid */
1611
+ workspaceId: string;
1612
+ /** @enum {string} */
1613
+ range: "4w" | "8w" | "q";
1614
+ scope: components["schemas"]["ProductivityInsightsAggregatedTeamsScopeDto"];
1615
+ /** Format: date-time */
1616
+ generatedAt: string;
1617
+ /** @description Present when `teamId` query is omitted — top-ranked teams. */
1618
+ items?: components["schemas"]["ProductivityInsightsTeamLeaderItemDto"][];
1619
+ /** @description Present when `teamId` query is set — single-team drilldown. */
1620
+ team?: components["schemas"]["ProductivityInsightsTeamDetailDto"];
1272
1621
  };
1273
- CreateWorkspaceBodyDto: {
1274
- slug: string;
1622
+ ProductivityInsightsContributorProfileDto: {
1623
+ /** @description Org-chart person id (typically email). */
1624
+ id: string;
1275
1625
  name: string;
1626
+ title?: string;
1627
+ team?: string;
1628
+ department?: string;
1276
1629
  };
1277
- CompanyProfileDto: {
1278
- companyName: string;
1279
- industry: string;
1280
- industryOther?: string;
1281
- /** @description One of 1-50 | 51-200 | 201-500 | 501-1000 | 1000+ */
1630
+ ProductivityInsightsContributorActivityDayDto: {
1631
+ /** Format: date */
1632
+ date: string;
1633
+ dayIndex: number;
1634
+ mergedPrCount: number;
1635
+ mergedPrs: string[];
1636
+ absent: boolean;
1637
+ absenceType?: string;
1638
+ failureSignal: boolean;
1639
+ failures: string[];
1640
+ };
1641
+ ProductivityInsightsContributorActivityWeekDto: {
1642
+ label: string;
1643
+ /** Format: date-time */
1644
+ bucketStart: string;
1645
+ /** Format: date-time */
1646
+ bucketEnd: string;
1647
+ days: components["schemas"]["ProductivityInsightsContributorActivityDayDto"][];
1648
+ };
1649
+ ProductivityInsightsContributorActivitySummaryDto: {
1650
+ totalMergedPrs: number;
1651
+ avgMergedPrsPerWeek: number;
1652
+ totalAbsenceDays: number;
1653
+ avgFailRate: number;
1654
+ mergedPrDelta: number;
1655
+ avgMergedPrsPerWeekDelta: number;
1656
+ totalAbsenceDaysDelta: number;
1657
+ avgFailRateDelta: number;
1658
+ };
1659
+ ProductivityInsightsContributorDetailDto: {
1660
+ /** Format: uuid */
1661
+ workspaceId: string;
1662
+ contributorId: string;
1663
+ /** @enum {string} */
1664
+ range: "4w" | "8w" | "q";
1665
+ scope: components["schemas"]["ProductivityInsightsAggregatedTeamsScopeDto"];
1666
+ /** Format: date-time */
1667
+ generatedAt: string;
1668
+ contributor: components["schemas"]["ProductivityInsightsContributorProfileDto"];
1669
+ weeks: components["schemas"]["ProductivityInsightsContributorActivityWeekDto"][];
1670
+ summary: components["schemas"]["ProductivityInsightsContributorActivitySummaryDto"];
1671
+ };
1672
+ ProductivityInsightsNeedsAttentionItemDto: {
1673
+ /** @description 1-based rank within the laggards list (1 = lowest performer). */
1674
+ rank: number;
1675
+ /** @description Org chart team id or canonical person id. */
1676
+ entityId: string;
1677
+ /** @enum {string} */
1678
+ entityType: "team" | "contributor";
1679
+ name: string;
1680
+ /** @description Optional context line (e.g. headcount or job title). */
1681
+ subtitle?: string;
1682
+ /** @description Mean weekly merged PR count across the selected range. */
1683
+ periodAvgMergedPrs: number;
1684
+ /** @description Percent change of the latest week vs the period mean. */
1685
+ deltaVsPeriodAvgPercent: number;
1686
+ /** @description Mean weekly change-failure rate when available. */
1687
+ avgFailRatePercent?: number;
1688
+ };
1689
+ ProductivityInsightsNeedsAttentionDto: {
1690
+ /** Format: uuid */
1691
+ workspaceId: string;
1692
+ /** @enum {string} */
1693
+ range: "4w" | "8w" | "q";
1694
+ scope: components["schemas"]["ProductivityInsightsAggregatedTeamsScopeDto"];
1695
+ /** @enum {string} */
1696
+ entityType: "teams" | "contributors";
1697
+ /** Format: date-time */
1698
+ generatedAt: string;
1699
+ items: components["schemas"]["ProductivityInsightsNeedsAttentionItemDto"][];
1700
+ };
1701
+ AiUsageSpendAggregatedTeamWeekDto: {
1702
+ /** Format: date-time */
1703
+ bucketStart: string;
1704
+ /** Format: date-time */
1705
+ bucketEnd: string;
1706
+ /** @description Short label for table headers (e.g. MM/DD). */
1707
+ weekLabel?: string;
1708
+ /** @description Total tokens consumed in the bucket (from AI-tool daily usage payloads when available). */
1709
+ tokenCount: number;
1710
+ /** @description Estimated spend in USD cents attributed to the bucket. */
1711
+ spendCents: number;
1712
+ /** @description Distinct engineers with active AI-tool usage in the bucket. */
1713
+ activeUsers: number;
1714
+ };
1715
+ AiUsageSpendAggregatedTeamRowDto: {
1716
+ teamId: string;
1717
+ teamName: string;
1718
+ headcount: number;
1719
+ managerLabel?: string;
1720
+ weeks: components["schemas"]["AiUsageSpendAggregatedTeamWeekDto"][];
1721
+ };
1722
+ AiUsageSpendAggregatedTeamsSummaryDto: {
1723
+ totalTokenCount: number;
1724
+ totalSpendCents: number;
1725
+ /** @description Distinct engineers with any active usage in the selected range. */
1726
+ activeUsers: number;
1727
+ /** @description Count of connected AI-tool providers with usage or spend in range. */
1728
+ activeTools: number;
1729
+ /** @description Sum of org-chart headcount across returned teams. */
1730
+ totalEngineers: number;
1731
+ };
1732
+ AiUsageSpendAggregatedTeamsDto: {
1733
+ /** Format: uuid */
1734
+ workspaceId: string;
1735
+ /** @enum {string} */
1736
+ range: "4w" | "8w" | "q";
1737
+ scope: components["schemas"]["ProductivityInsightsAggregatedTeamsScopeDto"];
1738
+ /** Format: date-time */
1739
+ generatedAt: string;
1740
+ teams: components["schemas"]["AiUsageSpendAggregatedTeamRowDto"][];
1741
+ summary: components["schemas"]["AiUsageSpendAggregatedTeamsSummaryDto"];
1742
+ };
1743
+ AiUsageSpendAggregatedContributorRowDto: {
1744
+ /** @description Org-chart person id (typically email). */
1745
+ contributorId: string;
1746
+ contributorName: string;
1747
+ title?: string;
1748
+ team?: string;
1749
+ department?: string;
1750
+ weeks: components["schemas"]["AiUsageSpendAggregatedTeamWeekDto"][];
1751
+ };
1752
+ AiUsageSpendAggregatedContributorsDto: {
1753
+ /** Format: uuid */
1754
+ workspaceId: string;
1755
+ /** @enum {string} */
1756
+ range: "4w" | "8w" | "q";
1757
+ scope: components["schemas"]["ProductivityInsightsAggregatedTeamsScopeDto"];
1758
+ /** Format: date-time */
1759
+ generatedAt: string;
1760
+ contributors: components["schemas"]["AiUsageSpendAggregatedContributorRowDto"][];
1761
+ summary: components["schemas"]["AiUsageSpendAggregatedTeamsSummaryDto"];
1762
+ };
1763
+ AiUsageSpendContributorToolHeatmapDto: {
1764
+ /** Format: uuid */
1765
+ workspaceId: string;
1766
+ /** @enum {string} */
1767
+ range: "4w" | "8w" | "q";
1768
+ scope: components["schemas"]["ProductivityInsightsAggregatedTeamsScopeDto"];
1769
+ /** Format: date-time */
1770
+ generatedAt: string;
1771
+ contributors: components["schemas"]["AiUsageSpendAggregatedContributorRowDto"][];
1772
+ };
1773
+ AiUsageSpendKeyInsightItemDto: {
1774
+ /** @description Stable insight key (e.g. spend-leader, spend-vs-output). */
1775
+ id: string;
1776
+ /** @enum {string} */
1777
+ tone: "positive" | "warning" | "neutral";
1778
+ /** @description Human-readable insight sentence for the UI panel. */
1779
+ text: string;
1780
+ };
1781
+ AiUsageSpendKeyInsightsDto: {
1782
+ /** Format: uuid */
1783
+ workspaceId: string;
1784
+ /** @enum {string} */
1785
+ range: "4w" | "8w" | "q";
1786
+ scope: components["schemas"]["ProductivityInsightsAggregatedTeamsScopeDto"];
1787
+ /** Format: date-time */
1788
+ generatedAt: string;
1789
+ items: components["schemas"]["AiUsageSpendKeyInsightItemDto"][];
1790
+ };
1791
+ /**
1792
+ * @description **measured** — derived from scoped productivity ingest (`aiAdoption.aiAssistedContributionRatioPercent`). **estimated** — derived from AI-tool token volume heuristics when ingest ratios are absent for that bucket.
1793
+ * @enum {string}
1794
+ */
1795
+ AiAssistedCodeDataQuality: "estimated" | "measured";
1796
+ AiUsageSpendAiAssistedCodeWeekDto: {
1797
+ /** Format: date-time */
1798
+ bucketStart: string;
1799
+ /** Format: date-time */
1800
+ bucketEnd: string;
1801
+ weekLabel?: string;
1802
+ aiAssistedCodePercent: number;
1803
+ totalLoc: number;
1804
+ aiLoc: number;
1805
+ humanLoc: number;
1806
+ dataQuality: components["schemas"]["AiAssistedCodeDataQuality"];
1807
+ };
1808
+ AiUsageSpendAiAssistedCodePercentageDto: {
1809
+ /** Format: uuid */
1810
+ workspaceId: string;
1811
+ /** @enum {string} */
1812
+ range: "4w" | "8w" | "q";
1813
+ scope: components["schemas"]["ProductivityInsightsAggregatedTeamsScopeDto"];
1814
+ /** Format: date-time */
1815
+ generatedAt: string;
1816
+ /** @description Portfolio AI-assisted code share for the selected period (0–100). */
1817
+ aiAssistedCodePercent: number;
1818
+ /** @description Period rollup quality. **measured** only when every weekly bucket in `weeks` used ingest ratios; otherwise **estimated** (including mixed ingest/heuristic weeks). */
1819
+ dataQuality: components["schemas"]["AiAssistedCodeDataQuality"];
1820
+ /** @description Change in AI-assisted code share vs the prior half of the range (percentage points). */
1821
+ deltaVsPriorPeriodPercent: number;
1822
+ totalLoc: number;
1823
+ aiLoc: number;
1824
+ humanLoc: number;
1825
+ /** @default 50 */
1826
+ targetMinPercent: number;
1827
+ /** @default 75 */
1828
+ targetMaxPercent: number;
1829
+ weeks: components["schemas"]["AiUsageSpendAiAssistedCodeWeekDto"][];
1830
+ };
1831
+ AiUsageSpendAiToolUsageSpendProviderItemDto: {
1832
+ providerId: string;
1833
+ providerName: string;
1834
+ tokenCount: number;
1835
+ spendCents: number;
1836
+ activeUsers: number;
1837
+ };
1838
+ AiUsageSpendAiToolUsageSpendModelItemDto: {
1839
+ providerId: string;
1840
+ providerName: string;
1841
+ modelName: string;
1842
+ tokenCount: number;
1843
+ spendCents: number;
1844
+ };
1845
+ AiUsageSpendAiToolUsageSpendDto: {
1846
+ /** Format: uuid */
1847
+ workspaceId: string;
1848
+ /** @enum {string} */
1849
+ range: "4w" | "8w" | "q";
1850
+ scope: components["schemas"]["ProductivityInsightsAggregatedTeamsScopeDto"];
1851
+ /** Format: date-time */
1852
+ generatedAt: string;
1853
+ totalEngineers: number;
1854
+ providers: components["schemas"]["AiUsageSpendAiToolUsageSpendProviderItemDto"][];
1855
+ models: components["schemas"]["AiUsageSpendAiToolUsageSpendModelItemDto"][];
1856
+ };
1857
+ AiUsageSpendTeamToolHeatmapDto: {
1858
+ /** Format: uuid */
1859
+ workspaceId: string;
1860
+ /** @enum {string} */
1861
+ range: "4w" | "8w" | "q";
1862
+ scope: components["schemas"]["ProductivityInsightsAggregatedTeamsScopeDto"];
1863
+ /** Format: date-time */
1864
+ generatedAt: string;
1865
+ teams: components["schemas"]["AiUsageSpendAggregatedTeamRowDto"][];
1866
+ };
1867
+ AiUsageSpendRoiProductivitySignalWeekDto: {
1868
+ /** Format: date-time */
1869
+ bucketStart: string;
1870
+ /** Format: date-time */
1871
+ bucketEnd: string;
1872
+ weekLabel?: string;
1873
+ /** @description Estimated merged PR count in the bucket from dashboard velocity metrics. */
1874
+ mergedPrCount: number;
1875
+ /** @description Total AI-tool tokens consumed in the bucket. */
1876
+ tokenCount: number;
1877
+ };
1878
+ AiUsageSpendRoiProductivitySignalDto: {
1879
+ /** Format: uuid */
1880
+ workspaceId: string;
1881
+ /** @enum {string} */
1882
+ range: "4w" | "8w" | "q";
1883
+ scope: components["schemas"]["ProductivityInsightsAggregatedTeamsScopeDto"];
1884
+ /** Format: date-time */
1885
+ generatedAt: string;
1886
+ totalMergedPrs: number;
1887
+ totalSpendCents: number;
1888
+ activeUsers: number;
1889
+ totalEngineers: number;
1890
+ /** @description Share of merged PRs estimated to be AI-assisted (0–1). */
1891
+ aiAssistedPrRatio: number;
1892
+ /** @description Percent change in merged PR throughput (recent half vs prior half of range). */
1893
+ prThroughputDeltaPercent: number;
1894
+ /** @description Percent change in token usage (recent half vs prior half of range). */
1895
+ usageDeltaPercent: number;
1896
+ weeks: components["schemas"]["AiUsageSpendRoiProductivitySignalWeekDto"][];
1897
+ };
1898
+ MeProfileDto: {
1899
+ id: string;
1900
+ email: string;
1901
+ name: string;
1902
+ roles: string[];
1903
+ defaultWorkspaceId?: string | null;
1904
+ };
1905
+ UpdateMeBodyDto: {
1906
+ name?: string;
1907
+ email?: string;
1908
+ defaultWorkspaceId?: string | null;
1909
+ };
1910
+ WorkspaceSummaryDto: {
1911
+ id: string;
1912
+ slug: string;
1913
+ name: string;
1914
+ status: string;
1915
+ };
1916
+ WorkspacesForUserDto: {
1917
+ workspaces: components["schemas"]["WorkspaceSummaryDto"][];
1918
+ };
1919
+ CreateWorkspaceBodyDto: {
1920
+ slug: string;
1921
+ name: string;
1922
+ };
1923
+ CompanyProfileDto: {
1924
+ companyName: string;
1925
+ industry: string;
1926
+ industryOther?: string;
1927
+ /** @description One of 1-50 | 51-200 | 201-500 | 501-1000 | 1000+ */
1282
1928
  companySize: string;
1283
1929
  engineeringHC: string;
1284
1930
  headquarters: string;
@@ -1299,6 +1945,17 @@ export interface components {
1299
1945
  language?: string | null;
1300
1946
  private?: boolean | null;
1301
1947
  };
1948
+ GithubMissingPermissionDto: {
1949
+ /** @description GitHub App permission key (e.g. contents, pull_requests). */
1950
+ name: string;
1951
+ /** @enum {string} */
1952
+ required: "read" | "write" | "admin";
1953
+ /**
1954
+ * @description Null when the installation has not granted this permission.
1955
+ * @enum {string|null}
1956
+ */
1957
+ granted?: "read" | "write" | "admin" | null;
1958
+ };
1302
1959
  GithubInstallationSummaryDto: {
1303
1960
  installationId: string;
1304
1961
  account: components["schemas"]["GithubAccountDto"];
@@ -1307,10 +1964,17 @@ export interface components {
1307
1964
  manageUrl?: string | null;
1308
1965
  /** Format: date-time */
1309
1966
  lastSyncedAt?: string | null;
1967
+ /** @description True when this installation's granted permissions are below what the ThinkAI GitHub App currently requests. */
1968
+ permissionsUpgradeRequired: boolean;
1969
+ missingPermissions?: components["schemas"]["GithubMissingPermissionDto"][];
1970
+ /** @description Human-readable summary for UI when permissionsUpgradeRequired is true. */
1971
+ upgradeMessage?: string | null;
1310
1972
  };
1311
1973
  GithubInstallationStatusDto: {
1312
1974
  installed: boolean;
1313
1975
  installations: components["schemas"]["GithubInstallationSummaryDto"][];
1976
+ /** @description True if any connected installation is under-permissioned. */
1977
+ permissionsUpgradeRequired: boolean;
1314
1978
  installationId?: string | null;
1315
1979
  account?: components["schemas"]["GithubAccountDto"] | null;
1316
1980
  repos?: components["schemas"]["GithubInstalledRepoDto"][] | null;
@@ -1785,6 +2449,8 @@ export interface components {
1785
2449
  ProjectId: string;
1786
2450
  NotificationId: string;
1787
2451
  FixId: string;
2452
+ /** @description Department filter; send `All departments` to include every department. Scoped using imported `thinkai_org_structure` members when present, otherwise SPA org chart `department` nodes and their descendant teams. When neither source defines the requested department, insights return no scoped teams or contributors (not org-wide data). */
2453
+ InsightsDepartmentFilter: string;
1788
2454
  };
1789
2455
  requestBodies: never;
1790
2456
  headers: never;
@@ -1814,6 +2480,42 @@ export type AiToolRefreshResponseDto = components['schemas']['AiToolRefreshRespo
1814
2480
  export type DashboardProductivityMetricsDto = components['schemas']['DashboardProductivityMetricsDto'];
1815
2481
  export type DashboardProductivityDto = components['schemas']['DashboardProductivityDto'];
1816
2482
  export type DashboardProductivityHistoryDto = components['schemas']['DashboardProductivityHistoryDto'];
2483
+ export type ProductivityInsightsAggregatedTeamsScopeDto = components['schemas']['ProductivityInsightsAggregatedTeamsScopeDto'];
2484
+ export type ProductivityInsightsAggregatedTeamWeekDto = components['schemas']['ProductivityInsightsAggregatedTeamWeekDto'];
2485
+ export type ProductivityInsightsAggregatedTeamRowDto = components['schemas']['ProductivityInsightsAggregatedTeamRowDto'];
2486
+ export type ProductivityInsightsAggregatedTeamsDto = components['schemas']['ProductivityInsightsAggregatedTeamsDto'];
2487
+ export type ProductivityInsightsMergedPrTrendWeekDto = components['schemas']['ProductivityInsightsMergedPrTrendWeekDto'];
2488
+ export type ProductivityInsightsMergedPrContributorRowDto = components['schemas']['ProductivityInsightsMergedPrContributorRowDto'];
2489
+ export type ProductivityInsightsMergedPrTrendsDto = components['schemas']['ProductivityInsightsMergedPrTrendsDto'];
2490
+ export type ProductivityInsightsTeamLeaderItemDto = components['schemas']['ProductivityInsightsTeamLeaderItemDto'];
2491
+ export type ProductivityInsightsTeamSummaryDto = components['schemas']['ProductivityInsightsTeamSummaryDto'];
2492
+ export type ProductivityInsightsTeamDetailDto = components['schemas']['ProductivityInsightsTeamDetailDto'];
2493
+ export type ProductivityInsightsTeamsResponseDto = components['schemas']['ProductivityInsightsTeamsResponseDto'];
2494
+ export type ProductivityInsightsContributorProfileDto = components['schemas']['ProductivityInsightsContributorProfileDto'];
2495
+ export type ProductivityInsightsContributorActivityDayDto = components['schemas']['ProductivityInsightsContributorActivityDayDto'];
2496
+ export type ProductivityInsightsContributorActivityWeekDto = components['schemas']['ProductivityInsightsContributorActivityWeekDto'];
2497
+ export type ProductivityInsightsContributorActivitySummaryDto = components['schemas']['ProductivityInsightsContributorActivitySummaryDto'];
2498
+ export type ProductivityInsightsContributorDetailDto = components['schemas']['ProductivityInsightsContributorDetailDto'];
2499
+ export type ProductivityInsightsNeedsAttentionItemDto = components['schemas']['ProductivityInsightsNeedsAttentionItemDto'];
2500
+ export type ProductivityInsightsNeedsAttentionDto = components['schemas']['ProductivityInsightsNeedsAttentionDto'];
2501
+ export type AiUsageSpendAggregatedTeamWeekDto = components['schemas']['AiUsageSpendAggregatedTeamWeekDto'];
2502
+ export type AiUsageSpendAggregatedTeamRowDto = components['schemas']['AiUsageSpendAggregatedTeamRowDto'];
2503
+ export type AiUsageSpendAggregatedTeamsSummaryDto = components['schemas']['AiUsageSpendAggregatedTeamsSummaryDto'];
2504
+ export type AiUsageSpendAggregatedTeamsDto = components['schemas']['AiUsageSpendAggregatedTeamsDto'];
2505
+ export type AiUsageSpendAggregatedContributorRowDto = components['schemas']['AiUsageSpendAggregatedContributorRowDto'];
2506
+ export type AiUsageSpendAggregatedContributorsDto = components['schemas']['AiUsageSpendAggregatedContributorsDto'];
2507
+ export type AiUsageSpendContributorToolHeatmapDto = components['schemas']['AiUsageSpendContributorToolHeatmapDto'];
2508
+ export type AiUsageSpendKeyInsightItemDto = components['schemas']['AiUsageSpendKeyInsightItemDto'];
2509
+ export type AiUsageSpendKeyInsightsDto = components['schemas']['AiUsageSpendKeyInsightsDto'];
2510
+ export type AiAssistedCodeDataQuality = components['schemas']['AiAssistedCodeDataQuality'];
2511
+ export type AiUsageSpendAiAssistedCodeWeekDto = components['schemas']['AiUsageSpendAiAssistedCodeWeekDto'];
2512
+ export type AiUsageSpendAiAssistedCodePercentageDto = components['schemas']['AiUsageSpendAiAssistedCodePercentageDto'];
2513
+ export type AiUsageSpendAiToolUsageSpendProviderItemDto = components['schemas']['AiUsageSpendAiToolUsageSpendProviderItemDto'];
2514
+ export type AiUsageSpendAiToolUsageSpendModelItemDto = components['schemas']['AiUsageSpendAiToolUsageSpendModelItemDto'];
2515
+ export type AiUsageSpendAiToolUsageSpendDto = components['schemas']['AiUsageSpendAiToolUsageSpendDto'];
2516
+ export type AiUsageSpendTeamToolHeatmapDto = components['schemas']['AiUsageSpendTeamToolHeatmapDto'];
2517
+ export type AiUsageSpendRoiProductivitySignalWeekDto = components['schemas']['AiUsageSpendRoiProductivitySignalWeekDto'];
2518
+ export type AiUsageSpendRoiProductivitySignalDto = components['schemas']['AiUsageSpendRoiProductivitySignalDto'];
1817
2519
  export type MeProfileDto = components['schemas']['MeProfileDto'];
1818
2520
  export type UpdateMeBodyDto = components['schemas']['UpdateMeBodyDto'];
1819
2521
  export type WorkspaceSummaryDto = components['schemas']['WorkspaceSummaryDto'];
@@ -1822,6 +2524,7 @@ export type CreateWorkspaceBodyDto = components['schemas']['CreateWorkspaceBodyD
1822
2524
  export type CompanyProfileDto = components['schemas']['CompanyProfileDto'];
1823
2525
  export type GithubAccountDto = components['schemas']['GithubAccountDto'];
1824
2526
  export type GithubInstalledRepoDto = components['schemas']['GithubInstalledRepoDto'];
2527
+ export type GithubMissingPermissionDto = components['schemas']['GithubMissingPermissionDto'];
1825
2528
  export type GithubInstallationSummaryDto = components['schemas']['GithubInstallationSummaryDto'];
1826
2529
  export type GithubInstallationStatusDto = components['schemas']['GithubInstallationStatusDto'];
1827
2530
  export type GithubInstallUrlRequestDto = components['schemas']['GithubInstallUrlRequestDto'];
@@ -1886,6 +2589,7 @@ export type ParameterRepoId = components['parameters']['RepoId'];
1886
2589
  export type ParameterProjectId = components['parameters']['ProjectId'];
1887
2590
  export type ParameterNotificationId = components['parameters']['NotificationId'];
1888
2591
  export type ParameterFixId = components['parameters']['FixId'];
2592
+ export type ParameterInsightsDepartmentFilter = components['parameters']['InsightsDepartmentFilter'];
1889
2593
  export type $defs = Record<string, never>;
1890
2594
  export interface operations {
1891
2595
  getMe: {
@@ -2401,6 +3105,692 @@ export interface operations {
2401
3105
  401: components["responses"]["Unauthorized"];
2402
3106
  };
2403
3107
  };
3108
+ getProductivityInsightsAggregatedTeams: {
3109
+ parameters: {
3110
+ query?: {
3111
+ /** @description Measure time range (maps to weekly bucket count). */
3112
+ rangeId?: "4w" | "8w" | "q";
3113
+ /** @description Department filter; send `All departments` to include every department. Scoped using imported `thinkai_org_structure` members when present, otherwise SPA org chart `department` nodes and their descendant teams. When neither source defines the requested department, insights return no scoped teams or contributors (not org-wide data). */
3114
+ department?: components["parameters"]["InsightsDepartmentFilter"];
3115
+ /** @description Team name filter; send `All teams` to include every team. */
3116
+ team?: string;
3117
+ /** @description ISO timestamp for the end of the last weekly bucket; omit for current week. */
3118
+ windowEnd?: string;
3119
+ };
3120
+ header?: never;
3121
+ path: {
3122
+ workspaceId: components["parameters"]["WorkspaceId"];
3123
+ };
3124
+ cookie?: never;
3125
+ };
3126
+ requestBody?: never;
3127
+ responses: {
3128
+ /** @description Aggregated team productivity series */
3129
+ 200: {
3130
+ headers: {
3131
+ [name: string]: unknown;
3132
+ };
3133
+ content: {
3134
+ "application/json": components["schemas"]["ProductivityInsightsAggregatedTeamsDto"];
3135
+ };
3136
+ };
3137
+ /** @description Invalid query parameters */
3138
+ 400: {
3139
+ headers: {
3140
+ [name: string]: unknown;
3141
+ };
3142
+ content: {
3143
+ "application/json": {
3144
+ /** @example invalid_query */
3145
+ error: string;
3146
+ };
3147
+ };
3148
+ };
3149
+ 401: components["responses"]["Unauthorized"];
3150
+ 403: components["responses"]["Forbidden"];
3151
+ /** @description Workspace does not exist or malformed workspaceId */
3152
+ 404: {
3153
+ headers: {
3154
+ [name: string]: unknown;
3155
+ };
3156
+ content?: never;
3157
+ };
3158
+ };
3159
+ };
3160
+ getProductivityInsightsMergedPrTrends: {
3161
+ parameters: {
3162
+ query?: {
3163
+ /** @description Measure time range (maps to weekly bucket count). */
3164
+ rangeId?: "4w" | "8w" | "q";
3165
+ /** @description Department filter; send `All departments` to include every department. Scoped using imported `thinkai_org_structure` members when present, otherwise SPA org chart `department` nodes and their descendant teams. When neither source defines the requested department, insights return no scoped teams or contributors (not org-wide data). */
3166
+ department?: components["parameters"]["InsightsDepartmentFilter"];
3167
+ /** @description Team name filter; send `All teams` to include every team. */
3168
+ team?: string;
3169
+ /** @description ISO timestamp for the end of the last weekly bucket; omit for current week. */
3170
+ windowEnd?: string;
3171
+ };
3172
+ header?: never;
3173
+ path: {
3174
+ workspaceId: components["parameters"]["WorkspaceId"];
3175
+ };
3176
+ cookie?: never;
3177
+ };
3178
+ requestBody?: never;
3179
+ responses: {
3180
+ /** @description Portfolio and per-contributor merged PR weekly series */
3181
+ 200: {
3182
+ headers: {
3183
+ [name: string]: unknown;
3184
+ };
3185
+ content: {
3186
+ "application/json": components["schemas"]["ProductivityInsightsMergedPrTrendsDto"];
3187
+ };
3188
+ };
3189
+ /** @description Invalid query parameters */
3190
+ 400: {
3191
+ headers: {
3192
+ [name: string]: unknown;
3193
+ };
3194
+ content: {
3195
+ "application/json": {
3196
+ /** @example invalid_query */
3197
+ error: string;
3198
+ };
3199
+ };
3200
+ };
3201
+ 401: components["responses"]["Unauthorized"];
3202
+ 403: components["responses"]["Forbidden"];
3203
+ /** @description Workspace does not exist or malformed workspaceId */
3204
+ 404: {
3205
+ headers: {
3206
+ [name: string]: unknown;
3207
+ };
3208
+ content?: never;
3209
+ };
3210
+ };
3211
+ };
3212
+ getProductivityInsightsTeams: {
3213
+ parameters: {
3214
+ query?: {
3215
+ /** @description When set, return drilldown for this org-chart team id instead of the top-team list. */
3216
+ teamId?: string;
3217
+ /** @description Maximum top-team rows when `teamId` is omitted (UI default 3). */
3218
+ limit?: number;
3219
+ /** @description Measure time range (maps to weekly bucket count). */
3220
+ rangeId?: "4w" | "8w" | "q";
3221
+ /** @description Department filter; send `All departments` to include every department. Scoped using imported `thinkai_org_structure` members when present, otherwise SPA org chart `department` nodes and their descendant teams. When neither source defines the requested department, insights return no scoped teams or contributors (not org-wide data). */
3222
+ department?: components["parameters"]["InsightsDepartmentFilter"];
3223
+ /** @description Team name filter; send `All teams` to include every team. */
3224
+ team?: string;
3225
+ /** @description ISO timestamp for the end of the last weekly bucket; omit for current week. */
3226
+ windowEnd?: string;
3227
+ };
3228
+ header?: never;
3229
+ path: {
3230
+ workspaceId: components["parameters"]["WorkspaceId"];
3231
+ };
3232
+ cookie?: never;
3233
+ };
3234
+ requestBody?: never;
3235
+ responses: {
3236
+ /** @description Top teams list or single-team drilldown */
3237
+ 200: {
3238
+ headers: {
3239
+ [name: string]: unknown;
3240
+ };
3241
+ content: {
3242
+ "application/json": components["schemas"]["ProductivityInsightsTeamsResponseDto"];
3243
+ };
3244
+ };
3245
+ /** @description Invalid query parameters */
3246
+ 400: {
3247
+ headers: {
3248
+ [name: string]: unknown;
3249
+ };
3250
+ content: {
3251
+ "application/json": {
3252
+ /** @example invalid_query */
3253
+ error: string;
3254
+ };
3255
+ };
3256
+ };
3257
+ 401: components["responses"]["Unauthorized"];
3258
+ 403: components["responses"]["Forbidden"];
3259
+ /** @description Workspace or team not found */
3260
+ 404: {
3261
+ headers: {
3262
+ [name: string]: unknown;
3263
+ };
3264
+ content?: never;
3265
+ };
3266
+ };
3267
+ };
3268
+ getProductivityInsightsContributor: {
3269
+ parameters: {
3270
+ query?: {
3271
+ /** @description Measure time range (maps to weekly bucket count). */
3272
+ rangeId?: "4w" | "8w" | "q";
3273
+ /** @description Department filter; send `All departments` to include every department. Scoped using imported `thinkai_org_structure` members when present, otherwise SPA org chart `department` nodes and their descendant teams. When neither source defines the requested department, insights return no scoped teams or contributors (not org-wide data). */
3274
+ department?: components["parameters"]["InsightsDepartmentFilter"];
3275
+ /** @description Team name filter; send `All teams` to include every team. */
3276
+ team?: string;
3277
+ /** @description ISO timestamp for the end of the last weekly bucket; omit for current week. */
3278
+ windowEnd?: string;
3279
+ };
3280
+ header?: never;
3281
+ path: {
3282
+ workspaceId: components["parameters"]["WorkspaceId"];
3283
+ /** @description Org-chart person id (e.g. email from `person_id` external id). */
3284
+ contributorId: string;
3285
+ };
3286
+ cookie?: never;
3287
+ };
3288
+ requestBody?: never;
3289
+ responses: {
3290
+ /** @description Contributor activity drilldown */
3291
+ 200: {
3292
+ headers: {
3293
+ [name: string]: unknown;
3294
+ };
3295
+ content: {
3296
+ "application/json": components["schemas"]["ProductivityInsightsContributorDetailDto"];
3297
+ };
3298
+ };
3299
+ /** @description Invalid query parameters */
3300
+ 400: {
3301
+ headers: {
3302
+ [name: string]: unknown;
3303
+ };
3304
+ content: {
3305
+ "application/json": {
3306
+ /** @example invalid_query */
3307
+ error: string;
3308
+ };
3309
+ };
3310
+ };
3311
+ 401: components["responses"]["Unauthorized"];
3312
+ 403: components["responses"]["Forbidden"];
3313
+ /** @description Workspace or contributor not found */
3314
+ 404: {
3315
+ headers: {
3316
+ [name: string]: unknown;
3317
+ };
3318
+ content?: never;
3319
+ };
3320
+ };
3321
+ };
3322
+ getProductivityInsightsNeedsAttention: {
3323
+ parameters: {
3324
+ query?: {
3325
+ /** @description Rank teams (Aggregated Teams tab) or contributors (Individual Contributors tab). */
3326
+ entityType?: "teams" | "contributors";
3327
+ /** @description Maximum number of laggard rows to return (UI default 3). */
3328
+ limit?: number;
3329
+ /** @description Measure time range (maps to weekly bucket count). */
3330
+ rangeId?: "4w" | "8w" | "q";
3331
+ /** @description Department filter; send `All departments` to include every department. Scoped using imported `thinkai_org_structure` members when present, otherwise SPA org chart `department` nodes and their descendant teams. When neither source defines the requested department, insights return no scoped teams or contributors (not org-wide data). */
3332
+ department?: components["parameters"]["InsightsDepartmentFilter"];
3333
+ /** @description Team name filter; send `All teams` to include every team. */
3334
+ team?: string;
3335
+ /** @description ISO timestamp for the end of the last weekly bucket; omit for current week. */
3336
+ windowEnd?: string;
3337
+ };
3338
+ header?: never;
3339
+ path: {
3340
+ workspaceId: components["parameters"]["WorkspaceId"];
3341
+ };
3342
+ cookie?: never;
3343
+ };
3344
+ requestBody?: never;
3345
+ responses: {
3346
+ /** @description Bottom performers for the needs-attention widget */
3347
+ 200: {
3348
+ headers: {
3349
+ [name: string]: unknown;
3350
+ };
3351
+ content: {
3352
+ "application/json": components["schemas"]["ProductivityInsightsNeedsAttentionDto"];
3353
+ };
3354
+ };
3355
+ /** @description Invalid query parameters */
3356
+ 400: {
3357
+ headers: {
3358
+ [name: string]: unknown;
3359
+ };
3360
+ content: {
3361
+ "application/json": {
3362
+ /** @example invalid_query */
3363
+ error: string;
3364
+ };
3365
+ };
3366
+ };
3367
+ 401: components["responses"]["Unauthorized"];
3368
+ 403: components["responses"]["Forbidden"];
3369
+ /** @description Workspace does not exist or malformed workspaceId */
3370
+ 404: {
3371
+ headers: {
3372
+ [name: string]: unknown;
3373
+ };
3374
+ content?: never;
3375
+ };
3376
+ };
3377
+ };
3378
+ getAiUsageSpendAggregatedTeams: {
3379
+ parameters: {
3380
+ query?: {
3381
+ /** @description Measure time range (maps to weekly bucket count). */
3382
+ rangeId?: "4w" | "8w" | "q";
3383
+ /** @description Department filter; send `All departments` to include every department. Scoped using imported `thinkai_org_structure` members when present, otherwise SPA org chart `department` nodes and their descendant teams. When neither source defines the requested department, insights return no scoped teams or contributors (not org-wide data). */
3384
+ department?: components["parameters"]["InsightsDepartmentFilter"];
3385
+ /** @description Team name filter; send `All teams` to include every team. */
3386
+ team?: string;
3387
+ /** @description ISO timestamp for the end of the last weekly bucket; omit for current week. */
3388
+ windowEnd?: string;
3389
+ };
3390
+ header?: never;
3391
+ path: {
3392
+ workspaceId: components["parameters"]["WorkspaceId"];
3393
+ };
3394
+ cookie?: never;
3395
+ };
3396
+ requestBody?: never;
3397
+ responses: {
3398
+ /** @description Aggregated team AI usage and spend series */
3399
+ 200: {
3400
+ headers: {
3401
+ [name: string]: unknown;
3402
+ };
3403
+ content: {
3404
+ "application/json": components["schemas"]["AiUsageSpendAggregatedTeamsDto"];
3405
+ };
3406
+ };
3407
+ /** @description Invalid query parameters */
3408
+ 400: {
3409
+ headers: {
3410
+ [name: string]: unknown;
3411
+ };
3412
+ content: {
3413
+ "application/json": {
3414
+ /** @example invalid_query */
3415
+ error: string;
3416
+ };
3417
+ };
3418
+ };
3419
+ 401: components["responses"]["Unauthorized"];
3420
+ 403: components["responses"]["Forbidden"];
3421
+ /** @description Workspace does not exist or malformed workspaceId */
3422
+ 404: {
3423
+ headers: {
3424
+ [name: string]: unknown;
3425
+ };
3426
+ content?: never;
3427
+ };
3428
+ };
3429
+ };
3430
+ getAiUsageSpendAggregatedContributors: {
3431
+ parameters: {
3432
+ query?: {
3433
+ /** @description Measure time range (maps to weekly bucket count). */
3434
+ rangeId?: "4w" | "8w" | "q";
3435
+ /** @description Department filter; send `All departments` to include every department. Scoped using imported `thinkai_org_structure` members when present, otherwise SPA org chart `department` nodes and their descendant teams. When neither source defines the requested department, insights return no scoped teams or contributors (not org-wide data). */
3436
+ department?: components["parameters"]["InsightsDepartmentFilter"];
3437
+ /** @description Team name filter; send `All teams` to include every team. */
3438
+ team?: string;
3439
+ /** @description ISO timestamp for the end of the last weekly bucket; omit for current week. */
3440
+ windowEnd?: string;
3441
+ };
3442
+ header?: never;
3443
+ path: {
3444
+ workspaceId: components["parameters"]["WorkspaceId"];
3445
+ };
3446
+ cookie?: never;
3447
+ };
3448
+ requestBody?: never;
3449
+ responses: {
3450
+ /** @description Aggregated contributor AI usage and spend series */
3451
+ 200: {
3452
+ headers: {
3453
+ [name: string]: unknown;
3454
+ };
3455
+ content: {
3456
+ "application/json": components["schemas"]["AiUsageSpendAggregatedContributorsDto"];
3457
+ };
3458
+ };
3459
+ /** @description Invalid query parameters */
3460
+ 400: {
3461
+ headers: {
3462
+ [name: string]: unknown;
3463
+ };
3464
+ content: {
3465
+ "application/json": {
3466
+ /** @example invalid_query */
3467
+ error: string;
3468
+ };
3469
+ };
3470
+ };
3471
+ 401: components["responses"]["Unauthorized"];
3472
+ 403: components["responses"]["Forbidden"];
3473
+ /** @description Workspace does not exist or malformed workspaceId */
3474
+ 404: {
3475
+ headers: {
3476
+ [name: string]: unknown;
3477
+ };
3478
+ content?: never;
3479
+ };
3480
+ };
3481
+ };
3482
+ getAiUsageSpendContributorToolHeatmap: {
3483
+ parameters: {
3484
+ query?: {
3485
+ /** @description Measure time range (maps to weekly bucket count). */
3486
+ rangeId?: "4w" | "8w" | "q";
3487
+ /** @description Department filter; send `All departments` to include every department. Scoped using imported `thinkai_org_structure` members when present, otherwise SPA org chart `department` nodes and their descendant teams. When neither source defines the requested department, insights return no scoped teams or contributors (not org-wide data). */
3488
+ department?: components["parameters"]["InsightsDepartmentFilter"];
3489
+ /** @description Team name filter; send `All teams` to include every team. */
3490
+ team?: string;
3491
+ /** @description ISO timestamp for the end of the last weekly bucket; omit for current week. */
3492
+ windowEnd?: string;
3493
+ };
3494
+ header?: never;
3495
+ path: {
3496
+ workspaceId: components["parameters"]["WorkspaceId"];
3497
+ };
3498
+ cookie?: never;
3499
+ };
3500
+ requestBody?: never;
3501
+ responses: {
3502
+ /** @description Contributor heatmap rows for AI usage and spend */
3503
+ 200: {
3504
+ headers: {
3505
+ [name: string]: unknown;
3506
+ };
3507
+ content: {
3508
+ "application/json": components["schemas"]["AiUsageSpendContributorToolHeatmapDto"];
3509
+ };
3510
+ };
3511
+ /** @description Invalid query parameters */
3512
+ 400: {
3513
+ headers: {
3514
+ [name: string]: unknown;
3515
+ };
3516
+ content: {
3517
+ "application/json": {
3518
+ /** @example invalid_query */
3519
+ error: string;
3520
+ };
3521
+ };
3522
+ };
3523
+ 401: components["responses"]["Unauthorized"];
3524
+ 403: components["responses"]["Forbidden"];
3525
+ /** @description Workspace does not exist or malformed workspaceId */
3526
+ 404: {
3527
+ headers: {
3528
+ [name: string]: unknown;
3529
+ };
3530
+ content?: never;
3531
+ };
3532
+ };
3533
+ };
3534
+ getAiUsageSpendKeyInsights: {
3535
+ parameters: {
3536
+ query?: {
3537
+ /** @description Measure time range (maps to weekly bucket count). */
3538
+ rangeId?: "4w" | "8w" | "q";
3539
+ /** @description Department filter; send `All departments` to include every department. Scoped using imported `thinkai_org_structure` members when present, otherwise SPA org chart `department` nodes and their descendant teams. When neither source defines the requested department, insights return no scoped teams or contributors (not org-wide data). */
3540
+ department?: components["parameters"]["InsightsDepartmentFilter"];
3541
+ /** @description Team name filter; send `All teams` to include every team. */
3542
+ team?: string;
3543
+ /** @description ISO timestamp for the end of the last weekly bucket; omit for current week. */
3544
+ windowEnd?: string;
3545
+ };
3546
+ header?: never;
3547
+ path: {
3548
+ workspaceId: components["parameters"]["WorkspaceId"];
3549
+ };
3550
+ cookie?: never;
3551
+ };
3552
+ requestBody?: never;
3553
+ responses: {
3554
+ /** @description Key insight cards for the AI usage & spend panel */
3555
+ 200: {
3556
+ headers: {
3557
+ [name: string]: unknown;
3558
+ };
3559
+ content: {
3560
+ "application/json": components["schemas"]["AiUsageSpendKeyInsightsDto"];
3561
+ };
3562
+ };
3563
+ /** @description Invalid query parameters */
3564
+ 400: {
3565
+ headers: {
3566
+ [name: string]: unknown;
3567
+ };
3568
+ content: {
3569
+ "application/json": {
3570
+ /** @example invalid_query */
3571
+ error: string;
3572
+ };
3573
+ };
3574
+ };
3575
+ 401: components["responses"]["Unauthorized"];
3576
+ 403: components["responses"]["Forbidden"];
3577
+ /** @description Workspace does not exist or malformed workspaceId */
3578
+ 404: {
3579
+ headers: {
3580
+ [name: string]: unknown;
3581
+ };
3582
+ content?: never;
3583
+ };
3584
+ };
3585
+ };
3586
+ getAiUsageSpendAiAssistedCodePercentage: {
3587
+ parameters: {
3588
+ query?: {
3589
+ /** @description Measure time range (maps to weekly bucket count). */
3590
+ rangeId?: "4w" | "8w" | "q";
3591
+ /** @description Department filter; send `All departments` to include every department. Scoped using imported `thinkai_org_structure` members when present, otherwise SPA org chart `department` nodes and their descendant teams. When neither source defines the requested department, insights return no scoped teams or contributors (not org-wide data). */
3592
+ department?: components["parameters"]["InsightsDepartmentFilter"];
3593
+ /** @description Team name filter; send `All teams` to include every team. */
3594
+ team?: string;
3595
+ /** @description ISO timestamp for the end of the last weekly bucket; omit for current week. */
3596
+ windowEnd?: string;
3597
+ };
3598
+ header?: never;
3599
+ path: {
3600
+ workspaceId: components["parameters"]["WorkspaceId"];
3601
+ };
3602
+ cookie?: never;
3603
+ };
3604
+ requestBody?: never;
3605
+ responses: {
3606
+ /** @description AI-assisted code percentage series */
3607
+ 200: {
3608
+ headers: {
3609
+ [name: string]: unknown;
3610
+ };
3611
+ content: {
3612
+ "application/json": components["schemas"]["AiUsageSpendAiAssistedCodePercentageDto"];
3613
+ };
3614
+ };
3615
+ /** @description Invalid query parameters */
3616
+ 400: {
3617
+ headers: {
3618
+ [name: string]: unknown;
3619
+ };
3620
+ content: {
3621
+ "application/json": {
3622
+ /** @example invalid_query */
3623
+ error: string;
3624
+ };
3625
+ };
3626
+ };
3627
+ 401: components["responses"]["Unauthorized"];
3628
+ 403: components["responses"]["Forbidden"];
3629
+ /** @description Workspace does not exist or malformed workspaceId */
3630
+ 404: {
3631
+ headers: {
3632
+ [name: string]: unknown;
3633
+ };
3634
+ content?: never;
3635
+ };
3636
+ };
3637
+ };
3638
+ getAiUsageSpendAiToolUsageSpend: {
3639
+ parameters: {
3640
+ query?: {
3641
+ /** @description Measure time range (maps to weekly bucket count). */
3642
+ rangeId?: "4w" | "8w" | "q";
3643
+ /** @description Department filter; send `All departments` to include every department. Scoped using imported `thinkai_org_structure` members when present, otherwise SPA org chart `department` nodes and their descendant teams. When neither source defines the requested department, insights return no scoped teams or contributors (not org-wide data). */
3644
+ department?: components["parameters"]["InsightsDepartmentFilter"];
3645
+ /** @description Team name filter; send `All teams` to include every team. */
3646
+ team?: string;
3647
+ /** @description ISO timestamp for the end of the last weekly bucket; omit for current week. */
3648
+ windowEnd?: string;
3649
+ };
3650
+ header?: never;
3651
+ path: {
3652
+ workspaceId: components["parameters"]["WorkspaceId"];
3653
+ };
3654
+ cookie?: never;
3655
+ };
3656
+ requestBody?: never;
3657
+ responses: {
3658
+ /** @description Provider and model AI tool usage/spend rollups */
3659
+ 200: {
3660
+ headers: {
3661
+ [name: string]: unknown;
3662
+ };
3663
+ content: {
3664
+ "application/json": components["schemas"]["AiUsageSpendAiToolUsageSpendDto"];
3665
+ };
3666
+ };
3667
+ /** @description Invalid query parameters */
3668
+ 400: {
3669
+ headers: {
3670
+ [name: string]: unknown;
3671
+ };
3672
+ content: {
3673
+ "application/json": {
3674
+ /** @example invalid_query */
3675
+ error: string;
3676
+ };
3677
+ };
3678
+ };
3679
+ 401: components["responses"]["Unauthorized"];
3680
+ 403: components["responses"]["Forbidden"];
3681
+ /** @description Workspace does not exist or malformed workspaceId */
3682
+ 404: {
3683
+ headers: {
3684
+ [name: string]: unknown;
3685
+ };
3686
+ content?: never;
3687
+ };
3688
+ };
3689
+ };
3690
+ getAiUsageSpendTeamToolHeatmap: {
3691
+ parameters: {
3692
+ query?: {
3693
+ /** @description Measure time range (maps to weekly bucket count). */
3694
+ rangeId?: "4w" | "8w" | "q";
3695
+ /** @description Department filter; send `All departments` to include every department. Scoped using imported `thinkai_org_structure` members when present, otherwise SPA org chart `department` nodes and their descendant teams. When neither source defines the requested department, insights return no scoped teams or contributors (not org-wide data). */
3696
+ department?: components["parameters"]["InsightsDepartmentFilter"];
3697
+ /** @description Team name filter; send `All teams` to include every team. */
3698
+ team?: string;
3699
+ /** @description ISO timestamp for the end of the last weekly bucket; omit for current week. */
3700
+ windowEnd?: string;
3701
+ };
3702
+ header?: never;
3703
+ path: {
3704
+ workspaceId: components["parameters"]["WorkspaceId"];
3705
+ };
3706
+ cookie?: never;
3707
+ };
3708
+ requestBody?: never;
3709
+ responses: {
3710
+ /** @description Team weekly AI usage heatmap rows */
3711
+ 200: {
3712
+ headers: {
3713
+ [name: string]: unknown;
3714
+ };
3715
+ content: {
3716
+ "application/json": components["schemas"]["AiUsageSpendTeamToolHeatmapDto"];
3717
+ };
3718
+ };
3719
+ /** @description Invalid query parameters */
3720
+ 400: {
3721
+ headers: {
3722
+ [name: string]: unknown;
3723
+ };
3724
+ content: {
3725
+ "application/json": {
3726
+ /** @example invalid_query */
3727
+ error: string;
3728
+ };
3729
+ };
3730
+ };
3731
+ 401: components["responses"]["Unauthorized"];
3732
+ 403: components["responses"]["Forbidden"];
3733
+ /** @description Workspace does not exist or malformed workspaceId */
3734
+ 404: {
3735
+ headers: {
3736
+ [name: string]: unknown;
3737
+ };
3738
+ content?: never;
3739
+ };
3740
+ };
3741
+ };
3742
+ getAiUsageSpendRoiProductivitySignal: {
3743
+ parameters: {
3744
+ query?: {
3745
+ /** @description Measure time range (maps to weekly bucket count). */
3746
+ rangeId?: "4w" | "8w" | "q";
3747
+ /** @description Department filter; send `All departments` to include every department. Scoped using imported `thinkai_org_structure` members when present, otherwise SPA org chart `department` nodes and their descendant teams. When neither source defines the requested department, insights return no scoped teams or contributors (not org-wide data). */
3748
+ department?: components["parameters"]["InsightsDepartmentFilter"];
3749
+ /** @description Team name filter; send `All teams` to include every team. */
3750
+ team?: string;
3751
+ /** @description ISO timestamp for the end of the last weekly bucket; omit for current week. */
3752
+ windowEnd?: string;
3753
+ };
3754
+ header?: never;
3755
+ path: {
3756
+ workspaceId: components["parameters"]["WorkspaceId"];
3757
+ };
3758
+ cookie?: never;
3759
+ };
3760
+ requestBody?: never;
3761
+ responses: {
3762
+ /** @description ROI and productivity signal rollups */
3763
+ 200: {
3764
+ headers: {
3765
+ [name: string]: unknown;
3766
+ };
3767
+ content: {
3768
+ "application/json": components["schemas"]["AiUsageSpendRoiProductivitySignalDto"];
3769
+ };
3770
+ };
3771
+ /** @description Invalid query parameters */
3772
+ 400: {
3773
+ headers: {
3774
+ [name: string]: unknown;
3775
+ };
3776
+ content: {
3777
+ "application/json": {
3778
+ /** @example invalid_query */
3779
+ error: string;
3780
+ };
3781
+ };
3782
+ };
3783
+ 401: components["responses"]["Unauthorized"];
3784
+ 403: components["responses"]["Forbidden"];
3785
+ /** @description Workspace does not exist or malformed workspaceId */
3786
+ 404: {
3787
+ headers: {
3788
+ [name: string]: unknown;
3789
+ };
3790
+ content?: never;
3791
+ };
3792
+ };
3793
+ };
2404
3794
  getCompanyProfile: {
2405
3795
  parameters: {
2406
3796
  query?: never;
@@ -2492,6 +3882,8 @@ export interface operations {
2492
3882
  query?: {
2493
3883
  /** @description When true, bypass `tai_workspace_vcs_repos_cache` and re-fetch from GitHub. */
2494
3884
  refresh?: boolean;
3885
+ /** @description When true, re-fetch GitHub App and installation permission metadata (used by the login permission gate after the user approves on GitHub). */
3886
+ permissionsRefresh?: boolean;
2495
3887
  };
2496
3888
  header?: never;
2497
3889
  path: {