@elevasis/sdk 1.8.1 → 1.8.3

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 (59) hide show
  1. package/dist/cli.cjs +13 -5
  2. package/dist/index.d.ts +88 -39
  3. package/dist/types/worker/adapters/lead.d.ts +1 -1
  4. package/dist/worker/index.js +2 -0
  5. package/package.json +2 -2
  6. package/reference/_navigation.md +7 -1
  7. package/reference/_reference-manifest.json +14 -0
  8. package/reference/claude-config/logs/scaffold-registry-reminder.log +4 -0
  9. package/reference/claude-config/rules/agent-start-here.md +254 -254
  10. package/reference/claude-config/rules/frontend.md +43 -43
  11. package/reference/claude-config/rules/operations.md +64 -64
  12. package/reference/claude-config/rules/organization-model.md +42 -43
  13. package/reference/claude-config/rules/organization-os.md +107 -107
  14. package/reference/claude-config/rules/shared-types.md +2 -2
  15. package/reference/claude-config/rules/task-tracking.md +1 -1
  16. package/reference/claude-config/rules/ui.md +202 -202
  17. package/reference/claude-config/rules/vibe.md +202 -202
  18. package/reference/claude-config/skills/configure/SKILL.md +98 -98
  19. package/reference/claude-config/skills/configure/operations/codify-level-a.md +100 -100
  20. package/reference/claude-config/skills/configure/operations/codify-level-b.md +158 -158
  21. package/reference/claude-config/skills/configure/operations/customers.md +150 -150
  22. package/reference/claude-config/skills/configure/operations/features.md +162 -162
  23. package/reference/claude-config/skills/configure/operations/goals.md +147 -147
  24. package/reference/claude-config/skills/configure/operations/identity.md +133 -133
  25. package/reference/claude-config/skills/configure/operations/labels.md +128 -128
  26. package/reference/claude-config/skills/configure/operations/offerings.md +159 -159
  27. package/reference/claude-config/skills/configure/operations/roles.md +153 -153
  28. package/reference/claude-config/skills/configure/operations/techStack.md +139 -139
  29. package/reference/claude-config/skills/explore/SKILL.md +78 -78
  30. package/reference/claude-config/skills/git-sync/SKILL.md +126 -0
  31. package/reference/claude-config/skills/save/SKILL.md +183 -183
  32. package/reference/claude-config/skills/setup/SKILL.md +275 -275
  33. package/reference/claude-config/skills/submit-request/SKILL.md +5 -5
  34. package/reference/claude-config/skills/sync/SKILL.md +10 -44
  35. package/reference/claude-config/sync-notes/2026-04-22-git-sync-and-sync-notes.md +27 -0
  36. package/reference/claude-config/sync-notes/2026-04-22-lead-gen-deliverability-removal.md +30 -0
  37. package/reference/claude-config/sync-notes/README.md +43 -0
  38. package/reference/packages/core/src/README.md +39 -36
  39. package/reference/packages/core/src/business/README.md +52 -52
  40. package/reference/packages/core/src/organization-model/README.md +97 -97
  41. package/reference/packages/core/src/test-utils/README.md +42 -0
  42. package/reference/scaffold/core/organization-graph.mdx +272 -272
  43. package/reference/scaffold/core/organization-model.mdx +320 -320
  44. package/reference/scaffold/index.mdx +64 -64
  45. package/reference/scaffold/operations/propagation-pipeline.md +125 -104
  46. package/reference/scaffold/operations/scaffold-maintenance.md +122 -122
  47. package/reference/scaffold/operations/workflow-recipes.md +436 -436
  48. package/reference/scaffold/recipes/add-a-feature.md +158 -158
  49. package/reference/scaffold/recipes/add-a-resource.md +158 -158
  50. package/reference/scaffold/recipes/customize-organization-model.md +400 -400
  51. package/reference/scaffold/recipes/extend-a-base-entity.md +140 -140
  52. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +158 -158
  53. package/reference/scaffold/recipes/index.md +32 -32
  54. package/reference/scaffold/reference/contracts.md +612 -607
  55. package/reference/scaffold/reference/feature-registry.md +2 -0
  56. package/reference/scaffold/reference/glossary.md +105 -105
  57. package/reference/scaffold/ui/composition-extensibility.mdx +1 -1
  58. package/reference/scaffold/ui/feature-flags-and-gating.md +1 -1
  59. package/reference/scaffold/ui/feature-shell.mdx +1 -0
@@ -1,4 +1,5 @@
1
- <!-- Auto-generated on 2026-04-21T08:23:05.375Z by scripts/monorepo/generate-scaffold-contracts.js -->
1
+ <!-- @generated by scripts/monorepo/generate-scaffold-contracts.js — DO NOT EDIT -->
2
+ <!-- Regenerate: pnpm scaffold:sync -->
2
3
  ---
3
4
  title: Reference Contracts
4
5
  description: Auto-generated TypeScript contracts for SDK consumers. Do not edit manually.
@@ -363,6 +364,8 @@ export interface ElevasisFeaturesProviderProps {
363
364
  timeRange?: TimeRange
364
365
  operationsApiUrl?: string
365
366
  operationsSSEManager?: SSEConnectionManagerLike
367
+ deliveryApiUrl?: string
368
+ deliverySSEManager?: SSEConnectionManagerLike
366
369
  disabledSubsectionPaths?: string[]
367
370
  children: ReactNode
368
371
  }
@@ -381,6 +384,8 @@ export interface ElevasisFeaturesContextValue {
381
384
  timeRange?: TimeRange
382
385
  operationsApiUrl?: string
383
386
  operationsSSEManager?: SSEConnectionManagerLike
387
+ deliveryApiUrl?: string
388
+ deliverySSEManager?: SSEConnectionManagerLike
384
389
  disabledSubsectionPaths: string[]
385
390
  isFeatureEnabled: (key: string) => boolean
386
391
  getResolvedFeature: (key: string) => ResolvedFeatureModule | undefined
@@ -392,194 +397,194 @@ export interface ElevasisFeaturesContextValue {
392
397
  ### `ResourceStatus`
393
398
 
394
399
  ```typescript
395
- /**
396
- * Resource Registry type definitions
400
+ /**
401
+ * Resource Registry type definitions
402
+ */
403
+
404
+ import type { IntegrationType } from '../../execution/engine/tools/integration'
405
+ import type { ResourceDomain } from './domains'
406
+
407
+ // ============================================================================
408
+ // Core Resource Type Definitions
409
+ // ============================================================================
410
+
411
+ /**
412
+ * Environment/deployment status for resources
397
413
  */
398
-
399
- import type { IntegrationType } from '../../execution/engine/tools/integration'
400
- import type { ResourceDomain } from './domains'
401
-
402
- // ============================================================================
403
- // Core Resource Type Definitions
404
- // ============================================================================
405
-
406
- /**
407
- * Environment/deployment status for resources
408
- */
409
- export type ResourceStatus = 'dev' | 'prod'
410
-
411
- /**
412
- * All resource types in the platform
413
- * Used as the discriminator field in ResourceDefinition
414
+ export type ResourceStatus = 'dev' | 'prod'
415
+
416
+ /**
417
+ * All resource types in the platform
418
+ * Used as the discriminator field in ResourceDefinition
414
419
  */
415
420
  ```
416
421
 
417
422
  ### `ResourceType`
418
423
 
419
424
  ```typescript
420
- /**
421
- * All resource types in the platform
422
- * Used as the discriminator field in ResourceDefinition
425
+ /**
426
+ * All resource types in the platform
427
+ * Used as the discriminator field in ResourceDefinition
423
428
  */
424
- export type ResourceType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human'
425
-
426
- /**
427
- * Executable resource types (subset of ResourceType)
428
- * These resources can be directly executed by the execution engine
429
+ export type ResourceType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human'
430
+
431
+ /**
432
+ * Executable resource types (subset of ResourceType)
433
+ * These resources can be directly executed by the execution engine
429
434
  */
430
435
  ```
431
436
 
432
437
  ### `ExecutableResourceType`
433
438
 
434
439
  ```typescript
435
- /**
436
- * Executable resource types (subset of ResourceType)
437
- * These resources can be directly executed by the execution engine
440
+ /**
441
+ * Executable resource types (subset of ResourceType)
442
+ * These resources can be directly executed by the execution engine
438
443
  */
439
- export type ExecutableResourceType = 'workflow' | 'agent'
440
-
441
- // ============================================================================
442
- // Base Resource Interface
443
- // ============================================================================
444
-
445
- /**
446
- * Base interface for ALL platform resources
447
- * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
444
+ export type ExecutableResourceType = 'workflow' | 'agent'
445
+
446
+ // ============================================================================
447
+ // Base Resource Interface
448
+ // ============================================================================
449
+
450
+ /**
451
+ * Base interface for ALL platform resources
452
+ * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
448
453
  */
449
454
  ```
450
455
 
451
456
  ### `ResourceDefinition`
452
457
 
453
458
  ```typescript
454
- /**
455
- * Base interface for ALL platform resources
456
- * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
459
+ /**
460
+ * Base interface for ALL platform resources
461
+ * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
457
462
  */
458
- export interface ResourceDefinition {
459
- /** Unique resource identifier */
460
- resourceId: string
461
-
462
- /** Display name */
463
- name: string
464
-
465
- /** Purpose and functionality description */
466
- description: string
467
-
468
- /** Version for change tracking and evolution */
469
- version: string
470
-
471
- /** Resource type discriminator */
472
- type: ResourceType
473
-
474
- /** Environment/deployment status */
475
- status: ResourceStatus
476
-
477
- /** Domain tags for filtering and organization */
478
- domains?: ResourceDomain[]
479
-
480
- /** Whether the agent supports multi-turn sessions (agents only) */
481
- sessionCapable?: boolean
482
-
483
- /** Whether the resource is local (monorepo) or remote (externally deployed) */
484
- origin?: 'local' | 'remote'
485
-
486
- /** Whether this resource is archived and should be excluded from registration and deployment */
487
- archived?: boolean
463
+ export interface ResourceDefinition {
464
+ /** Unique resource identifier */
465
+ resourceId: string
466
+
467
+ /** Display name */
468
+ name: string
469
+
470
+ /** Purpose and functionality description */
471
+ description: string
472
+
473
+ /** Version for change tracking and evolution */
474
+ version: string
475
+
476
+ /** Resource type discriminator */
477
+ type: ResourceType
478
+
479
+ /** Environment/deployment status */
480
+ status: ResourceStatus
481
+
482
+ /** Domain tags for filtering and organization */
483
+ domains?: ResourceDomain[]
484
+
485
+ /** Whether the agent supports multi-turn sessions (agents only) */
486
+ sessionCapable?: boolean
487
+
488
+ /** Whether the resource is local (monorepo) or remote (externally deployed) */
489
+ origin?: 'local' | 'remote'
490
+
491
+ /** Whether this resource is archived and should be excluded from registration and deployment */
492
+ archived?: boolean
488
493
  }
489
494
  ```
490
495
 
491
496
  ### `DomainDefinition`
492
497
 
493
498
  ```typescript
494
- /** Unique resource identifier */
495
- resourceId: string
496
-
497
- /** Display name */
498
- name: string
499
-
500
- /** Purpose and functionality description */
501
- description: string
502
-
503
- /** Version for change tracking and evolution */
504
- version: string
505
-
506
- /** Resource type discriminator */
507
- type: ResourceType
508
-
509
- /** Environment/deployment status */
510
- status: ResourceStatus
511
-
512
- /** Domain tags for filtering and organization */
513
- domains?: ResourceDomain[]
514
-
515
- /** Whether the agent supports multi-turn sessions (agents only) */
516
- sessionCapable?: boolean
517
-
518
- /** Whether the resource is local (monorepo) or remote (externally deployed) */
519
- origin?: 'local' | 'remote'
520
-
521
- /** Whether this resource is archived and should be excluded from registration and deployment */
522
- archived?: boolean
523
- }
524
-
525
- // ============================================================================
526
- // Domain Definition Types
527
- // ============================================================================
528
-
529
- /**
530
- * Domain definition for Command View filtering
531
- *
532
- * Domains are organizational metadata for UI filtering/grouping.
533
- * No execution impact - purely for visualization.
534
- *
535
- * @example
536
- * {
537
- * id: 'support',
538
- * name: 'Customer Support',
539
- * description: 'Ticket triage, knowledge base, escalations',
540
- * color: 'green',
541
- * icon: 'IconHeadset'
542
- * }
499
+ /** Unique resource identifier */
500
+ resourceId: string
501
+
502
+ /** Display name */
503
+ name: string
504
+
505
+ /** Purpose and functionality description */
506
+ description: string
507
+
508
+ /** Version for change tracking and evolution */
509
+ version: string
510
+
511
+ /** Resource type discriminator */
512
+ type: ResourceType
513
+
514
+ /** Environment/deployment status */
515
+ status: ResourceStatus
516
+
517
+ /** Domain tags for filtering and organization */
518
+ domains?: ResourceDomain[]
519
+
520
+ /** Whether the agent supports multi-turn sessions (agents only) */
521
+ sessionCapable?: boolean
522
+
523
+ /** Whether the resource is local (monorepo) or remote (externally deployed) */
524
+ origin?: 'local' | 'remote'
525
+
526
+ /** Whether this resource is archived and should be excluded from registration and deployment */
527
+ archived?: boolean
528
+ }
529
+
530
+ // ============================================================================
531
+ // Domain Definition Types
532
+ // ============================================================================
533
+
534
+ /**
535
+ * Domain definition for Command View filtering
536
+ *
537
+ * Domains are organizational metadata for UI filtering/grouping.
538
+ * No execution impact - purely for visualization.
539
+ *
540
+ * @example
541
+ * {
542
+ * id: 'support',
543
+ * name: 'Customer Support',
544
+ * description: 'Ticket triage, knowledge base, escalations',
545
+ * color: 'green',
546
+ * icon: 'IconHeadset'
547
+ * }
543
548
  */
544
- export interface DomainDefinition {
545
- /** Unique identifier (e.g., 'support') */
546
- id: string
547
- /** Display name (e.g., 'Customer Support') */
548
- name: string
549
- /** Purpose description */
550
- description: string
551
- /** Optional Mantine color for UI (e.g., 'blue', 'green', 'orange') */
552
- color?: string
553
- /** Optional Tabler icon name (e.g., 'IconHeadset') */
554
- icon?: string
549
+ export interface DomainDefinition {
550
+ /** Unique identifier (e.g., 'support') */
551
+ id: string
552
+ /** Display name (e.g., 'Customer Support') */
553
+ name: string
554
+ /** Purpose description */
555
+ description: string
556
+ /** Optional Mantine color for UI (e.g., 'blue', 'green', 'orange') */
557
+ color?: string
558
+ /** Optional Tabler icon name (e.g., 'IconHeadset') */
559
+ icon?: string
555
560
  }
556
561
  ```
557
562
 
558
563
  ### `ResourceList`
559
564
 
560
565
  ```typescript
561
- /** Unique identifier (e.g., 'support') */
562
- id: string
563
- /** Display name (e.g., 'Customer Support') */
564
- name: string
565
- /** Purpose description */
566
- description: string
567
- /** Optional Mantine color for UI (e.g., 'blue', 'green', 'orange') */
568
- color?: string
569
- /** Optional Tabler icon name (e.g., 'IconHeadset') */
570
- icon?: string
571
- }
572
-
573
- /**
574
- * Resource list for organization
575
- * Returns ResourceDefinition metadata (not full definitions)
566
+ /** Unique identifier (e.g., 'support') */
567
+ id: string
568
+ /** Display name (e.g., 'Customer Support') */
569
+ name: string
570
+ /** Purpose description */
571
+ description: string
572
+ /** Optional Mantine color for UI (e.g., 'blue', 'green', 'orange') */
573
+ color?: string
574
+ /** Optional Tabler icon name (e.g., 'IconHeadset') */
575
+ icon?: string
576
+ }
577
+
578
+ /**
579
+ * Resource list for organization
580
+ * Returns ResourceDefinition metadata (not full definitions)
576
581
  */
577
- export interface ResourceList {
578
- workflows: ResourceDefinition[]
579
- agents: ResourceDefinition[]
580
- total: number
581
- organizationName: string
582
- environment?: 'dev' | 'prod'
582
+ export interface ResourceList {
583
+ workflows: ResourceDefinition[]
584
+ agents: ResourceDefinition[]
585
+ total: number
586
+ organizationName: string
587
+ environment?: 'dev' | 'prod'
583
588
  }
584
589
  ```
585
590
 
@@ -587,8 +592,8 @@ export interface ResourceList {
587
592
 
588
593
  ```typescript
589
594
  /** Webhook provider identifiers */
590
- export type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'instantly' | 'apify' | 'test'
591
-
595
+ export type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'instantly' | 'apify' | 'test'
596
+
592
597
  /** Webhook trigger configuration */
593
598
  ```
594
599
 
@@ -596,490 +601,490 @@ export type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'inst
596
601
 
597
602
  ```typescript
598
603
  /** Webhook trigger configuration */
599
- export interface WebhookTriggerConfig {
600
- /** Provider identifier */
601
- provider: WebhookProviderType
602
- /** Event type for documentation (not used for matching - workflow handles routing) */
603
- event?: string
604
- /** Optional filtering (e.g., specific form ID for Fillout) */
605
- filter?: Record<string, string>
606
- /** References credential in credentials table for per-org webhook secrets */
607
- credentialName?: string
604
+ export interface WebhookTriggerConfig {
605
+ /** Provider identifier */
606
+ provider: WebhookProviderType
607
+ /** Event type for documentation (not used for matching - workflow handles routing) */
608
+ event?: string
609
+ /** Optional filtering (e.g., specific form ID for Fillout) */
610
+ filter?: Record<string, string>
611
+ /** References credential in credentials table for per-org webhook secrets */
612
+ credentialName?: string
608
613
  }
609
614
  ```
610
615
 
611
616
  ### `ScheduleTriggerConfig`
612
617
 
613
618
  ```typescript
614
- /** Provider identifier */
615
- provider: WebhookProviderType
616
- /** Event type for documentation (not used for matching - workflow handles routing) */
617
- event?: string
618
- /** Optional filtering (e.g., specific form ID for Fillout) */
619
- filter?: Record<string, string>
620
- /** References credential in credentials table for per-org webhook secrets */
621
- credentialName?: string
622
- }
623
-
619
+ /** Provider identifier */
620
+ provider: WebhookProviderType
621
+ /** Event type for documentation (not used for matching - workflow handles routing) */
622
+ event?: string
623
+ /** Optional filtering (e.g., specific form ID for Fillout) */
624
+ filter?: Record<string, string>
625
+ /** References credential in credentials table for per-org webhook secrets */
626
+ credentialName?: string
627
+ }
628
+
624
629
  /** Schedule trigger configuration */
625
- export interface ScheduleTriggerConfig {
626
- /** Cron expression (e.g., '0 6 * * *') */
627
- cron: string
628
- /** Optional timezone (default: UTC) */
629
- timezone?: string
630
+ export interface ScheduleTriggerConfig {
631
+ /** Cron expression (e.g., '0 6 * * *') */
632
+ cron: string
633
+ /** Optional timezone (default: UTC) */
634
+ timezone?: string
630
635
  }
631
636
  ```
632
637
 
633
638
  ### `EventTriggerConfig`
634
639
 
635
640
  ```typescript
636
- /** Cron expression (e.g., '0 6 * * *') */
637
- cron: string
638
- /** Optional timezone (default: UTC) */
639
- timezone?: string
640
- }
641
-
641
+ /** Cron expression (e.g., '0 6 * * *') */
642
+ cron: string
643
+ /** Optional timezone (default: UTC) */
644
+ timezone?: string
645
+ }
646
+
642
647
  /** Event trigger configuration */
643
- export interface EventTriggerConfig {
644
- /** Internal event type */
645
- eventType: string
646
- /** Event source */
647
- source?: string
648
+ export interface EventTriggerConfig {
649
+ /** Internal event type */
650
+ eventType: string
651
+ /** Event source */
652
+ source?: string
648
653
  }
649
654
  ```
650
655
 
651
656
  ### `TriggerConfig`
652
657
 
653
658
  ```typescript
654
- /** Internal event type */
655
- eventType: string
656
- /** Event source */
657
- source?: string
658
- }
659
-
659
+ /** Internal event type */
660
+ eventType: string
661
+ /** Event source */
662
+ source?: string
663
+ }
664
+
660
665
  /** Union of all trigger configs */
661
- export type TriggerConfig = WebhookTriggerConfig | ScheduleTriggerConfig | EventTriggerConfig
662
-
663
- // ============================================================================
664
- // Trigger Definition
665
- // ============================================================================
666
-
667
- /**
668
- * Trigger metadata - entry points that initiate resource execution
669
- *
670
- * Triggers represent how executions start: webhooks from external services,
671
- * scheduled cron jobs, platform events, or manual user actions.
672
- *
673
- * BREAKING CHANGES (2025-11-30):
674
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
675
- * - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
676
- * - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
677
- * - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
678
- * - triggers object now includes `externalResources` option
679
- *
680
- * @example
681
- * // TriggerDefinition - metadata only
682
- * {
683
- * resourceId: 'trigger-new-order',
684
- * type: 'trigger',
685
- * triggerType: 'webhook',
686
- * name: 'New Order',
687
- * description: 'Webhook from Shopify on new orders',
688
- * version: '1.0.0',
689
- * status: 'prod',
690
- * webhookPath: '/webhooks/shopify/orders'
691
- * }
692
- *
693
- * // Relationships declared in ResourceRelationships (not on TriggerDefinition):
694
- * // relationships: {
695
- * // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
696
- * // }
666
+ export type TriggerConfig = WebhookTriggerConfig | ScheduleTriggerConfig | EventTriggerConfig
667
+
668
+ // ============================================================================
669
+ // Trigger Definition
670
+ // ============================================================================
671
+
672
+ /**
673
+ * Trigger metadata - entry points that initiate resource execution
674
+ *
675
+ * Triggers represent how executions start: webhooks from external services,
676
+ * scheduled cron jobs, platform events, or manual user actions.
677
+ *
678
+ * BREAKING CHANGES (2025-11-30):
679
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
680
+ * - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
681
+ * - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
682
+ * - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
683
+ * - triggers object now includes `externalResources` option
684
+ *
685
+ * @example
686
+ * // TriggerDefinition - metadata only
687
+ * {
688
+ * resourceId: 'trigger-new-order',
689
+ * type: 'trigger',
690
+ * triggerType: 'webhook',
691
+ * name: 'New Order',
692
+ * description: 'Webhook from Shopify on new orders',
693
+ * version: '1.0.0',
694
+ * status: 'prod',
695
+ * webhookPath: '/webhooks/shopify/orders'
696
+ * }
697
+ *
698
+ * // Relationships declared in ResourceRelationships (not on TriggerDefinition):
699
+ * // relationships: {
700
+ * // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
701
+ * // }
697
702
  */
698
703
  ```
699
704
 
700
705
  ### `TriggerDefinition`
701
706
 
702
707
  ```typescript
703
- /**
704
- * Trigger metadata - entry points that initiate resource execution
705
- *
706
- * Triggers represent how executions start: webhooks from external services,
707
- * scheduled cron jobs, platform events, or manual user actions.
708
- *
709
- * BREAKING CHANGES (2025-11-30):
710
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
711
- * - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
712
- * - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
713
- * - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
714
- * - triggers object now includes `externalResources` option
715
- *
716
- * @example
717
- * // TriggerDefinition - metadata only
718
- * {
719
- * resourceId: 'trigger-new-order',
720
- * type: 'trigger',
721
- * triggerType: 'webhook',
722
- * name: 'New Order',
723
- * description: 'Webhook from Shopify on new orders',
724
- * version: '1.0.0',
725
- * status: 'prod',
726
- * webhookPath: '/webhooks/shopify/orders'
727
- * }
728
- *
729
- * // Relationships declared in ResourceRelationships (not on TriggerDefinition):
730
- * // relationships: {
731
- * // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
732
- * // }
708
+ /**
709
+ * Trigger metadata - entry points that initiate resource execution
710
+ *
711
+ * Triggers represent how executions start: webhooks from external services,
712
+ * scheduled cron jobs, platform events, or manual user actions.
713
+ *
714
+ * BREAKING CHANGES (2025-11-30):
715
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
716
+ * - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
717
+ * - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
718
+ * - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
719
+ * - triggers object now includes `externalResources` option
720
+ *
721
+ * @example
722
+ * // TriggerDefinition - metadata only
723
+ * {
724
+ * resourceId: 'trigger-new-order',
725
+ * type: 'trigger',
726
+ * triggerType: 'webhook',
727
+ * name: 'New Order',
728
+ * description: 'Webhook from Shopify on new orders',
729
+ * version: '1.0.0',
730
+ * status: 'prod',
731
+ * webhookPath: '/webhooks/shopify/orders'
732
+ * }
733
+ *
734
+ * // Relationships declared in ResourceRelationships (not on TriggerDefinition):
735
+ * // relationships: {
736
+ * // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
737
+ * // }
733
738
  */
734
- export interface TriggerDefinition extends ResourceDefinition {
735
- /** Resource type discriminator (narrowed from base union) */
736
- type: 'trigger'
737
-
738
- /** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
739
- triggerType: 'webhook' | 'schedule' | 'manual' | 'event'
740
-
741
- /** Type-specific configuration */
742
- config?: TriggerConfig
743
-
744
- // Legacy fields (deprecated, use config instead)
745
- /** For webhook triggers: path like '/webhooks/shopify/orders' */
746
- webhookPath?: string
747
- /** For schedule triggers: cron expression like '0 6 * * *' */
748
- schedule?: string
749
- /** For event triggers: event type like 'low-stock-alert' */
750
- eventType?: string
751
-
752
- // NOTE: What this trigger starts is declared in ResourceRelationships, not here
753
- // This prevents duplication - triggers are forward-declared in relationships
739
+ export interface TriggerDefinition extends ResourceDefinition {
740
+ /** Resource type discriminator (narrowed from base union) */
741
+ type: 'trigger'
742
+
743
+ /** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
744
+ triggerType: 'webhook' | 'schedule' | 'manual' | 'event'
745
+
746
+ /** Type-specific configuration */
747
+ config?: TriggerConfig
748
+
749
+ // Legacy fields (deprecated, use config instead)
750
+ /** For webhook triggers: path like '/webhooks/shopify/orders' */
751
+ webhookPath?: string
752
+ /** For schedule triggers: cron expression like '0 6 * * *' */
753
+ schedule?: string
754
+ /** For event triggers: event type like 'low-stock-alert' */
755
+ eventType?: string
756
+
757
+ // NOTE: What this trigger starts is declared in ResourceRelationships, not here
758
+ // This prevents duplication - triggers are forward-declared in relationships
754
759
  }
755
760
  ```
756
761
 
757
762
  ### `IntegrationDefinition`
758
763
 
759
764
  ```typescript
760
- /** Resource type discriminator (narrowed from base union) */
761
- type: 'trigger'
762
-
763
- /** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
764
- triggerType: 'webhook' | 'schedule' | 'manual' | 'event'
765
-
766
- /** Type-specific configuration */
767
- config?: TriggerConfig
768
-
769
- // Legacy fields (deprecated, use config instead)
770
- /** For webhook triggers: path like '/webhooks/shopify/orders' */
771
- webhookPath?: string
772
- /** For schedule triggers: cron expression like '0 6 * * *' */
773
- schedule?: string
774
- /** For event triggers: event type like 'low-stock-alert' */
775
- eventType?: string
776
-
777
- // NOTE: What this trigger starts is declared in ResourceRelationships, not here
778
- // This prevents duplication - triggers are forward-declared in relationships
779
- }
780
-
781
- /**
782
- * Integration metadata - external service connections
783
- *
784
- * References credentials table for actual connection. No connection status
785
- * stored here (queried at runtime from credentials table).
786
- *
787
- * BREAKING CHANGES (2025-11-30):
788
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
789
- * - Field renames: `id` -> `resourceId` (inherited)
790
- * - New required field: `status` (inherited) - organizations must add status to all integrations
791
- * - New required field: `version` (inherited) - organizations must add version to all integrations
792
- * - New required field: `type: 'integration'` (inherited) - resource type discriminator
793
- *
794
- * @example
795
- * {
796
- * resourceId: 'integration-shopify-prod',
797
- * type: 'integration',
798
- * provider: 'shopify',
799
- * credentialName: 'shopify-prod',
800
- * name: 'Shopify Production',
801
- * description: 'E-commerce platform',
802
- * version: '1.0.0',
803
- * status: 'prod'
804
- * }
765
+ /** Resource type discriminator (narrowed from base union) */
766
+ type: 'trigger'
767
+
768
+ /** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
769
+ triggerType: 'webhook' | 'schedule' | 'manual' | 'event'
770
+
771
+ /** Type-specific configuration */
772
+ config?: TriggerConfig
773
+
774
+ // Legacy fields (deprecated, use config instead)
775
+ /** For webhook triggers: path like '/webhooks/shopify/orders' */
776
+ webhookPath?: string
777
+ /** For schedule triggers: cron expression like '0 6 * * *' */
778
+ schedule?: string
779
+ /** For event triggers: event type like 'low-stock-alert' */
780
+ eventType?: string
781
+
782
+ // NOTE: What this trigger starts is declared in ResourceRelationships, not here
783
+ // This prevents duplication - triggers are forward-declared in relationships
784
+ }
785
+
786
+ /**
787
+ * Integration metadata - external service connections
788
+ *
789
+ * References credentials table for actual connection. No connection status
790
+ * stored here (queried at runtime from credentials table).
791
+ *
792
+ * BREAKING CHANGES (2025-11-30):
793
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
794
+ * - Field renames: `id` -> `resourceId` (inherited)
795
+ * - New required field: `status` (inherited) - organizations must add status to all integrations
796
+ * - New required field: `version` (inherited) - organizations must add version to all integrations
797
+ * - New required field: `type: 'integration'` (inherited) - resource type discriminator
798
+ *
799
+ * @example
800
+ * {
801
+ * resourceId: 'integration-shopify-prod',
802
+ * type: 'integration',
803
+ * provider: 'shopify',
804
+ * credentialName: 'shopify-prod',
805
+ * name: 'Shopify Production',
806
+ * description: 'E-commerce platform',
807
+ * version: '1.0.0',
808
+ * status: 'prod'
809
+ * }
805
810
  */
806
- export interface IntegrationDefinition extends ResourceDefinition {
807
- /** Resource type discriminator (narrowed from base union) */
808
- type: 'integration'
809
-
810
- /** Integration provider type */
811
- provider: IntegrationType
812
- /** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
813
- credentialName: string
811
+ export interface IntegrationDefinition extends ResourceDefinition {
812
+ /** Resource type discriminator (narrowed from base union) */
813
+ type: 'integration'
814
+
815
+ /** Integration provider type */
816
+ provider: IntegrationType
817
+ /** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
818
+ credentialName: string
814
819
  }
815
820
  ```
816
821
 
817
822
  ### `RelationshipDeclaration`
818
823
 
819
824
  ```typescript
820
- /** Resource type discriminator (narrowed from base union) */
821
- type: 'integration'
822
-
823
- /** Integration provider type */
824
- provider: IntegrationType
825
- /** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
826
- credentialName: string
827
- }
828
-
829
- /**
830
- * Explicit resource relationship declaration
831
- *
832
- * Single-direction only - Command View derives reverse relationships.
833
- * Agents/workflows declare what they trigger and use.
834
- *
835
- * @example
836
- * {
837
- * triggers: { workflows: ['order-fulfillment-workflow'] },
838
- * uses: { integrations: ['integration-shopify-prod', 'integration-postgres'] }
839
- * }
825
+ /** Resource type discriminator (narrowed from base union) */
826
+ type: 'integration'
827
+
828
+ /** Integration provider type */
829
+ provider: IntegrationType
830
+ /** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
831
+ credentialName: string
832
+ }
833
+
834
+ /**
835
+ * Explicit resource relationship declaration
836
+ *
837
+ * Single-direction only - Command View derives reverse relationships.
838
+ * Agents/workflows declare what they trigger and use.
839
+ *
840
+ * @example
841
+ * {
842
+ * triggers: { workflows: ['order-fulfillment-workflow'] },
843
+ * uses: { integrations: ['integration-shopify-prod', 'integration-postgres'] }
844
+ * }
840
845
  */
841
- export interface RelationshipDeclaration {
842
- /** Resources this resource triggers */
843
- triggers?: {
844
- /** Agent resourceIds this resource triggers */
845
- agents?: string[]
846
- /** Workflow resourceIds this resource triggers */
847
- workflows?: string[]
848
- }
849
- /** Integrations this resource uses */
850
- uses?: {
851
- /** Integration IDs this resource uses */
852
- integrations?: string[]
853
- }
846
+ export interface RelationshipDeclaration {
847
+ /** Resources this resource triggers */
848
+ triggers?: {
849
+ /** Agent resourceIds this resource triggers */
850
+ agents?: string[]
851
+ /** Workflow resourceIds this resource triggers */
852
+ workflows?: string[]
853
+ }
854
+ /** Integrations this resource uses */
855
+ uses?: {
856
+ /** Integration IDs this resource uses */
857
+ integrations?: string[]
858
+ }
854
859
  }
855
860
  ```
856
861
 
857
862
  ### `ResourceRelationships`
858
863
 
859
864
  ```typescript
860
- /** Resources this resource triggers */
861
- triggers?: {
862
- /** Agent resourceIds this resource triggers */
863
- agents?: string[]
864
- /** Workflow resourceIds this resource triggers */
865
- workflows?: string[]
866
- }
867
- /** Integrations this resource uses */
868
- uses?: {
869
- /** Integration IDs this resource uses */
870
- integrations?: string[]
871
- }
872
- }
873
-
874
- /**
875
- * Resource relationships map
876
- * Maps resourceId to its relationship declarations
877
- *
878
- * @example
879
- * {
880
- * 'order-processor-agent': {
881
- * triggers: { workflows: ['order-fulfillment-workflow'] },
882
- * uses: { integrations: ['integration-shopify-prod'] }
883
- * }
884
- * }
865
+ /** Resources this resource triggers */
866
+ triggers?: {
867
+ /** Agent resourceIds this resource triggers */
868
+ agents?: string[]
869
+ /** Workflow resourceIds this resource triggers */
870
+ workflows?: string[]
871
+ }
872
+ /** Integrations this resource uses */
873
+ uses?: {
874
+ /** Integration IDs this resource uses */
875
+ integrations?: string[]
876
+ }
877
+ }
878
+
879
+ /**
880
+ * Resource relationships map
881
+ * Maps resourceId to its relationship declarations
882
+ *
883
+ * @example
884
+ * {
885
+ * 'order-processor-agent': {
886
+ * triggers: { workflows: ['order-fulfillment-workflow'] },
887
+ * uses: { integrations: ['integration-shopify-prod'] }
888
+ * }
889
+ * }
885
890
  */
886
- export type ResourceRelationships = Record<string, RelationshipDeclaration>
887
-
888
- // ============================================================================
889
- // External Resource Types
890
- // ============================================================================
891
-
892
- /**
893
- * External platform type
894
- * Supported third-party automation platforms
891
+ export type ResourceRelationships = Record<string, RelationshipDeclaration>
892
+
893
+ // ============================================================================
894
+ // External Resource Types
895
+ // ============================================================================
896
+
897
+ /**
898
+ * External platform type
899
+ * Supported third-party automation platforms
895
900
  */
896
901
  ```
897
902
 
898
903
  ### `ExternalPlatform`
899
904
 
900
905
  ```typescript
901
- /**
902
- * External platform type
903
- * Supported third-party automation platforms
906
+ /**
907
+ * External platform type
908
+ * Supported third-party automation platforms
904
909
  */
905
- export type ExternalPlatform = 'n8n' | 'make' | 'zapier' | 'other'
906
-
907
- /**
908
- * External automation resource metadata
909
- *
910
- * Represents workflows/automations running on third-party platforms
911
- * (n8n, Make, Zapier, etc.) for visualization in Command View.
912
- *
913
- * NOTE: This is metadata ONLY for visualization. No execution logic,
914
- * no API integration with external platforms, no status syncing.
915
- *
916
- * BREAKING CHANGES (2025-11-30):
917
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
918
- * - Field renames: `id` -> `resourceId` (inherited)
919
- * - New required field: `version` (inherited) - organizations must add version to all external resources
920
- * - New required field: `type: 'external'` (inherited) - resource type discriminator
921
- * - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
922
- *
923
- * @example
924
- * {
925
- * resourceId: 'external-n8n-order-sync',
926
- * type: 'external',
927
- * version: '1.0.0',
928
- * platform: 'n8n',
929
- * name: 'Shopify Order Sync',
930
- * description: 'Legacy n8n workflow for syncing Shopify orders',
931
- * status: 'prod',
932
- * platformUrl: 'https://n8n.client.com/workflow/123',
933
- * triggers: { workflows: ['order-fulfillment-workflow'] },
934
- * uses: { integrations: ['integration-shopify-prod'] }
935
- * }
910
+ export type ExternalPlatform = 'n8n' | 'make' | 'zapier' | 'other'
911
+
912
+ /**
913
+ * External automation resource metadata
914
+ *
915
+ * Represents workflows/automations running on third-party platforms
916
+ * (n8n, Make, Zapier, etc.) for visualization in Command View.
917
+ *
918
+ * NOTE: This is metadata ONLY for visualization. No execution logic,
919
+ * no API integration with external platforms, no status syncing.
920
+ *
921
+ * BREAKING CHANGES (2025-11-30):
922
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
923
+ * - Field renames: `id` -> `resourceId` (inherited)
924
+ * - New required field: `version` (inherited) - organizations must add version to all external resources
925
+ * - New required field: `type: 'external'` (inherited) - resource type discriminator
926
+ * - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
927
+ *
928
+ * @example
929
+ * {
930
+ * resourceId: 'external-n8n-order-sync',
931
+ * type: 'external',
932
+ * version: '1.0.0',
933
+ * platform: 'n8n',
934
+ * name: 'Shopify Order Sync',
935
+ * description: 'Legacy n8n workflow for syncing Shopify orders',
936
+ * status: 'prod',
937
+ * platformUrl: 'https://n8n.client.com/workflow/123',
938
+ * triggers: { workflows: ['order-fulfillment-workflow'] },
939
+ * uses: { integrations: ['integration-shopify-prod'] }
940
+ * }
936
941
  */
937
942
  ```
938
943
 
939
944
  ### `ExternalResourceDefinition`
940
945
 
941
946
  ```typescript
942
- /**
943
- * External automation resource metadata
944
- *
945
- * Represents workflows/automations running on third-party platforms
946
- * (n8n, Make, Zapier, etc.) for visualization in Command View.
947
- *
948
- * NOTE: This is metadata ONLY for visualization. No execution logic,
949
- * no API integration with external platforms, no status syncing.
950
- *
951
- * BREAKING CHANGES (2025-11-30):
952
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
953
- * - Field renames: `id` -> `resourceId` (inherited)
954
- * - New required field: `version` (inherited) - organizations must add version to all external resources
955
- * - New required field: `type: 'external'` (inherited) - resource type discriminator
956
- * - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
957
- *
958
- * @example
959
- * {
960
- * resourceId: 'external-n8n-order-sync',
961
- * type: 'external',
962
- * version: '1.0.0',
963
- * platform: 'n8n',
964
- * name: 'Shopify Order Sync',
965
- * description: 'Legacy n8n workflow for syncing Shopify orders',
966
- * status: 'prod',
967
- * platformUrl: 'https://n8n.client.com/workflow/123',
968
- * triggers: { workflows: ['order-fulfillment-workflow'] },
969
- * uses: { integrations: ['integration-shopify-prod'] }
970
- * }
947
+ /**
948
+ * External automation resource metadata
949
+ *
950
+ * Represents workflows/automations running on third-party platforms
951
+ * (n8n, Make, Zapier, etc.) for visualization in Command View.
952
+ *
953
+ * NOTE: This is metadata ONLY for visualization. No execution logic,
954
+ * no API integration with external platforms, no status syncing.
955
+ *
956
+ * BREAKING CHANGES (2025-11-30):
957
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
958
+ * - Field renames: `id` -> `resourceId` (inherited)
959
+ * - New required field: `version` (inherited) - organizations must add version to all external resources
960
+ * - New required field: `type: 'external'` (inherited) - resource type discriminator
961
+ * - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
962
+ *
963
+ * @example
964
+ * {
965
+ * resourceId: 'external-n8n-order-sync',
966
+ * type: 'external',
967
+ * version: '1.0.0',
968
+ * platform: 'n8n',
969
+ * name: 'Shopify Order Sync',
970
+ * description: 'Legacy n8n workflow for syncing Shopify orders',
971
+ * status: 'prod',
972
+ * platformUrl: 'https://n8n.client.com/workflow/123',
973
+ * triggers: { workflows: ['order-fulfillment-workflow'] },
974
+ * uses: { integrations: ['integration-shopify-prod'] }
975
+ * }
971
976
  */
972
- export interface ExternalResourceDefinition extends ResourceDefinition {
973
- /** Resource type discriminator (narrowed from base union) */
974
- type: 'external'
975
-
976
- /** Platform type */
977
- platform: ExternalPlatform
978
-
979
- // Optional platform-specific metadata
980
- /** Link to external platform (e.g., n8n workflow editor URL) */
981
- platformUrl?: string
982
- /** Platform's internal ID/reference */
983
- externalId?: string
984
-
985
- /** What this external resource triggers (external -> internal) */
986
- triggers?: {
987
- /** Elevasis workflow resourceIds this external automation triggers */
988
- workflows?: string[]
989
- /** Elevasis agent resourceIds this external automation triggers */
990
- agents?: string[]
991
- }
992
-
993
- /** Integrations this external resource uses (shared credentials) */
994
- uses?: {
995
- /** Integration IDs this external automation uses */
996
- integrations?: string[]
997
- }
998
-
999
- // NOTE: triggeredBy field removed - per relationship-consolidation design,
1000
- // all relationships are forward-only declarations. Graph edges are built
1001
- // from forward declarations only.
977
+ export interface ExternalResourceDefinition extends ResourceDefinition {
978
+ /** Resource type discriminator (narrowed from base union) */
979
+ type: 'external'
980
+
981
+ /** Platform type */
982
+ platform: ExternalPlatform
983
+
984
+ // Optional platform-specific metadata
985
+ /** Link to external platform (e.g., n8n workflow editor URL) */
986
+ platformUrl?: string
987
+ /** Platform's internal ID/reference */
988
+ externalId?: string
989
+
990
+ /** What this external resource triggers (external -> internal) */
991
+ triggers?: {
992
+ /** Elevasis workflow resourceIds this external automation triggers */
993
+ workflows?: string[]
994
+ /** Elevasis agent resourceIds this external automation triggers */
995
+ agents?: string[]
996
+ }
997
+
998
+ /** Integrations this external resource uses (shared credentials) */
999
+ uses?: {
1000
+ /** Integration IDs this external automation uses */
1001
+ integrations?: string[]
1002
+ }
1003
+
1004
+ // NOTE: triggeredBy field removed - per relationship-consolidation design,
1005
+ // all relationships are forward-only declarations. Graph edges are built
1006
+ // from forward declarations only.
1002
1007
  }
1003
1008
  ```
1004
1009
 
1005
1010
  ### `HumanCheckpointDefinition`
1006
1011
 
1007
1012
  ```typescript
1008
- /** Resource type discriminator (narrowed from base union) */
1009
- type: 'external'
1010
-
1011
- /** Platform type */
1012
- platform: ExternalPlatform
1013
-
1014
- // Optional platform-specific metadata
1015
- /** Link to external platform (e.g., n8n workflow editor URL) */
1016
- platformUrl?: string
1017
- /** Platform's internal ID/reference */
1018
- externalId?: string
1019
-
1020
- /** What this external resource triggers (external -> internal) */
1021
- triggers?: {
1022
- /** Elevasis workflow resourceIds this external automation triggers */
1023
- workflows?: string[]
1024
- /** Elevasis agent resourceIds this external automation triggers */
1025
- agents?: string[]
1026
- }
1027
-
1028
- /** Integrations this external resource uses (shared credentials) */
1029
- uses?: {
1030
- /** Integration IDs this external automation uses */
1031
- integrations?: string[]
1032
- }
1033
-
1034
- // NOTE: triggeredBy field removed - per relationship-consolidation design,
1035
- // all relationships are forward-only declarations. Graph edges are built
1036
- // from forward declarations only.
1037
- }
1038
-
1039
- /**
1040
- * Human Checkpoint definition - human decision points in automation
1041
- *
1042
- * Represents where human judgment is deployed in the automation landscape.
1043
- * Tasks with matching command_queue_group are routed to this checkpoint.
1044
- *
1045
- * BREAKING CHANGES (2025-11-30):
1046
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
1047
- * - Field renames: `id` -> `resourceId` (inherited)
1048
- * - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
1049
- * - New required field: `version` (inherited) - organizations must add version to all human checkpoints
1050
- * - New required field: `type: 'human'` (inherited) - resource type discriminator
1051
- *
1052
- * @example
1053
- * {
1054
- * resourceId: 'sales-approval',
1055
- * type: 'human',
1056
- * name: 'Sales Approval Queue',
1057
- * description: 'High-value order approvals for sales team',
1058
- * version: '1.0.0',
1059
- * status: 'prod',
1060
- * requestedBy: { agents: ['order-processor-agent'] },
1061
- * routesTo: { agents: ['order-fulfillment-agent'] }
1062
- * }
1013
+ /** Resource type discriminator (narrowed from base union) */
1014
+ type: 'external'
1015
+
1016
+ /** Platform type */
1017
+ platform: ExternalPlatform
1018
+
1019
+ // Optional platform-specific metadata
1020
+ /** Link to external platform (e.g., n8n workflow editor URL) */
1021
+ platformUrl?: string
1022
+ /** Platform's internal ID/reference */
1023
+ externalId?: string
1024
+
1025
+ /** What this external resource triggers (external -> internal) */
1026
+ triggers?: {
1027
+ /** Elevasis workflow resourceIds this external automation triggers */
1028
+ workflows?: string[]
1029
+ /** Elevasis agent resourceIds this external automation triggers */
1030
+ agents?: string[]
1031
+ }
1032
+
1033
+ /** Integrations this external resource uses (shared credentials) */
1034
+ uses?: {
1035
+ /** Integration IDs this external automation uses */
1036
+ integrations?: string[]
1037
+ }
1038
+
1039
+ // NOTE: triggeredBy field removed - per relationship-consolidation design,
1040
+ // all relationships are forward-only declarations. Graph edges are built
1041
+ // from forward declarations only.
1042
+ }
1043
+
1044
+ /**
1045
+ * Human Checkpoint definition - human decision points in automation
1046
+ *
1047
+ * Represents where human judgment is deployed in the automation landscape.
1048
+ * Tasks with matching command_queue_group are routed to this checkpoint.
1049
+ *
1050
+ * BREAKING CHANGES (2025-11-30):
1051
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
1052
+ * - Field renames: `id` -> `resourceId` (inherited)
1053
+ * - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
1054
+ * - New required field: `version` (inherited) - organizations must add version to all human checkpoints
1055
+ * - New required field: `type: 'human'` (inherited) - resource type discriminator
1056
+ *
1057
+ * @example
1058
+ * {
1059
+ * resourceId: 'sales-approval',
1060
+ * type: 'human',
1061
+ * name: 'Sales Approval Queue',
1062
+ * description: 'High-value order approvals for sales team',
1063
+ * version: '1.0.0',
1064
+ * status: 'prod',
1065
+ * requestedBy: { agents: ['order-processor-agent'] },
1066
+ * routesTo: { agents: ['order-fulfillment-agent'] }
1067
+ * }
1063
1068
  */
1064
- export interface HumanCheckpointDefinition extends ResourceDefinition {
1065
- /** Resource type discriminator (narrowed from base union) */
1066
- type: 'human'
1067
-
1068
- /** Resources that create tasks for this checkpoint */
1069
- requestedBy?: {
1070
- /** Agent resourceIds that request approval here */
1071
- agents?: string[]
1072
- /** Workflow resourceIds that request approval here */
1073
- workflows?: string[]
1074
- }
1075
-
1076
- /** Resources that receive approved decisions */
1077
- routesTo?: {
1078
- /** Agent resourceIds that handle approved tasks */
1079
- agents?: string[]
1080
- /** Workflow resourceIds that handle approved tasks */
1081
- workflows?: string[]
1082
- }
1069
+ export interface HumanCheckpointDefinition extends ResourceDefinition {
1070
+ /** Resource type discriminator (narrowed from base union) */
1071
+ type: 'human'
1072
+
1073
+ /** Resources that create tasks for this checkpoint */
1074
+ requestedBy?: {
1075
+ /** Agent resourceIds that request approval here */
1076
+ agents?: string[]
1077
+ /** Workflow resourceIds that request approval here */
1078
+ workflows?: string[]
1079
+ }
1080
+
1081
+ /** Resources that receive approved decisions */
1082
+ routesTo?: {
1083
+ /** Agent resourceIds that handle approved tasks */
1084
+ agents?: string[]
1085
+ /** Workflow resourceIds that handle approved tasks */
1086
+ workflows?: string[]
1087
+ }
1083
1088
  }
1084
1089
  ```
1085
1090
 
@@ -1088,44 +1093,44 @@ export interface HumanCheckpointDefinition extends ResourceDefinition {
1088
1093
  ### `DeploymentSpec`
1089
1094
 
1090
1095
  ```typescript
1091
- /** Supabase Storage path: "{orgId}/{deploymentId}/bundle.js" */
1092
- storagePath: string
1093
- /** Deployment record ID */
1094
- deploymentId: string
1095
- /** OS temp path to bundle -- set after first download, used by worker threads */
1096
- cachedTempPath?: string
1097
- /** Platform tool name -> credential name mapping */
1098
- toolCredentials?: Record<string, string>
1099
- /** SDK version used to deploy this bundle */
1100
- sdkVersion?: string
1101
- /** Deployment version (semver) of the deployed bundle */
1102
- deploymentVersion?: string
1103
- }
1104
-
1105
- /**
1106
- * Organization-specific resource collection
1107
- *
1108
- * Complete manifest of all automation resources for an organization.
1109
- * Used by ResourceRegistry for discovery and Command View for visualization.
1096
+ /** Supabase Storage path: "{orgId}/{deploymentId}/bundle.js" */
1097
+ storagePath: string
1098
+ /** Deployment record ID */
1099
+ deploymentId: string
1100
+ /** OS temp path to bundle -- set after first download, used by worker threads */
1101
+ cachedTempPath?: string
1102
+ /** Platform tool name -> credential name mapping */
1103
+ toolCredentials?: Record<string, string>
1104
+ /** SDK version used to deploy this bundle */
1105
+ sdkVersion?: string
1106
+ /** Deployment version (semver) of the deployed bundle */
1107
+ deploymentVersion?: string
1108
+ }
1109
+
1110
+ /**
1111
+ * Organization-specific resource collection
1112
+ *
1113
+ * Complete manifest of all automation resources for an organization.
1114
+ * Used by ResourceRegistry for discovery and Command View for visualization.
1110
1115
  */
1111
- export interface DeploymentSpec {
1112
- /** Deployment version (semver) */
1113
- version: string
1114
- /** Workflow definitions */
1115
- workflows?: WorkflowDefinition[]
1116
- /** Agent definitions */
1117
- agents?: AgentDefinition[]
1118
-
1119
- // Resource Manifest fields (optional for backwards compatibility)
1120
- /** Trigger definitions - entry points that initiate executions */
1121
- triggers?: TriggerDefinition[]
1122
- /** Integration definitions - external service connections */
1123
- integrations?: IntegrationDefinition[]
1124
- /** Explicit relationship declarations between resources */
1125
- relationships?: ResourceRelationships
1126
- /** External automation resources (n8n, Make, Zapier, etc.) */
1127
- externalResources?: ExternalResourceDefinition[]
1128
- /** Human checkpoint definitions - human decision points in automation */
1129
- humanCheckpoints?: HumanCheckpointDefinition[]
1116
+ export interface DeploymentSpec {
1117
+ /** Deployment version (semver) */
1118
+ version: string
1119
+ /** Workflow definitions */
1120
+ workflows?: WorkflowDefinition[]
1121
+ /** Agent definitions */
1122
+ agents?: AgentDefinition[]
1123
+
1124
+ // Resource Manifest fields (optional for backwards compatibility)
1125
+ /** Trigger definitions - entry points that initiate executions */
1126
+ triggers?: TriggerDefinition[]
1127
+ /** Integration definitions - external service connections */
1128
+ integrations?: IntegrationDefinition[]
1129
+ /** Explicit relationship declarations between resources */
1130
+ relationships?: ResourceRelationships
1131
+ /** External automation resources (n8n, Make, Zapier, etc.) */
1132
+ externalResources?: ExternalResourceDefinition[]
1133
+ /** Human checkpoint definitions - human decision points in automation */
1134
+ humanCheckpoints?: HumanCheckpointDefinition[]
1130
1135
  }
1131
1136
  ```