@company-semantics/contracts 0.72.0 → 0.73.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@company-semantics/contracts",
3
- "version": "0.72.0",
3
+ "version": "0.73.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/src/index.ts CHANGED
@@ -198,6 +198,15 @@ export type {
198
198
  SsoReadinessCheck,
199
199
  SsoReadiness,
200
200
  SsoEnforcementStatus,
201
+ // SSO stepper types (PRD-00197)
202
+ ProviderStatus,
203
+ WorkspaceSsoState,
204
+ SsoStepperStep,
205
+ OwnerIdentityInfo,
206
+ OidcValidationResult,
207
+ TestSsoInitiation,
208
+ TestSsoResult,
209
+ ProviderSuggestion,
201
210
  WorkspaceAuditEvent,
202
211
  // Workspace expansion DTOs (Phase 3)
203
212
  // @see ADR-CONT-031 for design rationale
package/src/org/index.ts CHANGED
@@ -22,6 +22,15 @@ export type {
22
22
  SsoReadinessCheck,
23
23
  SsoReadiness,
24
24
  SsoEnforcementStatus,
25
+ // SSO stepper types (PRD-00197)
26
+ ProviderStatus,
27
+ WorkspaceSsoState,
28
+ SsoStepperStep,
29
+ OwnerIdentityInfo,
30
+ OidcValidationResult,
31
+ TestSsoInitiation,
32
+ TestSsoResult,
33
+ ProviderSuggestion,
25
34
  WorkspaceAuditEvent,
26
35
  // Workspace expansion DTOs (Phase 3)
27
36
  OrgInviteStatus,
package/src/org/types.ts CHANGED
@@ -137,6 +137,22 @@ export interface SsoSetupInfo {
137
137
  hasClientId: boolean;
138
138
  /** Whether an encrypted client secret is stored. NEVER return the actual value. */
139
139
  hasClientSecret: boolean;
140
+ /** Provider-level configuration status (state machine position). */
141
+ providerStatus: ProviderStatus;
142
+ /** Backend-authoritative stepper step derivation. Frontend MUST NOT re-derive. */
143
+ currentStep: SsoStepperStep;
144
+ /** True when enforce step is completed (ENABLED + requireSso). */
145
+ stepCompleted: boolean;
146
+ /** Currently active SSO provider, or null if none configured. */
147
+ activeProvider: string | null;
148
+ /** Validation result from OIDC discovery check, if available. */
149
+ oidcValidation?: OidcValidationResult;
150
+ /** ISO 8601 timestamp when OIDC credentials were last saved. */
151
+ credentialsSavedAt?: string;
152
+ /** ISO 8601 timestamp of last successful SSO test. */
153
+ lastTestSuccessAt?: string;
154
+ /** Provider used for last successful SSO test. Must match activeProvider for validity. */
155
+ lastTestSuccessProvider?: string;
140
156
  }
141
157
 
142
158
  /**
@@ -175,6 +191,71 @@ export interface SsoEnforcementStatus {
175
191
  enforcedSince: string | null;
176
192
  }
177
193
 
194
+ // =============================================================================
195
+ // SSO Stepper Types (PRD-00197)
196
+ // Types for the provider state machine, workspace SSO state, stepper step,
197
+ // and supporting types for the SSO stepper redesign.
198
+ // =============================================================================
199
+
200
+ /**
201
+ * Provider-level configuration lifecycle.
202
+ * NOT_CONFIGURED → CONFIG_SAVED → CONFIG_VALID → TEST_SUCCESS → ENABLED
203
+ * Any state → NOT_CONFIGURED (on credential removal or provider switch)
204
+ */
205
+ export type ProviderStatus =
206
+ | 'NOT_CONFIGURED'
207
+ | 'CONFIG_SAVED'
208
+ | 'CONFIG_VALID'
209
+ | 'TEST_SUCCESS'
210
+ | 'ENABLED';
211
+
212
+ /** Workspace SSO state derived from provider status + policy. */
213
+ export type WorkspaceSsoState = 'SSO_DISABLED' | 'SSO_ENABLED' | 'SSO_ENFORCED';
214
+
215
+ /** Backend-authoritative stepper step. Frontend MUST NOT re-derive. */
216
+ export type SsoStepperStep = 'configure' | 'test' | 'enable' | 'enforce';
217
+
218
+ /** Owner identity information for the SSO readiness surface. */
219
+ export interface OwnerIdentityInfo {
220
+ userId: string;
221
+ name: string;
222
+ email: string;
223
+ hasSsoIdentity: boolean;
224
+ linkedProvider: string | null;
225
+ lastSsoLoginAt: string | null;
226
+ }
227
+
228
+ /** Result of validating an OIDC discovery URL. */
229
+ export interface OidcValidationResult {
230
+ valid: boolean;
231
+ issuer?: string;
232
+ authorizationEndpoint?: string;
233
+ error?: string;
234
+ errorCode?: 'UNREACHABLE' | 'INVALID_DOCUMENT' | 'MISSING_FIELDS' | 'SSRF_BLOCKED';
235
+ }
236
+
237
+ /** Initiation payload for a test SSO login attempt. */
238
+ export interface TestSsoInitiation {
239
+ authorizationUrl: string;
240
+ attemptId: string;
241
+ }
242
+
243
+ /** Result of a test SSO login attempt. */
244
+ export interface TestSsoResult {
245
+ status: 'pending' | 'success' | 'failed' | 'expired';
246
+ claims?: { sub: string; email?: string; name?: string; issuer: string };
247
+ identityLinked?: boolean;
248
+ error?: string;
249
+ errorCode?: 'IDENTITY_CONFLICT' | 'DOMAIN_MISMATCH' | 'ISSUER_MISMATCH' | 'CALLBACK_ERROR';
250
+ }
251
+
252
+ /** MX-based provider suggestion for SSO setup. */
253
+ export interface ProviderSuggestion {
254
+ suggestedProvider: 'google' | 'microsoft' | null;
255
+ confidence: 'high' | 'low';
256
+ reason: string;
257
+ }
258
+
178
259
  /**
179
260
  * Workspace authentication configuration.
180
261
  * Enabled auth methods and provider metadata.
@@ -212,6 +293,12 @@ export interface WorkspaceAuthConfig {
212
293
  * Populated when requester has org.manage_auth capability.
213
294
  */
214
295
  ssoEnforcement?: SsoEnforcementStatus;
296
+ /** Derived workspace SSO state. Admin-only — omitted for non-admin requests. */
297
+ workspaceSsoState?: WorkspaceSsoState;
298
+ /** Owner identity linking info for SSO readiness. Admin-only. */
299
+ ownerIdentities?: OwnerIdentityInfo[];
300
+ /** MX-based provider suggestion. Admin-only. */
301
+ providerSuggestion?: ProviderSuggestion;
215
302
  }
216
303
 
217
304
  /**