@elevasis/core 0.25.0 → 0.26.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.
Files changed (66) hide show
  1. package/dist/index.d.ts +166 -85
  2. package/dist/index.js +146 -1346
  3. package/dist/knowledge/index.d.ts +27 -38
  4. package/dist/knowledge/index.js +1 -1
  5. package/dist/organization-model/index.d.ts +166 -85
  6. package/dist/organization-model/index.js +146 -1346
  7. package/dist/test-utils/index.d.ts +23 -31
  8. package/dist/test-utils/index.js +75 -1238
  9. package/package.json +1 -1
  10. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +14 -2
  11. package/src/business/acquisition/api-schemas.test.ts +70 -77
  12. package/src/business/acquisition/api-schemas.ts +21 -42
  13. package/src/business/acquisition/derive-actions.test.ts +11 -21
  14. package/src/business/acquisition/derive-actions.ts +61 -14
  15. package/src/business/acquisition/ontology-validation.ts +4 -4
  16. package/src/business/acquisition/types.ts +7 -8
  17. package/src/knowledge/queries.ts +0 -1
  18. package/src/organization-model/__tests__/content-kinds-registry.test.ts +35 -210
  19. package/src/organization-model/__tests__/defaults.test.ts +4 -4
  20. package/src/organization-model/__tests__/domains/actions.test.ts +12 -36
  21. package/src/organization-model/__tests__/domains/offerings.test.ts +13 -6
  22. package/src/organization-model/__tests__/domains/resources.test.ts +497 -350
  23. package/src/organization-model/__tests__/domains/systems.test.ts +6 -7
  24. package/src/organization-model/__tests__/flatten-additive-merge.test.ts +68 -80
  25. package/src/organization-model/__tests__/foundation.test.ts +81 -14
  26. package/src/organization-model/__tests__/graph.test.ts +662 -694
  27. package/src/organization-model/__tests__/knowledge.test.ts +31 -17
  28. package/src/organization-model/__tests__/lookup-helpers.test.ts +128 -438
  29. package/src/organization-model/__tests__/migration-helpers.test.ts +362 -591
  30. package/src/organization-model/__tests__/prospecting-ssot.test.ts +68 -103
  31. package/src/organization-model/__tests__/published-zero-leak.test.ts +17 -0
  32. package/src/organization-model/__tests__/recursive-system-schema.test.ts +159 -532
  33. package/src/organization-model/__tests__/resolve.test.ts +79 -42
  34. package/src/organization-model/__tests__/schema.test.ts +65 -56
  35. package/src/organization-model/catalogs/lead-gen.ts +0 -103
  36. package/src/organization-model/defaults.ts +17 -702
  37. package/src/organization-model/domains/actions.ts +116 -333
  38. package/src/organization-model/domains/knowledge.ts +15 -7
  39. package/src/organization-model/domains/projects.ts +4 -4
  40. package/src/organization-model/domains/prospecting.ts +405 -395
  41. package/src/organization-model/domains/resources.ts +206 -135
  42. package/src/organization-model/domains/sales.ts +5 -5
  43. package/src/organization-model/domains/systems.ts +8 -23
  44. package/src/organization-model/graph/build.ts +223 -294
  45. package/src/organization-model/graph/schema.ts +2 -3
  46. package/src/organization-model/graph/types.ts +12 -14
  47. package/src/organization-model/helpers.ts +130 -218
  48. package/src/organization-model/index.ts +104 -124
  49. package/src/organization-model/migration-helpers.ts +211 -249
  50. package/src/organization-model/ontology.ts +0 -60
  51. package/src/organization-model/organization-graph.mdx +4 -5
  52. package/src/organization-model/organization-model.mdx +1 -1
  53. package/src/organization-model/published.ts +236 -226
  54. package/src/organization-model/resolve.ts +4 -5
  55. package/src/organization-model/schema.ts +610 -704
  56. package/src/organization-model/types.ts +167 -161
  57. package/src/platform/registry/__tests__/validation.test.ts +23 -0
  58. package/src/platform/registry/validation.ts +13 -2
  59. package/src/reference/_generated/contracts.md +14 -2
  60. package/src/organization-model/content-kinds/config.ts +0 -36
  61. package/src/organization-model/content-kinds/index.ts +0 -78
  62. package/src/organization-model/content-kinds/pipeline.ts +0 -68
  63. package/src/organization-model/content-kinds/registry.ts +0 -44
  64. package/src/organization-model/content-kinds/status.ts +0 -71
  65. package/src/organization-model/content-kinds/template.ts +0 -83
  66. package/src/organization-model/content-kinds/types.ts +0 -117
@@ -1,57 +1,58 @@
1
- import type { z } from 'zod'
2
- import { OrganizationModelBrandingSchema } from './domains/branding'
3
- import { SalesPipelineSchema, SalesStageSchema } from './domains/sales'
4
- import { ProjectsDomainStateSchema } from './domains/projects'
5
- import { NodeIdPathSchema, NodeIdStringSchema } from './domains/systems'
6
- import { ProspectingBuildTemplateSchema, ProspectingLifecycleStageSchema } from './domains/prospecting'
7
- import {
8
- NavigationGroupSchema,
9
- OrganizationModelNavigationSchema,
10
- SidebarNavigationSchema,
11
- SidebarNodeSchema,
12
- SidebarSectionSchema,
13
- SidebarSurfaceTargetsSchema,
14
- SurfaceDefinitionSchema
15
- } from './domains/navigation'
16
- import { TechStackEntrySchema } from './domains/shared'
17
- import { StatusesDomainSchema, StatusEntrySchema, StatusSemanticClassSchema } from './domains/statuses'
18
- import { CustomersDomainSchema, CustomerSegmentSchema, FirmographicsSchema } from './domains/customers'
19
- import { OfferingsDomainSchema, ProductSchema, PricingModelSchema } from './domains/offerings'
20
- import {
21
- AgentRoleHolderSchema,
22
- HumanRoleHolderSchema,
23
- RoleHolderSchema,
24
- RoleIdSchema,
25
- RolesDomainSchema,
26
- RoleSchema,
27
- TeamRoleHolderSchema
28
- } from './domains/roles'
29
- import { GoalsDomainSchema, ObjectiveSchema, KeyResultSchema } from './domains/goals'
30
- import {
31
- KnowledgeDomainSchema,
32
- KnowledgeLinkSchema,
33
- KnowledgeTargetKindSchema,
34
- KnowledgeTargetRefSchema,
35
- OrgKnowledgeKindSchema,
36
- OrgKnowledgeNodeSchema
37
- } from './domains/knowledge'
38
- import {
1
+ import type { z } from 'zod'
2
+ import { OrganizationModelBrandingSchema } from './domains/branding'
3
+ import { SalesPipelineSchema, SalesStageSchema } from './domains/sales'
4
+ import { ProjectsDomainStateSchema } from './domains/projects'
5
+ import { NodeIdPathSchema, NodeIdStringSchema } from './domains/systems'
6
+ import { ProspectingBuildTemplateSchema, ProspectingLifecycleStageSchema } from './domains/prospecting'
7
+ import {
8
+ NavigationGroupSchema,
9
+ OrganizationModelNavigationSchema,
10
+ SidebarNavigationSchema,
11
+ SidebarNodeSchema,
12
+ SidebarSectionSchema,
13
+ SidebarSurfaceTargetsSchema,
14
+ SurfaceDefinitionSchema
15
+ } from './domains/navigation'
16
+ import { TechStackEntrySchema } from './domains/shared'
17
+ import { StatusesDomainSchema, StatusEntrySchema, StatusSemanticClassSchema } from './domains/statuses'
18
+ import { CustomersDomainSchema, CustomerSegmentSchema, FirmographicsSchema } from './domains/customers'
19
+ import { OfferingsDomainSchema, ProductSchema, PricingModelSchema } from './domains/offerings'
20
+ import {
21
+ AgentRoleHolderSchema,
22
+ HumanRoleHolderSchema,
23
+ RoleHolderSchema,
24
+ RoleIdSchema,
25
+ RolesDomainSchema,
26
+ RoleSchema,
27
+ TeamRoleHolderSchema
28
+ } from './domains/roles'
29
+ import { GoalsDomainSchema, ObjectiveSchema, KeyResultSchema } from './domains/goals'
30
+ import {
31
+ KnowledgeDomainSchema,
32
+ KnowledgeLinkSchema,
33
+ KnowledgeTargetKindSchema,
34
+ KnowledgeTargetRefSchema,
35
+ OrgKnowledgeKindSchema,
36
+ OrgKnowledgeNodeSchema
37
+ } from './domains/knowledge'
38
+ import {
39
39
  SystemEntrySchema,
40
40
  SystemConfigSchema,
41
41
  SystemIdSchema,
42
- SystemKindSchema,
43
- SystemLifecycleSchema,
44
- SystemPathSchema,
45
- SystemStatusSchema,
46
- SystemsDomainSchema
47
- } from './domains/systems'
48
- import {
49
- AgentKindSchema,
50
- AgentResourceEntrySchema,
51
- CodeReferenceRoleSchema,
52
- CodeReferenceSchema,
53
- EventDescriptorSchema,
54
- EventEmissionDescriptorSchema,
42
+ SystemKindSchema,
43
+ SystemLifecycleSchema,
44
+ SystemPathSchema,
45
+ SystemStatusSchema,
46
+ SystemsDomainSchema
47
+ } from './domains/systems'
48
+ import {
49
+ AgentKindSchema,
50
+ AgentResourceEntrySchema,
51
+ CodeReferenceRoleSchema,
52
+ CodeReferenceSchema,
53
+ ContractRefSchema,
54
+ EventDescriptorSchema,
55
+ EventEmissionDescriptorSchema,
55
56
  EventIdSchema,
56
57
  IntegrationResourceEntrySchema,
57
58
  ResourceEntrySchema,
@@ -63,7 +64,9 @@ import {
63
64
  ScriptResourceEntrySchema,
64
65
  ScriptResourceLanguageSchema,
65
66
  ScriptResourceSourceSchema,
66
- WorkflowResourceEntrySchema
67
+ WorkflowResourceEntrySchema,
68
+ type ParsedContractRef,
69
+ type ResourceOntologyBindingContract
67
70
  } from './domains/resources'
68
71
  import {
69
72
  OmTopologyDomainSchema,
@@ -73,75 +76,75 @@ import {
73
76
  OmTopologyRelationshipKindSchema,
74
77
  OmTopologyRelationshipSchema
75
78
  } from './domains/topology'
76
- import {
77
- ActionsDomainSchema,
78
- ActionIdSchema,
79
- ActionInvocationKindSchema,
80
- ActionInvocationSchema,
81
- ActionRefSchema,
82
- ActionSchema,
83
- ActionScopeSchema
84
- } from './domains/actions'
85
- import { EntitiesDomainSchema, EntityIdSchema, EntityLinkSchema, EntitySchema } from './domains/entities'
86
- import {
87
- PoliciesDomainSchema,
88
- PolicyEffectSchema,
89
- PolicyApplicabilitySchema,
90
- PolicyIdSchema,
91
- PolicyPredicateSchema,
92
- PolicySchema,
93
- PolicyTriggerSchema
94
- } from './domains/policies'
79
+ import {
80
+ ActionsDomainSchema,
81
+ ActionIdSchema,
82
+ ActionInvocationKindSchema,
83
+ ActionInvocationSchema,
84
+ ActionRefSchema,
85
+ ActionSchema,
86
+ ActionScopeSchema
87
+ } from './domains/actions'
88
+ import { EntitiesDomainSchema, EntityIdSchema, EntityLinkSchema, EntitySchema } from './domains/entities'
89
+ import {
90
+ PoliciesDomainSchema,
91
+ PolicyEffectSchema,
92
+ PolicyApplicabilitySchema,
93
+ PolicyIdSchema,
94
+ PolicyPredicateSchema,
95
+ PolicySchema,
96
+ PolicyTriggerSchema
97
+ } from './domains/policies'
95
98
  import { OrganizationModelIconTokenSchema, OrganizationModelBuiltinIconTokenSchema } from './icons'
96
99
  import { OntologyScopeSchema } from './ontology'
97
100
  import {
98
101
  OrganizationModelDomainKeySchema,
99
- OrganizationModelDomainMetadataByDomainSchema,
100
- OrganizationModelDomainMetadataSchema,
101
- OrganizationModelSchema
102
- } from './schema'
103
-
104
- export type OrganizationModel = z.infer<typeof OrganizationModelSchema>
105
- export type OrganizationModelDomainKey = z.infer<typeof OrganizationModelDomainKeySchema>
106
- export type OrganizationModelDomainMetadata = z.infer<typeof OrganizationModelDomainMetadataSchema>
107
- export type OrganizationModelDomainMetadataByDomain = z.infer<typeof OrganizationModelDomainMetadataByDomainSchema>
108
- export type OrganizationModelBranding = z.infer<typeof OrganizationModelBrandingSchema>
109
- // Phase 4: OrganizationModelSales, OrganizationModelProspecting, OrganizationModelProjects,
110
- // OrganizationModelNavigation removed — compound domain top-level fields deleted per D8/D1.
111
- // Retained as local aliases for content-kind payload shapes used in migration-helpers:
112
- export type SalesPipeline = z.infer<typeof SalesPipelineSchema>
113
- export type SalesStage = z.infer<typeof SalesStageSchema>
114
- export type ProspectingBuildTemplate = z.infer<typeof ProspectingBuildTemplateSchema>
115
- export type ProspectingLifecycleStage = z.infer<typeof ProspectingLifecycleStageSchema>
116
- export type ProjectsDomainState = z.infer<typeof ProjectsDomainStateSchema>
117
- export type NodeIdPath = z.infer<typeof NodeIdPathSchema>
118
- export type NodeIdString = z.infer<typeof NodeIdStringSchema>
119
- export type OrganizationModelSurface = z.infer<typeof SurfaceDefinitionSchema>
120
- export type OrganizationModelNavigationGroup = z.infer<typeof NavigationGroupSchema>
121
- export type OrganizationModelNavigation = z.infer<typeof OrganizationModelNavigationSchema>
122
- export type OrganizationModelSidebar = z.infer<typeof SidebarNavigationSchema>
123
- export type OrganizationModelSidebarSection = z.infer<typeof SidebarSectionSchema>
124
- export type OrganizationModelSidebarNode = z.infer<typeof SidebarNodeSchema>
125
- export type OrganizationModelSidebarSurfaceTargets = z.infer<typeof SidebarSurfaceTargetsSchema>
126
- export type OrganizationModelSidebarSurfaceNode = Extract<OrganizationModelSidebarNode, { type: 'surface' }>
127
- export type OrganizationModelSidebarGroupNode = Extract<OrganizationModelSidebarNode, { type: 'group' }>
128
- export type OrganizationModelTechStackEntry = z.infer<typeof TechStackEntrySchema>
129
- export type OrganizationModelStatuses = z.infer<typeof StatusesDomainSchema>
130
- export type OrganizationModelStatusEntry = z.infer<typeof StatusEntrySchema>
131
- export type OrganizationModelStatusSemanticClass = z.infer<typeof StatusSemanticClassSchema>
132
- export type OrganizationModelCustomers = z.infer<typeof CustomersDomainSchema>
133
- export type OrganizationModelCustomerSegment = z.infer<typeof CustomerSegmentSchema>
134
- export type OrganizationModelCustomerFirmographics = z.infer<typeof FirmographicsSchema>
135
- export type OrganizationModelOfferings = z.infer<typeof OfferingsDomainSchema>
136
- export type OrganizationModelProduct = z.infer<typeof ProductSchema>
137
- export type OrganizationModelPricingModel = z.infer<typeof PricingModelSchema>
138
- export type OrganizationModelRoles = z.infer<typeof RolesDomainSchema>
139
- export type OrganizationModelRole = z.infer<typeof RoleSchema>
140
- export type OrganizationModelRoleId = z.infer<typeof RoleIdSchema>
141
- export type OrganizationModelRoleHolder = z.infer<typeof RoleHolderSchema>
142
- export type OrganizationModelHumanRoleHolder = z.infer<typeof HumanRoleHolderSchema>
143
- export type OrganizationModelAgentRoleHolder = z.infer<typeof AgentRoleHolderSchema>
144
- export type OrganizationModelTeamRoleHolder = z.infer<typeof TeamRoleHolderSchema>
102
+ OrganizationModelDomainMetadataByDomainSchema,
103
+ OrganizationModelDomainMetadataSchema,
104
+ OrganizationModelSchema
105
+ } from './schema'
106
+
107
+ export type OrganizationModel = z.infer<typeof OrganizationModelSchema>
108
+ export type OrganizationModelDomainKey = z.infer<typeof OrganizationModelDomainKeySchema>
109
+ export type OrganizationModelDomainMetadata = z.infer<typeof OrganizationModelDomainMetadataSchema>
110
+ export type OrganizationModelDomainMetadataByDomain = z.infer<typeof OrganizationModelDomainMetadataByDomainSchema>
111
+ export type OrganizationModelBranding = z.infer<typeof OrganizationModelBrandingSchema>
112
+ // Phase 4: OrganizationModelSales, OrganizationModelProspecting, OrganizationModelProjects,
113
+ // OrganizationModelNavigation removed — compound domain top-level fields deleted per D8/D1.
114
+ // Retained as local aliases for content-kind payload shapes used in migration-helpers:
115
+ export type SalesPipeline = z.infer<typeof SalesPipelineSchema>
116
+ export type SalesStage = z.infer<typeof SalesStageSchema>
117
+ export type ProspectingBuildTemplate = z.infer<typeof ProspectingBuildTemplateSchema>
118
+ export type ProspectingLifecycleStage = z.infer<typeof ProspectingLifecycleStageSchema>
119
+ export type ProjectsDomainState = z.infer<typeof ProjectsDomainStateSchema>
120
+ export type NodeIdPath = z.infer<typeof NodeIdPathSchema>
121
+ export type NodeIdString = z.infer<typeof NodeIdStringSchema>
122
+ export type OrganizationModelSurface = z.infer<typeof SurfaceDefinitionSchema>
123
+ export type OrganizationModelNavigationGroup = z.infer<typeof NavigationGroupSchema>
124
+ export type OrganizationModelNavigation = z.infer<typeof OrganizationModelNavigationSchema>
125
+ export type OrganizationModelSidebar = z.infer<typeof SidebarNavigationSchema>
126
+ export type OrganizationModelSidebarSection = z.infer<typeof SidebarSectionSchema>
127
+ export type OrganizationModelSidebarNode = z.infer<typeof SidebarNodeSchema>
128
+ export type OrganizationModelSidebarSurfaceTargets = z.infer<typeof SidebarSurfaceTargetsSchema>
129
+ export type OrganizationModelSidebarSurfaceNode = Extract<OrganizationModelSidebarNode, { type: 'surface' }>
130
+ export type OrganizationModelSidebarGroupNode = Extract<OrganizationModelSidebarNode, { type: 'group' }>
131
+ export type OrganizationModelTechStackEntry = z.infer<typeof TechStackEntrySchema>
132
+ export type OrganizationModelStatuses = z.infer<typeof StatusesDomainSchema>
133
+ export type OrganizationModelStatusEntry = z.infer<typeof StatusEntrySchema>
134
+ export type OrganizationModelStatusSemanticClass = z.infer<typeof StatusSemanticClassSchema>
135
+ export type OrganizationModelCustomers = z.infer<typeof CustomersDomainSchema>
136
+ export type OrganizationModelCustomerSegment = z.infer<typeof CustomerSegmentSchema>
137
+ export type OrganizationModelCustomerFirmographics = z.infer<typeof FirmographicsSchema>
138
+ export type OrganizationModelOfferings = z.infer<typeof OfferingsDomainSchema>
139
+ export type OrganizationModelProduct = z.infer<typeof ProductSchema>
140
+ export type OrganizationModelPricingModel = z.infer<typeof PricingModelSchema>
141
+ export type OrganizationModelRoles = z.infer<typeof RolesDomainSchema>
142
+ export type OrganizationModelRole = z.infer<typeof RoleSchema>
143
+ export type OrganizationModelRoleId = z.infer<typeof RoleIdSchema>
144
+ export type OrganizationModelRoleHolder = z.infer<typeof RoleHolderSchema>
145
+ export type OrganizationModelHumanRoleHolder = z.infer<typeof HumanRoleHolderSchema>
146
+ export type OrganizationModelAgentRoleHolder = z.infer<typeof AgentRoleHolderSchema>
147
+ export type OrganizationModelTeamRoleHolder = z.infer<typeof TeamRoleHolderSchema>
145
148
  export type OrganizationModelGoals = z.infer<typeof GoalsDomainSchema>
146
149
  export type OrganizationModelObjective = z.infer<typeof ObjectiveSchema>
147
150
  export type OrganizationModelKeyResult = z.infer<typeof KeyResultSchema>
@@ -150,22 +153,25 @@ export type OrganizationModelSystems = z.infer<typeof SystemsDomainSchema>
150
153
  export type OrganizationModelSystemEntry = z.infer<typeof SystemEntrySchema>
151
154
  export type OrganizationModelSystemConfig = z.infer<typeof SystemConfigSchema>
152
155
  export type OrganizationModelSystemId = z.infer<typeof SystemIdSchema>
153
- export type OrganizationModelSystemPath = z.infer<typeof SystemPathSchema>
154
- export type OrganizationModelSystemKind = z.infer<typeof SystemKindSchema>
155
- export type OrganizationModelSystemLifecycle = z.infer<typeof SystemLifecycleSchema>
156
- /** @deprecated Use OrganizationModelSystemLifecycle. Accepted for one publish cycle. */
157
- export type OrganizationModelSystemStatus = z.infer<typeof SystemStatusSchema>
158
- export type OrganizationModelResources = z.infer<typeof ResourcesDomainSchema>
159
- export type OrganizationModelResourceEntry = z.infer<typeof ResourceEntrySchema>
160
- export type OrganizationModelResourceId = z.infer<typeof ResourceIdSchema>
161
- export type OrganizationModelCodeReference = z.infer<typeof CodeReferenceSchema>
162
- export type OrganizationModelCodeReferenceRole = z.infer<typeof CodeReferenceRoleSchema>
163
- export type EventId = z.infer<typeof EventIdSchema>
164
- export type EventEmissionDescriptor = z.infer<typeof EventEmissionDescriptorSchema>
165
- export type EventDescriptor = z.infer<typeof EventDescriptorSchema>
166
- export type OrganizationModelResourceKind = z.infer<typeof ResourceKindSchema>
156
+ export type OrganizationModelSystemPath = z.infer<typeof SystemPathSchema>
157
+ export type OrganizationModelSystemKind = z.infer<typeof SystemKindSchema>
158
+ export type OrganizationModelSystemLifecycle = z.infer<typeof SystemLifecycleSchema>
159
+ /** @deprecated Use OrganizationModelSystemLifecycle. Accepted for one publish cycle. */
160
+ export type OrganizationModelSystemStatus = z.infer<typeof SystemStatusSchema>
161
+ export type OrganizationModelResources = z.infer<typeof ResourcesDomainSchema>
162
+ export type OrganizationModelResourceEntry = z.infer<typeof ResourceEntrySchema>
163
+ export type OrganizationModelResourceId = z.infer<typeof ResourceIdSchema>
164
+ export type OrganizationModelCodeReference = z.infer<typeof CodeReferenceSchema>
165
+ export type OrganizationModelCodeReferenceRole = z.infer<typeof CodeReferenceRoleSchema>
166
+ export type EventId = z.infer<typeof EventIdSchema>
167
+ export type EventEmissionDescriptor = z.infer<typeof EventEmissionDescriptorSchema>
168
+ export type EventDescriptor = z.infer<typeof EventDescriptorSchema>
169
+ export type OrganizationModelResourceKind = z.infer<typeof ResourceKindSchema>
167
170
  export type OrganizationModelResourceGovernanceStatus = z.infer<typeof ResourceGovernanceStatusSchema>
168
171
  export type OrganizationModelResourceOntologyBinding = z.infer<typeof ResourceOntologyBindingSchema>
172
+ export type OrganizationModelContractRef = z.infer<typeof ContractRefSchema>
173
+ export type OrganizationModelResourceOntologyBindingContract = ResourceOntologyBindingContract
174
+ export type { ParsedContractRef }
169
175
  export type OrganizationModelAgentKind = z.infer<typeof AgentKindSchema>
170
176
  export type OrganizationModelScriptResourceLanguage = z.infer<typeof ScriptResourceLanguageSchema>
171
177
  export type OrganizationModelScriptResourceSource = z.infer<typeof ScriptResourceSourceSchema>
@@ -180,33 +186,33 @@ export type OrganizationModelTopologyRelationshipKind = z.infer<typeof OmTopolog
180
186
  export type OrganizationModelTopologyRelationship = z.infer<typeof OmTopologyRelationshipSchema>
181
187
  export type OrganizationModelTopologyMetadata = z.infer<typeof OmTopologyMetadataSchema>
182
188
  export type OrganizationModelActions = z.infer<typeof ActionsDomainSchema>
183
- export type OrganizationModelAction = z.infer<typeof ActionSchema>
184
- export type OrganizationModelActionId = z.infer<typeof ActionIdSchema>
185
- export type OrganizationModelActionScope = z.infer<typeof ActionScopeSchema>
186
- export type OrganizationModelActionRef = z.infer<typeof ActionRefSchema>
187
- export type OrganizationModelActionInvocationKind = z.infer<typeof ActionInvocationKindSchema>
188
- export type OrganizationModelActionInvocation = z.infer<typeof ActionInvocationSchema>
189
- export type EntityId = z.infer<typeof EntityIdSchema>
190
- export type EntityLink = z.infer<typeof EntityLinkSchema>
191
- export type Entity = z.infer<typeof EntitySchema>
192
- export type OrganizationModelEntity = z.infer<typeof EntitySchema>
193
- export type OrganizationModelEntities = z.infer<typeof EntitiesDomainSchema>
194
- export type OrganizationModelPolicies = z.infer<typeof PoliciesDomainSchema>
195
- export type OrganizationModelPolicy = z.infer<typeof PolicySchema>
196
- export type OrganizationModelPolicyId = z.infer<typeof PolicyIdSchema>
197
- export type OrganizationModelPolicyApplicability = z.infer<typeof PolicyApplicabilitySchema>
198
- export type OrganizationModelPolicyTrigger = z.infer<typeof PolicyTriggerSchema>
199
- export type OrganizationModelPolicyPredicate = z.infer<typeof PolicyPredicateSchema>
200
- export type OrganizationModelPolicyEffect = z.infer<typeof PolicyEffectSchema>
201
- export type OrganizationModelKnowledge = z.infer<typeof KnowledgeDomainSchema>
202
- export type OrgKnowledgeNode = z.infer<typeof OrgKnowledgeNodeSchema>
203
- export type OrgKnowledgeNodeInput = z.input<typeof OrgKnowledgeNodeSchema>
204
- export type OrgKnowledgeKind = z.infer<typeof OrgKnowledgeKindSchema>
205
- export type KnowledgeTargetKind = z.infer<typeof KnowledgeTargetKindSchema>
206
- export type KnowledgeTargetRef = z.infer<typeof KnowledgeTargetRefSchema>
207
- export type KnowledgeLink = z.infer<typeof KnowledgeLinkSchema>
208
- export type OrganizationModelIconToken = z.infer<typeof OrganizationModelIconTokenSchema>
209
- export type OrganizationModelBuiltinIconToken = z.infer<typeof OrganizationModelBuiltinIconTokenSchema>
210
-
211
- export type DeepPartial<T> =
212
- T extends Array<infer U> ? Array<DeepPartial<U>> : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T
189
+ export type OrganizationModelAction = z.infer<typeof ActionSchema>
190
+ export type OrganizationModelActionId = z.infer<typeof ActionIdSchema>
191
+ export type OrganizationModelActionScope = z.infer<typeof ActionScopeSchema>
192
+ export type OrganizationModelActionRef = z.infer<typeof ActionRefSchema>
193
+ export type OrganizationModelActionInvocationKind = z.infer<typeof ActionInvocationKindSchema>
194
+ export type OrganizationModelActionInvocation = z.infer<typeof ActionInvocationSchema>
195
+ export type EntityId = z.infer<typeof EntityIdSchema>
196
+ export type EntityLink = z.infer<typeof EntityLinkSchema>
197
+ export type Entity = z.infer<typeof EntitySchema>
198
+ export type OrganizationModelEntity = z.infer<typeof EntitySchema>
199
+ export type OrganizationModelEntities = z.infer<typeof EntitiesDomainSchema>
200
+ export type OrganizationModelPolicies = z.infer<typeof PoliciesDomainSchema>
201
+ export type OrganizationModelPolicy = z.infer<typeof PolicySchema>
202
+ export type OrganizationModelPolicyId = z.infer<typeof PolicyIdSchema>
203
+ export type OrganizationModelPolicyApplicability = z.infer<typeof PolicyApplicabilitySchema>
204
+ export type OrganizationModelPolicyTrigger = z.infer<typeof PolicyTriggerSchema>
205
+ export type OrganizationModelPolicyPredicate = z.infer<typeof PolicyPredicateSchema>
206
+ export type OrganizationModelPolicyEffect = z.infer<typeof PolicyEffectSchema>
207
+ export type OrganizationModelKnowledge = z.infer<typeof KnowledgeDomainSchema>
208
+ export type OrgKnowledgeNode = z.infer<typeof OrgKnowledgeNodeSchema>
209
+ export type OrgKnowledgeNodeInput = z.input<typeof OrgKnowledgeNodeSchema>
210
+ export type OrgKnowledgeKind = z.infer<typeof OrgKnowledgeKindSchema>
211
+ export type KnowledgeTargetKind = z.infer<typeof KnowledgeTargetKindSchema>
212
+ export type KnowledgeTargetRef = z.infer<typeof KnowledgeTargetRefSchema>
213
+ export type KnowledgeLink = z.infer<typeof KnowledgeLinkSchema>
214
+ export type OrganizationModelIconToken = z.infer<typeof OrganizationModelIconTokenSchema>
215
+ export type OrganizationModelBuiltinIconToken = z.infer<typeof OrganizationModelBuiltinIconTokenSchema>
216
+
217
+ export type DeepPartial<T> =
218
+ T extends Array<infer U> ? Array<DeepPartial<U>> : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T
@@ -662,6 +662,29 @@ describe('validateResourceGovernance', () => {
662
662
  ).toThrow("Resource 'lead-import' declares ontology bindings but no ontology actions")
663
663
  })
664
664
 
665
+ it('accepts contract-only workflow ontology bindings without ontology.actions', () => {
666
+ const contractOnlyResource: ResourceEntry = {
667
+ ...workflowResource,
668
+ ontology: {
669
+ contract: {
670
+ input: '@repo/elevasis-core/contracts/full-diagnostic#inputSchema'
671
+ }
672
+ }
673
+ }
674
+
675
+ const result = validateResourceGovernance(
676
+ 'test-org',
677
+ {
678
+ version: '1.0.0',
679
+ workflows: [createGovernedWorkflow(contractOnlyResource)]
680
+ },
681
+ createModel([contractOnlyResource], [systemA], { ontology: validOntology }),
682
+ { mode: 'strict' }
683
+ )
684
+
685
+ expect(result.valid).toBe(true)
686
+ })
687
+
665
688
  it('reports dangling required topology refs', () => {
666
689
  expect(() =>
667
690
  validateResourceGovernance(
@@ -156,7 +156,7 @@ function hasOntologySources(organizationModel: ResourceGovernanceModel): boolean
156
156
  }
157
157
 
158
158
  function systemHasOntologySource(system: SystemEntry): boolean {
159
- if (system.ontology !== undefined || (system.content !== undefined && Object.keys(system.content).length > 0)) return true
159
+ if (system.ontology !== undefined) return true
160
160
  return Object.values(system.systems ?? system.subsystems ?? {}).some(systemHasOntologySource)
161
161
  }
162
162
 
@@ -198,7 +198,18 @@ function addOntologyBindingIssues(
198
198
  const binding = resource.ontology
199
199
  if (binding === undefined) return
200
200
 
201
- if ((resource.kind === 'workflow' || resource.kind === 'agent') && (binding.actions?.length ?? 0) === 0) {
201
+ const hasOperationalOntologyBinding =
202
+ binding.primaryAction !== undefined ||
203
+ (binding.reads?.length ?? 0) > 0 ||
204
+ (binding.writes?.length ?? 0) > 0 ||
205
+ (binding.usesCatalogs?.length ?? 0) > 0 ||
206
+ (binding.emits?.length ?? 0) > 0
207
+
208
+ if (
209
+ (resource.kind === 'workflow' || resource.kind === 'agent') &&
210
+ hasOperationalOntologyBinding &&
211
+ (binding.actions?.length ?? 0) === 0
212
+ ) {
202
213
  addGovernanceIssue(
203
214
  issues,
204
215
  'missing-ontology-actions',
@@ -306,7 +306,7 @@ export type OrganizationModelSystemLifecycle = z.infer<typeof SystemLifecycleSch
306
306
  ### `OrganizationModelSystemStatus`
307
307
 
308
308
  ```typescript
309
- /** @deprecated Use OrganizationModelSystemLifecycle. Accepted for one publish cycle. */
309
+ /** @deprecated Use OrganizationModelSystemLifecycle. Accepted for one publish cycle. */
310
310
  export type OrganizationModelSystemStatus = z.infer<typeof SystemStatusSchema>
311
311
  ```
312
312
 
@@ -376,6 +376,18 @@ export type OrganizationModelResourceGovernanceStatus = z.infer<typeof ResourceG
376
376
  export type OrganizationModelResourceOntologyBinding = z.infer<typeof ResourceOntologyBindingSchema>
377
377
  ```
378
378
 
379
+ ### `OrganizationModelContractRef`
380
+
381
+ ```typescript
382
+ export type OrganizationModelContractRef = z.infer<typeof ContractRefSchema>
383
+ ```
384
+
385
+ ### `OrganizationModelResourceOntologyBindingContract`
386
+
387
+ ```typescript
388
+ export type OrganizationModelResourceOntologyBindingContract = ResourceOntologyBindingContract
389
+ ```
390
+
379
391
  ### `OrganizationModelAgentKind`
380
392
 
381
393
  ```typescript
@@ -625,7 +637,7 @@ export type OrganizationModelBuiltinIconToken = z.infer<typeof OrganizationModel
625
637
  ### `DeepPartial`
626
638
 
627
639
  ```typescript
628
- export type DeepPartial<T> =
640
+ export type DeepPartial<T> =
629
641
  T extends Array<infer U> ? Array<DeepPartial<U>> : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T
630
642
  ```
631
643
 
@@ -1,36 +0,0 @@
1
- import { z } from 'zod'
2
- import { defineContentType } from './registry'
3
-
4
- // ---------------------------------------------------------------------------
5
- // config kinds (Phase 3, Wave 2A)
6
- // ---------------------------------------------------------------------------
7
- //
8
- // `config:kv` — a flat key-value configuration store co-located with a system.
9
- // Per L15: single starter config type; feature-flag semantics are
10
- // a usage pattern over kv, not a separate type.
11
- //
12
- // Per L15: `config` is a first-class registered meta-kind. Scope: NEW
13
- // tenant-defined settings co-located with a system. Strongly-typed platform
14
- // fields (system.ui.devOnly, system.ui.requiresAdmin, etc.) stay where they
15
- // are and are NOT hoisting destinations for existing typed fields.
16
-
17
- const ConfigKvPayloadSchema = z.object({
18
- /**
19
- * Flat key-value entries. Values are JSON primitives.
20
- * Keys are short identifiers (e.g. 'maxBatchSize', 'featureEnabled').
21
- */
22
- entries: z
23
- .record(z.string().trim().min(1).max(200), z.union([z.string(), z.number(), z.boolean(), z.null()]))
24
- .meta({ label: 'Entries', hint: 'Key-value configuration entries (string, number, boolean, or null values)' })
25
- })
26
-
27
- export type ConfigKvPayload = z.infer<typeof ConfigKvPayloadSchema>
28
-
29
- export const configKvKind = defineContentType({
30
- kind: 'config',
31
- type: 'kv',
32
- label: 'Key-Value Config',
33
- description: 'A flat key-value configuration store co-located with a system. Values are JSON primitives.',
34
- payloadSchema: ConfigKvPayloadSchema,
35
- parentTypes: []
36
- })
@@ -1,78 +0,0 @@
1
- // ---------------------------------------------------------------------------
2
- // content-kinds barrel (Phase 3, Wave 2A)
3
- // ---------------------------------------------------------------------------
4
- //
5
- // Per D8 (locked): CONTENT_KIND_REGISTRY is populated via static import, not
6
- // side-effecting registration. This file is the single source of truth for
7
- // the populated registry. `registry.ts` exports the EMPTY registry constant
8
- // (kept for historical/import-chain reasons) — consumers MUST import from
9
- // this barrel, not from `registry.ts` directly, to get the populated registry.
10
- //
11
- // Registry keys follow the `<kind>:<type>` ContentTypeKey format (per L4, D8).
12
-
13
- export { defineContentType } from './registry'
14
- export type { ContentTypeKey, ContentTypeDefinition } from './types'
15
- export { ContentNodeBaseSchema, ContentNodeSchema, ExtensionNodeSchema } from './types'
16
- export type { ContentNodeBase, ContentNode, ExtensionNode } from './types'
17
-
18
- export { pipelineKind, stageKind } from './pipeline'
19
- export type { PipelinePayload, StagePayload } from './pipeline'
20
-
21
- export { templateKind, templateStepKind } from './template'
22
- export type { TemplatePayload, TemplateStepPayload } from './template'
23
-
24
- export { statusFlowKind, statusKind } from './status'
25
- export type { StatusFlowPayload, StatusPayload } from './status'
26
-
27
- export { configKvKind } from './config'
28
- export type { ConfigKvPayload } from './config'
29
-
30
- import { pipelineKind, stageKind } from './pipeline'
31
- import { templateKind, templateStepKind } from './template'
32
- import { statusFlowKind, statusKind } from './status'
33
- import { configKvKind } from './config'
34
- import type { ContentTypeDefinition, ContentTypeKey } from './types'
35
-
36
- /**
37
- * Compatibility registry for bridge-era System.content nodes.
38
- * New schema/catalog authoring should use System.ontology, and new
39
- * system-local settings should use System.config. These definitions remain so
40
- * old tenant content can parse, render, migrate, and project read-only.
41
- *
42
- * Per D8: static const object keyed by `'<kind>:<type>'` composite key.
43
- *
44
- * Bridge keys:
45
- * 'schema:pipeline' — projects to ontology catalog records
46
- * 'schema:stage' — projects to ontology catalog entries
47
- * 'schema:template' — projects to ontology/catalog or action metadata
48
- * 'schema:template-step' — projects to template metadata or catalog entries
49
- * 'schema:status-flow' — projects to ontology catalog records
50
- * 'schema:status' — projects to ontology catalog entries
51
- * 'config:kv' — projects into resolved System.config
52
- *
53
- * Wave 3A's `ContentNodeDescribeView` consumes `lookupContentType(kind, type)`
54
- * which indexes into this registry. Import `lookupContentType` from this barrel
55
- * to get the populated version.
56
- */
57
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
58
- export const CONTENT_KIND_REGISTRY: Readonly<Record<ContentTypeKey, ContentTypeDefinition<any>>> = {
59
- 'schema:pipeline': pipelineKind,
60
- 'schema:stage': stageKind,
61
- 'schema:template': templateKind,
62
- 'schema:template-step': templateStepKind,
63
- 'schema:status-flow': statusFlowKind,
64
- 'schema:status': statusKind,
65
- 'config:kv': configKvKind
66
- } as const
67
-
68
- /**
69
- * Look up a registered content-type definition by (kind, type).
70
- * Uses the populated CONTENT_KIND_REGISTRY from this barrel — wave 2A override
71
- * of the empty registry exported from registry.ts.
72
- * Returns `undefined` when the pair is not registered — per D2, this is not
73
- * an error; unregistered pairs render generically and skip payload validation.
74
- */
75
- export function lookupContentType(kind: string, type: string): ContentTypeDefinition | undefined {
76
- const key: ContentTypeKey = `${kind}:${type}`
77
- return CONTENT_KIND_REGISTRY[key]
78
- }
@@ -1,68 +0,0 @@
1
- import { z } from 'zod'
2
- import { defineContentType } from './registry'
3
-
4
- // ---------------------------------------------------------------------------
5
- // pipeline + stage kinds (Phase 3, Wave 2A)
6
- // ---------------------------------------------------------------------------
7
- //
8
- // `schema:pipeline` — a named pipeline that applies to an entity type.
9
- // `schema:stage` — a stage within a pipeline; parentTypes constrains it to
10
- // live under a `schema:pipeline` sibling.
11
- //
12
- // Per L19: `schema:stage` parents only under `schema:pipeline`.
13
- // Per L19 (parent kind constraint): both share the same meta-kind `schema`.
14
-
15
- const PipelinePayloadSchema = z.object({
16
- /**
17
- * Local NodeId of the entity this pipeline applies to (e.g. 'crm.deal').
18
- * `.meta({ ref: 'entity' })` enables SchemaDrivenFieldList to render a
19
- * clickable graph link to the referenced entity node.
20
- */
21
- entityId: z
22
- .string()
23
- .trim()
24
- .min(1)
25
- .max(200)
26
- .meta({ label: 'Entity', ref: 'entity', hint: 'The entity type this pipeline tracks' }),
27
- /**
28
- * Optional Kanban column color token for UI rendering.
29
- */
30
- kanbanColor: z.string().trim().min(1).max(40).optional().meta({ label: 'Kanban color', hint: 'UI color token' })
31
- })
32
-
33
- export type PipelinePayload = z.infer<typeof PipelinePayloadSchema>
34
-
35
- export const pipelineKind = defineContentType({
36
- kind: 'schema',
37
- type: 'pipeline',
38
- label: 'Pipeline',
39
- description: 'A named progression pipeline that applies to a specific entity type.',
40
- payloadSchema: PipelinePayloadSchema,
41
- parentTypes: []
42
- })
43
-
44
- // ---------------------------------------------------------------------------
45
-
46
- const StagePayloadSchema = z.object({
47
- /**
48
- * Semantic classification for this stage.
49
- * Drives color, icon, and CRM-priority logic in consuming views.
50
- * Optional — prospecting stages use data.entityKind instead.
51
- * Enum aligned with SalesStageSemanticClassSchema (sales.ts).
52
- */
53
- semanticClass: z
54
- .enum(['open', 'active', 'nurturing', 'closed_won', 'closed_lost', 'won', 'lost', 'closed'])
55
- .optional()
56
- .meta({ label: 'Semantic class', hint: 'Semantic meaning of this stage', color: 'blue' })
57
- })
58
-
59
- export type StagePayload = z.infer<typeof StagePayloadSchema>
60
-
61
- export const stageKind = defineContentType({
62
- kind: 'schema',
63
- type: 'stage',
64
- label: 'Stage',
65
- description: 'A stage within a pipeline. Must be parented under a schema:pipeline content node.',
66
- payloadSchema: StagePayloadSchema,
67
- parentTypes: ['schema:pipeline']
68
- })