@elevasis/core 0.15.1 → 0.17.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 (72) hide show
  1. package/dist/index.d.ts +1662 -23
  2. package/dist/index.js +171 -24
  3. package/dist/knowledge/index.d.ts +1340 -0
  4. package/dist/knowledge/index.js +138 -0
  5. package/dist/organization-model/index.d.ts +1662 -23
  6. package/dist/organization-model/index.js +171 -24
  7. package/dist/test-utils/index.d.ts +711 -10
  8. package/dist/test-utils/index.js +159 -16
  9. package/package.json +7 -3
  10. package/src/__tests__/publish.test.ts +14 -13
  11. package/src/__tests__/template-core-compatibility.test.ts +4 -4
  12. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +1265 -1154
  13. package/src/auth/multi-tenancy/index.ts +3 -0
  14. package/src/auth/multi-tenancy/theme-presets.ts +45 -0
  15. package/src/auth/multi-tenancy/types.ts +57 -83
  16. package/src/auth/multi-tenancy/users/api-schemas.ts +165 -194
  17. package/src/business/acquisition/activity-events.ts +1 -1
  18. package/src/business/acquisition/api-schemas.ts +1196 -1177
  19. package/src/business/acquisition/crm-state-actions.test.ts +139 -139
  20. package/src/business/acquisition/types.ts +381 -390
  21. package/src/business/crm/api-schemas.ts +40 -0
  22. package/src/business/crm/index.ts +1 -0
  23. package/src/business/deals/api-schemas.ts +79 -0
  24. package/src/business/deals/index.ts +1 -0
  25. package/src/business/projects/types.ts +124 -88
  26. package/src/execution/core/runner-types.ts +61 -80
  27. package/src/execution/engine/tools/integration/server/adapters/gmail/gmail-tools.ts +105 -104
  28. package/src/execution/engine/tools/integration/server/adapters/instantly/instantly-tools.ts +1474 -1473
  29. package/src/execution/engine/tools/integration/server/adapters/millionverifier/millionverifier-tools.ts +103 -102
  30. package/src/execution/engine/tools/integration/server/adapters/signature-api/signature-api-tools.ts +182 -179
  31. package/src/execution/engine/tools/integration/server/adapters/stripe/stripe-tools.ts +310 -309
  32. package/src/execution/engine/tools/integration/tool.ts +255 -253
  33. package/src/execution/engine/tools/lead-service-types.ts +895 -894
  34. package/src/execution/engine/tools/messages.ts +43 -0
  35. package/src/execution/engine/tools/platform/acquisition/types.ts +2 -1
  36. package/src/execution/engine/tools/platform/email/types.ts +97 -96
  37. package/src/execution/engine/tools/types.ts +234 -233
  38. package/src/execution/engine/workflow/types.ts +195 -193
  39. package/src/execution/external/api-schemas.ts +40 -0
  40. package/src/execution/external/index.ts +1 -0
  41. package/src/knowledge/README.md +32 -0
  42. package/src/knowledge/__tests__/queries.test.ts +504 -0
  43. package/src/knowledge/format.ts +99 -0
  44. package/src/knowledge/index.ts +5 -0
  45. package/src/knowledge/published.ts +5 -0
  46. package/src/knowledge/queries.ts +256 -0
  47. package/src/organization-model/__tests__/defaults.test.ts +172 -172
  48. package/src/organization-model/__tests__/foundation.test.ts +7 -7
  49. package/src/organization-model/__tests__/icons.test.ts +27 -0
  50. package/src/organization-model/__tests__/knowledge.test.ts +214 -0
  51. package/src/organization-model/contracts.ts +17 -15
  52. package/src/organization-model/defaults.ts +74 -19
  53. package/src/organization-model/domains/knowledge.ts +53 -0
  54. package/src/organization-model/domains/navigation.ts +416 -399
  55. package/src/organization-model/domains/shared.ts +6 -5
  56. package/src/organization-model/foundation.ts +10 -6
  57. package/src/organization-model/graph/build.ts +209 -182
  58. package/src/organization-model/graph/schema.ts +37 -34
  59. package/src/organization-model/graph/types.ts +47 -31
  60. package/src/organization-model/icons.ts +81 -0
  61. package/src/organization-model/index.ts +8 -3
  62. package/src/organization-model/organization-model.mdx +1 -1
  63. package/src/organization-model/published.ts +103 -86
  64. package/src/organization-model/schema.ts +90 -85
  65. package/src/organization-model/types.ts +40 -33
  66. package/src/platform/index.ts +23 -27
  67. package/src/platform/registry/index.ts +0 -4
  68. package/src/platform/registry/resource-registry.ts +0 -77
  69. package/src/platform/registry/serialized-types.ts +148 -219
  70. package/src/platform/registry/stats-types.ts +60 -60
  71. package/src/reference/_generated/contracts.md +1265 -1154
  72. package/src/platform/registry/__tests__/resource-registry.list-executable.test.ts +0 -393
@@ -0,0 +1,81 @@
1
+ import { z } from 'zod'
2
+
3
+ export const ORGANIZATION_MODEL_ICON_TOKENS = [
4
+ 'nav.dashboard',
5
+ 'nav.sales',
6
+ 'nav.crm',
7
+ 'nav.lead-gen',
8
+ 'nav.projects',
9
+ 'nav.operations',
10
+ 'nav.monitoring',
11
+ 'nav.knowledge',
12
+ 'nav.settings',
13
+ 'nav.admin',
14
+ 'nav.archive',
15
+ 'knowledge.playbook',
16
+ 'knowledge.strategy',
17
+ 'knowledge.reference',
18
+ 'feature.dashboard',
19
+ 'feature.sales',
20
+ 'feature.crm',
21
+ 'feature.finance',
22
+ 'feature.lead-gen',
23
+ 'feature.platform',
24
+ 'feature.projects',
25
+ 'feature.operations',
26
+ 'feature.knowledge',
27
+ 'feature.monitoring',
28
+ 'feature.settings',
29
+ 'feature.admin',
30
+ 'feature.archive',
31
+ 'feature.seo',
32
+ 'resource.agent',
33
+ 'resource.workflow',
34
+ 'resource.integration',
35
+ 'resource.database',
36
+ 'resource.user',
37
+ 'resource.team',
38
+ 'integration.gmail',
39
+ 'integration.google-sheets',
40
+ 'integration.attio',
41
+ 'surface.dashboard',
42
+ 'surface.overview',
43
+ 'surface.command-view',
44
+ 'surface.command-queue',
45
+ 'surface.pipeline',
46
+ 'surface.lists',
47
+ 'surface.resources',
48
+ 'surface.settings',
49
+ 'status.success',
50
+ 'status.error',
51
+ 'status.warning',
52
+ 'status.info',
53
+ 'status.pending',
54
+ 'action.approve',
55
+ 'action.reject',
56
+ 'action.retry',
57
+ 'action.edit',
58
+ 'action.view',
59
+ 'action.launch',
60
+ 'action.message',
61
+ 'action.escalate',
62
+ 'action.promote',
63
+ 'action.submit',
64
+ 'action.email'
65
+ ] as const
66
+
67
+ const CustomIconTokenSchema = z
68
+ .string()
69
+ .trim()
70
+ .max(80)
71
+ .regex(/^custom\.[a-z0-9]+(?:[-._][a-z0-9]+)*$/, 'Custom icon tokens must start with custom.')
72
+
73
+ export const OrganizationModelBuiltinIconTokenSchema = z.enum(ORGANIZATION_MODEL_ICON_TOKENS)
74
+
75
+ export const OrganizationModelIconTokenSchema = z.union([
76
+ OrganizationModelBuiltinIconTokenSchema,
77
+ CustomIconTokenSchema
78
+ ])
79
+
80
+ export type OrganizationModelBuiltinIconToken = (typeof ORGANIZATION_MODEL_ICON_TOKENS)[number]
81
+ export type OrganizationModelIconToken = z.infer<typeof OrganizationModelIconTokenSchema>
@@ -1,6 +1,11 @@
1
- export * from './schema'
2
- export * from './types'
3
- export * from './contracts'
1
+ export * from './schema'
2
+ export * from './types'
3
+ export * from './contracts'
4
+ export {
5
+ ORGANIZATION_MODEL_ICON_TOKENS,
6
+ OrganizationModelBuiltinIconTokenSchema,
7
+ OrganizationModelIconTokenSchema
8
+ } from './icons'
4
9
  export * from './defaults'
5
10
  export * from './resolve'
6
11
  export * from './foundation'
@@ -69,7 +69,7 @@ Authored fields:
69
69
  Containers omit `path`; leaves provide `path`. `uiPosition`, `requiresAdmin`, and `devOnly` inherit from ancestors.
70
70
  Development-only features remain defined and enabled with `devOnly: true`; shell consumers hide those entries and route paths outside development mode while preserving the semantic contract.
71
71
 
72
- Navigation surfaces may also carry `devOnly` for compatibility with the legacy/domain navigation model. `operations.command-view` is intentionally development-only while its graph visualization modes continue to mature.
72
+ Navigation surfaces may also carry `devOnly` for compatibility with the legacy/domain navigation model. `knowledge.command-view` is intentionally development-only while its graph visualization modes continue to mature.
73
73
 
74
74
  ## Graph IDs and Resource Links
75
75
 
@@ -1,86 +1,103 @@
1
- export { OrganizationModelSchema } from './schema'
2
- export { FeatureSchema, NodeIdPathSchema, NodeIdStringSchema, UiPositionSchema } from './domains/features'
3
- export { LinkSchema } from './graph/link'
4
- export { TechStackEntrySchema } from './domains/shared'
5
- export {
6
- PROJECTS_FEATURE_ID,
7
- PROJECTS_INDEX_SURFACE_ID,
8
- PROJECTS_VIEW_CAPABILITY_ID,
9
- SALES_FEATURE_ID,
10
- PROSPECTING_FEATURE_ID,
11
- OPERATIONS_FEATURE_ID,
12
- MONITORING_FEATURE_ID,
13
- SETTINGS_FEATURE_ID,
14
- SEO_FEATURE_ID,
15
- SALES_PIPELINE_SURFACE_ID,
16
- PROSPECTING_LISTS_SURFACE_ID,
17
- OPERATIONS_COMMAND_VIEW_SURFACE_ID,
18
- SETTINGS_ROLES_SURFACE_ID
19
- } from './contracts'
20
- export { DEFAULT_ORGANIZATION_MODEL } from './defaults'
21
- export {
22
- DEFAULT_ORGANIZATION_MODEL_STATUSES,
23
- StatusesDomainSchema,
24
- StatusEntrySchema,
25
- StatusSemanticClassSchema
26
- } from './domains/statuses'
27
- export {
28
- DEFAULT_ORGANIZATION_MODEL_OPERATIONS,
29
- OperationsDomainSchema,
30
- OperationEntrySchema,
31
- OperationSemanticClassSchema
32
- } from './domains/operations'
33
- export {
34
- DEFAULT_ORGANIZATION_MODEL_CUSTOMERS,
35
- CustomersDomainSchema,
36
- CustomerSegmentSchema,
37
- FirmographicsSchema
38
- } from './domains/customers'
39
- export {
40
- DEFAULT_ORGANIZATION_MODEL_OFFERINGS,
41
- OfferingsDomainSchema,
42
- ProductSchema,
43
- PricingModelSchema
44
- } from './domains/offerings'
45
- export { DEFAULT_ORGANIZATION_MODEL_ROLES, RolesDomainSchema, RoleSchema } from './domains/roles'
46
- export { DEFAULT_ORGANIZATION_MODEL_GOALS, GoalsDomainSchema, ObjectiveSchema, KeyResultSchema } from './domains/goals'
47
- export { defineOrganizationModel, resolveOrganizationModel } from './resolve'
48
- export { createFoundationOrganizationModel } from './foundation'
49
-
50
- export type {
51
- DeepPartial,
52
- OrganizationModel,
53
- OrganizationModelBranding,
54
- OrganizationModelSales,
55
- OrganizationModelProspecting,
56
- OrganizationModelProjects,
57
- OrganizationModelCustomerFirmographics,
58
- OrganizationModelCustomers,
59
- OrganizationModelCustomerSegment,
60
- OrganizationModelFeature,
61
- OrganizationModelGoals,
62
- OrganizationModelKeyResult,
63
- OrganizationModelObjective,
64
- OrganizationModelOfferings,
65
- OrganizationModelOperationEntry,
66
- OrganizationModelOperationSemanticClass,
67
- OrganizationModelOperations,
68
- OrganizationModelPricingModel,
69
- OrganizationModelProduct,
70
- OrganizationModelRole,
71
- OrganizationModelTechStackEntry,
72
- OrganizationModelRoles,
73
- OrganizationModelStatuses,
74
- OrganizationModelStatusEntry,
75
- OrganizationModelStatusSemanticClass,
76
- NodeIdPath,
77
- NodeIdString
78
- } from './types'
79
-
80
- export type {
81
- FoundationBranding,
82
- FoundationNavigationSurface,
83
- FoundationOrganizationModel,
84
- FoundationSurfaceIcon,
85
- FoundationSurfaceType
86
- } from './foundation'
1
+ export { OrganizationModelSchema } from './schema'
2
+ export { FeatureSchema, NodeIdPathSchema, NodeIdStringSchema, UiPositionSchema } from './domains/features'
3
+ export { LinkSchema } from './graph/link'
4
+ export { IconNameSchema, TechStackEntrySchema } from './domains/shared'
5
+ export {
6
+ ORGANIZATION_MODEL_ICON_TOKENS,
7
+ OrganizationModelBuiltinIconTokenSchema,
8
+ OrganizationModelIconTokenSchema
9
+ } from './icons'
10
+ export {
11
+ KNOWLEDGE_FEATURE_ID,
12
+ PROJECTS_FEATURE_ID,
13
+ PROJECTS_INDEX_SURFACE_ID,
14
+ PROJECTS_VIEW_CAPABILITY_ID,
15
+ SALES_FEATURE_ID,
16
+ PROSPECTING_FEATURE_ID,
17
+ OPERATIONS_FEATURE_ID,
18
+ MONITORING_FEATURE_ID,
19
+ SETTINGS_FEATURE_ID,
20
+ SEO_FEATURE_ID,
21
+ SALES_PIPELINE_SURFACE_ID,
22
+ PROSPECTING_LISTS_SURFACE_ID,
23
+ OPERATIONS_COMMAND_VIEW_SURFACE_ID,
24
+ SETTINGS_ROLES_SURFACE_ID
25
+ } from './contracts'
26
+ export { DEFAULT_ORGANIZATION_MODEL } from './defaults'
27
+ export {
28
+ DEFAULT_ORGANIZATION_MODEL_STATUSES,
29
+ StatusesDomainSchema,
30
+ StatusEntrySchema,
31
+ StatusSemanticClassSchema
32
+ } from './domains/statuses'
33
+ export {
34
+ DEFAULT_ORGANIZATION_MODEL_OPERATIONS,
35
+ OperationsDomainSchema,
36
+ OperationEntrySchema,
37
+ OperationSemanticClassSchema
38
+ } from './domains/operations'
39
+ export {
40
+ DEFAULT_ORGANIZATION_MODEL_CUSTOMERS,
41
+ CustomersDomainSchema,
42
+ CustomerSegmentSchema,
43
+ FirmographicsSchema
44
+ } from './domains/customers'
45
+ export {
46
+ DEFAULT_ORGANIZATION_MODEL_OFFERINGS,
47
+ OfferingsDomainSchema,
48
+ ProductSchema,
49
+ PricingModelSchema
50
+ } from './domains/offerings'
51
+ export { DEFAULT_ORGANIZATION_MODEL_ROLES, RolesDomainSchema, RoleSchema } from './domains/roles'
52
+ export { DEFAULT_ORGANIZATION_MODEL_GOALS, GoalsDomainSchema, ObjectiveSchema, KeyResultSchema } from './domains/goals'
53
+ export {
54
+ KnowledgeDomainSchema,
55
+ KnowledgeLinkSchema,
56
+ OrgKnowledgeNodeSchema,
57
+ OrgKnowledgeKindSchema
58
+ } from './domains/knowledge'
59
+ export { defineOrganizationModel, resolveOrganizationModel } from './resolve'
60
+ export { createFoundationOrganizationModel } from './foundation'
61
+
62
+ export type {
63
+ DeepPartial,
64
+ OrganizationModel,
65
+ OrganizationModelBranding,
66
+ OrganizationModelSales,
67
+ OrganizationModelProspecting,
68
+ OrganizationModelProjects,
69
+ OrganizationModelCustomerFirmographics,
70
+ OrganizationModelCustomers,
71
+ OrganizationModelCustomerSegment,
72
+ OrganizationModelFeature,
73
+ OrganizationModelGoals,
74
+ OrganizationModelKeyResult,
75
+ OrganizationModelObjective,
76
+ OrganizationModelOfferings,
77
+ OrganizationModelOperationEntry,
78
+ OrganizationModelOperationSemanticClass,
79
+ OrganizationModelOperations,
80
+ OrganizationModelPricingModel,
81
+ OrganizationModelProduct,
82
+ OrganizationModelRole,
83
+ OrganizationModelTechStackEntry,
84
+ OrganizationModelRoles,
85
+ OrganizationModelStatuses,
86
+ OrganizationModelStatusEntry,
87
+ OrganizationModelStatusSemanticClass,
88
+ NodeIdPath,
89
+ NodeIdString,
90
+ OrganizationModelKnowledge,
91
+ OrgKnowledgeNode,
92
+ OrgKnowledgeKind,
93
+ OrganizationModelIconToken,
94
+ OrganizationModelBuiltinIconToken
95
+ } from './types'
96
+
97
+ export type {
98
+ FoundationBranding,
99
+ FoundationNavigationSurface,
100
+ FoundationOrganizationModel,
101
+ FoundationSurfaceIcon,
102
+ FoundationSurfaceType
103
+ } from './foundation'
@@ -1,4 +1,4 @@
1
- import { z } from 'zod'
1
+ import { z } from 'zod'
2
2
  import { OrganizationModelBrandingSchema } from './domains/branding'
3
3
  import { OrganizationModelSalesSchema } from './domains/sales'
4
4
  import { OrganizationModelProjectsSchema } from './domains/projects'
@@ -8,12 +8,13 @@ import { OrganizationModelNavigationSchema } from './domains/navigation'
8
8
  import { IdentityDomainSchema, DEFAULT_ORGANIZATION_MODEL_IDENTITY } from './domains/identity'
9
9
  import { CustomersDomainSchema, DEFAULT_ORGANIZATION_MODEL_CUSTOMERS } from './domains/customers'
10
10
  import { OfferingsDomainSchema, DEFAULT_ORGANIZATION_MODEL_OFFERINGS } from './domains/offerings'
11
- import { RolesDomainSchema, DEFAULT_ORGANIZATION_MODEL_ROLES } from './domains/roles'
12
- import { GoalsDomainSchema, DEFAULT_ORGANIZATION_MODEL_GOALS } from './domains/goals'
13
- import { OperationsDomainSchema } from './domains/operations'
14
- import { StatusesDomainSchema } from './domains/statuses'
15
-
16
- const OrganizationModelSchemaBase = z.object({
11
+ import { RolesDomainSchema, DEFAULT_ORGANIZATION_MODEL_ROLES } from './domains/roles'
12
+ import { GoalsDomainSchema, DEFAULT_ORGANIZATION_MODEL_GOALS } from './domains/goals'
13
+ import { OperationsDomainSchema } from './domains/operations'
14
+ import { StatusesDomainSchema } from './domains/statuses'
15
+ import { KnowledgeDomainSchema } from './domains/knowledge'
16
+
17
+ const OrganizationModelSchemaBase = z.object({
17
18
  version: z.literal(1).default(1),
18
19
  features: z.array(FeatureSchema).default([]),
19
20
  branding: OrganizationModelBrandingSchema,
@@ -21,40 +22,41 @@ const OrganizationModelSchemaBase = z.object({
21
22
  sales: OrganizationModelSalesSchema,
22
23
  prospecting: OrganizationModelProspectingSchema,
23
24
  projects: OrganizationModelProjectsSchema,
24
- identity: IdentityDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_IDENTITY),
25
- customers: CustomersDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_CUSTOMERS),
26
- offerings: OfferingsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_OFFERINGS),
27
- roles: RolesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ROLES),
25
+ identity: IdentityDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_IDENTITY),
26
+ customers: CustomersDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_CUSTOMERS),
27
+ offerings: OfferingsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_OFFERINGS),
28
+ roles: RolesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ROLES),
28
29
  goals: GoalsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_GOALS),
29
30
  statuses: StatusesDomainSchema.default({ entries: [] }),
30
- operations: OperationsDomainSchema.default({ entries: [] })
31
+ operations: OperationsDomainSchema.default({ entries: [] }),
32
+ knowledge: KnowledgeDomainSchema.default({ nodes: [] })
31
33
  })
32
-
33
- function addIssue(ctx: z.RefinementCtx, path: Array<string | number>, message: string): void {
34
- ctx.addIssue({
35
- code: z.ZodIssueCode.custom,
36
- path,
37
- message
38
- })
39
- }
40
-
34
+
35
+ function addIssue(ctx: z.RefinementCtx, path: Array<string | number>, message: string): void {
36
+ ctx.addIssue({
37
+ code: z.ZodIssueCode.custom,
38
+ path,
39
+ message
40
+ })
41
+ }
42
+
41
43
  function collectIds<T extends { id: string }>(
42
- items: T[],
43
- ctx: z.RefinementCtx,
44
- collectionPath: Array<string | number>,
45
- label: string
46
- ): Map<string, T> {
47
- const itemsById = new Map<string, T>()
48
-
49
- items.forEach((item, index) => {
50
- if (itemsById.has(item.id)) {
51
- addIssue(ctx, [...collectionPath, index, 'id'], `${label} id "${item.id}" must be unique`)
52
- return
53
- }
54
-
55
- itemsById.set(item.id, item)
56
- })
57
-
44
+ items: T[],
45
+ ctx: z.RefinementCtx,
46
+ collectionPath: Array<string | number>,
47
+ label: string
48
+ ): Map<string, T> {
49
+ const itemsById = new Map<string, T>()
50
+
51
+ items.forEach((item, index) => {
52
+ if (itemsById.has(item.id)) {
53
+ addIssue(ctx, [...collectionPath, index, 'id'], `${label} id "${item.id}" must be unique`)
54
+ return
55
+ }
56
+
57
+ itemsById.set(item.id, item)
58
+ })
59
+
58
60
  return itemsById
59
61
  }
60
62
 
@@ -67,7 +69,7 @@ const LEGACY_FEATURE_ALIASES = new Map<string, string>([
67
69
  function hasFeature(featuresById: Map<string, unknown>, featureId: string): boolean {
68
70
  return featuresById.has(featureId) || featuresById.has(LEGACY_FEATURE_ALIASES.get(featureId) ?? '')
69
71
  }
70
-
72
+
71
73
  export const OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ctx) => {
72
74
  const featuresById = collectIds(model.features, ctx, ['features'], 'Feature')
73
75
  model.features.forEach((feature, featureIndex) => {
@@ -75,7 +77,11 @@ export const OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((
75
77
  if (segments.length > 1) {
76
78
  const parentId = segments.slice(0, -1).join('.')
77
79
  if (!featuresById.has(parentId)) {
78
- addIssue(ctx, ['features', featureIndex, 'id'], `Feature "${feature.id}" references unknown parent "${parentId}"`)
80
+ addIssue(
81
+ ctx,
82
+ ['features', featureIndex, 'id'],
83
+ `Feature "${feature.id}" references unknown parent "${parentId}"`
84
+ )
79
85
  }
80
86
  }
81
87
 
@@ -95,51 +101,50 @@ export const OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((
95
101
  }
96
102
  }
97
103
  })
98
-
99
- // Offerings -> CustomerSegment cross-ref: targetSegmentIds must resolve
100
- const segmentsById = new Map(model.customers.segments.map((seg) => [seg.id, seg]))
101
- model.offerings.products.forEach((product, productIndex) => {
102
- product.targetSegmentIds.forEach((segmentId, segmentIndex) => {
103
- if (!segmentsById.has(segmentId)) {
104
- addIssue(
105
- ctx,
106
- ['offerings', 'products', productIndex, 'targetSegmentIds', segmentIndex],
107
- `Product "${product.id}" references unknown customer segment "${segmentId}"`
108
- )
109
- }
110
- })
111
-
112
- // Offerings -> Feature cross-ref: deliveryFeatureId must resolve (when present)
104
+
105
+ // Offerings -> CustomerSegment cross-ref: targetSegmentIds must resolve
106
+ const segmentsById = new Map(model.customers.segments.map((seg) => [seg.id, seg]))
107
+ model.offerings.products.forEach((product, productIndex) => {
108
+ product.targetSegmentIds.forEach((segmentId, segmentIndex) => {
109
+ if (!segmentsById.has(segmentId)) {
110
+ addIssue(
111
+ ctx,
112
+ ['offerings', 'products', productIndex, 'targetSegmentIds', segmentIndex],
113
+ `Product "${product.id}" references unknown customer segment "${segmentId}"`
114
+ )
115
+ }
116
+ })
117
+
118
+ // Offerings -> Feature cross-ref: deliveryFeatureId must resolve (when present)
113
119
  if (product.deliveryFeatureId !== undefined && !hasFeature(featuresById, product.deliveryFeatureId)) {
114
- addIssue(
115
- ctx,
116
- ['offerings', 'products', productIndex, 'deliveryFeatureId'],
117
- `Product "${product.id}" references unknown delivery feature "${product.deliveryFeatureId}"`
118
- )
119
- }
120
- })
121
-
122
- // Goals -> period-range validation: periodEnd must be strictly after periodStart
123
- model.goals.objectives.forEach((objective, index) => {
124
- if (objective.periodEnd <= objective.periodStart) {
125
- addIssue(
126
- ctx,
127
- ['goals', 'objectives', index, 'periodEnd'],
128
- `Goal "${objective.id}" has periodEnd "${objective.periodEnd}" which must be strictly after periodStart "${objective.periodStart}"`
129
- )
130
- }
131
- })
132
-
133
- // Roles -> reportsToId cross-ref: each reportsToId must resolve to another role in the same collection
134
- const rolesById = new Map(model.roles.roles.map((role) => [role.id, role]))
135
- model.roles.roles.forEach((role, roleIndex) => {
136
- if (role.reportsToId !== undefined && !rolesById.has(role.reportsToId)) {
137
- addIssue(
138
- ctx,
139
- ['roles', 'roles', roleIndex, 'reportsToId'],
140
- `Role "${role.id}" references unknown reportsToId "${role.reportsToId}"`
141
- )
142
- }
143
- })
144
-
120
+ addIssue(
121
+ ctx,
122
+ ['offerings', 'products', productIndex, 'deliveryFeatureId'],
123
+ `Product "${product.id}" references unknown delivery feature "${product.deliveryFeatureId}"`
124
+ )
125
+ }
126
+ })
127
+
128
+ // Goals -> period-range validation: periodEnd must be strictly after periodStart
129
+ model.goals.objectives.forEach((objective, index) => {
130
+ if (objective.periodEnd <= objective.periodStart) {
131
+ addIssue(
132
+ ctx,
133
+ ['goals', 'objectives', index, 'periodEnd'],
134
+ `Goal "${objective.id}" has periodEnd "${objective.periodEnd}" which must be strictly after periodStart "${objective.periodStart}"`
135
+ )
136
+ }
137
+ })
138
+
139
+ // Roles -> reportsToId cross-ref: each reportsToId must resolve to another role in the same collection
140
+ const rolesById = new Map(model.roles.roles.map((role) => [role.id, role]))
141
+ model.roles.roles.forEach((role, roleIndex) => {
142
+ if (role.reportsToId !== undefined && !rolesById.has(role.reportsToId)) {
143
+ addIssue(
144
+ ctx,
145
+ ['roles', 'roles', roleIndex, 'reportsToId'],
146
+ `Role "${role.id}" references unknown reportsToId "${role.reportsToId}"`
147
+ )
148
+ }
149
+ })
145
150
  })
@@ -1,21 +1,23 @@
1
- import type { z } from 'zod'
2
- import { OrganizationModelBrandingSchema } from './domains/branding'
3
- import { OrganizationModelSalesSchema } from './domains/sales'
1
+ import type { z } from 'zod'
2
+ import { OrganizationModelBrandingSchema } from './domains/branding'
3
+ import { OrganizationModelSalesSchema } from './domains/sales'
4
4
  import { OrganizationModelProjectsSchema } from './domains/projects'
5
5
  import { FeatureSchema, NodeIdPathSchema, NodeIdStringSchema } from './domains/features'
6
6
  import { OrganizationModelProspectingSchema } from './domains/prospecting'
7
7
  import { OrganizationModelNavigationSchema, SurfaceDefinitionSchema } from './domains/navigation'
8
8
  import { TechStackEntrySchema } from './domains/shared'
9
- import { OperationsDomainSchema, OperationEntrySchema, OperationSemanticClassSchema } from './domains/operations'
10
- import { StatusesDomainSchema, StatusEntrySchema, StatusSemanticClassSchema } from './domains/statuses'
11
- import { CustomersDomainSchema, CustomerSegmentSchema, FirmographicsSchema } from './domains/customers'
12
- import { OfferingsDomainSchema, ProductSchema, PricingModelSchema } from './domains/offerings'
13
- import { RolesDomainSchema, RoleSchema } from './domains/roles'
14
- import { GoalsDomainSchema, ObjectiveSchema, KeyResultSchema } from './domains/goals'
15
- import { OrganizationModelSchema } from './schema'
16
-
17
- export type OrganizationModel = z.infer<typeof OrganizationModelSchema>
18
- export type OrganizationModelBranding = z.infer<typeof OrganizationModelBrandingSchema>
9
+ import { OperationsDomainSchema, OperationEntrySchema, OperationSemanticClassSchema } from './domains/operations'
10
+ import { StatusesDomainSchema, StatusEntrySchema, StatusSemanticClassSchema } from './domains/statuses'
11
+ import { CustomersDomainSchema, CustomerSegmentSchema, FirmographicsSchema } from './domains/customers'
12
+ import { OfferingsDomainSchema, ProductSchema, PricingModelSchema } from './domains/offerings'
13
+ import { RolesDomainSchema, RoleSchema } from './domains/roles'
14
+ import { GoalsDomainSchema, ObjectiveSchema, KeyResultSchema } from './domains/goals'
15
+ import { KnowledgeDomainSchema, OrgKnowledgeNodeSchema, OrgKnowledgeKindSchema } from './domains/knowledge'
16
+ import { OrganizationModelIconTokenSchema, OrganizationModelBuiltinIconTokenSchema } from './icons'
17
+ import { OrganizationModelSchema } from './schema'
18
+
19
+ export type OrganizationModel = z.infer<typeof OrganizationModelSchema>
20
+ export type OrganizationModelBranding = z.infer<typeof OrganizationModelBrandingSchema>
19
21
  export type OrganizationModelSales = z.infer<typeof OrganizationModelSalesSchema>
20
22
  export type OrganizationModelProspecting = z.infer<typeof OrganizationModelProspectingSchema>
21
23
  export type OrganizationModelProjects = z.infer<typeof OrganizationModelProjectsSchema>
@@ -25,23 +27,28 @@ export type NodeIdString = z.infer<typeof NodeIdStringSchema>
25
27
  export type OrganizationModelNavigation = z.infer<typeof OrganizationModelNavigationSchema>
26
28
  export type OrganizationModelSurface = z.infer<typeof SurfaceDefinitionSchema>
27
29
  export type OrganizationModelTechStackEntry = z.infer<typeof TechStackEntrySchema>
28
- export type OrganizationModelStatuses = z.infer<typeof StatusesDomainSchema>
29
- export type OrganizationModelStatusEntry = z.infer<typeof StatusEntrySchema>
30
- export type OrganizationModelStatusSemanticClass = z.infer<typeof StatusSemanticClassSchema>
31
- export type OrganizationModelOperations = z.infer<typeof OperationsDomainSchema>
32
- export type OrganizationModelOperationEntry = z.infer<typeof OperationEntrySchema>
33
- export type OrganizationModelOperationSemanticClass = z.infer<typeof OperationSemanticClassSchema>
34
- export type OrganizationModelCustomers = z.infer<typeof CustomersDomainSchema>
35
- export type OrganizationModelCustomerSegment = z.infer<typeof CustomerSegmentSchema>
36
- export type OrganizationModelCustomerFirmographics = z.infer<typeof FirmographicsSchema>
37
- export type OrganizationModelOfferings = z.infer<typeof OfferingsDomainSchema>
38
- export type OrganizationModelProduct = z.infer<typeof ProductSchema>
39
- export type OrganizationModelPricingModel = z.infer<typeof PricingModelSchema>
40
- export type OrganizationModelRoles = z.infer<typeof RolesDomainSchema>
41
- export type OrganizationModelRole = z.infer<typeof RoleSchema>
42
- export type OrganizationModelGoals = z.infer<typeof GoalsDomainSchema>
43
- export type OrganizationModelObjective = z.infer<typeof ObjectiveSchema>
44
- export type OrganizationModelKeyResult = z.infer<typeof KeyResultSchema>
45
-
46
- export type DeepPartial<T> =
47
- T extends Array<infer U> ? Array<DeepPartial<U>> : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T
30
+ export type OrganizationModelStatuses = z.infer<typeof StatusesDomainSchema>
31
+ export type OrganizationModelStatusEntry = z.infer<typeof StatusEntrySchema>
32
+ export type OrganizationModelStatusSemanticClass = z.infer<typeof StatusSemanticClassSchema>
33
+ export type OrganizationModelOperations = z.infer<typeof OperationsDomainSchema>
34
+ export type OrganizationModelOperationEntry = z.infer<typeof OperationEntrySchema>
35
+ export type OrganizationModelOperationSemanticClass = z.infer<typeof OperationSemanticClassSchema>
36
+ export type OrganizationModelCustomers = z.infer<typeof CustomersDomainSchema>
37
+ export type OrganizationModelCustomerSegment = z.infer<typeof CustomerSegmentSchema>
38
+ export type OrganizationModelCustomerFirmographics = z.infer<typeof FirmographicsSchema>
39
+ export type OrganizationModelOfferings = z.infer<typeof OfferingsDomainSchema>
40
+ export type OrganizationModelProduct = z.infer<typeof ProductSchema>
41
+ export type OrganizationModelPricingModel = z.infer<typeof PricingModelSchema>
42
+ export type OrganizationModelRoles = z.infer<typeof RolesDomainSchema>
43
+ export type OrganizationModelRole = z.infer<typeof RoleSchema>
44
+ export type OrganizationModelGoals = z.infer<typeof GoalsDomainSchema>
45
+ export type OrganizationModelObjective = z.infer<typeof ObjectiveSchema>
46
+ export type OrganizationModelKeyResult = z.infer<typeof KeyResultSchema>
47
+ export type OrganizationModelKnowledge = z.infer<typeof KnowledgeDomainSchema>
48
+ export type OrgKnowledgeNode = z.infer<typeof OrgKnowledgeNodeSchema>
49
+ export type OrgKnowledgeKind = z.infer<typeof OrgKnowledgeKindSchema>
50
+ export type OrganizationModelIconToken = z.infer<typeof OrganizationModelIconTokenSchema>
51
+ export type OrganizationModelBuiltinIconToken = z.infer<typeof OrganizationModelBuiltinIconTokenSchema>
52
+
53
+ export type DeepPartial<T> =
54
+ T extends Array<infer U> ? Array<DeepPartial<U>> : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T
@@ -1,27 +1,23 @@
1
- /**
2
- * Platform group barrel - browser-safe exports
3
- *
4
- * Infrastructure foundation: constants, utilities, registry, SSE, API types
5
- */
6
-
7
- // Shared constants
8
- export * from './constants/index'
9
-
10
- // Core utilities
11
- export * from './utils/index'
12
-
13
- // Resource Registry
14
- export * from './registry/index'
15
-
16
- // Serialized types (for CLI and frontend usage)
17
- export type {
18
- SerializedAgentDefinition,
19
- SerializedWorkflowDefinition,
20
- SerializedExecutionInterface
21
- } from './registry/serialized-types'
22
-
23
- // SSE event types (shared between backend and frontend)
24
- export * from './sse/index'
25
-
26
- // API types (error responses shared with frontend)
27
- export * from './api/index'
1
+ /**
2
+ * Platform group barrel - browser-safe exports
3
+ *
4
+ * Infrastructure foundation: constants, utilities, registry, SSE, API types
5
+ */
6
+
7
+ // Shared constants
8
+ export * from './constants/index'
9
+
10
+ // Core utilities
11
+ export * from './utils/index'
12
+
13
+ // Resource Registry
14
+ export * from './registry/index'
15
+
16
+ // Serialized types (for CLI and frontend usage)
17
+ export type { SerializedAgentDefinition, SerializedWorkflowDefinition } from './registry/serialized-types'
18
+
19
+ // SSE event types (shared between backend and frontend)
20
+ export * from './sse/index'
21
+
22
+ // API types (error responses shared with frontend)
23
+ export * from './api/index'