@company-semantics/contracts 86.1.0 → 88.0.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 +14 -10
- package/src/api/generated-spec-hash.ts +2 -2
- package/src/api/generated.ts +50 -262
- package/src/chat/README.md +8 -20
- package/src/chat/__tests__/compaction-boundary.test.ts +1 -0
- package/src/chat/__tests__/continuity.test.ts +1 -0
- package/src/chat/__tests__/discussion-scope.test.ts +0 -7
- package/src/chat/__tests__/message-mentions.test.ts +1 -12
- package/src/chat/__tests__/multi-party.test.ts +15 -6
- package/src/chat/__tests__/page-context.test.ts +3 -3
- package/src/chat/enums.ts +24 -11
- package/src/chat/index.ts +4 -16
- package/src/chat/schemas.ts +9 -71
- package/src/chat/types.ts +25 -77
- package/src/generated/openapi-routes.ts +1 -4
- package/src/guards/README.md +0 -1
- package/src/guards/config.ts +1 -10
- package/src/guards/evolution-config.ts +1 -18
- package/src/guards/index.ts +0 -1
- package/src/index.ts +15 -1279
- package/src/notifications/__tests__/__snapshots__/monospace-budget.test.ts.snap +4 -4
- package/src/notifications/__tests__/__snapshots__/render-snapshot.test.ts.snap +50 -49
- package/src/notifications/__tests__/fixtures.ts +7 -7
- package/src/notifications/__tests__/render-snapshot.test.ts +7 -7
- package/src/notifications/kinds/chat-shared.ts +11 -5
- package/src/notifications/payloads.ts +5 -5
- package/src/org/README.md +0 -212
- package/src/org/__tests__/view-scopes.test.ts +0 -2
- package/src/org/authority-schemas.ts +242 -0
- package/src/org/index.ts +26 -249
- package/src/org/invite-schemas.ts +596 -0
- package/src/org/org-governance-schemas.ts +198 -0
- package/src/org/org-unit-api-schemas.ts +226 -0
- package/src/org/org-unit-schemas.ts +223 -0
- package/src/org/ownership-transfer-types.ts +51 -0
- package/src/org/schemas.ts +18 -1658
- package/src/org/sso-stepper-types.ts +81 -0
- package/src/org/types.ts +15 -115
- package/src/org/view-scopes.ts +0 -1
- package/src/org/workspace-admin-schemas.ts +240 -0
- package/src/root-exports/README.md +91 -0
- package/src/root-exports/agent-runtime.ts +213 -0
- package/src/root-exports/collaboration.ts +247 -0
- package/src/root-exports/delivery.ts +218 -0
- package/src/root-exports/org-structure.ts +214 -0
- package/src/root-exports/org-workspace.ts +254 -0
- package/src/root-exports/platform.ts +205 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSO Stepper Types (PRD-00197)
|
|
3
|
+
*
|
|
4
|
+
* Provider state machine, workspace SSO state, stepper step, OIDC validation,
|
|
5
|
+
* SSO test flow and provider-suggestion types.
|
|
6
|
+
*
|
|
7
|
+
* Split out of `./types.ts`, which re-exports this module unchanged — import
|
|
8
|
+
* from `./types` (or the `./org` entry), not from this file directly.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// =============================================================================
|
|
12
|
+
// SSO Stepper Types (PRD-00197)
|
|
13
|
+
// Types for the provider state machine, workspace SSO state, stepper step,
|
|
14
|
+
// and supporting types for the SSO stepper redesign.
|
|
15
|
+
// =============================================================================
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Provider-level configuration lifecycle.
|
|
19
|
+
* NOT_CONFIGURED → CONFIG_SAVED → CONFIG_VALID → TEST_SUCCESS → ENABLED
|
|
20
|
+
* Any state → NOT_CONFIGURED (on credential removal or provider switch)
|
|
21
|
+
*/
|
|
22
|
+
export type ProviderStatus =
|
|
23
|
+
| "NOT_CONFIGURED"
|
|
24
|
+
| "CONFIG_SAVED"
|
|
25
|
+
| "CONFIG_VALID"
|
|
26
|
+
| "TEST_SUCCESS"
|
|
27
|
+
| "ENABLED";
|
|
28
|
+
|
|
29
|
+
/** Workspace SSO state derived from provider status + policy. */
|
|
30
|
+
export type WorkspaceSsoState = "SSO_DISABLED" | "SSO_ENABLED" | "SSO_ENFORCED";
|
|
31
|
+
|
|
32
|
+
/** Backend-authoritative stepper step. Frontend MUST NOT re-derive. */
|
|
33
|
+
export type SsoStepperStep = "configure" | "test" | "enable" | "enforce";
|
|
34
|
+
|
|
35
|
+
/** Owner identity information for the SSO readiness surface. */
|
|
36
|
+
export interface OwnerIdentityInfo {
|
|
37
|
+
userId: string;
|
|
38
|
+
name: string;
|
|
39
|
+
email: string;
|
|
40
|
+
hasSsoIdentity: boolean;
|
|
41
|
+
linkedProvider: string | null;
|
|
42
|
+
lastSsoLoginAt: string | null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Result of validating an OIDC discovery URL. */
|
|
46
|
+
export interface OidcValidationResult {
|
|
47
|
+
valid: boolean;
|
|
48
|
+
issuer?: string;
|
|
49
|
+
authorizationEndpoint?: string;
|
|
50
|
+
error?: string;
|
|
51
|
+
errorCode?:
|
|
52
|
+
"UNREACHABLE" | "INVALID_DOCUMENT" | "MISSING_FIELDS" | "SSRF_BLOCKED";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Initiation payload for a test SSO login attempt. */
|
|
56
|
+
export interface TestSsoInitiation {
|
|
57
|
+
authorizationUrl: string;
|
|
58
|
+
attemptId: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Result of a test SSO login attempt. */
|
|
62
|
+
export interface TestSsoResult {
|
|
63
|
+
status: "pending" | "success" | "failed" | "expired";
|
|
64
|
+
claims?: { sub: string; email?: string; name?: string; issuer: string };
|
|
65
|
+
identityLinked?: boolean;
|
|
66
|
+
error?: string;
|
|
67
|
+
errorCode?:
|
|
68
|
+
| "IDENTITY_CONFLICT"
|
|
69
|
+
| "DOMAIN_MISMATCH"
|
|
70
|
+
| "ISSUER_MISMATCH"
|
|
71
|
+
| "CALLBACK_ERROR";
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** MX-based provider suggestion for SSO setup. */
|
|
75
|
+
export interface ProviderSuggestion {
|
|
76
|
+
suggestedProvider: "google" | "microsoft" | null;
|
|
77
|
+
confidence: "high" | "low";
|
|
78
|
+
reason: string;
|
|
79
|
+
/** The verified domain that triggered the suggestion (for pre-filling provider inputs). */
|
|
80
|
+
detectedDomain?: string;
|
|
81
|
+
}
|
package/src/org/types.ts
CHANGED
|
@@ -3,9 +3,23 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Vocabulary types for the personal → shared organization model.
|
|
5
5
|
* @see ADR-BE-XXX (Personal vs Shared Organization Model)
|
|
6
|
+
*
|
|
7
|
+
* The SSO stepper vocabulary (`./sso-stepper-types`) and the ownership-transfer
|
|
8
|
+
* DTOs (`./ownership-transfer-types`) live in sibling modules re-exported below,
|
|
9
|
+
* so `./types` stays the one import path for every org type.
|
|
6
10
|
*/
|
|
7
|
-
|
|
8
11
|
import type { OrgChartRole } from "../permissions/orgchart-roles";
|
|
12
|
+
import type {
|
|
13
|
+
OidcValidationResult,
|
|
14
|
+
OwnerIdentityInfo,
|
|
15
|
+
ProviderStatus,
|
|
16
|
+
ProviderSuggestion,
|
|
17
|
+
SsoStepperStep,
|
|
18
|
+
WorkspaceSsoState,
|
|
19
|
+
} from "./sso-stepper-types";
|
|
20
|
+
|
|
21
|
+
export * from "./sso-stepper-types";
|
|
22
|
+
export * from "./ownership-transfer-types";
|
|
9
23
|
|
|
10
24
|
/**
|
|
11
25
|
* Organization type distinguishes personal workspaces from shared organizations.
|
|
@@ -274,78 +288,6 @@ export interface SsoEnforcementStatus {
|
|
|
274
288
|
enforcedSince: string | null;
|
|
275
289
|
}
|
|
276
290
|
|
|
277
|
-
// =============================================================================
|
|
278
|
-
// SSO Stepper Types (PRD-00197)
|
|
279
|
-
// Types for the provider state machine, workspace SSO state, stepper step,
|
|
280
|
-
// and supporting types for the SSO stepper redesign.
|
|
281
|
-
// =============================================================================
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Provider-level configuration lifecycle.
|
|
285
|
-
* NOT_CONFIGURED → CONFIG_SAVED → CONFIG_VALID → TEST_SUCCESS → ENABLED
|
|
286
|
-
* Any state → NOT_CONFIGURED (on credential removal or provider switch)
|
|
287
|
-
*/
|
|
288
|
-
export type ProviderStatus =
|
|
289
|
-
| "NOT_CONFIGURED"
|
|
290
|
-
| "CONFIG_SAVED"
|
|
291
|
-
| "CONFIG_VALID"
|
|
292
|
-
| "TEST_SUCCESS"
|
|
293
|
-
| "ENABLED";
|
|
294
|
-
|
|
295
|
-
/** Workspace SSO state derived from provider status + policy. */
|
|
296
|
-
export type WorkspaceSsoState = "SSO_DISABLED" | "SSO_ENABLED" | "SSO_ENFORCED";
|
|
297
|
-
|
|
298
|
-
/** Backend-authoritative stepper step. Frontend MUST NOT re-derive. */
|
|
299
|
-
export type SsoStepperStep = "configure" | "test" | "enable" | "enforce";
|
|
300
|
-
|
|
301
|
-
/** Owner identity information for the SSO readiness surface. */
|
|
302
|
-
export interface OwnerIdentityInfo {
|
|
303
|
-
userId: string;
|
|
304
|
-
name: string;
|
|
305
|
-
email: string;
|
|
306
|
-
hasSsoIdentity: boolean;
|
|
307
|
-
linkedProvider: string | null;
|
|
308
|
-
lastSsoLoginAt: string | null;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
/** Result of validating an OIDC discovery URL. */
|
|
312
|
-
export interface OidcValidationResult {
|
|
313
|
-
valid: boolean;
|
|
314
|
-
issuer?: string;
|
|
315
|
-
authorizationEndpoint?: string;
|
|
316
|
-
error?: string;
|
|
317
|
-
errorCode?:
|
|
318
|
-
"UNREACHABLE" | "INVALID_DOCUMENT" | "MISSING_FIELDS" | "SSRF_BLOCKED";
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
/** Initiation payload for a test SSO login attempt. */
|
|
322
|
-
export interface TestSsoInitiation {
|
|
323
|
-
authorizationUrl: string;
|
|
324
|
-
attemptId: string;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
/** Result of a test SSO login attempt. */
|
|
328
|
-
export interface TestSsoResult {
|
|
329
|
-
status: "pending" | "success" | "failed" | "expired";
|
|
330
|
-
claims?: { sub: string; email?: string; name?: string; issuer: string };
|
|
331
|
-
identityLinked?: boolean;
|
|
332
|
-
error?: string;
|
|
333
|
-
errorCode?:
|
|
334
|
-
| "IDENTITY_CONFLICT"
|
|
335
|
-
| "DOMAIN_MISMATCH"
|
|
336
|
-
| "ISSUER_MISMATCH"
|
|
337
|
-
| "CALLBACK_ERROR";
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/** MX-based provider suggestion for SSO setup. */
|
|
341
|
-
export interface ProviderSuggestion {
|
|
342
|
-
suggestedProvider: "google" | "microsoft" | null;
|
|
343
|
-
confidence: "high" | "low";
|
|
344
|
-
reason: string;
|
|
345
|
-
/** The verified domain that triggered the suggestion (for pre-filling provider inputs). */
|
|
346
|
-
detectedDomain?: string;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
291
|
/**
|
|
350
292
|
* Workspace authentication configuration.
|
|
351
293
|
* Enabled auth methods and provider metadata.
|
|
@@ -739,48 +681,6 @@ export interface WorkspaceSettingsOverview extends WorkspaceInfoOverview {
|
|
|
739
681
|
};
|
|
740
682
|
}
|
|
741
683
|
|
|
742
|
-
// =============================================================================
|
|
743
|
-
// Ownership Transfer DTOs (PRD-00153)
|
|
744
|
-
// Rich types for the transfer UI flows, supplementing OwnershipTransferRequest
|
|
745
|
-
// and OwnershipTransferStatus above.
|
|
746
|
-
// =============================================================================
|
|
747
|
-
|
|
748
|
-
/** Request body for initiating ownership transfer (extends existing to include optional note). */
|
|
749
|
-
export interface TransferInitiateRequest {
|
|
750
|
-
readonly newOwnerEmail: string;
|
|
751
|
-
readonly note?: string;
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
/** Response for transfer status queries — extends existing OwnershipTransferStatus. */
|
|
755
|
-
export interface TransferStatusResponse {
|
|
756
|
-
readonly pending: boolean;
|
|
757
|
-
readonly newOwnerEmail?: string;
|
|
758
|
-
readonly note?: string;
|
|
759
|
-
readonly requestedAt?: string;
|
|
760
|
-
readonly expiresAt?: string;
|
|
761
|
-
readonly initiatorName?: string;
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
/** Read-only view for the transfer acceptance page. */
|
|
765
|
-
export interface TransferAcceptanceView {
|
|
766
|
-
readonly workspaceName: string;
|
|
767
|
-
readonly initiatorName: string;
|
|
768
|
-
readonly initiatorEmail: string;
|
|
769
|
-
readonly note?: string;
|
|
770
|
-
readonly expiresAt: string;
|
|
771
|
-
readonly token: string;
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
/** Responsibility checklist items shown on the acceptance page. */
|
|
775
|
-
export const TRANSFER_RESPONSIBILITIES = [
|
|
776
|
-
"You will become the sole owner of this workspace",
|
|
777
|
-
"You will be responsible for billing and compliance",
|
|
778
|
-
"The current owner will be downgraded to admin",
|
|
779
|
-
"This action cannot be undone without a new transfer",
|
|
780
|
-
] as const;
|
|
781
|
-
|
|
782
|
-
export type TransferResponsibility = (typeof TRANSFER_RESPONSIBILITIES)[number];
|
|
783
|
-
|
|
784
684
|
// =============================================================================
|
|
785
685
|
// Identity Trust Level Types (PRD-00154)
|
|
786
686
|
// Org identity posture for ownership transfer constraints.
|
package/src/org/view-scopes.ts
CHANGED
|
@@ -33,7 +33,6 @@ export const VIEW_SCOPE_MAP = {
|
|
|
33
33
|
// not a scope. Repointed from the never-enforced `org.view_teams` to null when
|
|
34
34
|
// that scope was retired from the backend catalog (ADR-CONTRACTS-062 / ADR-BE-256).
|
|
35
35
|
teams: null,
|
|
36
|
-
chat: null,
|
|
37
36
|
settings: null,
|
|
38
37
|
"my-work": null,
|
|
39
38
|
"user-md": null,
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Admin Response Schemas
|
|
3
|
+
*
|
|
4
|
+
* Workspace auth configuration (SSO setup, readiness, enforcement), audit log,
|
|
5
|
+
* resolve-path, auth policy, Slack logo resync and SSO test flows.
|
|
6
|
+
*
|
|
7
|
+
* Split out of `./schemas.ts`, which re-exports this module unchanged — import
|
|
8
|
+
* from `./schemas` (or the `./org` entry), not from this file directly.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// GET /api/workspace/auth
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
const OidcValidationResultSchema = z.object({
|
|
17
|
+
valid: z.boolean(),
|
|
18
|
+
issuer: z.string().optional(),
|
|
19
|
+
authorizationEndpoint: z.string().optional(),
|
|
20
|
+
error: z.string().optional(),
|
|
21
|
+
errorCode: z
|
|
22
|
+
.enum(["UNREACHABLE", "INVALID_DOCUMENT", "MISSING_FIELDS", "SSRF_BLOCKED"])
|
|
23
|
+
.optional(),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const SsoDiscoveryConfigSchema = z.object({
|
|
27
|
+
redirectUri: z.string(),
|
|
28
|
+
requiredScopes: z.array(z.string()),
|
|
29
|
+
isOidcConfigured: z.boolean(),
|
|
30
|
+
oidcDiscoveryUrl: z.string().nullable(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const SsoCredentialStatusSchema = z.object({
|
|
34
|
+
hasClientId: z.boolean(),
|
|
35
|
+
hasClientSecret: z.boolean(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const ProviderStatusSchema = z.enum([
|
|
39
|
+
"NOT_CONFIGURED",
|
|
40
|
+
"CONFIG_SAVED",
|
|
41
|
+
"CONFIG_VALID",
|
|
42
|
+
"TEST_SUCCESS",
|
|
43
|
+
"ENABLED",
|
|
44
|
+
]);
|
|
45
|
+
|
|
46
|
+
const SsoStepperStepSchema = z.enum(["configure", "test", "enable", "enforce"]);
|
|
47
|
+
|
|
48
|
+
const SsoOperationalStateSchema = z.object({
|
|
49
|
+
providerStatus: ProviderStatusSchema,
|
|
50
|
+
currentStep: SsoStepperStepSchema,
|
|
51
|
+
stepCompleted: z.boolean(),
|
|
52
|
+
activeProvider: z.string().nullable(),
|
|
53
|
+
oidcValidation: OidcValidationResultSchema.optional(),
|
|
54
|
+
credentialsSavedAt: z.string().optional(),
|
|
55
|
+
lastTestSuccessAt: z.string().optional(),
|
|
56
|
+
lastTestSuccessProvider: z.string().optional(),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const SsoSetupInfoSchema = SsoDiscoveryConfigSchema.merge(
|
|
60
|
+
SsoCredentialStatusSchema,
|
|
61
|
+
).merge(SsoOperationalStateSchema);
|
|
62
|
+
|
|
63
|
+
const SsoReadinessCheckSchema = z.object({
|
|
64
|
+
code: z.string(),
|
|
65
|
+
label: z.string(),
|
|
66
|
+
passed: z.boolean(),
|
|
67
|
+
message: z.string(),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const SsoReadinessSchema = z.object({
|
|
71
|
+
ready: z.boolean(),
|
|
72
|
+
checks: z.array(SsoReadinessCheckSchema),
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const SsoEnforcementStatusSchema = z.object({
|
|
76
|
+
enforced: z.boolean(),
|
|
77
|
+
enforcedDomains: z.array(z.string()),
|
|
78
|
+
enforcedSince: z.string().nullable(),
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const OwnerIdentityInfoSchema = z.object({
|
|
82
|
+
userId: z.string(),
|
|
83
|
+
name: z.string(),
|
|
84
|
+
email: z.string(),
|
|
85
|
+
hasSsoIdentity: z.boolean(),
|
|
86
|
+
linkedProvider: z.string().nullable(),
|
|
87
|
+
lastSsoLoginAt: z.string().nullable(),
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const ProviderSuggestionSchema = z.object({
|
|
91
|
+
suggestedProvider: z.enum(["google", "microsoft"]).nullable(),
|
|
92
|
+
confidence: z.enum(["high", "low"]),
|
|
93
|
+
reason: z.string(),
|
|
94
|
+
detectedDomain: z.string().optional(),
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const AuthMethodConfigSchema = z.object({
|
|
98
|
+
enabled: z.boolean(),
|
|
99
|
+
provider: z.string().optional(),
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
export const WorkspaceAuthConfigSchema = z.object({
|
|
103
|
+
emailOtp: AuthMethodConfigSchema,
|
|
104
|
+
googleSso: AuthMethodConfigSchema,
|
|
105
|
+
microsoftSso: AuthMethodConfigSchema,
|
|
106
|
+
okta: AuthMethodConfigSchema,
|
|
107
|
+
policy: z.object({
|
|
108
|
+
requireSSO: z.boolean(),
|
|
109
|
+
allowedProviders: z.array(z.string()),
|
|
110
|
+
}),
|
|
111
|
+
ssoSetup: SsoSetupInfoSchema.optional(),
|
|
112
|
+
ssoReadiness: SsoReadinessSchema.optional(),
|
|
113
|
+
ssoEnforcement: SsoEnforcementStatusSchema.optional(),
|
|
114
|
+
workspaceSsoState: z
|
|
115
|
+
.enum(["SSO_DISABLED", "SSO_ENABLED", "SSO_ENFORCED"])
|
|
116
|
+
.optional(),
|
|
117
|
+
ownerIdentities: z.array(OwnerIdentityInfoSchema).optional(),
|
|
118
|
+
providerSuggestion: ProviderSuggestionSchema.optional(),
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
export type WorkspaceAuthConfig = z.infer<typeof WorkspaceAuthConfigSchema>;
|
|
122
|
+
|
|
123
|
+
// ---------------------------------------------------------------------------
|
|
124
|
+
// GET /api/workspace/audit
|
|
125
|
+
// ---------------------------------------------------------------------------
|
|
126
|
+
|
|
127
|
+
export const WorkspaceAuditEventSchema = z.object({
|
|
128
|
+
id: z.string(),
|
|
129
|
+
timestamp: z.string(),
|
|
130
|
+
actor: z.object({
|
|
131
|
+
id: z.string(),
|
|
132
|
+
name: z.string(),
|
|
133
|
+
type: z.enum(["user", "system"]),
|
|
134
|
+
}),
|
|
135
|
+
action: z.string(),
|
|
136
|
+
summary: z.string(),
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export const WorkspaceAuditResponseSchema = z.array(WorkspaceAuditEventSchema);
|
|
140
|
+
|
|
141
|
+
export type WorkspaceAuditEvent = z.infer<typeof WorkspaceAuditEventSchema>;
|
|
142
|
+
|
|
143
|
+
// ---------------------------------------------------------------------------
|
|
144
|
+
// POST /api/workspace/resolve-path
|
|
145
|
+
// ---------------------------------------------------------------------------
|
|
146
|
+
|
|
147
|
+
const ResolvedDeptEntitySchema = z.object({
|
|
148
|
+
id: z.string(),
|
|
149
|
+
name: z.string(),
|
|
150
|
+
slug: z.string(),
|
|
151
|
+
memberCount: z.number(),
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
export const WorkspaceResolvePathResponseSchema = z.object({
|
|
155
|
+
layers: z.array(
|
|
156
|
+
z.discriminatedUnion("type", [
|
|
157
|
+
z.object({ type: z.literal("dept"), entity: ResolvedDeptEntitySchema }),
|
|
158
|
+
z.object({ type: z.literal("team"), entity: ResolvedDeptEntitySchema }),
|
|
159
|
+
z.object({
|
|
160
|
+
type: z.literal("members"),
|
|
161
|
+
scope: z.enum(["org", "dept", "team"]),
|
|
162
|
+
}),
|
|
163
|
+
]),
|
|
164
|
+
),
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
export type WorkspaceResolvePathResponse = z.infer<
|
|
168
|
+
typeof WorkspaceResolvePathResponseSchema
|
|
169
|
+
>;
|
|
170
|
+
|
|
171
|
+
// ---------------------------------------------------------------------------
|
|
172
|
+
// PATCH /api/workspace/auth-policy
|
|
173
|
+
// ---------------------------------------------------------------------------
|
|
174
|
+
|
|
175
|
+
export const OrgAuthPolicySchema = z.object({
|
|
176
|
+
requireSSO: z.boolean(),
|
|
177
|
+
allowedProviders: z.array(z.string()),
|
|
178
|
+
selfRevoked: z.boolean().optional(),
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
export type OrgAuthPolicy = z.infer<typeof OrgAuthPolicySchema>;
|
|
182
|
+
|
|
183
|
+
// ---------------------------------------------------------------------------
|
|
184
|
+
// POST /api/workspace/auth-policy/validate-oidc
|
|
185
|
+
// ---------------------------------------------------------------------------
|
|
186
|
+
|
|
187
|
+
export { OidcValidationResultSchema };
|
|
188
|
+
export type OidcValidationResult = z.infer<typeof OidcValidationResultSchema>;
|
|
189
|
+
|
|
190
|
+
// ---------------------------------------------------------------------------
|
|
191
|
+
// POST /api/workspace/resync-slack-logo
|
|
192
|
+
// ---------------------------------------------------------------------------
|
|
193
|
+
|
|
194
|
+
export const WorkspaceResyncSlackLogoResponseSchema = z.object({
|
|
195
|
+
success: z.literal(true),
|
|
196
|
+
logoUrl: z.string().nullable(),
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
export type WorkspaceResyncSlackLogoResponse = z.infer<
|
|
200
|
+
typeof WorkspaceResyncSlackLogoResponseSchema
|
|
201
|
+
>;
|
|
202
|
+
|
|
203
|
+
// ---------------------------------------------------------------------------
|
|
204
|
+
// POST /api/workspace/auth-policy/test-sso
|
|
205
|
+
// ---------------------------------------------------------------------------
|
|
206
|
+
|
|
207
|
+
export const TestSsoInitiationSchema = z.object({
|
|
208
|
+
authorizationUrl: z.string(),
|
|
209
|
+
attemptId: z.string(),
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
export type TestSsoInitiation = z.infer<typeof TestSsoInitiationSchema>;
|
|
213
|
+
|
|
214
|
+
// ---------------------------------------------------------------------------
|
|
215
|
+
// GET /api/workspace/auth-policy/test-sso/:attemptId
|
|
216
|
+
// ---------------------------------------------------------------------------
|
|
217
|
+
|
|
218
|
+
export const TestSsoResultSchema = z.object({
|
|
219
|
+
status: z.enum(["pending", "success", "failed", "expired"]),
|
|
220
|
+
claims: z
|
|
221
|
+
.object({
|
|
222
|
+
sub: z.string(),
|
|
223
|
+
email: z.string().optional(),
|
|
224
|
+
name: z.string().optional(),
|
|
225
|
+
issuer: z.string(),
|
|
226
|
+
})
|
|
227
|
+
.optional(),
|
|
228
|
+
identityLinked: z.boolean().optional(),
|
|
229
|
+
error: z.string().optional(),
|
|
230
|
+
errorCode: z
|
|
231
|
+
.enum([
|
|
232
|
+
"IDENTITY_CONFLICT",
|
|
233
|
+
"DOMAIN_MISMATCH",
|
|
234
|
+
"ISSUER_MISMATCH",
|
|
235
|
+
"CALLBACK_ERROR",
|
|
236
|
+
])
|
|
237
|
+
.optional(),
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
export type TestSsoResult = z.infer<typeof TestSsoResultSchema>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# root-exports/
|
|
2
|
+
|
|
3
|
+
Themed slices of the package root entry (`src/index.ts`).
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Named re-export lists for most of the package root surface, split by theme.
|
|
8
|
+
|
|
9
|
+
They keep `src/index.ts` a short table of contents under the `graduation`
|
|
10
|
+
guard's thresholds; `src/index.ts` re-exports every slice here with
|
|
11
|
+
`export * from "./root-exports/<slice>"`.
|
|
12
|
+
|
|
13
|
+
| Slice | Covers |
|
|
14
|
+
| ------------------ | ---------------------------------------------------------------------------------------------------------------- |
|
|
15
|
+
| `delivery.ts` | notifications, action items, user events, the in-app inbox, proactive delivery, workflows |
|
|
16
|
+
| `collaboration.ts` | the comment wire contract and the chat domain |
|
|
17
|
+
| `org-workspace.ts` | org, workspace, membership, invite, directory, company.md and sharing vocabulary |
|
|
18
|
+
| `org-structure.ts` | sync runs, conflicts, reconciliation, structure findings, transformations, canonical facts, inference, authority |
|
|
19
|
+
| `agent-runtime.ts` | MCP tool discovery, message parts, execution kinds, Ralph, internal admin, rate limits |
|
|
20
|
+
| `platform.ts` | impersonation, usage telemetry, resource keys, errors, the generated OpenAPI surface, security, request tiers |
|
|
21
|
+
|
|
22
|
+
## Invariants
|
|
23
|
+
|
|
24
|
+
- **Named lists only.** A slice re-exports by name, never with `export *`. Most
|
|
25
|
+
root lists are a deliberate SUBSET of their domain barrel (e.g. the root exposes
|
|
26
|
+
307 of the org barrel's 483 names); a star here would silently widen the root.
|
|
27
|
+
- **Content, not policy.** A slice decides nothing: moving a list between a slice
|
|
28
|
+
and `src/index.ts` must leave the root surface byte-for-byte unchanged.
|
|
29
|
+
- **No name in two root star sources.** `src/index.ts` star-exports these slices
|
|
30
|
+
next to whole-domain stars (`./permissions`, `./billing/index`, …). Two star
|
|
31
|
+
exports of one name with different bindings are ambiguous, and the name drops
|
|
32
|
+
out of the surface — so a name that collides is exported BY NAME from
|
|
33
|
+
`src/index.ts` instead (today: the org sharing `AccessLevel`, which collides
|
|
34
|
+
with `./permissions`). `tsc` reports the collision as TS2308.
|
|
35
|
+
- **Root-only.** Nothing imports a slice except `src/index.ts`; consumers import
|
|
36
|
+
the package root. The `system` and `identity` lists stay in `src/index.ts`
|
|
37
|
+
itself, because the export guard reads their names from that file.
|
|
38
|
+
|
|
39
|
+
## Public API
|
|
40
|
+
|
|
41
|
+
None of its own. Every name here is part of the package root surface and is
|
|
42
|
+
documented in its owning domain (`src/org/`, `src/chat/`, `src/comments/`, …).
|
|
43
|
+
|
|
44
|
+
<!-- BEGIN GENERATED: readme-dependencies — derived from code by `pnpm readme-api`. Do not edit. -->
|
|
45
|
+
|
|
46
|
+
## Dependencies
|
|
47
|
+
|
|
48
|
+
**Internal domains:**
|
|
49
|
+
|
|
50
|
+
- `action-items`
|
|
51
|
+
- `api`
|
|
52
|
+
- `autotune`
|
|
53
|
+
- `chat`
|
|
54
|
+
- `comments`
|
|
55
|
+
- `errors`
|
|
56
|
+
- `execution`
|
|
57
|
+
- `generated`
|
|
58
|
+
- `impersonation`
|
|
59
|
+
- `impersonation-events`
|
|
60
|
+
- `internal-admin`
|
|
61
|
+
- `mcp`
|
|
62
|
+
- `message-parts`
|
|
63
|
+
- `mutations`
|
|
64
|
+
- `notifications`
|
|
65
|
+
- `observability`
|
|
66
|
+
- `org`
|
|
67
|
+
- `pressure`
|
|
68
|
+
- `proactive`
|
|
69
|
+
- `queryIntent`
|
|
70
|
+
- `ralph`
|
|
71
|
+
- `rate-limit`
|
|
72
|
+
- `requests`
|
|
73
|
+
- `resource-keys`
|
|
74
|
+
- `resource-response`
|
|
75
|
+
- `route-builder`
|
|
76
|
+
- `safe-mode`
|
|
77
|
+
- `security`
|
|
78
|
+
- `sse`
|
|
79
|
+
- `timeouts`
|
|
80
|
+
- `tracing`
|
|
81
|
+
- `types`
|
|
82
|
+
- `usage`
|
|
83
|
+
- `user-events`
|
|
84
|
+
- `user-notifications`
|
|
85
|
+
- `workflows`
|
|
86
|
+
|
|
87
|
+
**External packages:**
|
|
88
|
+
|
|
89
|
+
_None._
|
|
90
|
+
|
|
91
|
+
<!-- END GENERATED: readme-dependencies -->
|