@thinkai/tai-api-contract 2.211.1 → 2.213.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.
@@ -951,12 +951,12 @@ export interface paths {
951
951
  };
952
952
  /**
953
953
  * Get enterprise SAML SSO configuration
954
- * @description Returns per-workspace enterprise SSO binding (`ssoProviderId`, domains, join policy). Member-level read. Does not return IdP metadata XML.
954
+ * @description Returns per-workspace enterprise SSO status (`pending` / `active` / …), domains, join policy, and optional IdP metadata URL. Member-level read. Does not return IdP metadata XML. `ssoProviderId` is present only after platform Apply.
955
955
  */
956
956
  get: operations["getWorkspaceEnterpriseSso"];
957
957
  /**
958
- * Set enterprise SAML SSO configuration
959
- * @description Full-replace workspace enterprise SSO config. Bind a Supabase `sso_provider_id` (from `supabase sso add` for Okta or Entra) and one or more email domains. `joinPolicy: domain_auto_join` grants viewer membership on first `GET /me/workspaces` after SSO login when the JWT email domain matches. Requires workspace **admin**. Domains must be unique across enabled workspaces (`409 sso_domain_conflict`).
958
+ * Submit or update a pending enterprise SSO request
959
+ * @description Workspace **admin** submits Okta or Entra IdP details (`metadataUrl`, domains, join policy). Sets `status=pending`, `enabled=false`, and clears `ssoProviderId`. Platform admins register the IdP via `POST /admin/enterprise-sso/{workspaceId}/apply`. Domains must be unique across pending and active workspaces (`409 sso_domain_conflict`). Rejected when SSO is already active (`409 enterprise_sso_already_active`).
960
960
  */
961
961
  put: operations["putWorkspaceEnterpriseSso"];
962
962
  post?: never;
@@ -966,6 +966,66 @@ export interface paths {
966
966
  patch?: never;
967
967
  trace?: never;
968
968
  };
969
+ "/admin/enterprise-sso/pending": {
970
+ parameters: {
971
+ query?: never;
972
+ header?: never;
973
+ path?: never;
974
+ cookie?: never;
975
+ };
976
+ /**
977
+ * List pending enterprise SSO requests
978
+ * @description Platform admin only. Returns workspaces with `status=pending`.
979
+ */
980
+ get: operations["listAdminEnterpriseSsoPending"];
981
+ put?: never;
982
+ post?: never;
983
+ delete?: never;
984
+ options?: never;
985
+ head?: never;
986
+ patch?: never;
987
+ trace?: never;
988
+ };
989
+ "/admin/enterprise-sso/{workspaceId}/apply": {
990
+ parameters: {
991
+ query?: never;
992
+ header?: never;
993
+ path?: never;
994
+ cookie?: never;
995
+ };
996
+ get?: never;
997
+ put?: never;
998
+ /**
999
+ * Apply a pending enterprise SSO request
1000
+ * @description Platform admin only. Creates a SAML SSO provider on ThinkAI Auth from the workspace pending `metadataUrl` and domains, then sets `status=active` and `enabled=true`. `dedicatedScope` defaults to true when `idpType` is `entra`.
1001
+ */
1002
+ post: operations["postAdminEnterpriseSsoApply"];
1003
+ delete?: never;
1004
+ options?: never;
1005
+ head?: never;
1006
+ patch?: never;
1007
+ trace?: never;
1008
+ };
1009
+ "/admin/enterprise-sso/{workspaceId}/reject": {
1010
+ parameters: {
1011
+ query?: never;
1012
+ header?: never;
1013
+ path?: never;
1014
+ cookie?: never;
1015
+ };
1016
+ get?: never;
1017
+ put?: never;
1018
+ /**
1019
+ * Reject a pending enterprise SSO request
1020
+ * @description Platform admin only. Sets `status=rejected` and optional `rejectReason`.
1021
+ */
1022
+ post: operations["postAdminEnterpriseSsoReject"];
1023
+ delete?: never;
1024
+ options?: never;
1025
+ head?: never;
1026
+ patch?: never;
1027
+ trace?: never;
1028
+ };
969
1029
  "/workspaces/{workspaceId}/productivity-targets": {
970
1030
  parameters: {
971
1031
  query?: never;
@@ -6758,11 +6818,16 @@ export interface components {
6758
6818
  };
6759
6819
  };
6760
6820
  WorkspaceSsoConfigDto: {
6761
- /** @description When true, enterprise SAML SSO is active for the listed domains. */
6821
+ /**
6822
+ * @description Lifecycle of the SSO binding. Sign-in (`/auth/sso-lookup`) is available only when `status` is `active` and `enabled` is true with a provider id.
6823
+ * @enum {string}
6824
+ */
6825
+ status: "pending" | "active" | "rejected" | "disabled";
6826
+ /** @description When true with `status=active`, enterprise SAML SSO is live for the listed domains. */
6762
6827
  enabled: boolean;
6763
6828
  /**
6764
6829
  * Format: uuid
6765
- * @description Supabase Auth SSO provider id from `supabase sso add` / dashboard.
6830
+ * @description ThinkAI Auth SSO provider id set by platform Apply (null while pending).
6766
6831
  */
6767
6832
  ssoProviderId: string | null;
6768
6833
  /**
@@ -6778,13 +6843,77 @@ export interface components {
6778
6843
  */
6779
6844
  joinPolicy: "invite_only" | "domain_auto_join";
6780
6845
  /**
6781
- * @description Optional label for UI / ops (Okta, Microsoft Entra, or generic SAML).
6846
+ * @description IdP label (Okta / Microsoft Entra; `saml` is legacy).
6782
6847
  * @enum {string|null}
6783
6848
  */
6784
6849
  idpType?: "okta" | "entra" | "saml" | null;
6785
- /** @description Ops-only label or URL reference; never raw SAML metadata XML. */
6850
+ /**
6851
+ * Format: uri
6852
+ * @description HTTPS IdP SAML metadata URL from the customer IdP admin.
6853
+ */
6854
+ metadataUrl?: string | null;
6855
+ /** @description Optional ops label; not the IdP metadata URL. */
6856
+ metadataRef?: string | null;
6857
+ /** @description Present when `status` is `rejected`. */
6858
+ rejectReason?: string | null;
6859
+ };
6860
+ WorkspaceSsoRequestDto: {
6861
+ /**
6862
+ * @description Which company IdP the workspace is connecting.
6863
+ * @enum {string}
6864
+ */
6865
+ idpType: "okta" | "entra";
6866
+ /**
6867
+ * Format: uri
6868
+ * @description HTTPS Identity Provider metadata URL from Okta or Entra.
6869
+ */
6870
+ metadataUrl: string;
6871
+ /**
6872
+ * @description Work email domains that should use this IdP.
6873
+ * @example [
6874
+ * "acme.com"
6875
+ * ]
6876
+ */
6877
+ domains: string[];
6878
+ /** @enum {string} */
6879
+ joinPolicy: "invite_only" | "domain_auto_join";
6880
+ /** @description Optional internal ops label (not the metadata URL). */
6881
+ metadataRef?: string | null;
6882
+ };
6883
+ AdminEnterpriseSsoPendingListDto: {
6884
+ items: components["schemas"]["AdminEnterpriseSsoPendingItemDto"][];
6885
+ };
6886
+ AdminEnterpriseSsoPendingItemDto: {
6887
+ /** Format: uuid */
6888
+ workspaceId: string;
6889
+ workspaceSlug: string;
6890
+ workspaceName: string;
6891
+ /** Format: date-time */
6892
+ submittedAt: string;
6893
+ /** @enum {string|null} */
6894
+ idpType?: "okta" | "entra" | "saml" | null;
6895
+ domains: string[];
6896
+ metadataUrl?: string | null;
6897
+ /** @enum {string} */
6898
+ joinPolicy: "invite_only" | "domain_auto_join";
6786
6899
  metadataRef?: string | null;
6787
6900
  };
6901
+ AdminEnterpriseSsoApplyRequestDto: {
6902
+ /** @description When true, Auth may allocate a dedicated ACS (recommended for Entra). Defaults to true for Entra and false for Okta when omitted. */
6903
+ dedicatedScope?: boolean;
6904
+ };
6905
+ AdminEnterpriseSsoApplyResponseDto: {
6906
+ /** Format: uuid */
6907
+ workspaceId: string;
6908
+ /** Format: uuid */
6909
+ ssoProviderId: string;
6910
+ /** @enum {string} */
6911
+ status: "active";
6912
+ dedicatedScope: boolean;
6913
+ };
6914
+ AdminEnterpriseSsoRejectRequestDto: {
6915
+ reason?: string;
6916
+ };
6788
6917
  AuthSsoLookupDto: {
6789
6918
  available: boolean;
6790
6919
  domain: string;
@@ -11108,6 +11237,18 @@ export interface components {
11108
11237
  depthScan: components["schemas"]["IngestCoverageProductivityDepthScanDto"];
11109
11238
  weekReconcile: components["schemas"]["IngestCoverageProductivityWeekReconcileDto"];
11110
11239
  };
11240
+ /** @description Post-ingest ship-weight scoring progress for org-ledger GitHub PRs. Additive to Backfill complete, Source verified, and Data trust — does not change pipeline status. Aligns with Home Ship weight BACKFILLING (pendingCount > 0). */
11241
+ IngestCoverageShipWeightScoringDto: {
11242
+ /**
11243
+ * @description up_to_date when no GitHub ledger PRs in the window lack shipWeight; in_progress when pendingCount > 0.
11244
+ * @enum {string}
11245
+ */
11246
+ status: "up_to_date" | "in_progress";
11247
+ /** @description Distinct org-ledger GitHub merged PRs in the window still missing shipWeight. */
11248
+ pendingCount: number;
11249
+ /** @description Inclusive calendar-day window ending today (UTC), matching Home ship-weight KPIs (30). */
11250
+ windowDays: number;
11251
+ };
11111
11252
  IngestCoverageProductivityDetailDto: {
11112
11253
  /** @enum {string|null} */
11113
11254
  phase?: "recent" | "historical" | "complete" | null;
@@ -11119,6 +11260,8 @@ export interface components {
11119
11260
  repos?: components["schemas"]["IngestCoverageProductivityRepoDto"][];
11120
11261
  /** @description Latest depth-scan and week-reconcile summary from stored activity rows. Null when neither event exists. The coverage GET does not run a scan. */
11121
11262
  selfHeal?: components["schemas"]["IngestCoverageProductivitySelfHealDto"] | null;
11263
+ /** @description Org-ledger ship-weight scoring for the Home-aligned window. Null when metrics cannot be loaded. Separate from productivity backfill phase / Backfill complete. */
11264
+ shipWeightScoring?: components["schemas"]["IngestCoverageShipWeightScoringDto"] | null;
11122
11265
  /**
11123
11266
  * @description Whether the latest depth-scan sample counts as source-verified. unverified when phase is not complete or no depth scan has completed. stale when phase is complete and the scan is at least 7 days old. insufficient_sample when a fresh scan has no usable GitHub merge count. below_target when that fresh minimum capture is under 90. verified when it is 90 or higher. Other pipeline kinds omit this field.
11124
11267
  * @enum {string}
@@ -13726,6 +13869,12 @@ export type AiModelPolicyConfigDto = components['schemas']['AiModelPolicyConfigD
13726
13869
  export type AiModelPolicyPersonOverrideDto = components['schemas']['AiModelPolicyPersonOverrideDto'];
13727
13870
  export type AiModelPolicyDto = components['schemas']['AiModelPolicyDto'];
13728
13871
  export type WorkspaceSsoConfigDto = components['schemas']['WorkspaceSsoConfigDto'];
13872
+ export type WorkspaceSsoRequestDto = components['schemas']['WorkspaceSsoRequestDto'];
13873
+ export type AdminEnterpriseSsoPendingListDto = components['schemas']['AdminEnterpriseSsoPendingListDto'];
13874
+ export type AdminEnterpriseSsoPendingItemDto = components['schemas']['AdminEnterpriseSsoPendingItemDto'];
13875
+ export type AdminEnterpriseSsoApplyRequestDto = components['schemas']['AdminEnterpriseSsoApplyRequestDto'];
13876
+ export type AdminEnterpriseSsoApplyResponseDto = components['schemas']['AdminEnterpriseSsoApplyResponseDto'];
13877
+ export type AdminEnterpriseSsoRejectRequestDto = components['schemas']['AdminEnterpriseSsoRejectRequestDto'];
13729
13878
  export type AuthSsoLookupDto = components['schemas']['AuthSsoLookupDto'];
13730
13879
  export type ProductivityTargetsDto = components['schemas']['ProductivityTargetsDto'];
13731
13880
  export type DimensionTargetPercentsDto = components['schemas']['DimensionTargetPercentsDto'];
@@ -14090,6 +14239,7 @@ export type ProductivityDualVcsCutoverPatchDto = components['schemas']['Producti
14090
14239
  export type IngestCoverageProductivityDepthScanDto = components['schemas']['IngestCoverageProductivityDepthScanDto'];
14091
14240
  export type IngestCoverageProductivityWeekReconcileDto = components['schemas']['IngestCoverageProductivityWeekReconcileDto'];
14092
14241
  export type IngestCoverageProductivitySelfHealDto = components['schemas']['IngestCoverageProductivitySelfHealDto'];
14242
+ export type IngestCoverageShipWeightScoringDto = components['schemas']['IngestCoverageShipWeightScoringDto'];
14093
14243
  export type IngestCoverageProductivityDetailDto = components['schemas']['IngestCoverageProductivityDetailDto'];
14094
14244
  export type IngestCoverageFactFamilyDto = components['schemas']['IngestCoverageFactFamilyDto'];
14095
14245
  export type IngestCoverageAiDetailDto = components['schemas']['IngestCoverageAiDetailDto'];
@@ -17283,11 +17433,11 @@ export interface operations {
17283
17433
  };
17284
17434
  requestBody: {
17285
17435
  content: {
17286
- "application/json": components["schemas"]["WorkspaceSsoConfigDto"];
17436
+ "application/json": components["schemas"]["WorkspaceSsoRequestDto"];
17287
17437
  };
17288
17438
  };
17289
17439
  responses: {
17290
- /** @description Config persisted */
17440
+ /** @description Pending request persisted */
17291
17441
  204: {
17292
17442
  headers: {
17293
17443
  [name: string]: unknown;
@@ -17322,7 +17472,137 @@ export interface operations {
17322
17472
  "application/json": components["schemas"]["ErrorMessageDto"];
17323
17473
  };
17324
17474
  };
17325
- /** @description Email domain already bound to another workspace */
17475
+ /** @description Domain conflict or SSO already active */
17476
+ 409: {
17477
+ headers: {
17478
+ [name: string]: unknown;
17479
+ };
17480
+ content: {
17481
+ "application/json": components["schemas"]["ErrorMessageDto"];
17482
+ };
17483
+ };
17484
+ };
17485
+ };
17486
+ listAdminEnterpriseSsoPending: {
17487
+ parameters: {
17488
+ query?: never;
17489
+ header?: never;
17490
+ path?: never;
17491
+ cookie?: never;
17492
+ };
17493
+ requestBody?: never;
17494
+ responses: {
17495
+ /** @description Pending queue */
17496
+ 200: {
17497
+ headers: {
17498
+ [name: string]: unknown;
17499
+ };
17500
+ content: {
17501
+ "application/json": components["schemas"]["AdminEnterpriseSsoPendingListDto"];
17502
+ };
17503
+ };
17504
+ 401: components["responses"]["Unauthorized"];
17505
+ 403: components["responses"]["Forbidden"];
17506
+ };
17507
+ };
17508
+ postAdminEnterpriseSsoApply: {
17509
+ parameters: {
17510
+ query?: never;
17511
+ header?: never;
17512
+ path: {
17513
+ workspaceId: components["parameters"]["WorkspaceId"];
17514
+ };
17515
+ cookie?: never;
17516
+ };
17517
+ requestBody?: {
17518
+ content: {
17519
+ "application/json": components["schemas"]["AdminEnterpriseSsoApplyRequestDto"];
17520
+ };
17521
+ };
17522
+ responses: {
17523
+ /** @description Provider created and workspace activated */
17524
+ 200: {
17525
+ headers: {
17526
+ [name: string]: unknown;
17527
+ };
17528
+ content: {
17529
+ "application/json": components["schemas"]["AdminEnterpriseSsoApplyResponseDto"];
17530
+ };
17531
+ };
17532
+ /** @description Invalid pending payload */
17533
+ 400: {
17534
+ headers: {
17535
+ [name: string]: unknown;
17536
+ };
17537
+ content: {
17538
+ "application/json": components["schemas"]["ErrorMessageDto"];
17539
+ };
17540
+ };
17541
+ 401: components["responses"]["Unauthorized"];
17542
+ 403: components["responses"]["Forbidden"];
17543
+ /** @description Workspace not found */
17544
+ 404: {
17545
+ headers: {
17546
+ [name: string]: unknown;
17547
+ };
17548
+ content: {
17549
+ "application/json": components["schemas"]["ErrorMessageDto"];
17550
+ };
17551
+ };
17552
+ /** @description Not pending */
17553
+ 409: {
17554
+ headers: {
17555
+ [name: string]: unknown;
17556
+ };
17557
+ content: {
17558
+ "application/json": components["schemas"]["ErrorMessageDto"];
17559
+ };
17560
+ };
17561
+ /** @description ThinkAI Auth rejected provider create */
17562
+ 502: {
17563
+ headers: {
17564
+ [name: string]: unknown;
17565
+ };
17566
+ content: {
17567
+ "application/json": components["schemas"]["ErrorMessageDto"];
17568
+ };
17569
+ };
17570
+ };
17571
+ };
17572
+ postAdminEnterpriseSsoReject: {
17573
+ parameters: {
17574
+ query?: never;
17575
+ header?: never;
17576
+ path: {
17577
+ workspaceId: components["parameters"]["WorkspaceId"];
17578
+ };
17579
+ cookie?: never;
17580
+ };
17581
+ requestBody?: {
17582
+ content: {
17583
+ "application/json": components["schemas"]["AdminEnterpriseSsoRejectRequestDto"];
17584
+ };
17585
+ };
17586
+ responses: {
17587
+ /** @description Rejected */
17588
+ 204: {
17589
+ headers: {
17590
+ [name: string]: unknown;
17591
+ };
17592
+ content?: never;
17593
+ };
17594
+ 401: components["responses"]["Unauthorized"];
17595
+ 403: components["responses"]["Forbidden"];
17596
+ /** @description Workspace not found */
17597
+ 404: {
17598
+ headers: {
17599
+ [name: string]: unknown;
17600
+ };
17601
+ content: {
17602
+ "application/json": components["schemas"]["ErrorMessageDto"];
17603
+ };
17604
+ };
17605
+ /** @description Not pending */
17326
17606
  409: {
17327
17607
  headers: {
17328
17608
  [name: string]: unknown;
package/src/index.ts CHANGED
@@ -1500,6 +1500,13 @@ export interface IngestCoverageSourceReconcileDto {
1500
1500
  storedChecksum: string | null;
1501
1501
  }
1502
1502
 
1503
+ /** Org-ledger ship-weight scoring for the Home-aligned window (ingest-coverage). */
1504
+ export interface IngestCoverageShipWeightScoringDto {
1505
+ status: "up_to_date" | "in_progress";
1506
+ pendingCount: number;
1507
+ windowDays: number;
1508
+ }
1509
+
1503
1510
  export interface IngestCoverageProductivityDetailDto {
1504
1511
  phase?: "recent" | "historical" | "complete" | null;
1505
1512
  historicalWeekStart?: string | null;
@@ -1513,6 +1520,11 @@ export interface IngestCoverageProductivityDetailDto {
1513
1520
  * event are stored. Absent from pipelines that are omitted.
1514
1521
  */
1515
1522
  selfHeal?: IngestCoverageProductivitySelfHealDto | null;
1523
+ /**
1524
+ * Org-ledger ship-weight scoring for the Home-aligned window. Null when metrics cannot
1525
+ * be loaded. Separate from productivity backfill phase / Backfill complete.
1526
+ */
1527
+ shipWeightScoring?: IngestCoverageShipWeightScoringDto | null;
1516
1528
  /**
1517
1529
  * Always present when this productivity object is present.
1518
1530
  * `unverified` when phase is not complete or no depth scan has completed.