@elevasis/core 0.22.0 → 0.23.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 (112) hide show
  1. package/dist/index.d.ts +2330 -2391
  2. package/dist/index.js +2322 -1147
  3. package/dist/knowledge/index.d.ts +702 -1136
  4. package/dist/knowledge/index.js +9 -9
  5. package/dist/organization-model/index.d.ts +2330 -2391
  6. package/dist/organization-model/index.js +2322 -1147
  7. package/dist/test-utils/index.d.ts +703 -1106
  8. package/dist/test-utils/index.js +1735 -1089
  9. package/package.json +1 -1
  10. package/src/__tests__/template-core-compatibility.test.ts +11 -79
  11. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +360 -98
  12. package/src/business/acquisition/api-schemas.test.ts +2 -2
  13. package/src/business/acquisition/api-schemas.ts +7 -9
  14. package/src/business/acquisition/build-templates.test.ts +4 -4
  15. package/src/business/acquisition/build-templates.ts +72 -30
  16. package/src/business/acquisition/crm-state-actions.test.ts +13 -11
  17. package/src/business/acquisition/types.ts +7 -3
  18. package/src/execution/engine/agent/core/types.ts +1 -1
  19. package/src/execution/engine/workflow/types.ts +2 -2
  20. package/src/knowledge/README.md +8 -7
  21. package/src/knowledge/__tests__/queries.test.ts +74 -73
  22. package/src/knowledge/format.ts +10 -9
  23. package/src/knowledge/index.ts +1 -1
  24. package/src/knowledge/published.ts +1 -1
  25. package/src/knowledge/queries.ts +26 -25
  26. package/src/organization-model/README.md +66 -26
  27. package/src/organization-model/__tests__/content-kinds-registry.test.ts +210 -0
  28. package/src/organization-model/__tests__/defaults.test.ts +72 -98
  29. package/src/organization-model/__tests__/domains/actions.test.ts +56 -0
  30. package/src/organization-model/__tests__/domains/customers.test.ts +299 -295
  31. package/src/organization-model/__tests__/domains/entities.test.ts +56 -0
  32. package/src/organization-model/__tests__/domains/goals.test.ts +493 -479
  33. package/src/organization-model/__tests__/domains/identity.test.ts +280 -279
  34. package/src/organization-model/__tests__/domains/navigation.test.ts +268 -212
  35. package/src/organization-model/__tests__/domains/offerings.test.ts +414 -419
  36. package/src/organization-model/__tests__/domains/policies.test.ts +323 -0
  37. package/src/organization-model/__tests__/domains/resource-mappings.test.ts +271 -271
  38. package/src/organization-model/__tests__/domains/resources.test.ts +159 -37
  39. package/src/organization-model/__tests__/domains/roles.test.ts +147 -86
  40. package/src/organization-model/__tests__/domains/statuses.test.ts +246 -243
  41. package/src/organization-model/__tests__/domains/systems.test.ts +67 -51
  42. package/src/organization-model/__tests__/flatten-additive-merge.test.ts +361 -0
  43. package/src/organization-model/__tests__/foundation.test.ts +74 -102
  44. package/src/organization-model/__tests__/get-resources-for-system.test.ts +144 -0
  45. package/src/organization-model/__tests__/graph.test.ts +899 -71
  46. package/src/organization-model/__tests__/knowledge.test.ts +173 -52
  47. package/src/organization-model/__tests__/lookup-helpers.test.ts +438 -0
  48. package/src/organization-model/__tests__/migration-helpers.test.ts +591 -0
  49. package/src/organization-model/__tests__/prospecting-ssot.test.ts +36 -27
  50. package/src/organization-model/__tests__/recursive-system-schema.test.ts +520 -0
  51. package/src/organization-model/__tests__/resolve.test.ts +174 -23
  52. package/src/organization-model/__tests__/schema.test.ts +291 -114
  53. package/src/organization-model/__tests__/surface-projection.test.ts +207 -97
  54. package/src/organization-model/catalogs/lead-gen.ts +144 -0
  55. package/src/organization-model/content-kinds/config.ts +36 -0
  56. package/src/organization-model/content-kinds/index.ts +74 -0
  57. package/src/organization-model/content-kinds/pipeline.ts +68 -0
  58. package/src/organization-model/content-kinds/registry.ts +44 -0
  59. package/src/organization-model/content-kinds/status.ts +71 -0
  60. package/src/organization-model/content-kinds/template.ts +83 -0
  61. package/src/organization-model/content-kinds/types.ts +117 -0
  62. package/src/organization-model/contracts.ts +13 -3
  63. package/src/organization-model/defaults.ts +488 -96
  64. package/src/organization-model/domains/actions.ts +239 -0
  65. package/src/organization-model/domains/customers.ts +78 -75
  66. package/src/organization-model/domains/entities.ts +144 -0
  67. package/src/organization-model/domains/goals.ts +83 -80
  68. package/src/organization-model/domains/knowledge.ts +74 -16
  69. package/src/organization-model/domains/navigation.ts +107 -384
  70. package/src/organization-model/domains/offerings.ts +71 -66
  71. package/src/organization-model/domains/policies.ts +102 -0
  72. package/src/organization-model/domains/projects.ts +14 -48
  73. package/src/organization-model/domains/prospecting.ts +62 -181
  74. package/src/organization-model/domains/resources.ts +81 -24
  75. package/src/organization-model/domains/roles.ts +13 -10
  76. package/src/organization-model/domains/sales.ts +10 -219
  77. package/src/organization-model/domains/shared.ts +57 -57
  78. package/src/organization-model/domains/statuses.ts +339 -130
  79. package/src/organization-model/domains/systems.ts +186 -29
  80. package/src/organization-model/foundation.ts +54 -67
  81. package/src/organization-model/graph/build.ts +682 -54
  82. package/src/organization-model/graph/link.ts +1 -1
  83. package/src/organization-model/graph/schema.ts +24 -9
  84. package/src/organization-model/graph/types.ts +20 -7
  85. package/src/organization-model/helpers.ts +231 -26
  86. package/src/organization-model/index.ts +116 -5
  87. package/src/organization-model/migration-helpers.ts +249 -0
  88. package/src/organization-model/organization-graph.mdx +16 -15
  89. package/src/organization-model/organization-model.mdx +89 -41
  90. package/src/organization-model/published.ts +120 -18
  91. package/src/organization-model/resolve.ts +117 -54
  92. package/src/organization-model/schema.ts +561 -140
  93. package/src/organization-model/surface-projection.ts +116 -122
  94. package/src/organization-model/types.ts +102 -21
  95. package/src/platform/constants/versions.ts +1 -1
  96. package/src/platform/registry/__tests__/command-view.test.ts +6 -8
  97. package/src/platform/registry/__tests__/resource-link.test.ts +13 -8
  98. package/src/platform/registry/__tests__/resource-registry.integration.test.ts +16 -31
  99. package/src/platform/registry/__tests__/resource-registry.nested-systems.test.ts +245 -0
  100. package/src/platform/registry/__tests__/resource-registry.test.ts +9 -7
  101. package/src/platform/registry/__tests__/validation.test.ts +15 -11
  102. package/src/platform/registry/resource-registry.ts +20 -8
  103. package/src/platform/registry/serialization.ts +7 -7
  104. package/src/platform/registry/types.ts +3 -3
  105. package/src/platform/registry/validation.ts +17 -15
  106. package/src/reference/_generated/contracts.md +362 -99
  107. package/src/reference/glossary.md +18 -18
  108. package/src/supabase/database.types.ts +60 -0
  109. package/src/test-utils/test-utils.test.ts +1 -6
  110. package/src/organization-model/__tests__/domains/operations.test.ts +0 -203
  111. package/src/organization-model/domains/features.ts +0 -31
  112. package/src/organization-model/domains/operations.ts +0 -85
@@ -1,23 +1,30 @@
1
- import type { OrganizationModel, OrganizationModelFeature, OrganizationModelSurface } from './types'
1
+ import type {
2
+ OrganizationModel,
3
+ OrganizationModelSurface,
4
+ OrganizationModelSidebarNode,
5
+ OrganizationModelSidebarSurfaceNode,
6
+ OrganizationModelSystemEntry
7
+ } from './types'
8
+ import { listAllSystems } from './helpers'
9
+ import { getSortedSidebarEntries } from './domains/navigation'
2
10
 
3
11
  export type OrganizationSurfaceProjectionIssueCode =
4
12
  | 'duplicate-surface-id'
5
13
  | 'duplicate-surface-path'
6
- | 'unknown-default-surface'
7
- | 'unknown-group-surface'
8
- | 'unknown-surface-feature'
9
- | 'unknown-surface-feature-reference'
14
+ | 'unknown-surface-system'
10
15
 
11
16
  export interface OrganizationSurfaceProjection {
12
17
  id: string
13
18
  label: string
14
19
  path: string
15
20
  surfaceType: OrganizationModelSurface['surfaceType']
16
- featureId?: string
17
- featureIds: string[]
21
+ description?: string
22
+ icon?: string
23
+ order?: number
24
+ systemIds: string[]
18
25
  entityIds: string[]
19
26
  resourceIds: string[]
20
- capabilityIds: string[]
27
+ actionIds: string[]
21
28
  enabled: boolean
22
29
  devOnly?: boolean
23
30
  requiresAdmin?: boolean
@@ -28,104 +35,129 @@ export interface OrganizationSurfaceProjectionIssue {
28
35
  message: string
29
36
  path: Array<string | number>
30
37
  surfaceId?: string
31
- featureId?: string
32
- groupId?: string
38
+ systemId?: string
33
39
  value?: string
34
40
  }
35
41
 
36
- const LEGACY_FEATURE_ALIASES = new Map<string, string>([
37
- ['crm', 'sales.crm'],
38
- ['lead-gen', 'sales.lead-gen'],
39
- ['submitted-requests', 'monitoring.submitted-requests']
40
- ])
42
+ interface SidebarSurfaceWithId {
43
+ id: string
44
+ surface: OrganizationModelSidebarSurfaceNode
45
+ path: Array<string | number>
46
+ }
41
47
 
42
48
  function normalizePath(path: string): string {
43
49
  return path.length > 1 ? path.replace(/\/+$/, '') : path
44
50
  }
45
51
 
46
- function collectFeaturesById(model: OrganizationModel): Map<string, OrganizationModelFeature> {
47
- return new Map(model.features.map((feature) => [feature.id, feature]))
48
- }
49
-
50
- function resolveFeatureId(featuresById: Map<string, OrganizationModelFeature>, featureId: string): string | undefined {
51
- if (featuresById.has(featureId)) {
52
- return featureId
52
+ function collectSystemsById(model: OrganizationModel): Map<string, OrganizationModelSystemEntry> {
53
+ const systemsById = new Map<string, OrganizationModelSystemEntry>()
54
+ for (const { path, system } of listAllSystems(model)) {
55
+ systemsById.set(path, system)
56
+ systemsById.set(system.id, system)
53
57
  }
54
-
55
- const aliasTarget = LEGACY_FEATURE_ALIASES.get(featureId)
56
- return aliasTarget !== undefined && featuresById.has(aliasTarget) ? aliasTarget : undefined
58
+ return systemsById
57
59
  }
58
60
 
59
- function getFeatureWithAncestors(
60
- featuresById: Map<string, OrganizationModelFeature>,
61
- featureId: string
62
- ): OrganizationModelFeature[] {
63
- const features: OrganizationModelFeature[] = []
64
- const segments = featureId.split('.')
65
-
66
- for (let index = 1; index <= segments.length; index += 1) {
67
- const candidate = featuresById.get(segments.slice(0, index).join('.'))
68
- if (candidate) {
69
- features.push(candidate)
70
- }
61
+ function getSystemWithAncestors(
62
+ systemsById: Map<string, OrganizationModelSystemEntry>,
63
+ systemId: string
64
+ ): OrganizationModelSystemEntry[] {
65
+ const systems: OrganizationModelSystemEntry[] = []
66
+ let current = systemsById.get(systemId)
67
+ while (current !== undefined) {
68
+ systems.unshift(current)
69
+ current = current.parentSystemId ? systemsById.get(current.parentSystemId) : undefined
71
70
  }
72
-
73
- return features
71
+ return systems
74
72
  }
75
73
 
76
74
  function hasInheritedFlag(
77
- featuresById: Map<string, OrganizationModelFeature>,
78
- featureIds: string[],
75
+ systemsById: Map<string, OrganizationModelSystemEntry>,
76
+ systemIds: string[],
79
77
  flag: 'devOnly' | 'requiresAdmin'
80
78
  ): boolean {
81
- return featureIds.some((featureId) =>
82
- getFeatureWithAncestors(featuresById, featureId).some((feature) => feature[flag] === true)
79
+ return systemIds.some((systemId) =>
80
+ getSystemWithAncestors(systemsById, systemId).some((system) => system[flag] === true)
83
81
  )
84
82
  }
85
83
 
86
- function isFeatureEnabled(featuresById: Map<string, OrganizationModelFeature>, featureId: string): boolean {
87
- const featureLineage = getFeatureWithAncestors(featuresById, featureId)
88
- return featureLineage.length > 0 && featureLineage.every((feature) => feature.enabled)
84
+ function isLifecycleEnabled(system: OrganizationModelSystemEntry): boolean {
85
+ if (system.enabled === false) return false
86
+ return system.lifecycle !== 'deprecated' && system.lifecycle !== 'archived'
87
+ }
88
+
89
+ function isLifecycleDevOnly(system: OrganizationModelSystemEntry): boolean {
90
+ return system.devOnly === true || system.lifecycle === 'beta'
91
+ }
92
+
93
+ function isSystemEnabled(systemsById: Map<string, OrganizationModelSystemEntry>, systemId: string): boolean {
94
+ const systemLineage = getSystemWithAncestors(systemsById, systemId)
95
+ return systemLineage.length > 0 && systemLineage.every(isLifecycleEnabled)
89
96
  }
90
97
 
91
98
  function unique(values: string[]): string[] {
92
99
  return [...new Set(values)]
93
100
  }
94
101
 
102
+ function collectSidebarSurfaces(
103
+ nodes: Record<string, OrganizationModelSidebarNode>,
104
+ schemaPath: Array<string | number>,
105
+ surfaces: SidebarSurfaceWithId[] = []
106
+ ): SidebarSurfaceWithId[] {
107
+ getSortedSidebarEntries(nodes).forEach(([id, node]) => {
108
+ const nodePath = [...schemaPath, id]
109
+ if (node.type === 'group') {
110
+ collectSidebarSurfaces(node.children, [...nodePath, 'children'], surfaces)
111
+ return
112
+ }
113
+ surfaces.push({ id, surface: node, path: nodePath })
114
+ })
115
+
116
+ return surfaces
117
+ }
118
+
119
+ function getSidebarSurfaces(model: OrganizationModel): SidebarSurfaceWithId[] {
120
+ return [
121
+ ...collectSidebarSurfaces(model.navigation.sidebar.primary, ['navigation', 'sidebar', 'primary']),
122
+ ...collectSidebarSurfaces(model.navigation.sidebar.bottom, ['navigation', 'sidebar', 'bottom'])
123
+ ]
124
+ }
125
+
95
126
  export function projectOrganizationSurfaces(model: OrganizationModel): OrganizationSurfaceProjection[] {
96
- const featuresById = collectFeaturesById(model)
97
-
98
- return model.navigation.surfaces.map((surface) => {
99
- const featureId = surface.featureId ? resolveFeatureId(featuresById, surface.featureId) : undefined
100
- const featureIds = unique(
101
- [featureId, ...surface.featureIds.map((candidate) => resolveFeatureId(featuresById, candidate))].filter(
102
- (candidate): candidate is string => candidate !== undefined
103
- )
104
- )
105
- const enabled = surface.enabled && featureIds.every((candidate) => isFeatureEnabled(featuresById, candidate))
106
- const devOnly = surface.devOnly === true || hasInheritedFlag(featuresById, featureIds, 'devOnly')
107
- const requiresAdmin = hasInheritedFlag(featuresById, featureId ? [featureId] : featureIds, 'requiresAdmin')
127
+ const systemsById = collectSystemsById(model)
128
+
129
+ return getSidebarSurfaces(model).map(({ id, surface }) => {
130
+ const targets = surface.targets ?? {}
131
+ const systemIds = unique((targets.systems ?? []).filter((systemId: string) => systemsById.has(systemId)))
132
+ const enabled = systemIds.every((candidate) => isSystemEnabled(systemsById, candidate))
133
+ const devOnly =
134
+ surface.devOnly === true ||
135
+ hasInheritedFlag(systemsById, systemIds, 'devOnly') ||
136
+ systemIds.some((candidate) => getSystemWithAncestors(systemsById, candidate).some(isLifecycleDevOnly))
137
+ const requiresAdmin = hasInheritedFlag(systemsById, systemIds, 'requiresAdmin')
108
138
 
109
139
  return {
110
- id: surface.id,
140
+ id,
111
141
  label: surface.label,
112
142
  path: surface.path,
113
143
  surfaceType: surface.surfaceType,
114
- featureId,
115
- featureIds,
116
- entityIds: [...surface.entityIds],
117
- resourceIds: [...surface.resourceIds],
118
- capabilityIds: [...surface.capabilityIds],
144
+ ...(surface.description !== undefined ? { description: surface.description } : {}),
145
+ ...(surface.icon !== undefined ? { icon: surface.icon } : {}),
146
+ ...(surface.order !== undefined ? { order: surface.order } : {}),
147
+ systemIds,
148
+ entityIds: [...(targets.entities ?? [])],
149
+ resourceIds: [...(targets.resources ?? [])],
150
+ actionIds: [...(targets.actions ?? [])],
119
151
  enabled,
120
152
  ...(devOnly ? { devOnly } : {}),
121
- ...(requiresAdmin ? { requiresAdmin } : {})
153
+ ...(surface.requiresAdmin === true || requiresAdmin ? { requiresAdmin: true } : {})
122
154
  }
123
155
  })
124
156
  }
125
157
 
126
158
  export function validateOrganizationSurfaceProjection(model: OrganizationModel): OrganizationSurfaceProjectionIssue[] {
127
159
  const issues: OrganizationSurfaceProjectionIssue[] = []
128
- const featuresById = collectFeaturesById(model)
160
+ const systemsById = collectSystemsById(model)
129
161
  const surfaceIds = new Set<string>()
130
162
  const surfacePaths = new Map<string, string>()
131
163
 
@@ -133,17 +165,17 @@ export function validateOrganizationSurfaceProjection(model: OrganizationModel):
133
165
  issues.push(issue)
134
166
  }
135
167
 
136
- model.navigation.surfaces.forEach((surface, surfaceIndex) => {
137
- if (surfaceIds.has(surface.id)) {
168
+ getSidebarSurfaces(model).forEach(({ id, surface, path }) => {
169
+ if (surfaceIds.has(id)) {
138
170
  addIssue({
139
171
  code: 'duplicate-surface-id',
140
- message: `Surface id "${surface.id}" must be unique`,
141
- path: ['navigation', 'surfaces', surfaceIndex, 'id'],
142
- surfaceId: surface.id,
143
- value: surface.id
172
+ message: `Surface id "${id}" must be unique`,
173
+ path,
174
+ surfaceId: id,
175
+ value: id
144
176
  })
145
177
  } else {
146
- surfaceIds.add(surface.id)
178
+ surfaceIds.add(id)
147
179
  }
148
180
 
149
181
  const normalizedPath = normalizePath(surface.path)
@@ -152,64 +184,26 @@ export function validateOrganizationSurfaceProjection(model: OrganizationModel):
152
184
  addIssue({
153
185
  code: 'duplicate-surface-path',
154
186
  message: `Surface path "${surface.path}" is already used by surface "${existingSurfaceId}"`,
155
- path: ['navigation', 'surfaces', surfaceIndex, 'path'],
156
- surfaceId: surface.id,
187
+ path: [...path, 'path'],
188
+ surfaceId: id,
157
189
  value: surface.path
158
190
  })
159
191
  } else {
160
- surfacePaths.set(normalizedPath, surface.id)
192
+ surfacePaths.set(normalizedPath, id)
161
193
  }
162
194
 
163
- if (surface.featureId !== undefined && resolveFeatureId(featuresById, surface.featureId) === undefined) {
164
- addIssue({
165
- code: 'unknown-surface-feature',
166
- message: `Surface "${surface.id}" references unknown feature "${surface.featureId}"`,
167
- path: ['navigation', 'surfaces', surfaceIndex, 'featureId'],
168
- surfaceId: surface.id,
169
- featureId: surface.featureId,
170
- value: surface.featureId
171
- })
172
- }
173
-
174
- surface.featureIds.forEach((featureId, featureIndex) => {
175
- if (resolveFeatureId(featuresById, featureId) !== undefined) {
176
- return
177
- }
178
-
179
- addIssue({
180
- code: 'unknown-surface-feature-reference',
181
- message: `Surface "${surface.id}" references unknown feature "${featureId}"`,
182
- path: ['navigation', 'surfaces', surfaceIndex, 'featureIds', featureIndex],
183
- surfaceId: surface.id,
184
- featureId,
185
- value: featureId
186
- })
187
- })
188
- })
189
-
190
- if (model.navigation.defaultSurfaceId !== undefined && !surfaceIds.has(model.navigation.defaultSurfaceId)) {
191
- addIssue({
192
- code: 'unknown-default-surface',
193
- message: `Default surface "${model.navigation.defaultSurfaceId}" is not declared in navigation.surfaces`,
194
- path: ['navigation', 'defaultSurfaceId'],
195
- surfaceId: model.navigation.defaultSurfaceId,
196
- value: model.navigation.defaultSurfaceId
197
- })
198
- }
199
-
200
- model.navigation.groups.forEach((group, groupIndex) => {
201
- group.surfaceIds.forEach((surfaceId, surfaceIndex) => {
202
- if (surfaceIds.has(surfaceId)) {
195
+ surface.targets?.systems?.forEach((systemId: string, systemIndex: number) => {
196
+ if (systemsById.has(systemId)) {
203
197
  return
204
198
  }
205
199
 
206
200
  addIssue({
207
- code: 'unknown-group-surface',
208
- message: `Navigation group "${group.id}" references unknown surface "${surfaceId}"`,
209
- path: ['navigation', 'groups', groupIndex, 'surfaceIds', surfaceIndex],
210
- surfaceId,
211
- groupId: group.id,
212
- value: surfaceId
201
+ code: 'unknown-surface-system',
202
+ message: `Surface "${id}" references unknown system "${systemId}"`,
203
+ path: [...path, 'targets', 'systems', systemIndex],
204
+ surfaceId: id,
205
+ systemId,
206
+ value: systemId
213
207
  })
214
208
  })
215
209
  })
@@ -1,12 +1,19 @@
1
1
  import type { z } from 'zod'
2
2
  import { OrganizationModelBrandingSchema } from './domains/branding'
3
- import { OrganizationModelSalesSchema } from './domains/sales'
4
- import { OrganizationModelProjectsSchema } from './domains/projects'
5
- import { FeatureSchema, NodeIdPathSchema, NodeIdStringSchema } from './domains/features'
6
- import { OrganizationModelProspectingSchema } from './domains/prospecting'
7
- import { OrganizationModelNavigationSchema, SurfaceDefinitionSchema } from './domains/navigation'
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'
8
16
  import { TechStackEntrySchema } from './domains/shared'
9
- import { OperationsDomainSchema, OperationEntrySchema, OperationSemanticClassSchema } from './domains/operations'
10
17
  import { StatusesDomainSchema, StatusEntrySchema, StatusSemanticClassSchema } from './domains/statuses'
11
18
  import { CustomersDomainSchema, CustomerSegmentSchema, FirmographicsSchema } from './domains/customers'
12
19
  import { OfferingsDomainSchema, ProductSchema, PricingModelSchema } from './domains/offerings'
@@ -21,9 +28,10 @@ import {
21
28
  } from './domains/roles'
22
29
  import { GoalsDomainSchema, ObjectiveSchema, KeyResultSchema } from './domains/goals'
23
30
  import {
24
- KnowledgeDomainBindingSchema,
25
31
  KnowledgeDomainSchema,
26
- KnowledgeSkillBindingSchema,
32
+ KnowledgeLinkSchema,
33
+ KnowledgeTargetKindSchema,
34
+ KnowledgeTargetRefSchema,
27
35
  OrgKnowledgeKindSchema,
28
36
  OrgKnowledgeNodeSchema
29
37
  } from './domains/knowledge'
@@ -31,40 +39,83 @@ import {
31
39
  SystemEntrySchema,
32
40
  SystemIdSchema,
33
41
  SystemKindSchema,
34
- SystemsDomainSchema,
35
- SystemStatusSchema
42
+ SystemLifecycleSchema,
43
+ SystemPathSchema,
44
+ SystemStatusSchema,
45
+ SystemsDomainSchema
36
46
  } from './domains/systems'
37
47
  import {
38
48
  AgentKindSchema,
39
49
  AgentResourceEntrySchema,
50
+ EventDescriptorSchema,
51
+ EventEmissionDescriptorSchema,
52
+ EventIdSchema,
40
53
  IntegrationResourceEntrySchema,
41
54
  ResourceEntrySchema,
42
55
  ResourceGovernanceStatusSchema,
43
56
  ResourceIdSchema,
44
57
  ResourceKindSchema,
45
58
  ResourcesDomainSchema,
59
+ ScriptResourceEntrySchema,
60
+ ScriptResourceLanguageSchema,
61
+ ScriptResourceSourceSchema,
46
62
  WorkflowResourceEntrySchema
47
63
  } from './domains/resources'
64
+ import {
65
+ ActionsDomainSchema,
66
+ ActionIdSchema,
67
+ ActionInvocationKindSchema,
68
+ ActionInvocationSchema,
69
+ ActionRefSchema,
70
+ ActionSchema,
71
+ ActionScopeSchema
72
+ } from './domains/actions'
73
+ import { EntitiesDomainSchema, EntityIdSchema, EntityLinkSchema, EntitySchema } from './domains/entities'
74
+ import {
75
+ PoliciesDomainSchema,
76
+ PolicyEffectSchema,
77
+ PolicyApplicabilitySchema,
78
+ PolicyIdSchema,
79
+ PolicyPredicateSchema,
80
+ PolicySchema,
81
+ PolicyTriggerSchema
82
+ } from './domains/policies'
48
83
  import { OrganizationModelIconTokenSchema, OrganizationModelBuiltinIconTokenSchema } from './icons'
49
- import { OrganizationModelSchema } from './schema'
84
+ import {
85
+ OrganizationModelDomainKeySchema,
86
+ OrganizationModelDomainMetadataByDomainSchema,
87
+ OrganizationModelDomainMetadataSchema,
88
+ OrganizationModelSchema
89
+ } from './schema'
50
90
 
51
91
  export type OrganizationModel = z.infer<typeof OrganizationModelSchema>
92
+ export type OrganizationModelDomainKey = z.infer<typeof OrganizationModelDomainKeySchema>
93
+ export type OrganizationModelDomainMetadata = z.infer<typeof OrganizationModelDomainMetadataSchema>
94
+ export type OrganizationModelDomainMetadataByDomain = z.infer<typeof OrganizationModelDomainMetadataByDomainSchema>
52
95
  export type OrganizationModelBranding = z.infer<typeof OrganizationModelBrandingSchema>
53
- export type OrganizationModelSales = z.infer<typeof OrganizationModelSalesSchema>
54
- export type OrganizationModelProspecting = z.infer<typeof OrganizationModelProspectingSchema>
55
- export type OrganizationModelProjects = z.infer<typeof OrganizationModelProjectsSchema>
56
- export type OrganizationModelFeature = z.infer<typeof FeatureSchema>
96
+ // Phase 4: OrganizationModelSales, OrganizationModelProspecting, OrganizationModelProjects,
97
+ // OrganizationModelNavigation removed compound domain top-level fields deleted per D8/D1.
98
+ // Retained as local aliases for content-kind payload shapes used in migration-helpers:
99
+ export type SalesPipeline = z.infer<typeof SalesPipelineSchema>
100
+ export type SalesStage = z.infer<typeof SalesStageSchema>
101
+ export type ProspectingBuildTemplate = z.infer<typeof ProspectingBuildTemplateSchema>
102
+ export type ProspectingLifecycleStage = z.infer<typeof ProspectingLifecycleStageSchema>
103
+ export type ProjectsDomainState = z.infer<typeof ProjectsDomainStateSchema>
57
104
  export type NodeIdPath = z.infer<typeof NodeIdPathSchema>
58
105
  export type NodeIdString = z.infer<typeof NodeIdStringSchema>
59
- export type OrganizationModelNavigation = z.infer<typeof OrganizationModelNavigationSchema>
60
106
  export type OrganizationModelSurface = z.infer<typeof SurfaceDefinitionSchema>
107
+ export type OrganizationModelNavigationGroup = z.infer<typeof NavigationGroupSchema>
108
+ export type OrganizationModelNavigation = z.infer<typeof OrganizationModelNavigationSchema>
109
+ export type OrganizationModelSidebar = z.infer<typeof SidebarNavigationSchema>
110
+ export type OrganizationModelSidebarSection = z.infer<typeof SidebarSectionSchema>
111
+ export type OrganizationModelSidebarNode = z.infer<typeof SidebarNodeSchema>
112
+ export type OrganizationModelSidebarSurfaceTargets = z.infer<typeof SidebarSurfaceTargetsSchema>
113
+ export type OrganizationModelSidebarSurfaceNode = Extract<OrganizationModelSidebarNode, { type: 'surface' }>
114
+ export type OrganizationModelSidebarGroupNode = Extract<OrganizationModelSidebarNode, { type: 'group' }>
61
115
  export type OrganizationModelTechStackEntry = z.infer<typeof TechStackEntrySchema>
62
116
  export type OrganizationModelStatuses = z.infer<typeof StatusesDomainSchema>
63
117
  export type OrganizationModelStatusEntry = z.infer<typeof StatusEntrySchema>
64
118
  export type OrganizationModelStatusSemanticClass = z.infer<typeof StatusSemanticClassSchema>
65
- export type OrganizationModelOperations = z.infer<typeof OperationsDomainSchema>
66
- export type OrganizationModelOperationEntry = z.infer<typeof OperationEntrySchema>
67
- export type OrganizationModelOperationSemanticClass = z.infer<typeof OperationSemanticClassSchema>
68
119
  export type OrganizationModelCustomers = z.infer<typeof CustomersDomainSchema>
69
120
  export type OrganizationModelCustomerSegment = z.infer<typeof CustomerSegmentSchema>
70
121
  export type OrganizationModelCustomerFirmographics = z.infer<typeof FirmographicsSchema>
@@ -84,22 +135,52 @@ export type OrganizationModelKeyResult = z.infer<typeof KeyResultSchema>
84
135
  export type OrganizationModelSystems = z.infer<typeof SystemsDomainSchema>
85
136
  export type OrganizationModelSystemEntry = z.infer<typeof SystemEntrySchema>
86
137
  export type OrganizationModelSystemId = z.infer<typeof SystemIdSchema>
138
+ export type OrganizationModelSystemPath = z.infer<typeof SystemPathSchema>
87
139
  export type OrganizationModelSystemKind = z.infer<typeof SystemKindSchema>
140
+ export type OrganizationModelSystemLifecycle = z.infer<typeof SystemLifecycleSchema>
141
+ /** @deprecated Use OrganizationModelSystemLifecycle. Accepted for one publish cycle. */
88
142
  export type OrganizationModelSystemStatus = z.infer<typeof SystemStatusSchema>
89
143
  export type OrganizationModelResources = z.infer<typeof ResourcesDomainSchema>
90
144
  export type OrganizationModelResourceEntry = z.infer<typeof ResourceEntrySchema>
91
145
  export type OrganizationModelResourceId = z.infer<typeof ResourceIdSchema>
146
+ export type EventId = z.infer<typeof EventIdSchema>
147
+ export type EventEmissionDescriptor = z.infer<typeof EventEmissionDescriptorSchema>
148
+ export type EventDescriptor = z.infer<typeof EventDescriptorSchema>
92
149
  export type OrganizationModelResourceKind = z.infer<typeof ResourceKindSchema>
93
150
  export type OrganizationModelResourceGovernanceStatus = z.infer<typeof ResourceGovernanceStatusSchema>
94
151
  export type OrganizationModelAgentKind = z.infer<typeof AgentKindSchema>
152
+ export type OrganizationModelScriptResourceLanguage = z.infer<typeof ScriptResourceLanguageSchema>
153
+ export type OrganizationModelScriptResourceSource = z.infer<typeof ScriptResourceSourceSchema>
95
154
  export type OrganizationModelWorkflowResourceEntry = z.infer<typeof WorkflowResourceEntrySchema>
96
155
  export type OrganizationModelAgentResourceEntry = z.infer<typeof AgentResourceEntrySchema>
97
156
  export type OrganizationModelIntegrationResourceEntry = z.infer<typeof IntegrationResourceEntrySchema>
157
+ export type OrganizationModelScriptResourceEntry = z.infer<typeof ScriptResourceEntrySchema>
158
+ export type OrganizationModelActions = z.infer<typeof ActionsDomainSchema>
159
+ export type OrganizationModelAction = z.infer<typeof ActionSchema>
160
+ export type OrganizationModelActionId = z.infer<typeof ActionIdSchema>
161
+ export type OrganizationModelActionScope = z.infer<typeof ActionScopeSchema>
162
+ export type OrganizationModelActionRef = z.infer<typeof ActionRefSchema>
163
+ export type OrganizationModelActionInvocationKind = z.infer<typeof ActionInvocationKindSchema>
164
+ export type OrganizationModelActionInvocation = z.infer<typeof ActionInvocationSchema>
165
+ export type EntityId = z.infer<typeof EntityIdSchema>
166
+ export type EntityLink = z.infer<typeof EntityLinkSchema>
167
+ export type Entity = z.infer<typeof EntitySchema>
168
+ export type OrganizationModelEntity = z.infer<typeof EntitySchema>
169
+ export type OrganizationModelEntities = z.infer<typeof EntitiesDomainSchema>
170
+ export type OrganizationModelPolicies = z.infer<typeof PoliciesDomainSchema>
171
+ export type OrganizationModelPolicy = z.infer<typeof PolicySchema>
172
+ export type OrganizationModelPolicyId = z.infer<typeof PolicyIdSchema>
173
+ export type OrganizationModelPolicyApplicability = z.infer<typeof PolicyApplicabilitySchema>
174
+ export type OrganizationModelPolicyTrigger = z.infer<typeof PolicyTriggerSchema>
175
+ export type OrganizationModelPolicyPredicate = z.infer<typeof PolicyPredicateSchema>
176
+ export type OrganizationModelPolicyEffect = z.infer<typeof PolicyEffectSchema>
98
177
  export type OrganizationModelKnowledge = z.infer<typeof KnowledgeDomainSchema>
99
178
  export type OrgKnowledgeNode = z.infer<typeof OrgKnowledgeNodeSchema>
179
+ export type OrgKnowledgeNodeInput = z.input<typeof OrgKnowledgeNodeSchema>
100
180
  export type OrgKnowledgeKind = z.infer<typeof OrgKnowledgeKindSchema>
101
- export type KnowledgeSkillBinding = z.infer<typeof KnowledgeSkillBindingSchema>
102
- export type KnowledgeDomainBinding = z.infer<typeof KnowledgeDomainBindingSchema>
181
+ export type KnowledgeTargetKind = z.infer<typeof KnowledgeTargetKindSchema>
182
+ export type KnowledgeTargetRef = z.infer<typeof KnowledgeTargetRefSchema>
183
+ export type KnowledgeLink = z.infer<typeof KnowledgeLinkSchema>
103
184
  export type OrganizationModelIconToken = z.infer<typeof OrganizationModelIconTokenSchema>
104
185
  export type OrganizationModelBuiltinIconToken = z.infer<typeof OrganizationModelBuiltinIconTokenSchema>
105
186
 
@@ -1,3 +1,3 @@
1
1
  export const VERSION = {
2
- CURRENT: '1.8.7'
2
+ CURRENT: '1.8.8'
3
3
  }
@@ -36,13 +36,12 @@ const mockAgent: CommandViewAgent = {
36
36
  type: 'agent',
37
37
  status: 'dev',
38
38
  modelProvider: 'anthropic',
39
- modelId: 'claude-sonnet-4-20250514',
39
+ modelId: 'claude-sonnet-4-20250514',
40
40
  toolCount: 5,
41
41
  hasKnowledgeMap: true,
42
42
  hasMemory: false,
43
- links: [{ nodeId: 'feature:sales.crm', kind: 'operates-on' }],
44
43
  category: 'production'
45
- }
44
+ }
46
45
 
47
46
  const mockWorkflow: CommandViewWorkflow = {
48
47
  resourceId: 'test-workflow-456',
@@ -50,11 +49,10 @@ const mockWorkflow: CommandViewWorkflow = {
50
49
  description: 'A test workflow for unit testing',
51
50
  version: '2.1.0',
52
51
  type: 'workflow',
53
- status: 'prod',
54
- stepCount: 3,
55
- entryPoint: 'start',
56
- links: [{ nodeId: 'feature:monitoring.submitted-requests', kind: 'operates-on' }]
57
- }
52
+ status: 'prod',
53
+ stepCount: 3,
54
+ entryPoint: 'start'
55
+ }
58
56
 
59
57
  const mockTrigger: TriggerDefinition = {
60
58
  resourceId: 'test-trigger-789',
@@ -4,27 +4,32 @@ import type { OrganizationGraph } from '../../../organization-model/graph/types'
4
4
 
5
5
  describe('resource-link', () => {
6
6
  it('parses resource links and categories', () => {
7
- expect(ResourceLinkSchema.parse({ nodeId: 'feature:sales.crm', kind: 'operates-on' })).toEqual({
8
- nodeId: 'feature:sales.crm',
9
- kind: 'operates-on'
7
+ expect(ResourceLinkSchema.parse({ nodeId: 'system:sales.crm', kind: 'references' })).toEqual({
8
+ nodeId: 'system:sales.crm',
9
+ kind: 'references'
10
10
  })
11
11
  expect(ResourceCategorySchema.parse('diagnostic')).toBe('diagnostic')
12
12
  })
13
13
 
14
14
  it('rejects node ids without a kind prefix', () => {
15
- expect(() => ResourceLinkSchema.parse({ nodeId: 'sales.crm', kind: 'operates-on' })).toThrow()
15
+ expect(() => ResourceLinkSchema.parse({ nodeId: 'sales.crm', kind: 'references' })).toThrow()
16
+ })
17
+
18
+ it('rejects retired ad hoc resource-operation links', () => {
19
+ const retiredKind = ['operates', 'on'].join('-')
20
+ expect(() => ResourceLinkSchema.parse({ nodeId: 'system:sales.crm', kind: retiredKind })).toThrow()
16
21
  })
17
22
 
18
23
  it('builds and validates graph node ids', () => {
19
24
  const graph: OrganizationGraph = {
20
25
  version: 1,
21
26
  organizationModelVersion: 1,
22
- nodes: [{ id: 'feature:sales.crm', kind: 'feature', label: 'CRM', sourceId: 'sales.crm' }],
27
+ nodes: [{ id: 'system:sales.crm', kind: 'system', label: 'CRM', sourceId: 'sales.crm' }],
23
28
  edges: []
24
29
  }
25
30
 
26
- expect(kindPrefix('feature', 'sales.crm')).toBe('feature:sales.crm')
27
- expect(() => validateNodeId('feature:sales.crm', graph)).not.toThrow()
28
- expect(() => validateNodeId('feature:missing', graph)).toThrow(/Unknown organization graph node/)
31
+ expect(kindPrefix('system', 'sales.crm')).toBe('system:sales.crm')
32
+ expect(() => validateNodeId('system:sales.crm', graph)).not.toThrow()
33
+ expect(() => validateNodeId('system:missing', graph)).toThrow(/Unknown organization graph node/)
29
34
  })
30
35
  })