@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
@@ -418,6 +418,42 @@ export type OrganizationModelIntegrationResourceEntry = z.infer<typeof Integrati
418
418
  export type OrganizationModelScriptResourceEntry = z.infer<typeof ScriptResourceEntrySchema>
419
419
  ```
420
420
 
421
+ ### `OrganizationModelTopology`
422
+
423
+ ```typescript
424
+ export type OrganizationModelTopology = z.infer<typeof OmTopologyDomainSchema>
425
+ ```
426
+
427
+ ### `OrganizationModelTopologyNodeKind`
428
+
429
+ ```typescript
430
+ export type OrganizationModelTopologyNodeKind = z.infer<typeof OmTopologyNodeKindSchema>
431
+ ```
432
+
433
+ ### `OrganizationModelTopologyNodeRef`
434
+
435
+ ```typescript
436
+ export type OrganizationModelTopologyNodeRef = z.infer<typeof OmTopologyNodeRefSchema>
437
+ ```
438
+
439
+ ### `OrganizationModelTopologyRelationshipKind`
440
+
441
+ ```typescript
442
+ export type OrganizationModelTopologyRelationshipKind = z.infer<typeof OmTopologyRelationshipKindSchema>
443
+ ```
444
+
445
+ ### `OrganizationModelTopologyRelationship`
446
+
447
+ ```typescript
448
+ export type OrganizationModelTopologyRelationship = z.infer<typeof OmTopologyRelationshipSchema>
449
+ ```
450
+
451
+ ### `OrganizationModelTopologyMetadata`
452
+
453
+ ```typescript
454
+ export type OrganizationModelTopologyMetadata = z.infer<typeof OmTopologyMetadataSchema>
455
+ ```
456
+
421
457
  ### `OrganizationModelActions`
422
458
 
423
459
  ```typescript
@@ -598,8 +634,8 @@ export type DeepPartial<T> =
598
634
  ### `ElevasisOrganizationModel`
599
635
 
600
636
  ```typescript
601
- export type ElevasisOrganizationModel = Omit<OrganizationModel, 'knowledge'> & {
602
- knowledge?: OrganizationModel['knowledge']
637
+ export type ElevasisOrganizationModel = Omit<OrganizationModel, 'knowledge'> & {
638
+ knowledge?: OrganizationModel['knowledge']
603
639
  }
604
640
  ```
605
641
 
@@ -624,107 +660,107 @@ export type SystemSidebarWidthResolver = number | ((context: { currentPath: stri
624
660
  ### `SystemModule`
625
661
 
626
662
  ```typescript
627
- export interface SystemModule {
628
- /** Unique stable identifier for this UI system module. */
629
- key: string
630
- /** Organization Model system id this module presents. Omit for navigation-only app surfaces. */
631
- systemId?: string
632
- /** Route prefixes owned by navigation-only app surfaces. */
633
- routePrefixes?: string[]
634
- /** Capability identifiers contributed by this system module. */
635
- capabilityIds?: string[]
636
- /** Icon used when this system node appears in shell navigation. */
637
- icon?: SystemIconComponent
638
- /** Sidebar component rendered when this system's subtree route is active. */
639
- sidebar?: SystemSidebarComponent
640
- /** Optional shell sidebar width override. Defaults to 250px. */
641
- sidebarWidth?: SystemSidebarWidthResolver
642
- /** Operations-only bridge connecting this system to the organization graph node. */
643
- organizationGraph?: OrganizationGraphSystemBridge
663
+ export interface SystemModule {
664
+ /** Unique stable identifier for this UI system module. */
665
+ key: string
666
+ /** Organization Model system id this module presents. Omit for navigation-only app surfaces. */
667
+ systemId?: string
668
+ /** Route prefixes owned by navigation-only app surfaces. */
669
+ routePrefixes?: string[]
670
+ /** Capability identifiers contributed by this system module. */
671
+ capabilityIds?: string[]
672
+ /** Icon used when this system node appears in shell navigation. */
673
+ icon?: SystemIconComponent
674
+ /** Sidebar component rendered when this system's subtree route is active. */
675
+ sidebar?: SystemSidebarComponent
676
+ /** Optional shell sidebar width override. Defaults to 250px. */
677
+ sidebarWidth?: SystemSidebarWidthResolver
678
+ /** Operations-only bridge connecting this system to the organization graph node. */
679
+ organizationGraph?: OrganizationGraphSystemBridge
644
680
  }
645
681
  ```
646
682
 
647
683
  ### `ResolvedSystemAccess`
648
684
 
649
685
  ```typescript
650
- export interface ResolvedSystemAccess {
651
- featureKey: string
652
- systemId?: string
653
- enabled: boolean
686
+ export interface ResolvedSystemAccess {
687
+ systemKey: string
688
+ systemId?: string
689
+ enabled: boolean
654
690
  }
655
691
  ```
656
692
 
657
693
  ### `ResolvedSystemSemantics`
658
694
 
659
695
  ```typescript
660
- export interface ResolvedSystemSemantics {
661
- capabilityIds: string[]
696
+ export interface ResolvedSystemSemantics {
697
+ capabilityIds: string[]
662
698
  }
663
699
  ```
664
700
 
665
701
  ### `ResolvedSystemModule`
666
702
 
667
703
  ```typescript
668
- export interface ResolvedSystemModule extends SystemModule {
669
- access: ResolvedSystemAccess
670
- semantics: ResolvedSystemSemantics
704
+ export interface ResolvedSystemModule extends SystemModule {
705
+ access: ResolvedSystemAccess
706
+ semantics: ResolvedSystemSemantics
671
707
  }
672
708
  ```
673
709
 
674
710
  ### `ResolvedShellSystem`
675
711
 
676
712
  ```typescript
677
- export type ResolvedShellSystem = OrganizationModelSystemEntry & {
678
- label: string
679
- iconComponent?: SystemIconComponent
713
+ export type ResolvedShellSystem = OrganizationModelSystemEntry & {
714
+ label: string
715
+ iconComponent?: SystemIconComponent
680
716
  }
681
717
  ```
682
718
 
683
719
  ### `ResolvedShellModel`
684
720
 
685
721
  ```typescript
686
- export interface ResolvedShellModel {
687
- systems: readonly ResolvedShellSystem[]
688
- findByPath: (path: string) => ResolvedShellSystem | undefined
689
- findById: (id: string) => ResolvedShellSystem | undefined
690
- childrenOf: (id: string) => ResolvedShellSystem[]
691
- ancestorsOf: (id: string) => ResolvedShellSystem[]
692
- parentOf: (id: string) => ResolvedShellSystem | undefined
693
- topLevel: () => ResolvedShellSystem[]
694
- requiresAdminFor: (id: string) => boolean
695
- devOnlyFor: (id: string) => boolean
722
+ export interface ResolvedShellModel {
723
+ systems: readonly ResolvedShellSystem[]
724
+ findByPath: (path: string) => ResolvedShellSystem | undefined
725
+ findById: (id: string) => ResolvedShellSystem | undefined
726
+ childrenOf: (id: string) => ResolvedShellSystem[]
727
+ ancestorsOf: (id: string) => ResolvedShellSystem[]
728
+ parentOf: (id: string) => ResolvedShellSystem | undefined
729
+ topLevel: () => ResolvedShellSystem[]
730
+ requiresAdminFor: (id: string) => boolean
731
+ devOnlyFor: (id: string) => boolean
696
732
  }
697
733
  ```
698
734
 
699
735
  ### `ShellSidebarLinkItem`
700
736
 
701
737
  ```typescript
702
- export interface ShellSidebarLinkItem {
703
- label: string
704
- link: string
705
- exact?: boolean
706
- activeMatchPaths?: string[]
738
+ export interface ShellSidebarLinkItem {
739
+ label: string
740
+ link: string
741
+ exact?: boolean
742
+ activeMatchPaths?: string[]
707
743
  }
708
744
  ```
709
745
 
710
746
  ### `ShellSidebarLinkGroup`
711
747
 
712
748
  ```typescript
713
- export interface ShellSidebarLinkGroup {
714
- icon: SystemIconComponent
715
- label: string
716
- links?: ShellSidebarLinkItem[]
717
- link?: string
749
+ export interface ShellSidebarLinkGroup {
750
+ icon: SystemIconComponent
751
+ label: string
752
+ links?: ShellSidebarLinkItem[]
753
+ link?: string
718
754
  }
719
755
  ```
720
756
 
721
757
  ### `ShellSidebarProjectionOptions`
722
758
 
723
759
  ```typescript
724
- export interface ShellSidebarProjectionOptions {
725
- isPlatformAdmin?: boolean
726
- isDev?: boolean
727
- section?: 'primary' | 'bottom'
760
+ export interface ShellSidebarProjectionOptions {
761
+ isPlatformAdmin?: boolean
762
+ isDev?: boolean
763
+ section?: 'primary' | 'bottom'
728
764
  }
729
765
  ```
730
766
 
@@ -737,75 +773,75 @@ export type ShellRouteMatchStatus = 'matched' | 'hidden' | 'unmatched'
737
773
  ### `ResolvedShellRouteMatch`
738
774
 
739
775
  ```typescript
740
- export interface ResolvedShellRouteMatch {
741
- status: ShellRouteMatchStatus
742
- path: string
743
- system?: ResolvedSystemModule
744
- node?: ResolvedShellSystem
776
+ export interface ResolvedShellRouteMatch {
777
+ status: ShellRouteMatchStatus
778
+ path: string
779
+ system?: ResolvedSystemModule
780
+ node?: ResolvedShellSystem
745
781
  }
746
782
  ```
747
783
 
748
784
  ### `ShellRuntime`
749
785
 
750
786
  ```typescript
751
- export interface ShellRuntime {
752
- resolveRoute: (path: string) => ResolvedShellRouteMatch
787
+ export interface ShellRuntime {
788
+ resolveRoute: (path: string) => ResolvedShellRouteMatch
753
789
  }
754
790
  ```
755
791
 
756
792
  ### `OrganizationGraphSystemBridge`
757
793
 
758
794
  ```typescript
759
- export interface OrganizationGraphSystemBridge {
760
- systemId?: string
795
+ export interface OrganizationGraphSystemBridge {
796
+ systemId?: string
761
797
  }
762
798
  ```
763
799
 
764
800
  ### `OrganizationGraphContextValue`
765
801
 
766
802
  ```typescript
767
- export interface OrganizationGraphContextValue {
768
- available: boolean
769
- systemId?: string
770
- systemPath?: string
803
+ export interface OrganizationGraphContextValue {
804
+ available: boolean
805
+ systemId?: string
806
+ systemPath?: string
771
807
  }
772
808
  ```
773
809
 
774
810
  ### `ElevasisSystemsProviderProps`
775
811
 
776
812
  ```typescript
777
- export interface ElevasisSystemsProviderProps {
778
- systems?: SystemModule[]
779
- organizationModel?: ElevasisOrganizationModel
780
- timeRange?: TimeRange
781
- operationsApiUrl?: string
782
- operationsSSEManager?: SSEConnectionManagerLike
783
- deliveryApiUrl?: string
784
- deliverySSEManager?: SSEConnectionManagerLike
785
- disabledSubsectionPaths?: string[]
786
- children: ReactNode
813
+ export interface ElevasisSystemsProviderProps {
814
+ systems?: SystemModule[]
815
+ organizationModel?: ElevasisOrganizationModel
816
+ timeRange?: TimeRange
817
+ operationsApiUrl?: string
818
+ operationsSSEManager?: SSEConnectionManagerLike
819
+ deliveryApiUrl?: string
820
+ deliverySSEManager?: SSEConnectionManagerLike
821
+ disabledSubsectionPaths?: string[]
822
+ children: ReactNode
787
823
  }
788
824
  ```
789
825
 
790
826
  ### `ElevasisSystemsContextValue`
791
827
 
792
828
  ```typescript
793
- export interface ElevasisSystemsContextValue {
794
- shellModel: ResolvedShellModel
795
- shellRuntime: ShellRuntime
796
- getSidebarLinks: (options?: ShellSidebarProjectionOptions) => ShellSidebarLinkGroup[]
797
- enabledResolvedSystems: ResolvedSystemModule[]
798
- resolvedSystems: ResolvedSystemModule[]
799
- organizationGraph: OrganizationGraphContextValue
800
- organizationModel?: OrganizationModel
801
- timeRange?: TimeRange
802
- operationsApiUrl?: string
803
- operationsSSEManager?: SSEConnectionManagerLike
804
- deliveryApiUrl?: string
805
- deliverySSEManager?: SSEConnectionManagerLike
806
- disabledSubsectionPaths: string[]
807
- isSystemEnabled: (key: string) => boolean
808
- getResolvedSystem: (key: string) => ResolvedSystemModule | undefined
829
+ export interface ElevasisSystemsContextValue {
830
+ shellModel: ResolvedShellModel
831
+ shellRuntime: ShellRuntime
832
+ getSidebarLinks: (options?: ShellSidebarProjectionOptions) => ShellSidebarLinkGroup[]
833
+ enabledResolvedSystems: ResolvedSystemModule[]
834
+ resolvedSystems: ResolvedSystemModule[]
835
+ organizationGraph: OrganizationGraphContextValue
836
+ organizationModel?: OrganizationModel
837
+ timeRange?: TimeRange
838
+ operationsApiUrl?: string
839
+ operationsSSEManager?: SSEConnectionManagerLike
840
+ deliveryApiUrl?: string
841
+ deliverySSEManager?: SSEConnectionManagerLike
842
+ disabledSubsectionPaths: string[]
843
+ isSystemEnabled: (key: string) => boolean
844
+ getResolvedSystem: (key: string) => ResolvedSystemModule | undefined
809
845
  }
810
846
  ```
811
847
 
@@ -1287,13 +1323,15 @@ export interface HumanCheckpointDefinition extends ResourceDefinition {
1287
1323
  * Used by ResourceRegistry for discovery and Command View for visualization.
1288
1324
  */
1289
1325
  export interface DeploymentSpec {
1290
- /** Deployment version (semver) */
1291
- version: string
1292
- /** Optional Organization Model governance catalog used for OM-code validation */
1293
- organizationModel?: {
1294
- systems?: OrganizationModelSystems
1295
- resources?: OrganizationModelResources
1296
- }
1326
+ /** Deployment version (semver) */
1327
+ version: string
1328
+ /** Optional Organization Model governance catalog used for OM-code validation */
1329
+ organizationModel?: Partial<
1330
+ Pick<
1331
+ OrganizationModel,
1332
+ 'systems' | 'resources' | 'ontology' | 'topology' | 'roles' | 'policies' | 'entities' | 'actions'
1333
+ >
1334
+ >
1297
1335
  /** Workflow definitions */
1298
1336
  workflows?: WorkflowDefinition[]
1299
1337
  /** Agent definitions */
@@ -20,8 +20,8 @@ import { createLLMAdapter } from '../server/adapter-factory'
20
20
  import type { ModelConfig } from '../../model-info'
21
21
  import type { LLMGenerateRequest } from '../../types'
22
22
 
23
- // Skip if OPENROUTER_API_KEY not available
24
- const SKIP_TESTS = !process.env.OPENROUTER_API_KEY
23
+ // Skip by default: real OpenRouter model behavior can change independently of this repo.
24
+ const SKIP_TESTS = process.env.RUN_OPENROUTER_INTEGRATION !== 'true' || !process.env.OPENROUTER_API_KEY
25
25
 
26
26
  describe.skipIf(SKIP_TESTS)('OpenRouter Adapter Integration', () => {
27
27
  let apiKey: string
@@ -47,14 +47,14 @@ describe.skipIf(SKIP_TESTS)('OpenRouter Adapter Integration', () => {
47
47
  maxOutputTokens: 500
48
48
  })
49
49
 
50
- describe('Grok via OpenRouter', () => {
51
- it('generates structured output with accurate token counts', async () => {
52
- const config: ModelConfig = {
53
- provider: 'openrouter',
54
- model: 'openrouter/x-ai/grok-4.1-fast',
55
- apiKey,
56
- temperature: 0.7,
57
- maxOutputTokens: 500
50
+ describe('OpenRouter hosted model', () => {
51
+ it('generates structured output with accurate token counts', async () => {
52
+ const config: ModelConfig = {
53
+ provider: 'openrouter',
54
+ model: 'openrouter/z-ai/glm-5',
55
+ apiKey,
56
+ temperature: 0.7,
57
+ maxOutputTokens: 500
58
58
  }
59
59
 
60
60
  const adapter = createLLMAdapter(config)
@@ -12,13 +12,11 @@ import type { ResourceMetricsConfig } from '../../../operations/observability/ty
12
12
  import type { ExecutionInterface } from '../interface/types'
13
13
 
14
14
  // Workflow configuration
15
- export interface WorkflowConfig extends ResourceDefinition {
16
- type: 'workflow'
17
- /** OM descriptor backing canonical identity and governance metadata. */
18
- resource?: WorkflowResourceEntry
19
- /** Lead-gen action key for registry derivation (e.g. 'lead-gen.company.apollo-import') */
20
- actionKey?: string
21
- }
15
+ export interface WorkflowConfig extends ResourceDefinition {
16
+ type: 'workflow'
17
+ /** OM descriptor backing canonical identity and governance metadata. */
18
+ resource?: WorkflowResourceEntry
19
+ }
22
20
 
23
21
  export type DescriptorBackedWorkflowConfig = Omit<WorkflowConfig, 'resourceId' | 'type' | 'resource'> & {
24
22
  resource: WorkflowResourceEntry