@elevasis/core 0.20.0 → 0.22.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 (77) hide show
  1. package/dist/index.d.ts +524 -6
  2. package/dist/index.js +417 -42
  3. package/dist/knowledge/index.d.ts +151 -1
  4. package/dist/organization-model/index.d.ts +524 -6
  5. package/dist/organization-model/index.js +417 -42
  6. package/dist/test-utils/index.d.ts +270 -1
  7. package/dist/test-utils/index.js +407 -41
  8. package/package.json +5 -5
  9. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +501 -303
  10. package/src/auth/multi-tenancy/permissions.ts +20 -8
  11. package/src/business/README.md +2 -2
  12. package/src/business/acquisition/api-schemas.test.ts +198 -0
  13. package/src/business/acquisition/api-schemas.ts +250 -9
  14. package/src/business/acquisition/build-templates.test.ts +28 -0
  15. package/src/business/acquisition/build-templates.ts +20 -8
  16. package/src/business/acquisition/index.ts +12 -0
  17. package/src/business/acquisition/types.ts +6 -1
  18. package/src/business/clients/api-schemas.test.ts +115 -0
  19. package/src/business/clients/api-schemas.ts +158 -0
  20. package/src/business/clients/index.ts +1 -0
  21. package/src/business/deals/api-schemas.ts +8 -0
  22. package/src/business/index.ts +5 -2
  23. package/src/business/projects/types.ts +19 -0
  24. package/src/execution/engine/__tests__/fixtures/test-agents.ts +10 -8
  25. package/src/execution/engine/agent/core/__tests__/agent.test.ts +16 -12
  26. package/src/execution/engine/agent/core/__tests__/error-passthrough.test.ts +4 -3
  27. package/src/execution/engine/agent/core/types.ts +25 -15
  28. package/src/execution/engine/agent/index.ts +6 -4
  29. package/src/execution/engine/agent/reasoning/__tests__/request-builder.test.ts +24 -18
  30. package/src/execution/engine/index.ts +3 -0
  31. package/src/execution/engine/tools/integration/server/adapters/apify/apify-adapter.test.ts +55 -0
  32. package/src/execution/engine/tools/integration/server/adapters/apify/apify-adapter.ts +107 -41
  33. package/src/execution/engine/tools/integration/server/adapters/apollo/apollo-adapter.test.ts +48 -0
  34. package/src/execution/engine/tools/integration/server/adapters/apollo/apollo-adapter.ts +99 -0
  35. package/src/execution/engine/tools/integration/server/adapters/apollo/index.ts +1 -0
  36. package/src/execution/engine/tools/integration/server/adapters/clickup/clickup-adapter.test.ts +18 -0
  37. package/src/execution/engine/tools/integration/server/adapters/clickup/clickup-adapter.ts +194 -0
  38. package/src/execution/engine/tools/integration/server/adapters/clickup/index.ts +7 -0
  39. package/src/execution/engine/workflow/types.ts +7 -0
  40. package/src/integrations/credentials/api-schemas.ts +21 -2
  41. package/src/integrations/credentials/schemas.ts +200 -164
  42. package/src/organization-model/README.md +10 -3
  43. package/src/organization-model/__tests__/defaults.test.ts +6 -0
  44. package/src/organization-model/__tests__/domains/resources.test.ts +188 -0
  45. package/src/organization-model/__tests__/domains/roles.test.ts +402 -347
  46. package/src/organization-model/__tests__/domains/systems.test.ts +193 -0
  47. package/src/organization-model/__tests__/knowledge.test.ts +39 -0
  48. package/src/organization-model/__tests__/prospecting-ssot.test.ts +7 -4
  49. package/src/organization-model/__tests__/resolve.test.ts +1 -1
  50. package/src/organization-model/defaults.ts +24 -3
  51. package/src/organization-model/domains/knowledge.ts +3 -2
  52. package/src/organization-model/domains/prospecting.ts +182 -25
  53. package/src/organization-model/domains/resources.ts +88 -0
  54. package/src/organization-model/domains/roles.ts +93 -55
  55. package/src/organization-model/domains/sales.ts +24 -3
  56. package/src/organization-model/domains/systems.ts +46 -0
  57. package/src/organization-model/icons.ts +1 -0
  58. package/src/organization-model/index.ts +2 -0
  59. package/src/organization-model/organization-model.mdx +33 -14
  60. package/src/organization-model/published.ts +52 -1
  61. package/src/organization-model/schema.ts +121 -0
  62. package/src/organization-model/types.ts +46 -1
  63. package/src/platform/api/types.ts +38 -35
  64. package/src/platform/constants/versions.ts +1 -1
  65. package/src/platform/registry/__tests__/resource-registry.test.ts +2051 -2005
  66. package/src/platform/registry/__tests__/validation.test.ts +1343 -1086
  67. package/src/platform/registry/index.ts +14 -0
  68. package/src/platform/registry/resource-registry.ts +40 -2
  69. package/src/platform/registry/serialization.ts +241 -202
  70. package/src/platform/registry/serialized-types.ts +1 -0
  71. package/src/platform/registry/types.ts +411 -361
  72. package/src/platform/registry/validation.ts +743 -513
  73. package/src/projects/api-schemas.ts +290 -267
  74. package/src/reference/_generated/contracts.md +501 -303
  75. package/src/reference/glossary.md +8 -3
  76. package/src/server.ts +2 -0
  77. package/src/supabase/database.types.ts +121 -0
@@ -159,6 +159,36 @@ export type OrganizationModelRoles = z.infer<typeof RolesDomainSchema>
159
159
  export type OrganizationModelRole = z.infer<typeof RoleSchema>
160
160
  ```
161
161
 
162
+ ### `OrganizationModelRoleId`
163
+
164
+ ```typescript
165
+ export type OrganizationModelRoleId = z.infer<typeof RoleIdSchema>
166
+ ```
167
+
168
+ ### `OrganizationModelRoleHolder`
169
+
170
+ ```typescript
171
+ export type OrganizationModelRoleHolder = z.infer<typeof RoleHolderSchema>
172
+ ```
173
+
174
+ ### `OrganizationModelHumanRoleHolder`
175
+
176
+ ```typescript
177
+ export type OrganizationModelHumanRoleHolder = z.infer<typeof HumanRoleHolderSchema>
178
+ ```
179
+
180
+ ### `OrganizationModelAgentRoleHolder`
181
+
182
+ ```typescript
183
+ export type OrganizationModelAgentRoleHolder = z.infer<typeof AgentRoleHolderSchema>
184
+ ```
185
+
186
+ ### `OrganizationModelTeamRoleHolder`
187
+
188
+ ```typescript
189
+ export type OrganizationModelTeamRoleHolder = z.infer<typeof TeamRoleHolderSchema>
190
+ ```
191
+
162
192
  ### `OrganizationModelGoals`
163
193
 
164
194
  ```typescript
@@ -177,6 +207,90 @@ export type OrganizationModelObjective = z.infer<typeof ObjectiveSchema>
177
207
  export type OrganizationModelKeyResult = z.infer<typeof KeyResultSchema>
178
208
  ```
179
209
 
210
+ ### `OrganizationModelSystems`
211
+
212
+ ```typescript
213
+ export type OrganizationModelSystems = z.infer<typeof SystemsDomainSchema>
214
+ ```
215
+
216
+ ### `OrganizationModelSystemEntry`
217
+
218
+ ```typescript
219
+ export type OrganizationModelSystemEntry = z.infer<typeof SystemEntrySchema>
220
+ ```
221
+
222
+ ### `OrganizationModelSystemId`
223
+
224
+ ```typescript
225
+ export type OrganizationModelSystemId = z.infer<typeof SystemIdSchema>
226
+ ```
227
+
228
+ ### `OrganizationModelSystemKind`
229
+
230
+ ```typescript
231
+ export type OrganizationModelSystemKind = z.infer<typeof SystemKindSchema>
232
+ ```
233
+
234
+ ### `OrganizationModelSystemStatus`
235
+
236
+ ```typescript
237
+ export type OrganizationModelSystemStatus = z.infer<typeof SystemStatusSchema>
238
+ ```
239
+
240
+ ### `OrganizationModelResources`
241
+
242
+ ```typescript
243
+ export type OrganizationModelResources = z.infer<typeof ResourcesDomainSchema>
244
+ ```
245
+
246
+ ### `OrganizationModelResourceEntry`
247
+
248
+ ```typescript
249
+ export type OrganizationModelResourceEntry = z.infer<typeof ResourceEntrySchema>
250
+ ```
251
+
252
+ ### `OrganizationModelResourceId`
253
+
254
+ ```typescript
255
+ export type OrganizationModelResourceId = z.infer<typeof ResourceIdSchema>
256
+ ```
257
+
258
+ ### `OrganizationModelResourceKind`
259
+
260
+ ```typescript
261
+ export type OrganizationModelResourceKind = z.infer<typeof ResourceKindSchema>
262
+ ```
263
+
264
+ ### `OrganizationModelResourceGovernanceStatus`
265
+
266
+ ```typescript
267
+ export type OrganizationModelResourceGovernanceStatus = z.infer<typeof ResourceGovernanceStatusSchema>
268
+ ```
269
+
270
+ ### `OrganizationModelAgentKind`
271
+
272
+ ```typescript
273
+ export type OrganizationModelAgentKind = z.infer<typeof AgentKindSchema>
274
+ ```
275
+
276
+ ### `OrganizationModelWorkflowResourceEntry`
277
+
278
+ ```typescript
279
+ export type OrganizationModelWorkflowResourceEntry = z.infer<typeof WorkflowResourceEntrySchema>
280
+ ```
281
+
282
+ ### `OrganizationModelAgentResourceEntry`
283
+
284
+ ```typescript
285
+ export type OrganizationModelAgentResourceEntry = z.infer<typeof AgentResourceEntrySchema>
286
+ ```
287
+
288
+ ### `OrganizationModelIntegrationResourceEntry`
289
+
290
+ ```typescript
291
+ export type OrganizationModelIntegrationResourceEntry = z.infer<typeof IntegrationResourceEntrySchema>
292
+ ```
293
+
180
294
  ### `OrganizationModelKnowledge`
181
295
 
182
296
  ```typescript
@@ -411,413 +525,464 @@ export interface ElevasisFeaturesContextValue {
411
525
  ### `ResourceStatus`
412
526
 
413
527
  ```typescript
414
- /**
415
- * Environment/deployment status for resources
416
- */
528
+ /**
529
+ * Environment/deployment status for resources
530
+ */
417
531
  export type ResourceStatus = 'dev' | 'prod'
418
532
  ```
419
533
 
420
534
  ### `ResourceType`
421
535
 
422
536
  ```typescript
423
- /**
424
- * All resource types in the platform
425
- * Used as the discriminator field in ResourceDefinition
426
- */
537
+ /**
538
+ * All resource types in the platform
539
+ * Used as the discriminator field in ResourceDefinition
540
+ */
427
541
  export type ResourceType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human'
428
542
  ```
429
543
 
430
544
  ### `ExecutableResourceType`
431
545
 
432
546
  ```typescript
433
- /**
434
- * Executable resource types (subset of ResourceType)
435
- * These resources can be directly executed by the execution engine
436
- */
547
+ /**
548
+ * Executable resource types (subset of ResourceType)
549
+ * These resources can be directly executed by the execution engine
550
+ */
437
551
  export type ExecutableResourceType = 'workflow' | 'agent'
438
552
  ```
439
553
 
554
+ ### `ResourceSystemSummary`
555
+
556
+ ```typescript
557
+ export type ResourceSystemSummary = Pick<SystemEntry, 'id' | 'title' | 'description' | 'kind' | 'status'>
558
+ ```
559
+
440
560
  ### `ResourceDefinition`
441
561
 
442
562
  ```typescript
443
- /**
444
- * Base interface for ALL platform resources
445
- * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
446
- */
447
- export interface ResourceDefinition {
448
- /** Unique resource identifier */
449
- resourceId: string
450
-
451
- /** Display name */
452
- name: string
453
-
454
- /** Purpose and functionality description */
455
- description: string
456
-
457
- /** Version for change tracking and evolution */
458
- version: string
459
-
460
- /** Resource type discriminator */
461
- type: ResourceType
462
-
463
- /** Environment/deployment status */
464
- status: ResourceStatus
465
-
563
+ /**
564
+ * Base interface for ALL platform resources
565
+ * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
566
+ */
567
+ export interface ResourceDefinition {
568
+ /** Unique resource identifier */
569
+ resourceId: string
570
+
571
+ /** Display name */
572
+ name: string
573
+
574
+ /** Purpose and functionality description */
575
+ description: string
576
+
577
+ /** Version for change tracking and evolution */
578
+ version: string
579
+
580
+ /** Resource type discriminator */
581
+ type: ResourceType
582
+
583
+ /** Environment/deployment status */
584
+ status: ResourceStatus
585
+
466
586
  /** Graph links to Organization Model nodes */
467
587
  links?: ResourceLink[]
468
588
 
469
589
  /** Infrastructure category for filtering */
470
590
  category?: ResourceCategory
471
-
472
- /** Whether the agent supports multi-turn sessions (agents only) */
473
- sessionCapable?: boolean
474
-
475
- /** Whether the resource is local (monorepo) or remote (externally deployed) */
476
- origin?: 'local' | 'remote'
477
-
478
- /** Whether this resource is archived and should be excluded from registration and deployment */
479
- archived?: boolean
591
+
592
+ /** Whether the agent supports multi-turn sessions (agents only) */
593
+ sessionCapable?: boolean
594
+
595
+ /** Whether the resource is local (monorepo) or remote (externally deployed) */
596
+ origin?: 'local' | 'remote'
597
+
598
+ /** OM System membership, when backed by a Resource descriptor */
599
+ systemId?: string
600
+
601
+ /** Display metadata for the owning OM System */
602
+ system?: ResourceSystemSummary
603
+
604
+ /** Governance lifecycle status from the OM Resource descriptor */
605
+ governanceStatus?: ResourceGovernanceStatus
606
+
607
+ /** Whether this resource is archived and should be excluded from registration and deployment */
608
+ archived?: boolean
609
+ }
610
+ ```
611
+
612
+ ### `RuntimeResourceDescriptor`
613
+
614
+ ```typescript
615
+ export type RuntimeResourceDescriptor = Extract<ResourceEntry, { kind: 'workflow' | 'agent' | 'integration' }>
616
+ ```
617
+
618
+ ### `DescriptorBackedResourceDefinition`
619
+
620
+ ```typescript
621
+ export type DescriptorBackedResourceDefinition<
622
+ TResource extends RuntimeResourceDescriptor = RuntimeResourceDescriptor
623
+ > = Omit<ResourceDefinition, 'resourceId' | 'type'> & {
624
+ /** OM descriptor that owns canonical identity and governance metadata. */
625
+ resource: TResource
626
+ resourceId?: never
627
+ type?: never
480
628
  }
481
629
  ```
482
630
 
631
+ ### `BoundResourceDefinition`
632
+
633
+ ```typescript
634
+ export type BoundResourceDefinition<TResource extends RuntimeResourceDescriptor = RuntimeResourceDescriptor> = Omit<
635
+ DescriptorBackedResourceDefinition<TResource>,
636
+ 'resource'
637
+ > &
638
+ ResourceDefinition & {
639
+ resource: TResource
640
+ resourceId: TResource['id']
641
+ type: TResource['kind']
642
+ }
643
+ ```
644
+
483
645
  ### `ResourceList`
484
646
 
485
647
  ```typescript
486
648
  /**
487
649
  * Resource list for organization
488
650
  * Returns ResourceDefinition metadata (not full definitions)
489
- */
490
- export interface ResourceList {
491
- workflows: ResourceDefinition[]
492
- agents: ResourceDefinition[]
493
- total: number
494
- organizationName: string
495
- environment?: 'dev' | 'prod'
651
+ */
652
+ export interface ResourceList {
653
+ workflows: ResourceDefinition[]
654
+ agents: ResourceDefinition[]
655
+ total: number
656
+ organizationName: string
657
+ environment?: 'dev' | 'prod'
496
658
  }
497
659
  ```
498
660
 
499
661
  ### `WebhookProviderType`
500
662
 
501
663
  ```typescript
502
- /** Webhook provider identifiers */
664
+ /** Webhook provider identifiers */
503
665
  export type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'instantly' | 'apify' | 'test'
504
666
  ```
505
667
 
506
668
  ### `WebhookTriggerConfig`
507
669
 
508
670
  ```typescript
509
- /** Webhook trigger configuration */
510
- export interface WebhookTriggerConfig {
511
- /** Provider identifier */
512
- provider: WebhookProviderType
513
- /** Event type for documentation (not used for matching - workflow handles routing) */
514
- event?: string
515
- /** Optional filtering (e.g., specific form ID for Fillout) */
516
- filter?: Record<string, string>
517
- /** References credential in credentials table for per-org webhook secrets */
518
- credentialName?: string
671
+ /** Webhook trigger configuration */
672
+ export interface WebhookTriggerConfig {
673
+ /** Provider identifier */
674
+ provider: WebhookProviderType
675
+ /** Event type for documentation (not used for matching - workflow handles routing) */
676
+ event?: string
677
+ /** Optional filtering (e.g., specific form ID for Fillout) */
678
+ filter?: Record<string, string>
679
+ /** References credential in credentials table for per-org webhook secrets */
680
+ credentialName?: string
519
681
  }
520
682
  ```
521
683
 
522
684
  ### `ScheduleTriggerConfig`
523
685
 
524
686
  ```typescript
525
- /** Schedule trigger configuration */
526
- export interface ScheduleTriggerConfig {
527
- /** Cron expression (e.g., '0 6 * * *') */
528
- cron: string
529
- /** Optional timezone (default: UTC) */
530
- timezone?: string
687
+ /** Schedule trigger configuration */
688
+ export interface ScheduleTriggerConfig {
689
+ /** Cron expression (e.g., '0 6 * * *') */
690
+ cron: string
691
+ /** Optional timezone (default: UTC) */
692
+ timezone?: string
531
693
  }
532
694
  ```
533
695
 
534
696
  ### `EventTriggerConfig`
535
697
 
536
698
  ```typescript
537
- /** Event trigger configuration */
538
- export interface EventTriggerConfig {
539
- /** Internal event type */
540
- eventType: string
541
- /** Event source */
542
- source?: string
699
+ /** Event trigger configuration */
700
+ export interface EventTriggerConfig {
701
+ /** Internal event type */
702
+ eventType: string
703
+ /** Event source */
704
+ source?: string
543
705
  }
544
706
  ```
545
707
 
546
708
  ### `TriggerConfig`
547
709
 
548
710
  ```typescript
549
- /** Union of all trigger configs */
711
+ /** Union of all trigger configs */
550
712
  export type TriggerConfig = WebhookTriggerConfig | ScheduleTriggerConfig | EventTriggerConfig
551
713
  ```
552
714
 
553
715
  ### `TriggerDefinition`
554
716
 
555
717
  ```typescript
556
- /**
557
- * Trigger metadata - entry points that initiate resource execution
558
- *
559
- * Triggers represent how executions start: webhooks from external services,
560
- * scheduled cron jobs, platform events, or manual user actions.
561
- *
562
- * BREAKING CHANGES (2025-11-30):
718
+ /**
719
+ * Trigger metadata - entry points that initiate resource execution
720
+ *
721
+ * Triggers represent how executions start: webhooks from external services,
722
+ * scheduled cron jobs, platform events, or manual user actions.
723
+ *
724
+ * BREAKING CHANGES (2025-11-30):
563
725
  * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
564
- * - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
565
- * - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
566
- * - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
567
- * - triggers object now includes `externalResources` option
568
- *
569
- * @example
570
- * // TriggerDefinition - metadata only
571
- * {
572
- * resourceId: 'trigger-new-order',
573
- * type: 'trigger',
574
- * triggerType: 'webhook',
575
- * name: 'New Order',
576
- * description: 'Webhook from Shopify on new orders',
577
- * version: '1.0.0',
578
- * status: 'prod',
579
- * webhookPath: '/webhooks/shopify/orders'
580
- * }
581
- *
582
- * // Relationships declared in ResourceRelationships (not on TriggerDefinition):
583
- * // relationships: {
584
- * // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
585
- * // }
586
- */
587
- export interface TriggerDefinition extends ResourceDefinition {
588
- /** Resource type discriminator (narrowed from base union) */
589
- type: 'trigger'
590
-
591
- /** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
592
- triggerType: 'webhook' | 'schedule' | 'manual' | 'event'
593
-
594
- /** Type-specific configuration */
595
- config?: TriggerConfig
596
-
597
- // Legacy fields (deprecated, use config instead)
598
- /** For webhook triggers: path like '/webhooks/shopify/orders' */
599
- webhookPath?: string
600
- /** For schedule triggers: cron expression like '0 6 * * *' */
601
- schedule?: string
602
- /** For event triggers: event type like 'low-stock-alert' */
603
- eventType?: string
604
-
605
- // NOTE: What this trigger starts is declared in ResourceRelationships, not here
606
- // This prevents duplication - triggers are forward-declared in relationships
726
+ * - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
727
+ * - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
728
+ * - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
729
+ * - triggers object now includes `externalResources` option
730
+ *
731
+ * @example
732
+ * // TriggerDefinition - metadata only
733
+ * {
734
+ * resourceId: 'trigger-new-order',
735
+ * type: 'trigger',
736
+ * triggerType: 'webhook',
737
+ * name: 'New Order',
738
+ * description: 'Webhook from Shopify on new orders',
739
+ * version: '1.0.0',
740
+ * status: 'prod',
741
+ * webhookPath: '/webhooks/shopify/orders'
742
+ * }
743
+ *
744
+ * // Relationships declared in ResourceRelationships (not on TriggerDefinition):
745
+ * // relationships: {
746
+ * // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
747
+ * // }
748
+ */
749
+ export interface TriggerDefinition extends ResourceDefinition {
750
+ /** Resource type discriminator (narrowed from base union) */
751
+ type: 'trigger'
752
+
753
+ /** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
754
+ triggerType: 'webhook' | 'schedule' | 'manual' | 'event'
755
+
756
+ /** Type-specific configuration */
757
+ config?: TriggerConfig
758
+
759
+ // Legacy fields (deprecated, use config instead)
760
+ /** For webhook triggers: path like '/webhooks/shopify/orders' */
761
+ webhookPath?: string
762
+ /** For schedule triggers: cron expression like '0 6 * * *' */
763
+ schedule?: string
764
+ /** For event triggers: event type like 'low-stock-alert' */
765
+ eventType?: string
766
+
767
+ // NOTE: What this trigger starts is declared in ResourceRelationships, not here
768
+ // This prevents duplication - triggers are forward-declared in relationships
607
769
  }
608
770
  ```
609
771
 
610
772
  ### `IntegrationDefinition`
611
773
 
612
774
  ```typescript
613
- /**
614
- * Integration metadata - external service connections
615
- *
616
- * References credentials table for actual connection. No connection status
617
- * stored here (queried at runtime from credentials table).
618
- *
619
- * BREAKING CHANGES (2025-11-30):
775
+ /**
776
+ * Integration metadata - external service connections
777
+ *
778
+ * References credentials table for actual connection. No connection status
779
+ * stored here (queried at runtime from credentials table).
780
+ *
781
+ * BREAKING CHANGES (2025-11-30):
620
782
  * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
621
- * - Field renames: `id` -> `resourceId` (inherited)
622
- * - New required field: `status` (inherited) - organizations must add status to all integrations
623
- * - New required field: `version` (inherited) - organizations must add version to all integrations
624
- * - New required field: `type: 'integration'` (inherited) - resource type discriminator
625
- *
626
- * @example
627
- * {
628
- * resourceId: 'integration-shopify-prod',
629
- * type: 'integration',
630
- * provider: 'shopify',
631
- * credentialName: 'shopify-prod',
632
- * name: 'Shopify Production',
633
- * description: 'E-commerce platform',
634
- * version: '1.0.0',
635
- * status: 'prod'
636
- * }
637
- */
638
- export interface IntegrationDefinition extends ResourceDefinition {
639
- /** Resource type discriminator (narrowed from base union) */
640
- type: 'integration'
641
-
642
- /** Integration provider type */
643
- provider: IntegrationType
644
- /** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
645
- credentialName: string
783
+ * - Field renames: `id` -> `resourceId` (inherited)
784
+ * - New required field: `status` (inherited) - organizations must add status to all integrations
785
+ * - New required field: `version` (inherited) - organizations must add version to all integrations
786
+ * - New required field: `type: 'integration'` (inherited) - resource type discriminator
787
+ *
788
+ * @example
789
+ * {
790
+ * resourceId: 'integration-shopify-prod',
791
+ * type: 'integration',
792
+ * provider: 'shopify',
793
+ * credentialName: 'shopify-prod',
794
+ * name: 'Shopify Production',
795
+ * description: 'E-commerce platform',
796
+ * version: '1.0.0',
797
+ * status: 'prod'
798
+ * }
799
+ */
800
+ export interface IntegrationDefinition extends ResourceDefinition {
801
+ /** Resource type discriminator (narrowed from base union) */
802
+ type: 'integration'
803
+
804
+ /** OM descriptor that owns canonical identity and governance metadata. */
805
+ resource?: Extract<ResourceEntry, { kind: 'integration' }>
806
+
807
+ /** Integration provider type */
808
+ provider: IntegrationType
809
+ /** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
810
+ credentialName: string
646
811
  }
647
812
  ```
648
813
 
649
814
  ### `RelationshipDeclaration`
650
815
 
651
816
  ```typescript
652
- /**
653
- * Explicit resource relationship declaration
654
- *
655
- * Single-direction only - Command View derives reverse relationships.
656
- * Agents/workflows declare what they trigger and use.
657
- *
658
- * @example
659
- * {
660
- * triggers: { workflows: ['order-fulfillment-workflow'] },
661
- * uses: { integrations: ['integration-shopify-prod', 'integration-postgres'] }
662
- * }
663
- */
664
- export interface RelationshipDeclaration {
665
- /** Resources this resource triggers */
666
- triggers?: {
667
- /** Agent resourceIds this resource triggers */
668
- agents?: string[]
669
- /** Workflow resourceIds this resource triggers */
670
- workflows?: string[]
671
- }
672
- /** Integrations this resource uses */
673
- uses?: {
674
- /** Integration IDs this resource uses */
675
- integrations?: string[]
676
- }
817
+ /**
818
+ * Explicit resource relationship declaration
819
+ *
820
+ * Single-direction only - Command View derives reverse relationships.
821
+ * Agents/workflows declare what they trigger and use.
822
+ *
823
+ * @example
824
+ * {
825
+ * triggers: { workflows: ['order-fulfillment-workflow'] },
826
+ * uses: { integrations: ['integration-shopify-prod', 'integration-postgres'] }
827
+ * }
828
+ */
829
+ export interface RelationshipDeclaration {
830
+ /** Resources this resource triggers */
831
+ triggers?: {
832
+ /** Agent resourceIds this resource triggers */
833
+ agents?: string[]
834
+ /** Workflow resourceIds this resource triggers */
835
+ workflows?: string[]
836
+ }
837
+ /** Integrations this resource uses */
838
+ uses?: {
839
+ /** Integration IDs this resource uses */
840
+ integrations?: string[]
841
+ }
677
842
  }
678
843
  ```
679
844
 
680
845
  ### `ResourceRelationships`
681
846
 
682
847
  ```typescript
683
- /**
684
- * Resource relationships map
685
- * Maps resourceId to its relationship declarations
686
- *
687
- * @example
688
- * {
689
- * 'order-processor-agent': {
690
- * triggers: { workflows: ['order-fulfillment-workflow'] },
691
- * uses: { integrations: ['integration-shopify-prod'] }
692
- * }
693
- * }
694
- */
848
+ /**
849
+ * Resource relationships map
850
+ * Maps resourceId to its relationship declarations
851
+ *
852
+ * @example
853
+ * {
854
+ * 'order-processor-agent': {
855
+ * triggers: { workflows: ['order-fulfillment-workflow'] },
856
+ * uses: { integrations: ['integration-shopify-prod'] }
857
+ * }
858
+ * }
859
+ */
695
860
  export type ResourceRelationships = Record<string, RelationshipDeclaration>
696
861
  ```
697
862
 
698
863
  ### `ExternalPlatform`
699
864
 
700
865
  ```typescript
701
- /**
702
- * External platform type
703
- * Supported third-party automation platforms
704
- */
866
+ /**
867
+ * External platform type
868
+ * Supported third-party automation platforms
869
+ */
705
870
  export type ExternalPlatform = 'n8n' | 'make' | 'zapier' | 'other'
706
871
  ```
707
872
 
708
873
  ### `ExternalResourceDefinition`
709
874
 
710
875
  ```typescript
711
- /**
712
- * External automation resource metadata
713
- *
714
- * Represents workflows/automations running on third-party platforms
715
- * (n8n, Make, Zapier, etc.) for visualization in Command View.
716
- *
717
- * NOTE: This is metadata ONLY for visualization. No execution logic,
718
- * no API integration with external platforms, no status syncing.
719
- *
720
- * BREAKING CHANGES (2025-11-30):
876
+ /**
877
+ * External automation resource metadata
878
+ *
879
+ * Represents workflows/automations running on third-party platforms
880
+ * (n8n, Make, Zapier, etc.) for visualization in Command View.
881
+ *
882
+ * NOTE: This is metadata ONLY for visualization. No execution logic,
883
+ * no API integration with external platforms, no status syncing.
884
+ *
885
+ * BREAKING CHANGES (2025-11-30):
721
886
  * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
722
- * - Field renames: `id` -> `resourceId` (inherited)
723
- * - New required field: `version` (inherited) - organizations must add version to all external resources
724
- * - New required field: `type: 'external'` (inherited) - resource type discriminator
725
- * - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
726
- *
727
- * @example
728
- * {
729
- * resourceId: 'external-n8n-order-sync',
730
- * type: 'external',
731
- * version: '1.0.0',
732
- * platform: 'n8n',
733
- * name: 'Shopify Order Sync',
734
- * description: 'Legacy n8n workflow for syncing Shopify orders',
735
- * status: 'prod',
736
- * platformUrl: 'https://n8n.client.com/workflow/123',
737
- * triggers: { workflows: ['order-fulfillment-workflow'] },
738
- * uses: { integrations: ['integration-shopify-prod'] }
739
- * }
740
- */
741
- export interface ExternalResourceDefinition extends ResourceDefinition {
742
- /** Resource type discriminator (narrowed from base union) */
743
- type: 'external'
744
-
745
- /** Platform type */
746
- platform: ExternalPlatform
747
-
748
- // Optional platform-specific metadata
749
- /** Link to external platform (e.g., n8n workflow editor URL) */
750
- platformUrl?: string
751
- /** Platform's internal ID/reference */
752
- externalId?: string
753
-
754
- /** What this external resource triggers (external -> internal) */
755
- triggers?: {
756
- /** Elevasis workflow resourceIds this external automation triggers */
757
- workflows?: string[]
758
- /** Elevasis agent resourceIds this external automation triggers */
759
- agents?: string[]
760
- }
761
-
762
- /** Integrations this external resource uses (shared credentials) */
763
- uses?: {
764
- /** Integration IDs this external automation uses */
765
- integrations?: string[]
766
- }
767
-
768
- // NOTE: triggeredBy field removed - per relationship-consolidation design,
769
- // all relationships are forward-only declarations. Graph edges are built
770
- // from forward declarations only.
887
+ * - Field renames: `id` -> `resourceId` (inherited)
888
+ * - New required field: `version` (inherited) - organizations must add version to all external resources
889
+ * - New required field: `type: 'external'` (inherited) - resource type discriminator
890
+ * - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
891
+ *
892
+ * @example
893
+ * {
894
+ * resourceId: 'external-n8n-order-sync',
895
+ * type: 'external',
896
+ * version: '1.0.0',
897
+ * platform: 'n8n',
898
+ * name: 'Shopify Order Sync',
899
+ * description: 'Legacy n8n workflow for syncing Shopify orders',
900
+ * status: 'prod',
901
+ * platformUrl: 'https://n8n.client.com/workflow/123',
902
+ * triggers: { workflows: ['order-fulfillment-workflow'] },
903
+ * uses: { integrations: ['integration-shopify-prod'] }
904
+ * }
905
+ */
906
+ export interface ExternalResourceDefinition extends ResourceDefinition {
907
+ /** Resource type discriminator (narrowed from base union) */
908
+ type: 'external'
909
+
910
+ /** Platform type */
911
+ platform: ExternalPlatform
912
+
913
+ // Optional platform-specific metadata
914
+ /** Link to external platform (e.g., n8n workflow editor URL) */
915
+ platformUrl?: string
916
+ /** Platform's internal ID/reference */
917
+ externalId?: string
918
+
919
+ /** What this external resource triggers (external -> internal) */
920
+ triggers?: {
921
+ /** Elevasis workflow resourceIds this external automation triggers */
922
+ workflows?: string[]
923
+ /** Elevasis agent resourceIds this external automation triggers */
924
+ agents?: string[]
925
+ }
926
+
927
+ /** Integrations this external resource uses (shared credentials) */
928
+ uses?: {
929
+ /** Integration IDs this external automation uses */
930
+ integrations?: string[]
931
+ }
932
+
933
+ // NOTE: triggeredBy field removed - per relationship-consolidation design,
934
+ // all relationships are forward-only declarations. Graph edges are built
935
+ // from forward declarations only.
771
936
  }
772
937
  ```
773
938
 
774
939
  ### `HumanCheckpointDefinition`
775
940
 
776
941
  ```typescript
777
- /**
778
- * Human Checkpoint definition - human decision points in automation
779
- *
780
- * Represents where human judgment is deployed in the automation landscape.
781
- * Tasks with matching command_queue_group are routed to this checkpoint.
782
- *
783
- * BREAKING CHANGES (2025-11-30):
942
+ /**
943
+ * Human Checkpoint definition - human decision points in automation
944
+ *
945
+ * Represents where human judgment is deployed in the automation landscape.
946
+ * Tasks with matching command_queue_group are routed to this checkpoint.
947
+ *
948
+ * BREAKING CHANGES (2025-11-30):
784
949
  * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
785
- * - Field renames: `id` -> `resourceId` (inherited)
786
- * - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
787
- * - New required field: `version` (inherited) - organizations must add version to all human checkpoints
788
- * - New required field: `type: 'human'` (inherited) - resource type discriminator
789
- *
790
- * @example
791
- * {
792
- * resourceId: 'sales-approval',
793
- * type: 'human',
794
- * name: 'Sales Approval Queue',
795
- * description: 'High-value order approvals for sales team',
796
- * version: '1.0.0',
797
- * status: 'prod',
798
- * requestedBy: { agents: ['order-processor-agent'] },
799
- * routesTo: { agents: ['order-fulfillment-agent'] }
800
- * }
801
- */
802
- export interface HumanCheckpointDefinition extends ResourceDefinition {
803
- /** Resource type discriminator (narrowed from base union) */
804
- type: 'human'
805
-
806
- /** Resources that create tasks for this checkpoint */
807
- requestedBy?: {
808
- /** Agent resourceIds that request approval here */
809
- agents?: string[]
810
- /** Workflow resourceIds that request approval here */
811
- workflows?: string[]
812
- }
813
-
814
- /** Resources that receive approved decisions */
815
- routesTo?: {
816
- /** Agent resourceIds that handle approved tasks */
817
- agents?: string[]
818
- /** Workflow resourceIds that handle approved tasks */
819
- workflows?: string[]
820
- }
950
+ * - Field renames: `id` -> `resourceId` (inherited)
951
+ * - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
952
+ * - New required field: `version` (inherited) - organizations must add version to all human checkpoints
953
+ * - New required field: `type: 'human'` (inherited) - resource type discriminator
954
+ *
955
+ * @example
956
+ * {
957
+ * resourceId: 'sales-approval',
958
+ * type: 'human',
959
+ * name: 'Sales Approval Queue',
960
+ * description: 'High-value order approvals for sales team',
961
+ * version: '1.0.0',
962
+ * status: 'prod',
963
+ * requestedBy: { agents: ['order-processor-agent'] },
964
+ * routesTo: { agents: ['order-fulfillment-agent'] }
965
+ * }
966
+ */
967
+ export interface HumanCheckpointDefinition extends ResourceDefinition {
968
+ /** Resource type discriminator (narrowed from base union) */
969
+ type: 'human'
970
+
971
+ /** Resources that create tasks for this checkpoint */
972
+ requestedBy?: {
973
+ /** Agent resourceIds that request approval here */
974
+ agents?: string[]
975
+ /** Workflow resourceIds that request approval here */
976
+ workflows?: string[]
977
+ }
978
+
979
+ /** Resources that receive approved decisions */
980
+ routesTo?: {
981
+ /** Agent resourceIds that handle approved tasks */
982
+ agents?: string[]
983
+ /** Workflow resourceIds that handle approved tasks */
984
+ workflows?: string[]
985
+ }
821
986
  }
822
987
  ```
823
988
 
@@ -835,6 +1000,11 @@ export interface HumanCheckpointDefinition extends ResourceDefinition {
835
1000
  export interface DeploymentSpec {
836
1001
  /** Deployment version (semver) */
837
1002
  version: string
1003
+ /** Optional Organization Model governance catalog used for OM-code validation */
1004
+ organizationModel?: {
1005
+ systems?: OrganizationModelSystems
1006
+ resources?: OrganizationModelResources
1007
+ }
838
1008
  /** Workflow definitions */
839
1009
  workflows?: WorkflowDefinition[]
840
1010
  /** Agent definitions */
@@ -1155,6 +1325,9 @@ export const DealTaskIdParamsSchema = z.object({
1155
1325
  export const ListDealsQuerySchema = z
1156
1326
  .object({
1157
1327
  stage: DealStageSchema.optional(),
1328
+ list: UuidSchema.optional(),
1329
+ batch: z.string().trim().min(1).max(255).optional(),
1330
+ staleSince: z.string().datetime().optional(),
1158
1331
  search: z.string().optional(),
1159
1332
  limit: z.coerce.number().int().positive().default(50),
1160
1333
  offset: z.coerce.number().int().min(0).default(0)
@@ -1300,6 +1473,7 @@ export const DealListItemSchema = z.object({
1300
1473
  // acq_deals columns
1301
1474
  id: z.string(),
1302
1475
  organization_id: z.string(),
1476
+ client_id: z.string().nullable().optional(),
1303
1477
  contact_id: z.string().nullable(),
1304
1478
  contact_email: z.string(),
1305
1479
  pipeline_key: z.string(),
@@ -1348,7 +1522,8 @@ export const DealListResponseSchema = z.object({
1348
1522
  * Additive fields keep existing DealListItem callers compatible.
1349
1523
  */
1350
1524
  export const DealDetailResponseSchema = DealListItemSchema.extend({
1351
- conversation: DealConversationSchema
1525
+ conversation: DealConversationSchema,
1526
+ lineage: DealLineageSchema.optional()
1352
1527
  })
1353
1528
  ```
1354
1529
 
@@ -1437,6 +1612,10 @@ export const DealSchemas = {
1437
1612
  DealSummaryResponse: DealSummaryResponseSchema,
1438
1613
  DealLookupResponse: DealLookupResponseSchema,
1439
1614
  ConversationMessage: ConversationMessageSchema,
1615
+ DealLineageListRef: DealLineageListRefSchema,
1616
+ DealLineageProjectRef: DealLineageProjectRefSchema,
1617
+ DealLineageClientRef: DealLineageClientRefSchema,
1618
+ DealLineage: DealLineageSchema,
1440
1619
  DealDetailResponse: DealDetailResponseSchema,
1441
1620
  DealNoteResponse: DealNoteResponseSchema,
1442
1621
  DealNoteListResponse: DealNoteListResponseSchema,
@@ -2093,6 +2272,7 @@ export const ListContactsQuerySchema = z
2093
2272
  export const CreateCompanyRequestSchema = z
2094
2273
  .object({
2095
2274
  name: z.string().trim().min(1).max(255),
2275
+ clientId: UuidSchema.nullable().optional(),
2096
2276
  domain: z.string().trim().min(1).max(255).optional(),
2097
2277
  linkedinUrl: z.string().trim().url().optional(),
2098
2278
  website: z.string().trim().url().optional(),
@@ -2115,6 +2295,7 @@ export const CreateCompanyRequestSchema = z
2115
2295
  export const UpdateCompanyRequestSchema = z
2116
2296
  .object({
2117
2297
  name: z.string().trim().min(1).max(255).optional(),
2298
+ clientId: UuidSchema.nullable().optional(),
2118
2299
  domain: z.string().trim().min(1).max(255).optional(),
2119
2300
  linkedinUrl: z.string().trim().url().optional(),
2120
2301
  website: z.string().trim().url().optional(),
@@ -2136,6 +2317,7 @@ export const UpdateCompanyRequestSchema = z
2136
2317
  .refine(
2137
2318
  (data) =>
2138
2319
  data.name !== undefined ||
2320
+ data.clientId !== undefined ||
2139
2321
  data.domain !== undefined ||
2140
2322
  data.linkedinUrl !== undefined ||
2141
2323
  data.website !== undefined ||
@@ -2164,6 +2346,7 @@ export const UpdateCompanyRequestSchema = z
2164
2346
  export const CreateContactRequestSchema = z
2165
2347
  .object({
2166
2348
  email: z.string().trim().email(),
2349
+ clientId: UuidSchema.nullable().optional(),
2167
2350
  companyId: UuidSchema.optional(),
2168
2351
  firstName: z.string().trim().min(1).max(255).optional(),
2169
2352
  lastName: z.string().trim().min(1).max(255).optional(),
@@ -2183,6 +2366,7 @@ export const CreateContactRequestSchema = z
2183
2366
  export const UpdateContactRequestSchema = z
2184
2367
  .object({
2185
2368
  companyId: UuidSchema.optional(),
2369
+ clientId: UuidSchema.nullable().optional(),
2186
2370
  emailValid: AcqEmailValidSchema.optional(),
2187
2371
  firstName: z.string().trim().min(1).max(255).optional(),
2188
2372
  lastName: z.string().trim().min(1).max(255).optional(),
@@ -2200,6 +2384,7 @@ export const UpdateContactRequestSchema = z
2200
2384
  .refine(
2201
2385
  (data) =>
2202
2386
  data.companyId !== undefined ||
2387
+ data.clientId !== undefined ||
2203
2388
  data.emailValid !== undefined ||
2204
2389
  data.firstName !== undefined ||
2205
2390
  data.lastName !== undefined ||
@@ -2224,6 +2409,7 @@ export const UpdateContactRequestSchema = z
2224
2409
  export const AcqCompanyResponseSchema = z.object({
2225
2410
  id: z.string(),
2226
2411
  organizationId: z.string(),
2412
+ clientId: z.string().nullable().optional(),
2227
2413
  name: z.string(),
2228
2414
  domain: z.string().nullable(),
2229
2415
  linkedinUrl: z.string().nullable(),
@@ -2290,6 +2476,7 @@ export const AcqContactCompanySummarySchema = z.object({
2290
2476
  export const AcqContactResponseSchema = z.object({
2291
2477
  id: z.string(),
2292
2478
  organizationId: z.string(),
2479
+ clientId: z.string().nullable().optional(),
2293
2480
  companyId: z.string().nullable(),
2294
2481
  email: z.string(),
2295
2482
  emailValid: AcqEmailValidSchema.nullable(),
@@ -2518,6 +2705,8 @@ export const AcqListSchemas = {
2518
2705
  ListTelemetry: ListTelemetrySchema,
2519
2706
 
2520
2707
  // Requests
2708
+ ListReadQuery: ListReadQuerySchema,
2709
+ GetListQuery: GetListQuerySchema,
2521
2710
  CreateListRequest: CreateListRequestSchema,
2522
2711
  UpdateListRequest: UpdateListRequestSchema,
2523
2712
  UpdateListStatusRequest: UpdateListStatusRequestSchema,
@@ -2529,7 +2718,11 @@ export const AcqListSchemas = {
2529
2718
 
2530
2719
  // Responses
2531
2720
  AcqListResponse: AcqListResponseSchema,
2721
+ AcqListDetailResponse: AcqListDetailResponseSchema,
2532
2722
  AcqListListResponse: AcqListListResponseSchema,
2723
+ AcqListDealRef: AcqListDealRefSchema,
2724
+ AcqListLineage: AcqListLineageSchema,
2725
+ AcqListStatusResponse: AcqListStatusResponseSchema,
2533
2726
  ListTelemetryResponse: ListTelemetryResponseSchema,
2534
2727
  ListTelemetryListResponse: ListTelemetryListResponseSchema,
2535
2728
  ListExecutionsResponse: ListExecutionsResponseSchema,
@@ -2549,9 +2742,14 @@ export const AcqSubstrateSchemas = {
2549
2742
 
2550
2743
  // List members
2551
2744
  ListMembersQuery: ListMembersQuerySchema,
2745
+ ListRecordsQuery: ListRecordsQuerySchema,
2552
2746
  MemberIdParams: MemberIdParamsSchema,
2553
2747
  AcqListMemberResponse: AcqListMemberResponseSchema,
2554
2748
  AcqListMembersResponse: AcqListMembersResponseSchema,
2749
+ AcqListCompanyRecordRow: AcqListCompanyRecordRowSchema,
2750
+ AcqListContactRecordRow: AcqListContactRecordRowSchema,
2751
+ ListRecordRow: ListRecordRowSchema,
2752
+ ListRecordsResponse: ListRecordsResponseSchema,
2555
2753
 
2556
2754
  // List companies
2557
2755
  ListCompanyIdParams: ListCompanyIdParamsSchema,
@@ -2709,7 +2907,7 @@ export const ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE: StatefulPipelineDefinition =
2709
2907
  {
2710
2908
  stageKey: 'outreach',
2711
2909
  label: 'Outreach',
2712
- states: [PENDING_STATE]
2910
+ states: [PENDING_STATE, { stateKey: 'uploaded', label: 'Uploaded' }]
2713
2911
  },
2714
2912
  {
2715
2913
  stageKey: 'prospecting',
@@ -3355,8 +3553,8 @@ export const OrgKnowledgeNodeSchema = z.object({
3355
3553
  skills: z.array(KnowledgeSkillBindingSchema).optional(),
3356
3554
  /** Domain key used to derive fast graph->skill registries. */
3357
3555
  domain: KnowledgeDomainBindingSchema.optional(),
3358
- /** Identifiers of the roles or members who own this knowledge node. */
3359
- ownerIds: z.array(ModelIdSchema).default([]),
3556
+ /** Role identifiers that own this knowledge node. */
3557
+ ownerIds: z.array(RoleIdSchema).default([]),
3360
3558
  /** ISO date string (YYYY-MM-DD or full ISO 8601) of last meaningful update. */
3361
3559
  updatedAt: z.string().trim().min(1).max(50)
3362
3560
  })