@elevasis/core 0.36.0 → 0.38.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 (31) hide show
  1. package/dist/auth/index.d.ts +84 -1
  2. package/dist/index.d.ts +359 -5
  3. package/dist/index.js +41 -8
  4. package/dist/knowledge/index.d.ts +86 -1
  5. package/dist/organization-model/index.d.ts +359 -5
  6. package/dist/organization-model/index.js +41 -8
  7. package/dist/test-utils/index.d.ts +84 -1
  8. package/dist/test-utils/index.js +38 -6
  9. package/package.json +1 -1
  10. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +423 -338
  11. package/src/_gen/__tests__/__snapshots__/system-interface-capabilities.md.snap +47 -0
  12. package/src/_gen/__tests__/scaffold-contracts.test.ts +47 -8
  13. package/src/business/acquisition/api-schemas.test.ts +13 -1
  14. package/src/business/acquisition/ontology-validation.ts +13 -22
  15. package/src/organization-model/__tests__/domains/navigation-topbar.test.ts +282 -0
  16. package/src/organization-model/__tests__/domains/systems.test.ts +34 -1
  17. package/src/organization-model/__tests__/schema.test.ts +47 -0
  18. package/src/organization-model/defaults.ts +2 -1
  19. package/src/organization-model/domains/navigation.ts +176 -139
  20. package/src/organization-model/domains/systems.ts +22 -9
  21. package/src/organization-model/icons.ts +1 -0
  22. package/src/organization-model/published.ts +8 -6
  23. package/src/organization-model/types.ts +5 -1
  24. package/src/platform/constants/versions.ts +1 -1
  25. package/src/platform/registry/__tests__/validation.test.ts +1404 -1318
  26. package/src/platform/registry/index.ts +90 -88
  27. package/src/platform/registry/types.ts +443 -425
  28. package/src/platform/registry/validation.ts +60 -1
  29. package/src/reference/_generated/contracts.md +423 -338
  30. package/src/reference/_generated/system-interface-capabilities.md +47 -0
  31. package/src/reference/glossary.md +14 -2
@@ -135,6 +135,18 @@ export type OrganizationModelSidebarSurfaceNode = Extract<OrganizationModelSideb
135
135
  export type OrganizationModelSidebarGroupNode = Extract<OrganizationModelSidebarNode, { type: 'group' }>
136
136
  ```
137
137
 
138
+ ### `OrganizationModelTopbarActionNode`
139
+
140
+ ```typescript
141
+ export type OrganizationModelTopbarActionNode = z.infer<typeof TopbarActionNodeSchema>
142
+ ```
143
+
144
+ ### `OrganizationModelTopbarSection`
145
+
146
+ ```typescript
147
+ export type OrganizationModelTopbarSection = z.infer<typeof TopbarSectionSchema>
148
+ ```
149
+
138
150
  ### `OrganizationModelTechStackEntry`
139
151
 
140
152
  ```typescript
@@ -845,6 +857,57 @@ export interface ShellRuntime {
845
857
  }
846
858
  ```
847
859
 
860
+ ### `ResolvedTopbarAction`
861
+
862
+ ```typescript
863
+ /**
864
+ * A resolved topbar action — the OM node after gating/filtering, with icon resolved
865
+ * from the semantic icon registry. Passed to `TopbarActionModule.render`.
866
+ */
867
+ export interface ResolvedTopbarAction {
868
+ id: string
869
+ label: string
870
+ tooltip?: string
871
+ icon: TablerIconComponent
872
+ order: number
873
+ }
874
+ ```
875
+
876
+ ### `TopbarActionModule`
877
+
878
+ ```typescript
879
+ /**
880
+ * A topbar action module — binds a registry key to UI behavior (a render callback).
881
+ * The key must match `navigation.topbar[id]`. The OM supplies data + visibility;
882
+ * the module supplies behavior.
883
+ */
884
+ export interface TopbarActionModule {
885
+ /** Stable key that matches the `id` of a `navigation.topbar` node. */
886
+ key: string
887
+ /** Render the topbar action. Receives the resolved OM node (icon pre-resolved). */
888
+ render: (ctx: { node: ResolvedTopbarAction }) => ReactNode
889
+ }
890
+ ```
891
+
892
+ ### `ResolvedTopbarActionEntry`
893
+
894
+ ```typescript
895
+ /** A joined entry emitted by `getTopbarActions`: resolved OM node + module behavior. */
896
+ export interface ResolvedTopbarActionEntry {
897
+ node: ResolvedTopbarAction
898
+ render: TopbarActionModule['render']
899
+ }
900
+ ```
901
+
902
+ ### `TopbarActionsProjectionOptions`
903
+
904
+ ```typescript
905
+ export interface TopbarActionsProjectionOptions {
906
+ isPlatformAdmin?: boolean
907
+ isDev?: boolean
908
+ }
909
+ ```
910
+
848
911
  ### `OrganizationGraphSystemBridge`
849
912
 
850
913
  ```typescript
@@ -868,6 +931,8 @@ export interface OrganizationGraphContextValue {
868
931
  ```typescript
869
932
  export interface ElevasisSystemsProviderProps {
870
933
  systems?: SystemModule[]
934
+ /** Registered topbar action modules. OM node presence controls visibility; module supplies behavior. */
935
+ topbarActions?: TopbarActionModule[]
871
936
  organizationModel?: ElevasisOrganizationModel
872
937
  timeRange?: TimeRange
873
938
  operationsApiUrl?: string
@@ -886,6 +951,8 @@ export interface ElevasisSystemsContextValue {
886
951
  shellModel: ResolvedShellModel
887
952
  shellRuntime: ShellRuntime
888
953
  getSidebarLinks: (options?: ShellSidebarProjectionOptions) => ShellSidebarLinkGroup[]
954
+ /** Returns the list of topbar actions visible to the current user, in order. */
955
+ getTopbarActions: (options?: TopbarActionsProjectionOptions) => ResolvedTopbarActionEntry[]
889
956
  enabledResolvedSystems: ResolvedSystemModule[]
890
957
  resolvedSystems: ResolvedSystemModule[]
891
958
  organizationGraph: OrganizationGraphContextValue
@@ -906,29 +973,29 @@ export interface ElevasisSystemsContextValue {
906
973
  ### `ResourceStatus`
907
974
 
908
975
  ```typescript
909
- /**
910
- * Environment/deployment status for resources
911
- */
976
+ /**
977
+ * Environment/deployment status for resources
978
+ */
912
979
  export type ResourceStatus = 'dev' | 'prod'
913
980
  ```
914
981
 
915
982
  ### `ResourceType`
916
983
 
917
984
  ```typescript
918
- /**
919
- * All resource types in the platform
920
- * Used as the discriminator field in ResourceDefinition
921
- */
985
+ /**
986
+ * All resource types in the platform
987
+ * Used as the discriminator field in ResourceDefinition
988
+ */
922
989
  export type ResourceType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human'
923
990
  ```
924
991
 
925
992
  ### `ExecutableResourceType`
926
993
 
927
994
  ```typescript
928
- /**
929
- * Executable resource types (subset of ResourceType)
930
- * These resources can be directly executed by the execution engine
931
- */
995
+ /**
996
+ * Executable resource types (subset of ResourceType)
997
+ * These resources can be directly executed by the execution engine
998
+ */
932
999
  export type ExecutableResourceType = 'workflow' | 'agent'
933
1000
  ```
934
1001
 
@@ -941,52 +1008,52 @@ export type ResourceSystemSummary = Pick<SystemEntry, 'id' | 'title' | 'descript
941
1008
  ### `ResourceDefinition`
942
1009
 
943
1010
  ```typescript
944
- /**
945
- * Base interface for ALL platform resources
946
- * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
947
- */
948
- export interface ResourceDefinition {
949
- /** Unique resource identifier */
950
- resourceId: string
951
-
952
- /** Display name */
953
- name: string
954
-
955
- /** Purpose and functionality description */
956
- description: string
957
-
958
- /** Version for change tracking and evolution */
959
- version: string
960
-
961
- /** Resource type discriminator */
962
- type: ResourceType
963
-
964
- /** Environment/deployment status */
965
- status: ResourceStatus
966
-
967
- /** Graph links to Organization Model nodes */
968
- links?: ResourceLink[]
969
-
970
- /** Infrastructure category for filtering */
971
- category?: ResourceCategory
972
-
973
- /** Whether the agent supports multi-turn sessions (agents only) */
974
- sessionCapable?: boolean
975
-
976
- /** Whether the resource is local (monorepo) or remote (externally deployed) */
977
- origin?: 'local' | 'remote'
978
-
979
- /** OM System membership — dot-separated system path (e.g. "sys.lead-gen"), when backed by a Resource descriptor */
980
- systemPath?: string
981
-
982
- /** Display metadata for the owning OM System */
983
- system?: ResourceSystemSummary
984
-
985
- /** Governance lifecycle status from the OM Resource descriptor */
986
- governanceStatus?: ResourceGovernanceStatus
987
-
988
- /** Whether this resource is archived and should be excluded from registration and deployment */
989
- archived?: boolean
1011
+ /**
1012
+ * Base interface for ALL platform resources
1013
+ * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
1014
+ */
1015
+ export interface ResourceDefinition {
1016
+ /** Unique resource identifier */
1017
+ resourceId: string
1018
+
1019
+ /** Display name */
1020
+ name: string
1021
+
1022
+ /** Purpose and functionality description */
1023
+ description: string
1024
+
1025
+ /** Version for change tracking and evolution */
1026
+ version: string
1027
+
1028
+ /** Resource type discriminator */
1029
+ type: ResourceType
1030
+
1031
+ /** Environment/deployment status */
1032
+ status: ResourceStatus
1033
+
1034
+ /** Graph links to Organization Model nodes */
1035
+ links?: ResourceLink[]
1036
+
1037
+ /** Infrastructure category for filtering */
1038
+ category?: ResourceCategory
1039
+
1040
+ /** Whether the agent supports multi-turn sessions (agents only) */
1041
+ sessionCapable?: boolean
1042
+
1043
+ /** Whether the resource is local (monorepo) or remote (externally deployed) */
1044
+ origin?: 'local' | 'remote'
1045
+
1046
+ /** OM System membership — dot-separated system path (e.g. "sys.lead-gen"), when backed by a Resource descriptor */
1047
+ systemPath?: string
1048
+
1049
+ /** Display metadata for the owning OM System */
1050
+ system?: ResourceSystemSummary
1051
+
1052
+ /** Governance lifecycle status from the OM Resource descriptor */
1053
+ governanceStatus?: ResourceGovernanceStatus
1054
+
1055
+ /** Whether this resource is archived and should be excluded from registration and deployment */
1056
+ archived?: boolean
990
1057
  }
991
1058
  ```
992
1059
 
@@ -999,371 +1066,389 @@ export type RuntimeResourceDescriptor = Extract<ResourceEntry, { kind: 'workflow
999
1066
  ### `DescriptorBackedResourceDefinition`
1000
1067
 
1001
1068
  ```typescript
1002
- export type DescriptorBackedResourceDefinition<
1003
- TResource extends RuntimeResourceDescriptor = RuntimeResourceDescriptor
1004
- > = Omit<ResourceDefinition, 'resourceId' | 'type'> & {
1005
- /** OM descriptor that owns canonical identity and governance metadata. */
1006
- resource: TResource
1007
- resourceId?: never
1008
- type?: never
1069
+ export type DescriptorBackedResourceDefinition<
1070
+ TResource extends RuntimeResourceDescriptor = RuntimeResourceDescriptor
1071
+ > = Omit<ResourceDefinition, 'resourceId' | 'type'> & {
1072
+ /** OM descriptor that owns canonical identity and governance metadata. */
1073
+ resource: TResource
1074
+ resourceId?: never
1075
+ type?: never
1009
1076
  }
1010
1077
  ```
1011
1078
 
1012
1079
  ### `BoundResourceDefinition`
1013
1080
 
1014
1081
  ```typescript
1015
- export type BoundResourceDefinition<TResource extends RuntimeResourceDescriptor = RuntimeResourceDescriptor> = Omit<
1016
- DescriptorBackedResourceDefinition<TResource>,
1017
- 'resource'
1018
- > &
1019
- ResourceDefinition & {
1020
- resource: TResource
1021
- resourceId: TResource['id']
1022
- type: TResource['kind']
1082
+ export type BoundResourceDefinition<TResource extends RuntimeResourceDescriptor = RuntimeResourceDescriptor> = Omit<
1083
+ DescriptorBackedResourceDefinition<TResource>,
1084
+ 'resource'
1085
+ > &
1086
+ ResourceDefinition & {
1087
+ resource: TResource
1088
+ resourceId: TResource['id']
1089
+ type: TResource['kind']
1023
1090
  }
1024
1091
  ```
1025
1092
 
1026
1093
  ### `ResourceList`
1027
1094
 
1028
1095
  ```typescript
1029
- /**
1030
- * Resource list for organization
1031
- * Returns ResourceDefinition metadata (not full definitions)
1032
- */
1033
- export interface ResourceList {
1034
- workflows: ResourceDefinition[]
1035
- agents: ResourceDefinition[]
1036
- total: number
1037
- organizationName: string
1038
- environment?: 'dev' | 'prod'
1096
+ /**
1097
+ * Resource list for organization
1098
+ * Returns ResourceDefinition metadata (not full definitions)
1099
+ */
1100
+ export interface ResourceList {
1101
+ workflows: ResourceDefinition[]
1102
+ agents: ResourceDefinition[]
1103
+ total: number
1104
+ organizationName: string
1105
+ environment?: 'dev' | 'prod'
1039
1106
  }
1040
1107
  ```
1041
1108
 
1042
1109
  ### `WebhookProviderType`
1043
1110
 
1044
1111
  ```typescript
1045
- /** Webhook provider identifiers */
1112
+ /** Webhook provider identifiers */
1046
1113
  export type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'instantly' | 'apify' | 'test'
1047
1114
  ```
1048
1115
 
1049
1116
  ### `WebhookTriggerConfig`
1050
1117
 
1051
1118
  ```typescript
1052
- /** Webhook trigger configuration */
1053
- export interface WebhookTriggerConfig {
1054
- /** Provider identifier */
1055
- provider: WebhookProviderType
1056
- /** Event type for documentation (not used for matching - workflow handles routing) */
1057
- event?: string
1058
- /** Optional filtering (e.g., specific form ID for Fillout) */
1059
- filter?: Record<string, string>
1060
- /** References credential in credentials table for per-org webhook secrets */
1061
- credentialName?: string
1119
+ /** Webhook trigger configuration */
1120
+ export interface WebhookTriggerConfig {
1121
+ /** Provider identifier */
1122
+ provider: WebhookProviderType
1123
+ /** Event type for documentation (not used for matching - workflow handles routing) */
1124
+ event?: string
1125
+ /** Optional filtering (e.g., specific form ID for Fillout) */
1126
+ filter?: Record<string, string>
1127
+ /** References credential in credentials table for per-org webhook secrets */
1128
+ credentialName?: string
1062
1129
  }
1063
1130
  ```
1064
1131
 
1065
1132
  ### `ScheduleTriggerConfig`
1066
1133
 
1067
1134
  ```typescript
1068
- /** Schedule trigger configuration */
1069
- export interface ScheduleTriggerConfig {
1070
- /** Cron expression (e.g., '0 6 * * *') */
1071
- cron: string
1072
- /** Optional timezone (default: UTC) */
1073
- timezone?: string
1135
+ /** Schedule trigger configuration */
1136
+ export interface ScheduleTriggerConfig {
1137
+ /** Cron expression (e.g., '0 6 * * *') */
1138
+ cron: string
1139
+ /** Optional timezone (default: UTC) */
1140
+ timezone?: string
1074
1141
  }
1075
1142
  ```
1076
1143
 
1077
1144
  ### `EventTriggerConfig`
1078
1145
 
1079
1146
  ```typescript
1080
- /** Event trigger configuration */
1081
- export interface EventTriggerConfig {
1082
- /** Internal event type */
1083
- eventType: string
1084
- /** Event source */
1085
- source?: string
1147
+ /** Event trigger configuration */
1148
+ export interface EventTriggerConfig {
1149
+ /** Internal event type */
1150
+ eventType: string
1151
+ /** Event source */
1152
+ source?: string
1086
1153
  }
1087
1154
  ```
1088
1155
 
1089
1156
  ### `TriggerConfig`
1090
1157
 
1091
1158
  ```typescript
1092
- /** Union of all trigger configs */
1159
+ /** Union of all trigger configs */
1093
1160
  export type TriggerConfig = WebhookTriggerConfig | ScheduleTriggerConfig | EventTriggerConfig
1094
1161
  ```
1095
1162
 
1096
1163
  ### `TriggerDefinition`
1097
1164
 
1098
1165
  ```typescript
1099
- /**
1100
- * Trigger metadata - entry points that initiate resource execution
1101
- *
1102
- * Triggers represent how executions start: webhooks from external services,
1103
- * scheduled cron jobs, platform events, or manual user actions.
1104
- *
1105
- * BREAKING CHANGES (2025-11-30):
1106
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
1107
- * - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
1108
- * - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
1109
- * - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
1110
- * - triggers object now includes `externalResources` option
1111
- *
1112
- * @example
1113
- * // TriggerDefinition - metadata only
1114
- * {
1115
- * resourceId: 'trigger-new-order',
1116
- * type: 'trigger',
1117
- * triggerType: 'webhook',
1118
- * name: 'New Order',
1119
- * description: 'Webhook from Shopify on new orders',
1120
- * version: '1.0.0',
1121
- * status: 'prod',
1122
- * webhookPath: '/webhooks/shopify/orders'
1123
- * }
1124
- *
1125
- * // Relationships declared in ResourceRelationships (not on TriggerDefinition):
1126
- * // relationships: {
1127
- * // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
1128
- * // }
1129
- */
1130
- export interface TriggerDefinition extends ResourceDefinition {
1131
- /** Resource type discriminator (narrowed from base union) */
1132
- type: 'trigger'
1133
-
1134
- /** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
1135
- triggerType: 'webhook' | 'schedule' | 'manual' | 'event'
1136
-
1137
- /** Type-specific configuration */
1138
- config?: TriggerConfig
1139
-
1140
- // Legacy fields (deprecated, use config instead)
1141
- /** For webhook triggers: path like '/webhooks/shopify/orders' */
1142
- webhookPath?: string
1143
- /** For schedule triggers: cron expression like '0 6 * * *' */
1144
- schedule?: string
1145
- /** For event triggers: event type like 'low-stock-alert' */
1146
- eventType?: string
1147
-
1148
- // NOTE: What this trigger starts is declared in ResourceRelationships, not here
1149
- // This prevents duplication - triggers are forward-declared in relationships
1166
+ /**
1167
+ * Trigger metadata - entry points that initiate resource execution
1168
+ *
1169
+ * Triggers represent how executions start: webhooks from external services,
1170
+ * scheduled cron jobs, platform events, or manual user actions.
1171
+ *
1172
+ * BREAKING CHANGES (2025-11-30):
1173
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
1174
+ * - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
1175
+ * - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
1176
+ * - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
1177
+ * - triggers object now includes `externalResources` option
1178
+ *
1179
+ * @example
1180
+ * // TriggerDefinition - metadata only
1181
+ * {
1182
+ * resourceId: 'trigger-new-order',
1183
+ * type: 'trigger',
1184
+ * triggerType: 'webhook',
1185
+ * name: 'New Order',
1186
+ * description: 'Webhook from Shopify on new orders',
1187
+ * version: '1.0.0',
1188
+ * status: 'prod',
1189
+ * webhookPath: '/webhooks/shopify/orders'
1190
+ * }
1191
+ *
1192
+ * // Relationships declared in ResourceRelationships (not on TriggerDefinition):
1193
+ * // relationships: {
1194
+ * // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
1195
+ * // }
1196
+ */
1197
+ export interface TriggerDefinition extends ResourceDefinition {
1198
+ /** Resource type discriminator (narrowed from base union) */
1199
+ type: 'trigger'
1200
+
1201
+ /** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
1202
+ triggerType: 'webhook' | 'schedule' | 'manual' | 'event'
1203
+
1204
+ /** Type-specific configuration */
1205
+ config?: TriggerConfig
1206
+
1207
+ // Legacy fields (deprecated, use config instead)
1208
+ /** For webhook triggers: path like '/webhooks/shopify/orders' */
1209
+ webhookPath?: string
1210
+ /** For schedule triggers: cron expression like '0 6 * * *' */
1211
+ schedule?: string
1212
+ /** For event triggers: event type like 'low-stock-alert' */
1213
+ eventType?: string
1214
+
1215
+ // NOTE: What this trigger starts is declared in ResourceRelationships, not here
1216
+ // This prevents duplication - triggers are forward-declared in relationships
1150
1217
  }
1151
1218
  ```
1152
1219
 
1153
1220
  ### `IntegrationDefinition`
1154
1221
 
1155
1222
  ```typescript
1156
- /**
1157
- * Integration metadata - external service connections
1158
- *
1159
- * References credentials table for actual connection. No connection status
1160
- * stored here (queried at runtime from credentials table).
1161
- *
1162
- * BREAKING CHANGES (2025-11-30):
1163
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
1164
- * - Field renames: `id` -> `resourceId` (inherited)
1165
- * - New required field: `status` (inherited) - organizations must add status to all integrations
1166
- * - New required field: `version` (inherited) - organizations must add version to all integrations
1167
- * - New required field: `type: 'integration'` (inherited) - resource type discriminator
1168
- *
1169
- * @example
1170
- * {
1171
- * resourceId: 'integration-shopify-prod',
1172
- * type: 'integration',
1173
- * provider: 'shopify',
1174
- * credentialName: 'shopify-prod',
1175
- * name: 'Shopify Production',
1176
- * description: 'E-commerce platform',
1177
- * version: '1.0.0',
1178
- * status: 'prod'
1179
- * }
1180
- */
1181
- export interface IntegrationDefinition extends ResourceDefinition {
1182
- /** Resource type discriminator (narrowed from base union) */
1183
- type: 'integration'
1184
-
1185
- /** OM descriptor that owns canonical identity and governance metadata. */
1186
- resource?: Extract<ResourceEntry, { kind: 'integration' }>
1187
-
1188
- /** Integration provider type */
1189
- provider: IntegrationType
1190
- /** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
1191
- credentialName: string
1223
+ /**
1224
+ * Integration metadata - external service connections
1225
+ *
1226
+ * References credentials table for actual connection. No connection status
1227
+ * stored here (queried at runtime from credentials table).
1228
+ *
1229
+ * BREAKING CHANGES (2025-11-30):
1230
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
1231
+ * - Field renames: `id` -> `resourceId` (inherited)
1232
+ * - New required field: `status` (inherited) - organizations must add status to all integrations
1233
+ * - New required field: `version` (inherited) - organizations must add version to all integrations
1234
+ * - New required field: `type: 'integration'` (inherited) - resource type discriminator
1235
+ *
1236
+ * @example
1237
+ * {
1238
+ * resourceId: 'integration-shopify-prod',
1239
+ * type: 'integration',
1240
+ * provider: 'shopify',
1241
+ * credentialName: 'shopify-prod',
1242
+ * name: 'Shopify Production',
1243
+ * description: 'E-commerce platform',
1244
+ * version: '1.0.0',
1245
+ * status: 'prod'
1246
+ * }
1247
+ */
1248
+ export interface IntegrationDefinition extends ResourceDefinition {
1249
+ /** Resource type discriminator (narrowed from base union) */
1250
+ type: 'integration'
1251
+
1252
+ /** OM descriptor that owns canonical identity and governance metadata. */
1253
+ resource?: Extract<ResourceEntry, { kind: 'integration' }>
1254
+
1255
+ /** Integration provider type */
1256
+ provider: IntegrationType
1257
+ /** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
1258
+ credentialName: string
1192
1259
  }
1193
1260
  ```
1194
1261
 
1195
1262
  ### `RelationshipDeclaration`
1196
1263
 
1197
1264
  ```typescript
1198
- /**
1199
- * Explicit resource relationship declaration
1200
- *
1201
- * Single-direction only - Command View derives reverse relationships.
1202
- * Agents/workflows declare what they trigger and use.
1203
- *
1204
- * @example
1205
- * {
1206
- * triggers: { workflows: ['order-fulfillment-workflow'] },
1207
- * uses: { integrations: ['integration-shopify-prod', 'integration-postgres'] }
1208
- * }
1209
- */
1210
- export interface RelationshipDeclaration {
1211
- /** Resources this resource triggers */
1212
- triggers?: {
1213
- /** Agent resourceIds this resource triggers */
1214
- agents?: string[]
1215
- /** Workflow resourceIds this resource triggers */
1216
- workflows?: string[]
1217
- }
1218
- /** Integrations this resource uses */
1219
- uses?: {
1220
- /** Integration IDs this resource uses */
1221
- integrations?: string[]
1222
- }
1265
+ /**
1266
+ * Explicit resource relationship declaration
1267
+ *
1268
+ * Single-direction only - Command View derives reverse relationships.
1269
+ * Agents/workflows declare what they trigger and use.
1270
+ *
1271
+ * @example
1272
+ * {
1273
+ * triggers: { workflows: ['order-fulfillment-workflow'] },
1274
+ * uses: { integrations: ['integration-shopify-prod', 'integration-postgres'] }
1275
+ * }
1276
+ */
1277
+ export interface RelationshipDeclaration {
1278
+ /** Resources this resource triggers */
1279
+ triggers?: {
1280
+ /** Agent resourceIds this resource triggers */
1281
+ agents?: string[]
1282
+ /** Workflow resourceIds this resource triggers */
1283
+ workflows?: string[]
1284
+ }
1285
+ /** Integrations this resource uses */
1286
+ uses?: {
1287
+ /** Integration IDs this resource uses */
1288
+ integrations?: string[]
1289
+ }
1223
1290
  }
1224
1291
  ```
1225
1292
 
1226
1293
  ### `ResourceRelationships`
1227
1294
 
1228
1295
  ```typescript
1229
- /**
1230
- * Resource relationships map
1231
- * Maps resourceId to its relationship declarations
1232
- *
1233
- * @example
1234
- * {
1235
- * 'order-processor-agent': {
1236
- * triggers: { workflows: ['order-fulfillment-workflow'] },
1237
- * uses: { integrations: ['integration-shopify-prod'] }
1238
- * }
1239
- * }
1240
- */
1296
+ /**
1297
+ * Resource relationships map
1298
+ * Maps resourceId to its relationship declarations
1299
+ *
1300
+ * @example
1301
+ * {
1302
+ * 'order-processor-agent': {
1303
+ * triggers: { workflows: ['order-fulfillment-workflow'] },
1304
+ * uses: { integrations: ['integration-shopify-prod'] }
1305
+ * }
1306
+ * }
1307
+ */
1241
1308
  export type ResourceRelationships = Record<string, RelationshipDeclaration>
1242
1309
  ```
1243
1310
 
1244
1311
  ### `ExternalPlatform`
1245
1312
 
1246
1313
  ```typescript
1247
- /**
1248
- * External platform type
1249
- * Supported third-party automation platforms
1250
- */
1314
+ /**
1315
+ * External platform type
1316
+ * Supported third-party automation platforms
1317
+ */
1251
1318
  export type ExternalPlatform = 'n8n' | 'make' | 'zapier' | 'other'
1252
1319
  ```
1253
1320
 
1254
1321
  ### `ExternalResourceDefinition`
1255
1322
 
1256
1323
  ```typescript
1257
- /**
1258
- * External automation resource metadata
1259
- *
1260
- * Represents workflows/automations running on third-party platforms
1261
- * (n8n, Make, Zapier, etc.) for visualization in Command View.
1262
- *
1263
- * NOTE: This is metadata ONLY for visualization. No execution logic,
1264
- * no API integration with external platforms, no status syncing.
1265
- *
1266
- * BREAKING CHANGES (2025-11-30):
1267
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
1268
- * - Field renames: `id` -> `resourceId` (inherited)
1269
- * - New required field: `version` (inherited) - organizations must add version to all external resources
1270
- * - New required field: `type: 'external'` (inherited) - resource type discriminator
1271
- * - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
1272
- *
1273
- * @example
1274
- * {
1275
- * resourceId: 'external-n8n-order-sync',
1276
- * type: 'external',
1277
- * version: '1.0.0',
1278
- * platform: 'n8n',
1279
- * name: 'Shopify Order Sync',
1280
- * description: 'Legacy n8n workflow for syncing Shopify orders',
1281
- * status: 'prod',
1282
- * platformUrl: 'https://n8n.client.com/workflow/123',
1283
- * triggers: { workflows: ['order-fulfillment-workflow'] },
1284
- * uses: { integrations: ['integration-shopify-prod'] }
1285
- * }
1286
- */
1287
- export interface ExternalResourceDefinition extends ResourceDefinition {
1288
- /** Resource type discriminator (narrowed from base union) */
1289
- type: 'external'
1290
-
1291
- /** Platform type */
1292
- platform: ExternalPlatform
1293
-
1294
- // Optional platform-specific metadata
1295
- /** Link to external platform (e.g., n8n workflow editor URL) */
1296
- platformUrl?: string
1297
- /** Platform's internal ID/reference */
1298
- externalId?: string
1299
-
1300
- /** What this external resource triggers (external -> internal) */
1301
- triggers?: {
1302
- /** Elevasis workflow resourceIds this external automation triggers */
1303
- workflows?: string[]
1304
- /** Elevasis agent resourceIds this external automation triggers */
1305
- agents?: string[]
1306
- }
1307
-
1308
- /** Integrations this external resource uses (shared credentials) */
1309
- uses?: {
1310
- /** Integration IDs this external automation uses */
1311
- integrations?: string[]
1312
- }
1313
-
1314
- // NOTE: triggeredBy field removed - per relationship-consolidation design,
1315
- // all relationships are forward-only declarations. Graph edges are built
1316
- // from forward declarations only.
1324
+ /**
1325
+ * External automation resource metadata
1326
+ *
1327
+ * Represents workflows/automations running on third-party platforms
1328
+ * (n8n, Make, Zapier, etc.) for visualization in Command View.
1329
+ *
1330
+ * NOTE: This is metadata ONLY for visualization. No execution logic,
1331
+ * no API integration with external platforms, no status syncing.
1332
+ *
1333
+ * BREAKING CHANGES (2025-11-30):
1334
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
1335
+ * - Field renames: `id` -> `resourceId` (inherited)
1336
+ * - New required field: `version` (inherited) - organizations must add version to all external resources
1337
+ * - New required field: `type: 'external'` (inherited) - resource type discriminator
1338
+ * - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
1339
+ *
1340
+ * @example
1341
+ * {
1342
+ * resourceId: 'external-n8n-order-sync',
1343
+ * type: 'external',
1344
+ * version: '1.0.0',
1345
+ * platform: 'n8n',
1346
+ * name: 'Shopify Order Sync',
1347
+ * description: 'Legacy n8n workflow for syncing Shopify orders',
1348
+ * status: 'prod',
1349
+ * platformUrl: 'https://n8n.client.com/workflow/123',
1350
+ * triggers: { workflows: ['order-fulfillment-workflow'] },
1351
+ * uses: { integrations: ['integration-shopify-prod'] }
1352
+ * }
1353
+ */
1354
+ export interface ExternalResourceDefinition extends ResourceDefinition {
1355
+ /** Resource type discriminator (narrowed from base union) */
1356
+ type: 'external'
1357
+
1358
+ /** Platform type */
1359
+ platform: ExternalPlatform
1360
+
1361
+ // Optional platform-specific metadata
1362
+ /** Link to external platform (e.g., n8n workflow editor URL) */
1363
+ platformUrl?: string
1364
+ /** Platform's internal ID/reference */
1365
+ externalId?: string
1366
+
1367
+ /** What this external resource triggers (external -> internal) */
1368
+ triggers?: {
1369
+ /** Elevasis workflow resourceIds this external automation triggers */
1370
+ workflows?: string[]
1371
+ /** Elevasis agent resourceIds this external automation triggers */
1372
+ agents?: string[]
1373
+ }
1374
+
1375
+ /** Integrations this external resource uses (shared credentials) */
1376
+ uses?: {
1377
+ /** Integration IDs this external automation uses */
1378
+ integrations?: string[]
1379
+ }
1380
+
1381
+ // NOTE: triggeredBy field removed - per relationship-consolidation design,
1382
+ // all relationships are forward-only declarations. Graph edges are built
1383
+ // from forward declarations only.
1384
+ }
1385
+ ```
1386
+
1387
+ ### `ApiInterfaceConformanceGap`
1388
+
1389
+ ```typescript
1390
+ /**
1391
+ * Describes a system that has API-backed resources but lacks an `apiInterface`
1392
+ * declaration. Used by `detectMissingApiInterfaceDeclarations` as the return
1393
+ * payload that drives both CLI warnings and scaffold fill-mode input.
1394
+ */
1395
+ export interface ApiInterfaceConformanceGap {
1396
+ /** Dot-separated system path (e.g. "sales.lead-gen"). */
1397
+ systemPath: string
1398
+ /** Resource IDs in this system that have non-empty ontology bindings. */
1399
+ resourceIds: string[]
1400
+ /** Human-readable description of the gap. */
1401
+ message: string
1317
1402
  }
1318
1403
  ```
1319
1404
 
1320
1405
  ### `HumanCheckpointDefinition`
1321
1406
 
1322
1407
  ```typescript
1323
- /**
1324
- * Human Checkpoint definition - human decision points in automation
1325
- *
1326
- * Represents where human judgment is deployed in the automation landscape.
1327
- * Tasks with matching command_queue_group are routed to this checkpoint.
1328
- *
1329
- * BREAKING CHANGES (2025-11-30):
1330
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
1331
- * - Field renames: `id` -> `resourceId` (inherited)
1332
- * - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
1333
- * - New required field: `version` (inherited) - organizations must add version to all human checkpoints
1334
- * - New required field: `type: 'human'` (inherited) - resource type discriminator
1335
- *
1336
- * @example
1337
- * {
1338
- * resourceId: 'sales-approval',
1339
- * type: 'human',
1340
- * name: 'Sales Approval Queue',
1341
- * description: 'High-value order approvals for sales team',
1342
- * version: '1.0.0',
1343
- * status: 'prod',
1344
- * requestedBy: { agents: ['order-processor-agent'] },
1345
- * routesTo: { agents: ['order-fulfillment-agent'] }
1346
- * }
1347
- */
1348
- export interface HumanCheckpointDefinition extends ResourceDefinition {
1349
- /** Resource type discriminator (narrowed from base union) */
1350
- type: 'human'
1351
-
1352
- /** Resources that create tasks for this checkpoint */
1353
- requestedBy?: {
1354
- /** Agent resourceIds that request approval here */
1355
- agents?: string[]
1356
- /** Workflow resourceIds that request approval here */
1357
- workflows?: string[]
1358
- }
1359
-
1360
- /** Resources that receive approved decisions */
1361
- routesTo?: {
1362
- /** Agent resourceIds that handle approved tasks */
1363
- agents?: string[]
1364
- /** Workflow resourceIds that handle approved tasks */
1365
- workflows?: string[]
1366
- }
1408
+ /**
1409
+ * Human Checkpoint definition - human decision points in automation
1410
+ *
1411
+ * Represents where human judgment is deployed in the automation landscape.
1412
+ * Tasks with matching command_queue_group are routed to this checkpoint.
1413
+ *
1414
+ * BREAKING CHANGES (2025-11-30):
1415
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
1416
+ * - Field renames: `id` -> `resourceId` (inherited)
1417
+ * - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
1418
+ * - New required field: `version` (inherited) - organizations must add version to all human checkpoints
1419
+ * - New required field: `type: 'human'` (inherited) - resource type discriminator
1420
+ *
1421
+ * @example
1422
+ * {
1423
+ * resourceId: 'sales-approval',
1424
+ * type: 'human',
1425
+ * name: 'Sales Approval Queue',
1426
+ * description: 'High-value order approvals for sales team',
1427
+ * version: '1.0.0',
1428
+ * status: 'prod',
1429
+ * requestedBy: { agents: ['order-processor-agent'] },
1430
+ * routesTo: { agents: ['order-fulfillment-agent'] }
1431
+ * }
1432
+ */
1433
+ export interface HumanCheckpointDefinition extends ResourceDefinition {
1434
+ /** Resource type discriminator (narrowed from base union) */
1435
+ type: 'human'
1436
+
1437
+ /** Resources that create tasks for this checkpoint */
1438
+ requestedBy?: {
1439
+ /** Agent resourceIds that request approval here */
1440
+ agents?: string[]
1441
+ /** Workflow resourceIds that request approval here */
1442
+ workflows?: string[]
1443
+ }
1444
+
1445
+ /** Resources that receive approved decisions */
1446
+ routesTo?: {
1447
+ /** Agent resourceIds that handle approved tasks */
1448
+ agents?: string[]
1449
+ /** Workflow resourceIds that handle approved tasks */
1450
+ workflows?: string[]
1451
+ }
1367
1452
  }
1368
1453
  ```
1369
1454