@elevasis/core 0.24.0 → 0.25.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 (50) hide show
  1. package/dist/index.d.ts +3117 -2166
  2. package/dist/index.js +574 -16
  3. package/dist/knowledge/index.d.ts +122 -7
  4. package/dist/organization-model/index.d.ts +3117 -2166
  5. package/dist/organization-model/index.js +574 -16
  6. package/dist/test-utils/index.d.ts +135 -45
  7. package/dist/test-utils/index.js +122 -14
  8. package/package.json +3 -3
  9. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +139 -101
  10. package/src/execution/engine/llm/adapters/__tests__/openrouter.integration.test.ts +10 -10
  11. package/src/execution/engine/workflow/types.ts +5 -7
  12. package/src/knowledge/__tests__/queries.test.ts +960 -546
  13. package/src/knowledge/format.ts +322 -100
  14. package/src/knowledge/index.ts +18 -5
  15. package/src/knowledge/queries.ts +1004 -239
  16. package/src/organization-model/__tests__/deprecate-helpers.test.ts +71 -0
  17. package/src/organization-model/__tests__/domains/resources.test.ts +19 -8
  18. package/src/organization-model/__tests__/domains/topology.test.ts +188 -0
  19. package/src/organization-model/__tests__/graph.test.ts +98 -7
  20. package/src/organization-model/__tests__/resolve.test.ts +9 -7
  21. package/src/organization-model/__tests__/scaffolders.test.ts +93 -0
  22. package/src/organization-model/__tests__/schema.test.ts +14 -4
  23. package/src/organization-model/defaults.ts +5 -3
  24. package/src/organization-model/domains/resources.ts +63 -20
  25. package/src/organization-model/domains/topology.ts +261 -0
  26. package/src/organization-model/graph/build.ts +63 -15
  27. package/src/organization-model/graph/schema.ts +4 -3
  28. package/src/organization-model/graph/types.ts +5 -4
  29. package/src/organization-model/helpers.ts +76 -9
  30. package/src/organization-model/icons.ts +1 -0
  31. package/src/organization-model/index.ts +7 -5
  32. package/src/organization-model/ontology.ts +2 -5
  33. package/src/organization-model/organization-model.mdx +16 -11
  34. package/src/organization-model/published.ts +51 -15
  35. package/src/organization-model/scaffolders/helpers.ts +84 -0
  36. package/src/organization-model/scaffolders/index.ts +19 -0
  37. package/src/organization-model/scaffolders/scaffoldKnowledgeNode.ts +48 -0
  38. package/src/organization-model/scaffolders/scaffoldOntologyRecord.ts +38 -0
  39. package/src/organization-model/scaffolders/scaffoldResource.ts +59 -0
  40. package/src/organization-model/scaffolders/scaffoldSystem.ts +110 -0
  41. package/src/organization-model/scaffolders/types.ts +81 -0
  42. package/src/organization-model/schema.ts +51 -11
  43. package/src/organization-model/types.ts +25 -11
  44. package/src/platform/constants/versions.ts +1 -1
  45. package/src/platform/registry/__tests__/validation.test.ts +199 -14
  46. package/src/platform/registry/resource-registry.ts +11 -11
  47. package/src/platform/registry/validation.ts +226 -34
  48. package/src/reference/_generated/contracts.md +139 -101
  49. package/src/reference/glossary.md +74 -72
  50. package/src/supabase/database.types.ts +3156 -3153
@@ -241,6 +241,7 @@ declare const OrgKnowledgeNodeSchema: z.ZodObject<{
241
241
  crm: "crm";
242
242
  "lead-gen": "lead-gen";
243
243
  projects: "projects";
244
+ clients: "clients";
244
245
  operations: "operations";
245
246
  monitoring: "monitoring";
246
247
  knowledge: "knowledge";
@@ -344,6 +345,7 @@ declare const OrganizationModelIconTokenSchema: z.ZodUnion<readonly [z.ZodEnum<{
344
345
  crm: "crm";
345
346
  "lead-gen": "lead-gen";
346
347
  projects: "projects";
348
+ clients: "clients";
347
349
  operations: "operations";
348
350
  monitoring: "monitoring";
349
351
  knowledge: "knowledge";
@@ -434,6 +436,10 @@ declare const OrganizationModelSchema: z.ZodObject<{
434
436
  version: z.ZodDefault<z.ZodLiteral<1>>;
435
437
  lastModified: z.ZodString;
436
438
  }, z.core.$strip>>;
439
+ topology: z.ZodOptional<z.ZodObject<{
440
+ version: z.ZodDefault<z.ZodLiteral<1>>;
441
+ lastModified: z.ZodString;
442
+ }, z.core.$strip>>;
437
443
  actions: z.ZodOptional<z.ZodObject<{
438
444
  version: z.ZodDefault<z.ZodLiteral<1>>;
439
445
  lastModified: z.ZodString;
@@ -487,6 +493,10 @@ declare const OrganizationModelSchema: z.ZodObject<{
487
493
  version: 1;
488
494
  lastModified: string;
489
495
  };
496
+ topology: {
497
+ version: 1;
498
+ lastModified: string;
499
+ };
490
500
  actions: {
491
501
  version: 1;
492
502
  lastModified: string;
@@ -540,6 +550,10 @@ declare const OrganizationModelSchema: z.ZodObject<{
540
550
  version: 1;
541
551
  lastModified: string;
542
552
  } | undefined;
553
+ topology?: {
554
+ version: 1;
555
+ lastModified: string;
556
+ } | undefined;
543
557
  actions?: {
544
558
  version: 1;
545
559
  lastModified: string;
@@ -783,6 +797,8 @@ declare const OrganizationModelSchema: z.ZodObject<{
783
797
  id: z.ZodString;
784
798
  order: z.ZodDefault<z.ZodNumber>;
785
799
  systemPath: z.ZodString;
800
+ title: z.ZodOptional<z.ZodString>;
801
+ description: z.ZodOptional<z.ZodString>;
786
802
  ownerRoleId: z.ZodOptional<z.ZodString>;
787
803
  status: z.ZodEnum<{
788
804
  deprecated: "deprecated";
@@ -790,7 +806,8 @@ declare const OrganizationModelSchema: z.ZodObject<{
790
806
  archived: "archived";
791
807
  }>;
792
808
  ontology: z.ZodOptional<z.ZodObject<{
793
- implements: z.ZodOptional<z.ZodArray<z.ZodString>>;
809
+ actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
810
+ primaryAction: z.ZodOptional<z.ZodString>;
794
811
  reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
795
812
  writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
796
813
  usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -810,7 +827,6 @@ declare const OrganizationModelSchema: z.ZodObject<{
810
827
  description: z.ZodOptional<z.ZodString>;
811
828
  }, z.core.$strip>>>;
812
829
  kind: z.ZodLiteral<"workflow">;
813
- actionKey: z.ZodOptional<z.ZodString>;
814
830
  emits: z.ZodOptional<z.ZodArray<z.ZodObject<{
815
831
  eventKey: z.ZodString;
816
832
  label: z.ZodString;
@@ -827,6 +843,8 @@ declare const OrganizationModelSchema: z.ZodObject<{
827
843
  id: z.ZodString;
828
844
  order: z.ZodDefault<z.ZodNumber>;
829
845
  systemPath: z.ZodString;
846
+ title: z.ZodOptional<z.ZodString>;
847
+ description: z.ZodOptional<z.ZodString>;
830
848
  ownerRoleId: z.ZodOptional<z.ZodString>;
831
849
  status: z.ZodEnum<{
832
850
  deprecated: "deprecated";
@@ -834,7 +852,8 @@ declare const OrganizationModelSchema: z.ZodObject<{
834
852
  archived: "archived";
835
853
  }>;
836
854
  ontology: z.ZodOptional<z.ZodObject<{
837
- implements: z.ZodOptional<z.ZodArray<z.ZodString>>;
855
+ actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
856
+ primaryAction: z.ZodOptional<z.ZodString>;
838
857
  reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
839
858
  writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
840
859
  usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -901,6 +920,8 @@ declare const OrganizationModelSchema: z.ZodObject<{
901
920
  id: z.ZodString;
902
921
  order: z.ZodDefault<z.ZodNumber>;
903
922
  systemPath: z.ZodString;
923
+ title: z.ZodOptional<z.ZodString>;
924
+ description: z.ZodOptional<z.ZodString>;
904
925
  ownerRoleId: z.ZodOptional<z.ZodString>;
905
926
  status: z.ZodEnum<{
906
927
  deprecated: "deprecated";
@@ -908,7 +929,8 @@ declare const OrganizationModelSchema: z.ZodObject<{
908
929
  archived: "archived";
909
930
  }>;
910
931
  ontology: z.ZodOptional<z.ZodObject<{
911
- implements: z.ZodOptional<z.ZodArray<z.ZodString>>;
932
+ actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
933
+ primaryAction: z.ZodOptional<z.ZodString>;
912
934
  reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
913
935
  writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
914
936
  usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -933,6 +955,8 @@ declare const OrganizationModelSchema: z.ZodObject<{
933
955
  id: z.ZodString;
934
956
  order: z.ZodDefault<z.ZodNumber>;
935
957
  systemPath: z.ZodString;
958
+ title: z.ZodOptional<z.ZodString>;
959
+ description: z.ZodOptional<z.ZodString>;
936
960
  ownerRoleId: z.ZodOptional<z.ZodString>;
937
961
  status: z.ZodEnum<{
938
962
  deprecated: "deprecated";
@@ -940,7 +964,8 @@ declare const OrganizationModelSchema: z.ZodObject<{
940
964
  archived: "archived";
941
965
  }>;
942
966
  ontology: z.ZodOptional<z.ZodObject<{
943
- implements: z.ZodOptional<z.ZodArray<z.ZodString>>;
967
+ actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
968
+ primaryAction: z.ZodOptional<z.ZodString>;
944
969
  reads: z.ZodOptional<z.ZodArray<z.ZodString>>;
945
970
  writes: z.ZodOptional<z.ZodArray<z.ZodString>>;
946
971
  usesCatalogs: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -970,6 +995,69 @@ declare const OrganizationModelSchema: z.ZodObject<{
970
995
  file: z.ZodString;
971
996
  }, z.core.$strip>]>;
972
997
  }, z.core.$strip>], "kind">>>>;
998
+ topology: z.ZodDefault<z.ZodDefault<z.ZodObject<{
999
+ version: z.ZodDefault<z.ZodLiteral<1>>;
1000
+ relationships: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
1001
+ from: z.ZodDiscriminatedUnion<[z.ZodObject<{
1002
+ kind: z.ZodLiteral<"system">;
1003
+ id: z.ZodString;
1004
+ }, z.core.$strip>, z.ZodObject<{
1005
+ kind: z.ZodLiteral<"resource">;
1006
+ id: z.ZodString;
1007
+ }, z.core.$strip>, z.ZodObject<{
1008
+ kind: z.ZodLiteral<"ontology">;
1009
+ id: z.ZodString;
1010
+ }, z.core.$strip>, z.ZodObject<{
1011
+ kind: z.ZodLiteral<"policy">;
1012
+ id: z.ZodString;
1013
+ }, z.core.$strip>, z.ZodObject<{
1014
+ kind: z.ZodLiteral<"role">;
1015
+ id: z.ZodString;
1016
+ }, z.core.$strip>, z.ZodObject<{
1017
+ kind: z.ZodLiteral<"trigger">;
1018
+ id: z.ZodString;
1019
+ }, z.core.$strip>, z.ZodObject<{
1020
+ kind: z.ZodLiteral<"humanCheckpoint">;
1021
+ id: z.ZodString;
1022
+ }, z.core.$strip>, z.ZodObject<{
1023
+ kind: z.ZodLiteral<"externalResource">;
1024
+ id: z.ZodString;
1025
+ }, z.core.$strip>], "kind">;
1026
+ kind: z.ZodEnum<{
1027
+ triggers: "triggers";
1028
+ uses: "uses";
1029
+ approval: "approval";
1030
+ }>;
1031
+ to: z.ZodDiscriminatedUnion<[z.ZodObject<{
1032
+ kind: z.ZodLiteral<"system">;
1033
+ id: z.ZodString;
1034
+ }, z.core.$strip>, z.ZodObject<{
1035
+ kind: z.ZodLiteral<"resource">;
1036
+ id: z.ZodString;
1037
+ }, z.core.$strip>, z.ZodObject<{
1038
+ kind: z.ZodLiteral<"ontology">;
1039
+ id: z.ZodString;
1040
+ }, z.core.$strip>, z.ZodObject<{
1041
+ kind: z.ZodLiteral<"policy">;
1042
+ id: z.ZodString;
1043
+ }, z.core.$strip>, z.ZodObject<{
1044
+ kind: z.ZodLiteral<"role">;
1045
+ id: z.ZodString;
1046
+ }, z.core.$strip>, z.ZodObject<{
1047
+ kind: z.ZodLiteral<"trigger">;
1048
+ id: z.ZodString;
1049
+ }, z.core.$strip>, z.ZodObject<{
1050
+ kind: z.ZodLiteral<"humanCheckpoint">;
1051
+ id: z.ZodString;
1052
+ }, z.core.$strip>, z.ZodObject<{
1053
+ kind: z.ZodLiteral<"externalResource">;
1054
+ id: z.ZodString;
1055
+ }, z.core.$strip>], "kind">;
1056
+ systemPath: z.ZodOptional<z.ZodString>;
1057
+ required: z.ZodOptional<z.ZodBoolean>;
1058
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
1059
+ }, z.core.$strip>>>;
1060
+ }, z.core.$strip>>>;
973
1061
  actions: z.ZodDefault<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
974
1062
  id: z.ZodString;
975
1063
  order: z.ZodNumber;
@@ -1114,6 +1202,7 @@ declare const OrganizationModelSchema: z.ZodObject<{
1114
1202
  crm: "crm";
1115
1203
  "lead-gen": "lead-gen";
1116
1204
  projects: "projects";
1205
+ clients: "clients";
1117
1206
  operations: "operations";
1118
1207
  monitoring: "monitoring";
1119
1208
  knowledge: "knowledge";
@@ -1209,7 +1298,7 @@ type OrganizationModel = z.infer<typeof OrganizationModelSchema>;
1209
1298
  type OrganizationGraphNodeKind = 'organization' | 'system' | 'role' | 'action' | 'entity' | 'event' | 'policy' | 'stage' | 'resource' | 'knowledge' | 'customer-segment' | 'offering' | 'goal' | 'surface' | 'navigation-group'
1210
1299
  /** Phase 3 preview — Phase 4 populates this kind via graph projection of system.content entries. */
1211
1300
  | 'ontology' | 'content-node';
1212
- type OrganizationGraphEdgeKind = 'contains' | 'references' | 'maps_to' | 'uses' | 'governs' | 'links' | 'affects' | 'emits' | 'originates_from' | 'triggers' | 'applies_to' | 'effects' | 'implements' | 'reads' | 'writes' | 'uses_catalog';
1301
+ type OrganizationGraphEdgeKind = 'contains' | 'references' | 'maps_to' | 'uses' | 'governs' | 'links' | 'affects' | 'emits' | 'originates_from' | 'triggers' | 'approval' | 'applies_to' | 'effects' | 'actions' | 'reads' | 'writes' | 'uses_catalog';
1213
1302
 
1214
1303
  interface OrganizationGraphNode {
1215
1304
  id: string;
@@ -1320,6 +1409,32 @@ interface ParsedKnowledgePath {
1320
1409
  * match any supported mount pattern.
1321
1410
  */
1322
1411
  declare function parsePath(pathString: string): ParsedKnowledgePath;
1412
+ /**
1413
+ * The kind of OM node that produced a search hit.
1414
+ *
1415
+ * Maps to the surface being searched:
1416
+ * - `system` — recursive systems tree (model.systems)
1417
+ * - `resource` — model.resources (workflows, agents, integrations, scripts)
1418
+ * - `knowledge` — model.knowledge (playbooks, strategies, references)
1419
+ * - `ontology` — system.ontology and model.ontology (objects, actions, events, catalogs, links, ...)
1420
+ * - `role` — model.roles
1421
+ * - `policy` — model.policies
1422
+ */
1423
+ type OmSearchHitKind = 'system' | 'resource' | 'knowledge' | 'ontology' | 'role' | 'policy';
1424
+ interface OmSearchHit {
1425
+ /** Surface that produced the hit. */
1426
+ kind: OmSearchHitKind;
1427
+ /** Canonical id (system path, resource id, knowledge id, ontology id, role id, policy id). */
1428
+ id: string;
1429
+ /** Display title (label/title/summary fallback). */
1430
+ title: string;
1431
+ /** One-line description or summary (may be empty). */
1432
+ summary: string;
1433
+ /** Ranking score; higher is better. */
1434
+ score: number;
1435
+ /** Optional sub-kind for ontology / resource (`object`, `action`, `event`, `workflow`, ...). */
1436
+ subKind?: string;
1437
+ }
1323
1438
 
1324
1439
  /**
1325
1440
  * Renders a list of `OrgKnowledgeNode` results as a human-friendly text table.
@@ -1371,7 +1486,7 @@ declare function formatJson(input: {
1371
1486
  *
1372
1487
  * Returns an empty string when the array is empty (suitable for `wc -l` piping).
1373
1488
  */
1374
- declare function formatIdsOnly(results: OrgKnowledgeNode[] | string[]): string;
1489
+ declare function formatIdsOnly(results: OrgKnowledgeNode[] | string[] | OmSearchHit[]): string;
1375
1490
 
1376
1491
  export { byKind, byOwner, bySystem, formatIdsOnly, formatJson, formatText, governedBy, governs, parsePath };
1377
1492
  export type { KnowledgeJsonEnvelope, KnowledgeMount, ParsedKnowledgePath };