@thinkai/tai-api-contract 2.241.0 → 2.243.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.
@@ -486,6 +486,66 @@ export interface paths {
486
486
  patch?: never;
487
487
  trace?: never;
488
488
  };
489
+ "/admin/design-adoption": {
490
+ parameters: {
491
+ query?: never;
492
+ header?: never;
493
+ path?: never;
494
+ cookie?: never;
495
+ };
496
+ /**
497
+ * Design adoption totals, reasons, and people
498
+ * @description Platform admins only. Who is on the new design, who went back to classic, and who never chose. `totals.onNew`, `totals.backOnClassic`, `totals.neverChose`, and `totals.choseClassic` sum to `totals.totalPeople`. `reasons` counts one reason per person currently back on classic (tried the new design, saved choice is now `v1`), using the latest switch to classic. `reason: null` is no reason given. `people` is one row per active account (email, workspace, current design, since, switch count, last reason). Notes are not included. `workspaceId` and `design` filter the people list only; totals and reasons stay global. Requires a Bearer JWT from an email on `PLATFORM_ADMIN_EMAILS`.
499
+ */
500
+ get: operations["adminGetDesignAdoption"];
501
+ put?: never;
502
+ post?: never;
503
+ delete?: never;
504
+ options?: never;
505
+ head?: never;
506
+ patch?: never;
507
+ trace?: never;
508
+ };
509
+ "/admin/design-adoption.csv": {
510
+ parameters: {
511
+ query?: never;
512
+ header?: never;
513
+ path?: never;
514
+ cookie?: never;
515
+ };
516
+ /**
517
+ * Design adoption people list as CSV
518
+ * @description Platform admins only. The people list from `GET /admin/design-adoption` as an RFC 4180 CSV file. Accepts the same `workspaceId` and `design` filters. `limit` and `offset` are ignored. Columns are `email,workspace,design,since,switches,lastReason`. Notes are not included. At most 50000 matching rows. `Content-Disposition` is `attachment`. Requires a Bearer JWT from an email on `PLATFORM_ADMIN_EMAILS`.
519
+ */
520
+ get: operations["adminExportDesignAdoptionCsv"];
521
+ put?: never;
522
+ post?: never;
523
+ delete?: never;
524
+ options?: never;
525
+ head?: never;
526
+ patch?: never;
527
+ trace?: never;
528
+ };
529
+ "/admin/design-adoption/people/{userId}": {
530
+ parameters: {
531
+ query?: never;
532
+ header?: never;
533
+ path?: never;
534
+ cookie?: never;
535
+ };
536
+ /**
537
+ * One person's design switches, including notes
538
+ * @description Platform admins only. The same summary fields as a people-list row, plus that person's switch events. `note` is present only here (optional, at most 500 characters). Requires a Bearer JWT from an email on `PLATFORM_ADMIN_EMAILS`.
539
+ */
540
+ get: operations["adminGetDesignAdoptionPerson"];
541
+ put?: never;
542
+ post?: never;
543
+ delete?: never;
544
+ options?: never;
545
+ head?: never;
546
+ patch?: never;
547
+ trace?: never;
548
+ };
489
549
  "/admin/jobs-session": {
490
550
  parameters: {
491
551
  query?: never;
@@ -11759,6 +11819,76 @@ export interface components {
11759
11819
  /** @description App path the person was on. Query strings are not stored. */
11760
11820
  route?: string;
11761
11821
  };
11822
+ /** @description People counts partition active accounts: `onNew + backOnClassic + neverChose + choseClassic = totalPeople`. Workspace counts ignore the people-list filters. */
11823
+ DesignAdoptionTotalsDto: {
11824
+ /** @description Saved design is the new design (`v2`). */
11825
+ onNew: number;
11826
+ /** @description Tried the new design and the saved design is now classic (`v1`). */
11827
+ backOnClassic: number;
11828
+ /** @description No saved design choice. */
11829
+ neverChose: number;
11830
+ /** @description Saved classic (`v1`) without ever switching to the new design. */
11831
+ choseClassic: number;
11832
+ /** @description Active accounts. */
11833
+ totalPeople: number;
11834
+ /** @description Active workspaces with at least one active member, where every active member is on the new design. */
11835
+ workspacesFullyOnNew: number;
11836
+ /** @description Active workspaces, including those with no members. */
11837
+ totalWorkspaces: number;
11838
+ };
11839
+ DesignAdoptionReasonCountDto: {
11840
+ /** @description `null` means no reason was given on the latest switch back to classic. */
11841
+ reason: components["schemas"]["DesignSwitchReason"] | null;
11842
+ count: number;
11843
+ };
11844
+ /** @description One active account. Notes are not included. `workspaceId` is the earliest active membership, or the filtered workspace when `workspaceId` is set on the query. */
11845
+ DesignAdoptionPersonDto: {
11846
+ /** Format: uuid */
11847
+ userId: string;
11848
+ email: string;
11849
+ /** Format: uuid */
11850
+ workspaceId: string | null;
11851
+ workspaceName: string | null;
11852
+ /** @description `null` means the person has not chosen a design. */
11853
+ design: components["schemas"]["DesignVersion"] | null;
11854
+ /**
11855
+ * Format: date-time
11856
+ * @description When the saved design last changed. `null` when none is saved.
11857
+ */
11858
+ since: string | null;
11859
+ switchCount: number;
11860
+ /** @description Reason on the latest switch event. `null` when there is none. */
11861
+ lastReason: components["schemas"]["DesignSwitchReason"] | null;
11862
+ };
11863
+ DesignAdoptionPeoplePageDto: {
11864
+ items: components["schemas"]["DesignAdoptionPersonDto"][];
11865
+ /** @description Matching people before paging. */
11866
+ total: number;
11867
+ limit: number;
11868
+ offset: number;
11869
+ };
11870
+ DesignAdoptionDto: {
11871
+ totals: components["schemas"]["DesignAdoptionTotalsDto"];
11872
+ /** @description One row per switch reason, in a stable order, then `reason: null` for no reason given. Counts sum to `totals.backOnClassic`. */
11873
+ reasons: components["schemas"]["DesignAdoptionReasonCountDto"][];
11874
+ people: components["schemas"]["DesignAdoptionPeoplePageDto"];
11875
+ };
11876
+ DesignAdoptionSwitchEventDto: {
11877
+ /** Format: uuid */
11878
+ id: string;
11879
+ /** Format: date-time */
11880
+ createdAt: string;
11881
+ fromVersion: components["schemas"]["DesignVersion"] | null;
11882
+ toVersion: components["schemas"]["DesignVersion"];
11883
+ reason: components["schemas"]["DesignSwitchReason"] | null;
11884
+ /** @description Optional note. Present only on this per-person read. */
11885
+ note: string | null;
11886
+ route: string | null;
11887
+ };
11888
+ DesignAdoptionPersonDetailDto: components["schemas"]["DesignAdoptionPersonDto"] & {
11889
+ /** @description Newest switch first. Includes notes. */
11890
+ events: components["schemas"]["DesignAdoptionSwitchEventDto"][];
11891
+ };
11762
11892
  /** @description Body for `PUT /me/preferences`. `notificationChannels` may be omitted to keep stored cells. `designVersion` and `designVersionChangedAt` are not accepted; the stored design choice is kept. Use `PUT /me/design-version` to change it. */
11763
11893
  PutPreferencesBodyDto: {
11764
11894
  theme: components["schemas"]["ThemePreference"];
@@ -12886,10 +13016,16 @@ export interface components {
12886
13016
  sourceReconcile?: components["schemas"]["IngestCoverageSourceReconcileDto"] | null;
12887
13017
  dataTrust: components["schemas"]["DataTrustDto"];
12888
13018
  };
13019
+ /** @description ADR 006: dirty weeks waiting for repo-week facts to merge into tai_workspace_dashboard_metrics (Insights lag behind ledger fetch). */
13020
+ IngestCoverageMetricsRollupDto: {
13021
+ /** @description Number of workspace weeks with pending metrics rollup. */
13022
+ dirtyWeekCount: number;
13023
+ };
12889
13024
  IngestCoverageDto: {
12890
13025
  pipelines: components["schemas"]["IngestCoveragePipelineDto"][];
12891
13026
  /** Format: date-time */
12892
13027
  generatedAt?: string;
13028
+ metricsRollup?: components["schemas"]["IngestCoverageMetricsRollupDto"] | null;
12893
13029
  };
12894
13030
  IngestRunDto: {
12895
13031
  /** Format: uuid */
@@ -16199,6 +16335,13 @@ export type PreferencesDto = components['schemas']['PreferencesDto'];
16199
16335
  export type DesignVersion = components['schemas']['DesignVersion'];
16200
16336
  export type DesignSwitchReason = components['schemas']['DesignSwitchReason'];
16201
16337
  export type PutDesignVersionBodyDto = components['schemas']['PutDesignVersionBodyDto'];
16338
+ export type DesignAdoptionTotalsDto = components['schemas']['DesignAdoptionTotalsDto'];
16339
+ export type DesignAdoptionReasonCountDto = components['schemas']['DesignAdoptionReasonCountDto'];
16340
+ export type DesignAdoptionPersonDto = components['schemas']['DesignAdoptionPersonDto'];
16341
+ export type DesignAdoptionPeoplePageDto = components['schemas']['DesignAdoptionPeoplePageDto'];
16342
+ export type DesignAdoptionDto = components['schemas']['DesignAdoptionDto'];
16343
+ export type DesignAdoptionSwitchEventDto = components['schemas']['DesignAdoptionSwitchEventDto'];
16344
+ export type DesignAdoptionPersonDetailDto = components['schemas']['DesignAdoptionPersonDetailDto'];
16202
16345
  export type PutPreferencesBodyDto = components['schemas']['PutPreferencesBodyDto'];
16203
16346
  export type NotificationChannelRequiredErrorDto = components['schemas']['NotificationChannelRequiredErrorDto'];
16204
16347
  export type ValidationIssueDto = components['schemas']['ValidationIssueDto'];
@@ -16284,6 +16427,7 @@ export type PutStrictInsightsOnTrustDto = components['schemas']['PutStrictInsigh
16284
16427
  export type InsightsStrictTrustHideNotifyDto = components['schemas']['InsightsStrictTrustHideNotifyDto'];
16285
16428
  export type InsightsStrictTrustHideNotifyResultDto = components['schemas']['InsightsStrictTrustHideNotifyResultDto'];
16286
16429
  export type IngestCoveragePipelineDto = components['schemas']['IngestCoveragePipelineDto'];
16430
+ export type IngestCoverageMetricsRollupDto = components['schemas']['IngestCoverageMetricsRollupDto'];
16287
16431
  export type IngestCoverageDto = components['schemas']['IngestCoverageDto'];
16288
16432
  export type IngestRunDto = components['schemas']['IngestRunDto'];
16289
16433
  export type IngestRunListDto = components['schemas']['IngestRunListDto'];
@@ -18285,6 +18429,221 @@ export interface operations {
18285
18429
  };
18286
18430
  };
18287
18431
  };
18432
+ adminGetDesignAdoption: {
18433
+ parameters: {
18434
+ query?: {
18435
+ /** @description Keep people who are active members of this workspace. */
18436
+ workspaceId?: string;
18437
+ /** @description Current saved design. `v2` is the new design, `v1` is classic (including people who never tried the new design), `none` is no saved choice. */
18438
+ design?: "v1" | "v2" | "none";
18439
+ /** @description Page size (default 50, max 200). */
18440
+ limit?: number;
18441
+ /** @description Number of matching people to skip. */
18442
+ offset?: number;
18443
+ };
18444
+ header?: never;
18445
+ path?: never;
18446
+ cookie?: never;
18447
+ };
18448
+ requestBody?: never;
18449
+ responses: {
18450
+ /** @description Adoption totals, switch-back reasons, and one page of people. */
18451
+ 200: {
18452
+ headers: {
18453
+ [name: string]: unknown;
18454
+ };
18455
+ content: {
18456
+ "application/json": components["schemas"]["DesignAdoptionDto"];
18457
+ };
18458
+ };
18459
+ /** @description Invalid workspaceId, design, limit, or offset. */
18460
+ 400: {
18461
+ headers: {
18462
+ [name: string]: unknown;
18463
+ };
18464
+ content: {
18465
+ /**
18466
+ * @example {
18467
+ * "error": "design must be v1, v2, or none",
18468
+ * "code": "invalid_query"
18469
+ * }
18470
+ */
18471
+ "application/json": components["schemas"]["ErrorMessageDto"];
18472
+ };
18473
+ };
18474
+ 401: components["responses"]["Unauthorized"];
18475
+ /** @description Caller is not a platform admin. */
18476
+ 403: {
18477
+ headers: {
18478
+ [name: string]: unknown;
18479
+ };
18480
+ content: {
18481
+ /**
18482
+ * @example {
18483
+ * "error": "Forbidden",
18484
+ * "code": "forbidden"
18485
+ * }
18486
+ */
18487
+ "application/json": components["schemas"]["ErrorMessageDto"];
18488
+ };
18489
+ };
18490
+ /** @description Design adoption store is unavailable. */
18491
+ 503: {
18492
+ headers: {
18493
+ [name: string]: unknown;
18494
+ };
18495
+ content: {
18496
+ /**
18497
+ * @example {
18498
+ * "error": "Design adoption is unavailable",
18499
+ * "code": "design_adoption_unavailable"
18500
+ * }
18501
+ */
18502
+ "application/json": components["schemas"]["ErrorMessageDto"];
18503
+ };
18504
+ };
18505
+ };
18506
+ };
18507
+ adminExportDesignAdoptionCsv: {
18508
+ parameters: {
18509
+ query?: {
18510
+ workspaceId?: string;
18511
+ design?: "v1" | "v2" | "none";
18512
+ };
18513
+ header?: never;
18514
+ path?: never;
18515
+ cookie?: never;
18516
+ };
18517
+ requestBody?: never;
18518
+ responses: {
18519
+ /** @description CSV file of matching people. */
18520
+ 200: {
18521
+ headers: {
18522
+ [name: string]: unknown;
18523
+ };
18524
+ content: {
18525
+ "text/csv": string;
18526
+ };
18527
+ };
18528
+ /** @description Invalid workspaceId or design. */
18529
+ 400: {
18530
+ headers: {
18531
+ [name: string]: unknown;
18532
+ };
18533
+ content: {
18534
+ /**
18535
+ * @example {
18536
+ * "error": "workspaceId must be a uuid",
18537
+ * "code": "invalid_query"
18538
+ * }
18539
+ */
18540
+ "application/json": components["schemas"]["ErrorMessageDto"];
18541
+ };
18542
+ };
18543
+ 401: components["responses"]["Unauthorized"];
18544
+ /** @description Caller is not a platform admin. */
18545
+ 403: {
18546
+ headers: {
18547
+ [name: string]: unknown;
18548
+ };
18549
+ content: {
18550
+ /**
18551
+ * @example {
18552
+ * "error": "Forbidden",
18553
+ * "code": "forbidden"
18554
+ * }
18555
+ */
18556
+ "application/json": components["schemas"]["ErrorMessageDto"];
18557
+ };
18558
+ };
18559
+ /** @description Design adoption store is unavailable. */
18560
+ 503: {
18561
+ headers: {
18562
+ [name: string]: unknown;
18563
+ };
18564
+ content: {
18565
+ "application/json": components["schemas"]["ErrorMessageDto"];
18566
+ };
18567
+ };
18568
+ };
18569
+ };
18570
+ adminGetDesignAdoptionPerson: {
18571
+ parameters: {
18572
+ query?: never;
18573
+ header?: never;
18574
+ path: {
18575
+ userId: string;
18576
+ };
18577
+ cookie?: never;
18578
+ };
18579
+ requestBody?: never;
18580
+ responses: {
18581
+ /** @description One person and their switch events. */
18582
+ 200: {
18583
+ headers: {
18584
+ [name: string]: unknown;
18585
+ };
18586
+ content: {
18587
+ "application/json": components["schemas"]["DesignAdoptionPersonDetailDto"];
18588
+ };
18589
+ };
18590
+ /** @description userId is not a uuid. */
18591
+ 400: {
18592
+ headers: {
18593
+ [name: string]: unknown;
18594
+ };
18595
+ content: {
18596
+ /**
18597
+ * @example {
18598
+ * "error": "Invalid user ID format",
18599
+ * "code": "invalid_user_id"
18600
+ * }
18601
+ */
18602
+ "application/json": components["schemas"]["ErrorMessageDto"];
18603
+ };
18604
+ };
18605
+ 401: components["responses"]["Unauthorized"];
18606
+ /** @description Caller is not a platform admin. */
18607
+ 403: {
18608
+ headers: {
18609
+ [name: string]: unknown;
18610
+ };
18611
+ content: {
18612
+ /**
18613
+ * @example {
18614
+ * "error": "Forbidden",
18615
+ * "code": "forbidden"
18616
+ * }
18617
+ */
18618
+ "application/json": components["schemas"]["ErrorMessageDto"];
18619
+ };
18620
+ };
18621
+ /** @description No active user with that id. */
18622
+ 404: {
18623
+ headers: {
18624
+ [name: string]: unknown;
18625
+ };
18626
+ content: {
18627
+ /**
18628
+ * @example {
18629
+ * "error": "User not found",
18630
+ * "code": "user_not_found"
18631
+ * }
18632
+ */
18633
+ "application/json": components["schemas"]["ErrorMessageDto"];
18634
+ };
18635
+ };
18636
+ /** @description Design adoption store is unavailable. */
18637
+ 503: {
18638
+ headers: {
18639
+ [name: string]: unknown;
18640
+ };
18641
+ content: {
18642
+ "application/json": components["schemas"]["ErrorMessageDto"];
18643
+ };
18644
+ };
18645
+ };
18646
+ };
18288
18647
  adminCreateJobsSession: {
18289
18648
  parameters: {
18290
18649
  query?: never;
package/src/index.ts CHANGED
@@ -1777,10 +1777,17 @@ export interface IngestCoveragePipelineDto {
1777
1777
  dataTrust: DataTrustDto;
1778
1778
  }
1779
1779
 
1780
+ /** ADR 006: dirty-week metrics rollup lag on GET ingest-coverage. */
1781
+ export interface IngestCoverageMetricsRollupDto {
1782
+ dirtyWeekCount: number;
1783
+ }
1784
+
1780
1785
  /** Response body for GET /workspaces/:id/ingest-coverage. */
1781
1786
  export interface IngestCoverageDto {
1782
1787
  pipelines: IngestCoveragePipelineDto[];
1783
1788
  generatedAt?: string;
1789
+ /** Present when at least one week is dirty (or count is 0 after a successful read). */
1790
+ metricsRollup?: IngestCoverageMetricsRollupDto | null;
1784
1791
  }
1785
1792
 
1786
1793
  export type IngestRunKind = Exclude<