@elevasis/core 0.25.0 → 0.27.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 (80) hide show
  1. package/dist/index.d.ts +171 -90
  2. package/dist/index.js +377 -1541
  3. package/dist/knowledge/index.d.ts +48 -59
  4. package/dist/knowledge/index.js +1 -1
  5. package/dist/organization-model/index.d.ts +171 -90
  6. package/dist/organization-model/index.js +377 -1541
  7. package/dist/test-utils/index.d.ts +25 -33
  8. package/dist/test-utils/index.js +250 -1357
  9. package/package.json +1 -1
  10. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +990 -1065
  11. package/src/business/acquisition/api-schemas.test.ts +1996 -1882
  12. package/src/business/acquisition/api-schemas.ts +1478 -1502
  13. package/src/business/acquisition/crm-next-action.test.ts +45 -25
  14. package/src/business/acquisition/crm-next-action.ts +227 -220
  15. package/src/business/acquisition/crm-priority.test.ts +41 -8
  16. package/src/business/acquisition/crm-priority.ts +365 -349
  17. package/src/business/acquisition/crm-state-actions.test.ts +208 -153
  18. package/src/business/acquisition/derive-actions.test.ts +101 -34
  19. package/src/business/acquisition/derive-actions.ts +8 -92
  20. package/src/business/acquisition/ontology-validation.ts +76 -162
  21. package/src/business/acquisition/types.ts +7 -8
  22. package/src/business/pdf/sections/investment.ts +1 -1
  23. package/src/business/pdf/sections/summary-investment.ts +1 -1
  24. package/src/execution/engine/tools/tool-maps.ts +872 -831
  25. package/src/knowledge/queries.ts +0 -1
  26. package/src/organization-model/__tests__/content-kinds-registry.test.ts +35 -210
  27. package/src/organization-model/__tests__/cross-ref.test.ts +167 -0
  28. package/src/organization-model/__tests__/defaults.test.ts +4 -4
  29. package/src/organization-model/__tests__/domains/actions.test.ts +12 -36
  30. package/src/organization-model/__tests__/domains/offerings.test.ts +13 -6
  31. package/src/organization-model/__tests__/domains/resources.test.ts +497 -350
  32. package/src/organization-model/__tests__/domains/systems.test.ts +6 -7
  33. package/src/organization-model/__tests__/flatten-additive-merge.test.ts +68 -80
  34. package/src/organization-model/__tests__/foundation.test.ts +81 -14
  35. package/src/organization-model/__tests__/graph.test.ts +662 -694
  36. package/src/organization-model/__tests__/knowledge.test.ts +31 -17
  37. package/src/organization-model/__tests__/lookup-helpers.test.ts +128 -438
  38. package/src/organization-model/__tests__/migration-helpers.test.ts +362 -591
  39. package/src/organization-model/__tests__/prospecting-ssot.test.ts +68 -103
  40. package/src/organization-model/__tests__/published-zero-leak.test.ts +76 -0
  41. package/src/organization-model/__tests__/recursive-system-schema.test.ts +159 -532
  42. package/src/organization-model/__tests__/resolve.test.ts +79 -42
  43. package/src/organization-model/__tests__/schema-refinements.test.ts +72 -0
  44. package/src/organization-model/__tests__/schema.test.ts +65 -56
  45. package/src/organization-model/catalogs/lead-gen.ts +0 -103
  46. package/src/organization-model/cross-ref.ts +175 -0
  47. package/src/organization-model/defaults.ts +17 -702
  48. package/src/organization-model/domains/actions.ts +116 -333
  49. package/src/organization-model/domains/branding.ts +6 -6
  50. package/src/organization-model/domains/knowledge.ts +15 -7
  51. package/src/organization-model/domains/projects.ts +4 -4
  52. package/src/organization-model/domains/prospecting.ts +405 -395
  53. package/src/organization-model/domains/resources.ts +206 -135
  54. package/src/organization-model/domains/sales.test.ts +104 -218
  55. package/src/organization-model/domains/sales.ts +217 -380
  56. package/src/organization-model/domains/systems.ts +8 -23
  57. package/src/organization-model/graph/build.ts +223 -294
  58. package/src/organization-model/graph/schema.ts +2 -3
  59. package/src/organization-model/graph/types.ts +12 -14
  60. package/src/organization-model/helpers.ts +130 -218
  61. package/src/organization-model/index.ts +105 -124
  62. package/src/organization-model/migration-helpers.ts +211 -249
  63. package/src/organization-model/ontology.ts +0 -60
  64. package/src/organization-model/organization-graph.mdx +4 -5
  65. package/src/organization-model/organization-model.mdx +1 -1
  66. package/src/organization-model/published.ts +236 -226
  67. package/src/organization-model/resolve.ts +4 -5
  68. package/src/organization-model/schema-refinements.ts +667 -0
  69. package/src/organization-model/schema.ts +88 -889
  70. package/src/organization-model/types.ts +167 -161
  71. package/src/platform/registry/__tests__/validation.test.ts +23 -0
  72. package/src/platform/registry/validation.ts +13 -2
  73. package/src/reference/_generated/contracts.md +990 -1065
  74. package/src/organization-model/content-kinds/config.ts +0 -36
  75. package/src/organization-model/content-kinds/index.ts +0 -78
  76. package/src/organization-model/content-kinds/pipeline.ts +0 -68
  77. package/src/organization-model/content-kinds/registry.ts +0 -44
  78. package/src/organization-model/content-kinds/status.ts +0 -71
  79. package/src/organization-model/content-kinds/template.ts +0 -83
  80. package/src/organization-model/content-kinds/types.ts +0 -117
@@ -94,24 +94,6 @@ declare const OntologyScopeSchema: z.ZodDefault<z.ZodObject<{
94
94
  }, z.core.$strip>>;
95
95
  type OntologyScope = z.infer<typeof OntologyScopeSchema>;
96
96
 
97
- /**
98
- * Placeholder discriminated union for ContentNode (Wave 1A).
99
- * Wave 2A wires concrete (kind, type) pairs via the registry.
100
- *
101
- * Per D2: unregistered (kind, type) pairs are allowed and pass through validation.
102
- * Per L14: every node carries BOTH `kind` and `type`.
103
- */
104
- declare const ContentNodeSchema: z.ZodObject<{
105
- label: z.ZodString;
106
- description: z.ZodOptional<z.ZodString>;
107
- order: z.ZodOptional<z.ZodNumber>;
108
- parentContentId: z.ZodOptional<z.ZodString>;
109
- kind: z.ZodString;
110
- type: z.ZodString;
111
- data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
112
- }, z.core.$strip>;
113
- type ContentNode = z.infer<typeof ContentNodeSchema>;
114
-
115
97
  type JsonPrimitive = string | number | boolean | null;
116
98
  type JsonValue = JsonPrimitive | JsonValue[] | {
117
99
  [key: string]: JsonValue;
@@ -153,33 +135,9 @@ interface SystemEntry {
153
135
  config?: Record<string, JsonValue>;
154
136
  ontology?: OntologyScope;
155
137
  systems?: Record<string, SystemEntry>;
156
- /**
157
- * @deprecated Compatibility-only bridge for old tenant data and migration readers.
158
- * Author new semantic catalogs in `ontology` and local settings in `config`.
159
- */
160
- content?: Record<string, ContentNode>;
161
138
  subsystems?: Record<string, SystemEntry>;
162
139
  }
163
140
 
164
- /**
165
- * Command View Types
166
- *
167
- * Unified type definitions for the Command View graph visualization.
168
- * These types are used by both backend serialization and frontend rendering.
169
- *
170
- * Command View shows the resource graph: agents, workflows, triggers, integrations,
171
- * external resources, and human checkpoints with their relationships.
172
- */
173
-
174
- /**
175
- * Relationship types between resources
176
- *
177
- * - triggers: Resource initiates/starts another resource (orange)
178
- * - uses: Resource uses an integration (teal)
179
- * - approval: Resource requires human approval (yellow)
180
- */
181
- type RelationshipType = 'triggers' | 'uses' | 'approval';
182
-
183
141
  declare const SurfaceTypeSchema: z.ZodEnum<{
184
142
  dashboard: "dashboard";
185
143
  settings: "settings";
@@ -303,11 +261,10 @@ declare const OrgKnowledgeNodeSchema: z.ZodObject<{
303
261
  ontology: "ontology";
304
262
  role: "role";
305
263
  goal: "goal";
306
- stage: "stage";
307
264
  resource: "resource";
265
+ stage: "stage";
308
266
  "customer-segment": "customer-segment";
309
267
  offering: "offering";
310
- "content-node": "content-node";
311
268
  }>;
312
269
  id: z.ZodString;
313
270
  }, z.core.$strip>;
@@ -315,7 +272,7 @@ declare const OrgKnowledgeNodeSchema: z.ZodObject<{
315
272
  nodeId: z.ZodUnion<readonly [z.ZodString, z.ZodTemplateLiteral<`ontology:${string}`>]>;
316
273
  }, z.core.$strip>]>, z.ZodTransform<{
317
274
  target: {
318
- kind: "knowledge" | "system" | "action" | "ontology" | "role" | "goal" | "stage" | "resource" | "customer-segment" | "offering" | "content-node";
275
+ kind: "knowledge" | "system" | "action" | "ontology" | "role" | "goal" | "resource" | "stage" | "customer-segment" | "offering";
319
276
  id: string;
320
277
  };
321
278
  nodeId: string;
@@ -323,7 +280,7 @@ declare const OrgKnowledgeNodeSchema: z.ZodObject<{
323
280
  nodeId: string;
324
281
  } | {
325
282
  target: {
326
- kind: "knowledge" | "system" | "action" | "ontology" | "role" | "goal" | "stage" | "resource" | "customer-segment" | "offering" | "content-node";
283
+ kind: "knowledge" | "system" | "action" | "ontology" | "role" | "goal" | "resource" | "stage" | "customer-segment" | "offering";
327
284
  id: string;
328
285
  };
329
286
  }>>>>;
@@ -571,7 +528,7 @@ declare const OrganizationModelSchema: z.ZodObject<{
571
528
  lastModified: string;
572
529
  } | undefined;
573
530
  }>>;
574
- branding: z.ZodObject<{
531
+ branding: z.ZodDefault<z.ZodObject<{
575
532
  organizationName: z.ZodString;
576
533
  productName: z.ZodString;
577
534
  shortName: z.ZodString;
@@ -580,7 +537,7 @@ declare const OrganizationModelSchema: z.ZodObject<{
580
537
  light: z.ZodOptional<z.ZodString>;
581
538
  dark: z.ZodOptional<z.ZodString>;
582
539
  }, z.core.$strip>>;
583
- }, z.core.$strip>;
540
+ }, z.core.$strip>>;
584
541
  navigation: z.ZodDefault<z.ZodObject<{
585
542
  sidebar: z.ZodDefault<z.ZodObject<{
586
543
  primary: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<SidebarNode, unknown, z.core.$ZodTypeInternals<SidebarNode, unknown>>>>;
@@ -812,14 +769,18 @@ declare const OrganizationModelSchema: z.ZodObject<{
812
769
  writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
813
770
  usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
814
771
  emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
772
+ contract: z.ZodOptional<z.ZodObject<{
773
+ input: z.ZodOptional<z.ZodString>;
774
+ output: z.ZodOptional<z.ZodString>;
775
+ }, z.core.$strip>>;
815
776
  }, z.core.$strip>>;
816
777
  codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
817
778
  path: z.ZodString;
818
779
  role: z.ZodEnum<{
819
- schema: "schema";
820
780
  config: "config";
821
781
  entrypoint: "entrypoint";
822
782
  handler: "handler";
783
+ schema: "schema";
823
784
  test: "test";
824
785
  docs: "docs";
825
786
  }>;
@@ -858,14 +819,18 @@ declare const OrganizationModelSchema: z.ZodObject<{
858
819
  writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
859
820
  usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
860
821
  emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
822
+ contract: z.ZodOptional<z.ZodObject<{
823
+ input: z.ZodOptional<z.ZodString>;
824
+ output: z.ZodOptional<z.ZodString>;
825
+ }, z.core.$strip>>;
861
826
  }, z.core.$strip>>;
862
827
  codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
863
828
  path: z.ZodString;
864
829
  role: z.ZodEnum<{
865
- schema: "schema";
866
830
  config: "config";
867
831
  entrypoint: "entrypoint";
868
832
  handler: "handler";
833
+ schema: "schema";
869
834
  test: "test";
870
835
  docs: "docs";
871
836
  }>;
@@ -935,14 +900,18 @@ declare const OrganizationModelSchema: z.ZodObject<{
935
900
  writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
936
901
  usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
937
902
  emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
903
+ contract: z.ZodOptional<z.ZodObject<{
904
+ input: z.ZodOptional<z.ZodString>;
905
+ output: z.ZodOptional<z.ZodString>;
906
+ }, z.core.$strip>>;
938
907
  }, z.core.$strip>>;
939
908
  codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
940
909
  path: z.ZodString;
941
910
  role: z.ZodEnum<{
942
- schema: "schema";
943
911
  config: "config";
944
912
  entrypoint: "entrypoint";
945
913
  handler: "handler";
914
+ schema: "schema";
946
915
  test: "test";
947
916
  docs: "docs";
948
917
  }>;
@@ -970,14 +939,18 @@ declare const OrganizationModelSchema: z.ZodObject<{
970
939
  writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
971
940
  usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
972
941
  emits: z.ZodOptional<z.ZodArray<z.ZodString>>;
942
+ contract: z.ZodOptional<z.ZodObject<{
943
+ input: z.ZodOptional<z.ZodString>;
944
+ output: z.ZodOptional<z.ZodString>;
945
+ }, z.core.$strip>>;
973
946
  }, z.core.$strip>>;
974
947
  codeRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
975
948
  path: z.ZodString;
976
949
  role: z.ZodEnum<{
977
- schema: "schema";
978
950
  config: "config";
979
951
  entrypoint: "entrypoint";
980
952
  handler: "handler";
953
+ schema: "schema";
981
954
  test: "test";
982
955
  docs: "docs";
983
956
  }>;
@@ -1264,11 +1237,10 @@ declare const OrganizationModelSchema: z.ZodObject<{
1264
1237
  ontology: "ontology";
1265
1238
  role: "role";
1266
1239
  goal: "goal";
1267
- stage: "stage";
1268
1240
  resource: "resource";
1241
+ stage: "stage";
1269
1242
  "customer-segment": "customer-segment";
1270
1243
  offering: "offering";
1271
- "content-node": "content-node";
1272
1244
  }>;
1273
1245
  id: z.ZodString;
1274
1246
  }, z.core.$strip>;
@@ -1276,7 +1248,7 @@ declare const OrganizationModelSchema: z.ZodObject<{
1276
1248
  nodeId: z.ZodUnion<readonly [z.ZodString, z.ZodTemplateLiteral<`ontology:${string}`>]>;
1277
1249
  }, z.core.$strip>]>, z.ZodTransform<{
1278
1250
  target: {
1279
- kind: "knowledge" | "system" | "action" | "ontology" | "role" | "goal" | "stage" | "resource" | "customer-segment" | "offering" | "content-node";
1251
+ kind: "knowledge" | "system" | "action" | "ontology" | "role" | "goal" | "resource" | "stage" | "customer-segment" | "offering";
1280
1252
  id: string;
1281
1253
  };
1282
1254
  nodeId: string;
@@ -1284,7 +1256,7 @@ declare const OrganizationModelSchema: z.ZodObject<{
1284
1256
  nodeId: string;
1285
1257
  } | {
1286
1258
  target: {
1287
- kind: "knowledge" | "system" | "action" | "ontology" | "role" | "goal" | "stage" | "resource" | "customer-segment" | "offering" | "content-node";
1259
+ kind: "knowledge" | "system" | "action" | "ontology" | "role" | "goal" | "resource" | "stage" | "customer-segment" | "offering";
1288
1260
  id: string;
1289
1261
  };
1290
1262
  }>>>>;
@@ -1295,9 +1267,26 @@ declare const OrganizationModelSchema: z.ZodObject<{
1295
1267
 
1296
1268
  type OrganizationModel = z.infer<typeof OrganizationModelSchema>;
1297
1269
 
1298
- type OrganizationGraphNodeKind = 'organization' | 'system' | 'role' | 'action' | 'entity' | 'event' | 'policy' | 'stage' | 'resource' | 'knowledge' | 'customer-segment' | 'offering' | 'goal' | 'surface' | 'navigation-group'
1299
- /** Phase 3 preview — Phase 4 populates this kind via graph projection of system.content entries. */
1300
- | 'ontology' | 'content-node';
1270
+ /**
1271
+ * Command View Types
1272
+ *
1273
+ * Unified type definitions for the Command View graph visualization.
1274
+ * These types are used by both backend serialization and frontend rendering.
1275
+ *
1276
+ * Command View shows the resource graph: agents, workflows, triggers, integrations,
1277
+ * external resources, and human checkpoints with their relationships.
1278
+ */
1279
+
1280
+ /**
1281
+ * Relationship types between resources
1282
+ *
1283
+ * - triggers: Resource initiates/starts another resource (orange)
1284
+ * - uses: Resource uses an integration (teal)
1285
+ * - approval: Resource requires human approval (yellow)
1286
+ */
1287
+ type RelationshipType = 'triggers' | 'uses' | 'approval';
1288
+
1289
+ type OrganizationGraphNodeKind = 'organization' | 'system' | 'role' | 'action' | 'entity' | 'event' | 'policy' | 'stage' | 'resource' | 'knowledge' | 'customer-segment' | 'offering' | 'goal' | 'surface' | 'navigation-group' | 'ontology';
1301
1290
  type OrganizationGraphEdgeKind = 'contains' | 'references' | 'maps_to' | 'uses' | 'governs' | 'links' | 'affects' | 'emits' | 'originates_from' | 'triggers' | 'approval' | 'applies_to' | 'effects' | 'actions' | 'reads' | 'writes' | 'uses_catalog';
1302
1291
 
1303
1292
  interface OrganizationGraphNode {
@@ -90,7 +90,7 @@ function toGraphNodeId(omNodeId) {
90
90
  return `knowledge:${omNodeId}`;
91
91
  }
92
92
  function toTargetGraphNodeId(nodeId) {
93
- if (nodeId.startsWith("system:") || nodeId.startsWith("knowledge:") || nodeId.startsWith("resource:") || nodeId.startsWith("content-node:") || nodeId.startsWith("ontology:")) {
93
+ if (nodeId.startsWith("system:") || nodeId.startsWith("knowledge:") || nodeId.startsWith("resource:") || nodeId.startsWith("ontology:")) {
94
94
  return nodeId;
95
95
  }
96
96
  const ontologyId = OntologyIdSchema.safeParse(nodeId);