@company-semantics/contracts 9.0.0 → 9.2.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 +6 -3
- package/src/__tests__/resource-keys.test.ts +30 -23
- package/src/admin/authz-simulate.ts +4 -4
- package/src/admin/direct-grants.ts +2 -2
- package/src/api/generated-spec-hash.ts +2 -2
- package/src/api/generated.ts +97 -0
- package/src/api/http/routes/ai-chat.ts +3 -3
- package/src/api/http/utils/resource-response.ts +5 -2
- package/src/api/index.ts +4 -4
- package/src/api/primitives.ts +6 -2
- package/src/auth/README.md +1 -0
- package/src/auth/index.ts +12 -5
- package/src/autotune.ts +5 -1
- package/src/billing/index.ts +1 -1
- package/src/billing/types.ts +1 -1
- package/src/chat/README.md +3 -0
- package/src/chat/__tests__/runtime-profile.test.ts +68 -48
- package/src/chat/index.ts +10 -4
- package/src/chat/runtime-profile.ts +25 -10
- package/src/chat/schemas.ts +49 -41
- package/src/chat/types.ts +48 -42
- package/src/ci-envelope/README.md +2 -0
- package/src/ci-envelope/__tests__/transitions.test.ts +56 -56
- package/src/ci-envelope/index.ts +2 -2
- package/src/ci-envelope/types.ts +20 -20
- package/src/ci-results/index.ts +2 -2
- package/src/ci-results/repo-ci-result.ts +15 -12
- package/src/compatibility.ts +6 -6
- package/src/content/index.ts +10 -4
- package/src/content/schemas.ts +42 -24
- package/src/dispatch/index.ts +18 -15
- package/src/email/__tests__/registry.test.ts +81 -77
- package/src/email/index.ts +3 -3
- package/src/email/registry.ts +25 -25
- package/src/email/types.ts +43 -43
- package/src/errors/index.ts +8 -8
- package/src/execution/__tests__/events.test.ts +42 -42
- package/src/execution/__tests__/lifecycle.test.ts +192 -190
- package/src/execution/__tests__/registry.test.ts +114 -114
- package/src/execution/audit-export.ts +4 -4
- package/src/execution/errors.ts +7 -7
- package/src/execution/event-metadata.ts +4 -4
- package/src/execution/events.ts +23 -21
- package/src/execution/expiry.ts +5 -5
- package/src/execution/hash-chain.ts +2 -2
- package/src/execution/index.ts +19 -28
- package/src/execution/kinds.ts +7 -7
- package/src/execution/lifecycle.ts +33 -33
- package/src/execution/registry.ts +63 -63
- package/src/execution/schemas.ts +31 -23
- package/src/execution/status.ts +45 -26
- package/src/execution/summary.ts +16 -17
- package/src/execution/timeline-ui.ts +9 -9
- package/src/execution/types.ts +31 -25
- package/src/generated/openapi-routes.ts +2 -0
- package/src/guards/config.ts +22 -18
- package/src/guards/index.ts +4 -4
- package/src/guards/types.ts +32 -24
- package/src/identity/__tests__/avatar.test.ts +68 -59
- package/src/identity/avatar.ts +8 -8
- package/src/identity/display-name.ts +3 -3
- package/src/identity/index.ts +8 -8
- package/src/identity/people-org-chart.ts +8 -4
- package/src/identity/schemas.ts +28 -18
- package/src/identity/types.ts +5 -5
- package/src/impersonation/index.ts +5 -5
- package/src/impersonation/schemas.ts +15 -9
- package/src/impersonation-events.ts +21 -21
- package/src/impersonation.ts +25 -24
- package/src/index.ts +118 -90
- package/src/interfaces/mcp/tools/help.ts +19 -19
- package/src/internal-admin.ts +6 -6
- package/src/mcp/README.md +2 -0
- package/src/mcp/__tests__/capability-graph.test.ts +290 -290
- package/src/mcp/capability-graph.ts +42 -40
- package/src/mcp/failure-context.ts +1 -3
- package/src/mcp/index.ts +69 -56
- package/src/mcp/resources.ts +9 -9
- package/src/meetings/index.ts +2 -2
- package/src/meetings/schemas.ts +51 -34
- package/src/message-parts/README.md +2 -0
- package/src/message-parts/__tests__/builder.test.ts +142 -142
- package/src/message-parts/__tests__/confirmation.test.ts +100 -86
- package/src/message-parts/__tests__/preview.test.ts +63 -63
- package/src/message-parts/__tests__/wire.test.ts +130 -124
- package/src/message-parts/builder.ts +23 -23
- package/src/message-parts/confirmation.ts +17 -14
- package/src/message-parts/execution.ts +7 -7
- package/src/message-parts/index.ts +10 -10
- package/src/message-parts/lifecycle.ts +25 -25
- package/src/message-parts/preview.ts +30 -30
- package/src/message-parts/types.ts +27 -27
- package/src/message-parts/wire.ts +24 -24
- package/src/mutations.ts +2 -2
- package/src/observability.ts +23 -11
- package/src/org/__tests__/org-units.test.ts +131 -96
- package/src/org/__tests__/tree-ordering.test.ts +57 -37
- package/src/org/__tests__/view-scopes.test.ts +40 -40
- package/src/org/domain.ts +9 -9
- package/src/org/index.ts +31 -21
- package/src/org/org-units.ts +34 -20
- package/src/org/schemas.ts +261 -124
- package/src/org/sharing.ts +17 -13
- package/src/org/tree-ordering.ts +3 -1
- package/src/org/types.ts +54 -47
- package/src/org/view-scopes.ts +9 -9
- package/src/permissions/access-levels.ts +7 -2
- package/src/permissions/access-source.ts +6 -6
- package/src/permissions/index.ts +5 -5
- package/src/permissions/orgchart-roles.ts +7 -7
- package/src/permissions/permission-introspection.ts +7 -5
- package/src/permissions/share-api.ts +19 -9
- package/src/pressure.ts +4 -4
- package/src/queryIntent.ts +21 -21
- package/src/ralph/__tests__/prd-groups.test.ts +159 -159
- package/src/ralph/__tests__/prd.test.ts +30 -30
- package/src/ralph/index.ts +3 -8
- package/src/ralph/prd.ts +33 -33
- package/src/ralph/progress.ts +1 -1
- package/src/rate-limit/README.md +4 -4
- package/src/rate-limit/index.ts +3 -3
- package/src/requests.ts +36 -8
- package/src/resource-keys.ts +207 -124
- package/src/resource-registry.ts +5 -5
- package/src/route-builder.ts +3 -3
- package/src/safe-mode.ts +2 -2
- package/src/security/index.ts +4 -4
- package/src/security/org-secrets.ts +13 -9
- package/src/security/secret.ts +3 -3
- package/src/sse.ts +3 -1
- package/src/system/README.md +3 -0
- package/src/system/capabilities.ts +22 -23
- package/src/system/diagram.ts +45 -45
- package/src/system/index.ts +14 -14
- package/src/tiers.ts +1 -1
- package/src/timeouts.ts +1 -1
- package/src/tracing.ts +30 -30
- package/src/types/analytics.ts +2 -2
- package/src/usage/README.md +3 -0
- package/src/usage/execution-types.ts +69 -69
- package/src/usage/types.ts +7 -3
package/src/org/domain.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* INVARIANT: Only ONE org may have status='verified' for any domain globally.
|
|
14
14
|
* @see ADR-BE-070 (revoked status removed — domains are hard-deleted instead)
|
|
15
15
|
*/
|
|
16
|
-
export type DomainStatus =
|
|
16
|
+
export type DomainStatus = "pending" | "verified";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Method used to verify domain ownership.
|
|
@@ -21,7 +21,7 @@ export type DomainStatus = 'pending' | 'verified';
|
|
|
21
21
|
* - 'email': Email-based verification (reserved for future)
|
|
22
22
|
* - 'idp': IdP-based verification via SAML/OIDC (reserved for future)
|
|
23
23
|
*/
|
|
24
|
-
export type DomainVerificationMethod =
|
|
24
|
+
export type DomainVerificationMethod = "dns_txt" | "email" | "idp";
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Organization domain claim and verification status.
|
|
@@ -58,12 +58,12 @@ export interface OrgDomain {
|
|
|
58
58
|
*/
|
|
59
59
|
export type Phase4AuditAction =
|
|
60
60
|
// Domain lifecycle
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
61
|
+
| "org.domain.claimed"
|
|
62
|
+
| "org.domain.verified"
|
|
63
|
+
| "org.domain.deleted"
|
|
64
64
|
// Auth policy enforcement
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
65
|
+
| "org.auth_policy.enforced"
|
|
66
|
+
| "org.auth_policy.override_used" // Emergency SSO bypass succeeded
|
|
67
|
+
| "org.auth_policy.override_attempted" // Emergency SSO bypass denied (incident review)
|
|
68
68
|
// Multi-org context
|
|
69
|
-
|
|
|
69
|
+
| "user.active_org.switched";
|
package/src/org/index.ts
CHANGED
|
@@ -68,9 +68,12 @@ export type {
|
|
|
68
68
|
IdentityTrustLevel,
|
|
69
69
|
TransferEligibilityResult,
|
|
70
70
|
TransferMemberEligibility,
|
|
71
|
-
} from
|
|
71
|
+
} from "./types";
|
|
72
72
|
|
|
73
|
-
export {
|
|
73
|
+
export {
|
|
74
|
+
TRANSFER_RESPONSIBILITIES,
|
|
75
|
+
IDENTITY_TRUST_LEVEL_LABELS,
|
|
76
|
+
} from "./types";
|
|
74
77
|
|
|
75
78
|
// Domain types (Phase 4)
|
|
76
79
|
export type {
|
|
@@ -78,15 +81,15 @@ export type {
|
|
|
78
81
|
DomainVerificationMethod,
|
|
79
82
|
OrgDomain,
|
|
80
83
|
Phase4AuditAction,
|
|
81
|
-
} from
|
|
84
|
+
} from "./domain";
|
|
82
85
|
|
|
83
86
|
// View authorization scopes (Phase 5 - ADR-APP-013)
|
|
84
|
-
export type { AuthorizableView } from
|
|
85
|
-
export { VIEW_SCOPE_MAP, getViewScope } from
|
|
87
|
+
export type { AuthorizableView } from "./view-scopes";
|
|
88
|
+
export { VIEW_SCOPE_MAP, getViewScope } from "./view-scopes";
|
|
86
89
|
|
|
87
90
|
// Canonical OrgUnit tree ordering (PRD-00506)
|
|
88
|
-
export type { TreeOrderableNode } from
|
|
89
|
-
export { orderTreeNodes } from
|
|
91
|
+
export type { TreeOrderableNode } from "./tree-ordering";
|
|
92
|
+
export { orderTreeNodes } from "./tree-ordering";
|
|
90
93
|
|
|
91
94
|
// Company.md domain types (PRD-00173)
|
|
92
95
|
export type {
|
|
@@ -103,7 +106,7 @@ export type {
|
|
|
103
106
|
CompanyMdDocRelations,
|
|
104
107
|
CompanyMdDoc,
|
|
105
108
|
CompanyMdContextBankItem,
|
|
106
|
-
} from
|
|
109
|
+
} from "./company-md";
|
|
107
110
|
|
|
108
111
|
// Sharing and ACL types (PRD-00306)
|
|
109
112
|
export type {
|
|
@@ -117,7 +120,7 @@ export type {
|
|
|
117
120
|
AccessExplanation,
|
|
118
121
|
ShareState,
|
|
119
122
|
PermissionAuditEntry,
|
|
120
|
-
} from
|
|
123
|
+
} from "./sharing";
|
|
121
124
|
|
|
122
125
|
// Workspace response schemas (PRD-00445)
|
|
123
126
|
export {
|
|
@@ -145,7 +148,7 @@ export {
|
|
|
145
148
|
LeaveOrgResponseSchema,
|
|
146
149
|
ScopeCheckResponseSchema,
|
|
147
150
|
ScopeCheckBatchResponseSchema,
|
|
148
|
-
} from
|
|
151
|
+
} from "./schemas";
|
|
149
152
|
export type {
|
|
150
153
|
WorkspaceAccessResponse,
|
|
151
154
|
WorkspaceOverview as WorkspaceOverviewDto,
|
|
@@ -167,7 +170,7 @@ export type {
|
|
|
167
170
|
LeaveOrgResponse,
|
|
168
171
|
ScopeCheckResponse,
|
|
169
172
|
ScopeCheckBatchResponse,
|
|
170
|
-
} from
|
|
173
|
+
} from "./schemas";
|
|
171
174
|
|
|
172
175
|
// Org lifecycle response schemas (PRD-00446)
|
|
173
176
|
export {
|
|
@@ -179,7 +182,7 @@ export {
|
|
|
179
182
|
OrgDeletionStatusSchema,
|
|
180
183
|
OwnershipTransferResponseSchema,
|
|
181
184
|
OwnershipTransferPreviewSchema,
|
|
182
|
-
} from
|
|
185
|
+
} from "./schemas";
|
|
183
186
|
export type {
|
|
184
187
|
InviteResponse,
|
|
185
188
|
InviteListResponse,
|
|
@@ -189,7 +192,7 @@ export type {
|
|
|
189
192
|
OrgDeletionStatus,
|
|
190
193
|
OwnershipTransferResponse,
|
|
191
194
|
OwnershipTransferPreview,
|
|
192
|
-
} from
|
|
195
|
+
} from "./schemas";
|
|
193
196
|
|
|
194
197
|
// Org-ops response schemas (PRD-00449)
|
|
195
198
|
export {
|
|
@@ -197,13 +200,13 @@ export {
|
|
|
197
200
|
AcknowledgeSystemEventResponseSchema,
|
|
198
201
|
OrgBudgetConfigSchema,
|
|
199
202
|
OrgUsageResponseSchema,
|
|
200
|
-
} from
|
|
203
|
+
} from "./schemas";
|
|
201
204
|
export type {
|
|
202
205
|
OrgSystemEventsList,
|
|
203
206
|
AcknowledgeSystemEventResponse,
|
|
204
207
|
OrgBudgetConfig,
|
|
205
208
|
OrgUsageResponse,
|
|
206
|
-
} from
|
|
209
|
+
} from "./schemas";
|
|
207
210
|
|
|
208
211
|
// OrgUnit canonical model (ADR-BE-120)
|
|
209
212
|
export type {
|
|
@@ -216,8 +219,8 @@ export type {
|
|
|
216
219
|
OrgUnitMembershipSource,
|
|
217
220
|
OrgUnitErrorCode,
|
|
218
221
|
OrgTreeResponse,
|
|
219
|
-
} from
|
|
220
|
-
export { ORG_UNITS_ROUTES } from
|
|
222
|
+
} from "./org-units";
|
|
223
|
+
export { ORG_UNITS_ROUTES } from "./org-units";
|
|
221
224
|
export {
|
|
222
225
|
OrgUnitClassificationSchema,
|
|
223
226
|
OrgUnitSyncModeSchema,
|
|
@@ -248,7 +251,7 @@ export {
|
|
|
248
251
|
ListOrgUnitPermissionsResponseSchema,
|
|
249
252
|
UpdateOrgUnitRequestSchema,
|
|
250
253
|
UpdateOrgUnitResponseSchema,
|
|
251
|
-
} from
|
|
254
|
+
} from "./schemas";
|
|
252
255
|
export type {
|
|
253
256
|
UnitMembershipRole,
|
|
254
257
|
OrgUnit,
|
|
@@ -271,7 +274,7 @@ export type {
|
|
|
271
274
|
ListOrgUnitPermissionsResponse,
|
|
272
275
|
UpdateOrgUnitRequest,
|
|
273
276
|
UpdateOrgUnitResponse,
|
|
274
|
-
} from
|
|
277
|
+
} from "./schemas";
|
|
275
278
|
|
|
276
279
|
// Authority & Delegation vocabulary
|
|
277
280
|
export {
|
|
@@ -288,7 +291,11 @@ export {
|
|
|
288
291
|
CreateDelegationRequestSchema,
|
|
289
292
|
UpdateDelegationRequestSchema,
|
|
290
293
|
DelegationListResponseSchema,
|
|
291
|
-
|
|
294
|
+
// Mutation capabilities (GET /api/capabilities) — ADR-BE-241
|
|
295
|
+
FieldCapabilitySchema,
|
|
296
|
+
ActionCapabilitySchema,
|
|
297
|
+
CapabilitiesResponseSchema,
|
|
298
|
+
} from "./schemas";
|
|
292
299
|
export type {
|
|
293
300
|
AuthoritySource,
|
|
294
301
|
AuthorityOrigin,
|
|
@@ -303,4 +310,7 @@ export type {
|
|
|
303
310
|
CreateDelegationRequest,
|
|
304
311
|
UpdateDelegationRequest,
|
|
305
312
|
DelegationListResponse,
|
|
306
|
-
|
|
313
|
+
FieldCapability,
|
|
314
|
+
ActionCapability,
|
|
315
|
+
CapabilitiesResponse,
|
|
316
|
+
} from "./schemas";
|
package/src/org/org-units.ts
CHANGED
|
@@ -22,25 +22,39 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
/** Semantic classification — projection-only, never drives traversal. */
|
|
25
|
-
export type OrgUnitClassification =
|
|
25
|
+
export type OrgUnitClassification =
|
|
26
|
+
| "execution_unit"
|
|
27
|
+
| "org_container"
|
|
28
|
+
| "custom";
|
|
26
29
|
|
|
27
30
|
/** External directory reconciliation policy for a unit. */
|
|
28
|
-
export type OrgUnitSyncMode =
|
|
31
|
+
export type OrgUnitSyncMode =
|
|
32
|
+
| "manual_only"
|
|
33
|
+
| "synced_readonly"
|
|
34
|
+
| "synced_with_overrides";
|
|
29
35
|
|
|
30
36
|
/** Default visibility inherited by new docs under this unit. */
|
|
31
|
-
export type OrgUnitVisibility =
|
|
37
|
+
export type OrgUnitVisibility = "public" | "private" | "restricted";
|
|
32
38
|
|
|
33
39
|
/** Edge classification for `org_unit_relationships`. Graph-only; never structural. */
|
|
34
|
-
export type OrgUnitRelationshipType =
|
|
40
|
+
export type OrgUnitRelationshipType =
|
|
41
|
+
| "collaborates_with"
|
|
42
|
+
| "reports_to"
|
|
43
|
+
| "depends_on"
|
|
44
|
+
| "custom";
|
|
35
45
|
|
|
36
46
|
/** Edge role — refines the collaboration nature on a graph edge. */
|
|
37
|
-
export type OrgUnitRelationshipRole =
|
|
47
|
+
export type OrgUnitRelationshipRole = "owner" | "participant" | "supporting";
|
|
38
48
|
|
|
39
49
|
/** Active/pending/removed lifecycle for a unit membership. */
|
|
40
|
-
export type OrgUnitMembershipStatus =
|
|
50
|
+
export type OrgUnitMembershipStatus = "active" | "pending" | "removed";
|
|
41
51
|
|
|
42
52
|
/** External directory origin of a membership row. */
|
|
43
|
-
export type OrgUnitMembershipSource =
|
|
53
|
+
export type OrgUnitMembershipSource =
|
|
54
|
+
| "manual"
|
|
55
|
+
| "google_groups"
|
|
56
|
+
| "scim"
|
|
57
|
+
| "hris";
|
|
44
58
|
|
|
45
59
|
/**
|
|
46
60
|
* Canonical route path constants for the `/api/org-units` surface.
|
|
@@ -57,8 +71,8 @@ export type OrgUnitMembershipSource = 'manual' | 'google_groups' | 'scim' | 'hri
|
|
|
57
71
|
* into `/api/org-units/tree` without changing the response shape.
|
|
58
72
|
*/
|
|
59
73
|
export const ORG_UNITS_ROUTES = {
|
|
60
|
-
list:
|
|
61
|
-
tree:
|
|
74
|
+
list: "/api/org-units",
|
|
75
|
+
tree: "/api/org-units/tree",
|
|
62
76
|
byId: (unitId: string) => `/api/org-units/${unitId}`,
|
|
63
77
|
children: (unitId: string) => `/api/org-units/${unitId}/children`,
|
|
64
78
|
ancestors: (unitId: string) => `/api/org-units/${unitId}/ancestors`,
|
|
@@ -82,7 +96,7 @@ export const ORG_UNITS_ROUTES = {
|
|
|
82
96
|
* / `OrgUnitTreeResponse`. This alias gives consumers the shorter
|
|
83
97
|
* `OrgTreeResponse` name used by `GET /api/org-units/tree`.
|
|
84
98
|
*/
|
|
85
|
-
export type { OrgUnitTreeResponse as OrgTreeResponse } from
|
|
99
|
+
export type { OrgUnitTreeResponse as OrgTreeResponse } from "./schemas";
|
|
86
100
|
|
|
87
101
|
/**
|
|
88
102
|
* Error codes returned by `POST /api/org-units/:id/reparent` and related
|
|
@@ -90,22 +104,22 @@ export type { OrgUnitTreeResponse as OrgTreeResponse } from './schemas';
|
|
|
90
104
|
*/
|
|
91
105
|
export type OrgUnitErrorCode =
|
|
92
106
|
/** newParent.path contains unit.path — would create a cycle. */
|
|
93
|
-
|
|
|
107
|
+
| "CYCLE_BLOCKED"
|
|
94
108
|
/** Reparent would push subtree above depth 5. */
|
|
95
|
-
|
|
|
109
|
+
| "DEPTH_EXCEEDED"
|
|
96
110
|
/** Target parent is archived; reparenting into archived subtrees is forbidden. */
|
|
97
|
-
|
|
|
111
|
+
| "TARGET_ARCHIVED"
|
|
98
112
|
/** Attempted to set `parent_id` on a level-1 root unit. */
|
|
99
|
-
|
|
|
113
|
+
| "ROOT_HAS_NO_PARENT"
|
|
100
114
|
/** Parent is archived on create. */
|
|
101
|
-
|
|
|
115
|
+
| "PARENT_ARCHIVED"
|
|
102
116
|
/** Slug already taken under the target parent. */
|
|
103
|
-
|
|
|
117
|
+
| "SLUG_TAKEN"
|
|
104
118
|
/** Attempted to reparent across orgs (or create with mismatched orgId). */
|
|
105
|
-
|
|
|
119
|
+
| "CROSS_ORG_REPARENT"
|
|
106
120
|
/** Reorder: computed order_key collided with an existing sibling; client should re-fetch neighbors and retry. */
|
|
107
|
-
|
|
|
121
|
+
| "ORDERKEY_CONFLICT"
|
|
108
122
|
/** Reorder: prev or next sibling id does not resolve to a live unit. */
|
|
109
|
-
|
|
|
123
|
+
| "SIBLING_NOT_FOUND"
|
|
110
124
|
/** Reorder: prev or next sibling belongs to a different parent than the moving unit. */
|
|
111
|
-
|
|
|
125
|
+
| "SIBLINGS_DIFFERENT_PARENT";
|