@elevasis/sdk 1.21.0 → 1.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 (160) hide show
  1. package/dist/cli.cjs +951 -171
  2. package/dist/index.d.ts +632 -341
  3. package/dist/index.js +3102 -142
  4. package/dist/node/index.d.ts +1 -0
  5. package/dist/node/index.js +19 -1
  6. package/dist/test-utils/index.d.ts +313 -4
  7. package/dist/test-utils/index.js +3246 -281
  8. package/dist/worker/index.js +3041 -80
  9. package/package.json +3 -3
  10. package/reference/claude-config/hooks/post-edit-validate.mjs +98 -98
  11. package/reference/claude-config/hooks/scaffold-registry-reminder.mjs +188 -188
  12. package/reference/claude-config/hooks/tool-failure-recovery.mjs +73 -73
  13. package/reference/claude-config/registries/graph-skills.json +4 -4
  14. package/reference/claude-config/registries/knowledge-flags.json +0 -2
  15. package/reference/claude-config/rules/active-change-index.md +80 -80
  16. package/reference/claude-config/rules/agent-start-here.md +277 -277
  17. package/reference/claude-config/rules/deployment.md +57 -57
  18. package/reference/claude-config/rules/error-handling.md +56 -56
  19. package/reference/claude-config/rules/execution.md +40 -40
  20. package/reference/claude-config/rules/frontend.md +4 -4
  21. package/reference/claude-config/rules/observability.md +31 -31
  22. package/reference/claude-config/rules/operations.md +29 -17
  23. package/reference/claude-config/rules/organization-model.md +110 -84
  24. package/reference/claude-config/rules/organization-os.md +115 -113
  25. package/reference/claude-config/rules/package-taxonomy.md +33 -33
  26. package/reference/claude-config/rules/platform.md +42 -42
  27. package/reference/claude-config/rules/shared-types.md +49 -46
  28. package/reference/claude-config/rules/task-tracking.md +47 -47
  29. package/reference/claude-config/rules/ui.md +200 -200
  30. package/reference/claude-config/rules/vibe.md +235 -235
  31. package/reference/claude-config/scripts/statusline-command.js +18 -18
  32. package/reference/claude-config/settings.json +34 -34
  33. package/reference/claude-config/skills/deploy/{SKILL.md → skill.md} +156 -156
  34. package/reference/claude-config/skills/dsp/SKILL.md +66 -66
  35. package/reference/claude-config/skills/elevasis/SKILL.md +235 -235
  36. package/reference/claude-config/skills/explore/SKILL.md +6 -6
  37. package/reference/claude-config/skills/git-sync/SKILL.md +126 -126
  38. package/reference/claude-config/skills/knowledge/SKILL.md +314 -299
  39. package/reference/claude-config/skills/knowledge/operations/codify-level-a.md +100 -100
  40. package/reference/claude-config/skills/knowledge/operations/codify-level-b.md +159 -159
  41. package/reference/claude-config/skills/knowledge/operations/customers.md +109 -109
  42. package/reference/claude-config/skills/knowledge/operations/features.md +76 -76
  43. package/reference/claude-config/skills/knowledge/operations/goals.md +118 -118
  44. package/reference/claude-config/skills/knowledge/operations/identity.md +93 -93
  45. package/reference/claude-config/skills/knowledge/operations/labels.md +94 -94
  46. package/reference/claude-config/skills/knowledge/operations/offerings.md +109 -109
  47. package/reference/claude-config/skills/knowledge/operations/roles.md +99 -99
  48. package/reference/claude-config/skills/knowledge/operations/techStack.md +30 -30
  49. package/reference/claude-config/skills/project/SKILL.md +1088 -1088
  50. package/reference/claude-config/skills/run-ui/SKILL.md +73 -73
  51. package/reference/claude-config/skills/save/SKILL.md +3 -3
  52. package/reference/claude-config/skills/setup/SKILL.md +275 -275
  53. package/reference/claude-config/skills/status/SKILL.md +59 -59
  54. package/reference/claude-config/skills/submit-request/SKILL.md +180 -180
  55. package/reference/claude-config/skills/sync/SKILL.md +47 -47
  56. package/reference/claude-config/skills/tutorial/SKILL.md +259 -259
  57. package/reference/claude-config/skills/tutorial/progress-template.md +74 -74
  58. package/reference/claude-config/skills/tutorial/technical.md +1303 -1303
  59. package/reference/claude-config/skills/tutorial/vibe-coder.md +890 -890
  60. package/reference/claude-config/sync-notes/2026-04-22-git-sync-and-sync-notes.md +27 -27
  61. package/reference/claude-config/sync-notes/2026-04-22-lead-gen-deliverability-removal.md +30 -30
  62. package/reference/claude-config/sync-notes/2026-04-24-test-utils-and-template-tests.md +73 -73
  63. package/reference/claude-config/sync-notes/2026-04-24-ui-consolidation-and-sdk-cli-train.md +86 -86
  64. package/reference/claude-config/sync-notes/2026-04-25-auth-role-system-and-settings-roles.md +55 -55
  65. package/reference/claude-config/sync-notes/2026-04-27-crm-hitl-action-layer-cutover.md +97 -97
  66. package/reference/claude-config/sync-notes/2026-04-27-lead-gen-substrate-train.md +112 -112
  67. package/reference/claude-config/sync-notes/2026-04-29-crm-state-and-lead-gen-processing-status.md +93 -93
  68. package/reference/claude-config/sync-notes/2026-05-02-crm-ownership-next-action.md +58 -58
  69. package/reference/claude-config/sync-notes/2026-05-02-template-hardcode-workos-config.md +56 -56
  70. package/reference/claude-config/sync-notes/2026-05-04-elevasis-workspace.md +71 -71
  71. package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +83 -83
  72. package/reference/claude-config/sync-notes/2026-05-04-template-skills-run-ui-and-tutorial.md +59 -59
  73. package/reference/claude-config/sync-notes/2026-05-05-list-builder.md +42 -42
  74. package/reference/claude-config/sync-notes/2026-05-06-crm-spine.md +60 -60
  75. package/reference/claude-config/sync-notes/2026-05-06-sdk-changes-release-train.md +37 -37
  76. package/reference/claude-config/sync-notes/2026-05-07-sdk-changes-release-train.md +34 -34
  77. package/reference/claude-config/sync-notes/2026-05-08-resource-governance-scaffold-guidance.md +38 -38
  78. package/reference/claude-config/sync-notes/2026-05-09-clients-domain.md +32 -32
  79. package/reference/claude-config/sync-notes/2026-05-09-command-system.md +33 -33
  80. package/reference/claude-config/sync-notes/2026-05-09-resource-governance-and-misc.md +69 -69
  81. package/reference/claude-config/sync-notes/2026-05-12-sdk-ready-release-train.md +30 -30
  82. package/reference/claude-config/sync-notes/2026-05-14-organization-model-ontology-refactor.md +42 -0
  83. package/reference/claude-config/sync-notes/README.md +43 -43
  84. package/reference/cli.mdx +808 -808
  85. package/reference/concepts.mdx +146 -146
  86. package/reference/deployment/api.mdx +297 -297
  87. package/reference/deployment/command-center.mdx +209 -209
  88. package/reference/deployment/index.mdx +195 -195
  89. package/reference/deployment/provided-features.mdx +107 -107
  90. package/reference/deployment/ui-execution.mdx +250 -250
  91. package/reference/examples/organization-model.ts +146 -83
  92. package/reference/framework/agent.mdx +156 -156
  93. package/reference/framework/index.mdx +195 -195
  94. package/reference/framework/interaction-guidance.mdx +182 -182
  95. package/reference/framework/memory.mdx +326 -326
  96. package/reference/framework/project-structure.mdx +282 -282
  97. package/reference/framework/tutorial-system.mdx +135 -135
  98. package/reference/getting-started.mdx +142 -142
  99. package/reference/index.mdx +106 -106
  100. package/reference/packages/core/src/README.md +14 -14
  101. package/reference/packages/core/src/business/README.md +2 -2
  102. package/reference/packages/core/src/knowledge/README.md +32 -32
  103. package/reference/packages/core/src/organization-model/README.md +149 -149
  104. package/reference/packages/core/src/test-utils/README.md +37 -37
  105. package/reference/packages/ui/src/api/README.md +18 -18
  106. package/reference/packages/ui/src/app/README.md +24 -24
  107. package/reference/packages/ui/src/auth/README.md +18 -18
  108. package/reference/packages/ui/src/components/README.md +24 -24
  109. package/reference/packages/ui/src/execution/README.md +16 -16
  110. package/reference/packages/ui/src/features/README.md +28 -28
  111. package/reference/packages/ui/src/graph/README.md +16 -16
  112. package/reference/packages/ui/src/hooks/README.md +23 -23
  113. package/reference/packages/ui/src/initialization/README.md +19 -19
  114. package/reference/packages/ui/src/knowledge/README.md +31 -31
  115. package/reference/packages/ui/src/organization/README.md +18 -18
  116. package/reference/packages/ui/src/profile/README.md +19 -19
  117. package/reference/packages/ui/src/provider/README.md +32 -32
  118. package/reference/packages/ui/src/router/README.md +18 -18
  119. package/reference/packages/ui/src/sse/README.md +13 -13
  120. package/reference/packages/ui/src/test-utils/README.md +7 -7
  121. package/reference/packages/ui/src/theme/README.md +23 -23
  122. package/reference/packages/ui/src/theme/presets/README.md +19 -19
  123. package/reference/packages/ui/src/types/README.md +16 -16
  124. package/reference/packages/ui/src/utils/README.md +18 -18
  125. package/reference/packages/ui/src/zustand/README.md +18 -18
  126. package/reference/platform-tools/adapters-integration.mdx +301 -301
  127. package/reference/platform-tools/adapters-platform.mdx +553 -553
  128. package/reference/platform-tools/index.mdx +217 -217
  129. package/reference/platform-tools/type-safety.mdx +82 -82
  130. package/reference/resources/index.mdx +349 -349
  131. package/reference/resources/patterns.mdx +449 -449
  132. package/reference/resources/types.mdx +116 -116
  133. package/reference/roadmap.mdx +165 -165
  134. package/reference/runtime.mdx +173 -173
  135. package/reference/scaffold/core/organization-graph.mdx +110 -90
  136. package/reference/scaffold/core/organization-model.mdx +226 -219
  137. package/reference/scaffold/index.mdx +67 -67
  138. package/reference/scaffold/operations/propagation-pipeline.md +77 -77
  139. package/reference/scaffold/operations/scaffold-maintenance.md +12 -12
  140. package/reference/scaffold/operations/workflow-recipes.md +138 -138
  141. package/reference/scaffold/recipes/add-a-feature.md +308 -88
  142. package/reference/scaffold/recipes/add-a-resource.md +134 -110
  143. package/reference/scaffold/recipes/customize-knowledge-browser.md +5 -5
  144. package/reference/scaffold/recipes/customize-organization-model.md +273 -138
  145. package/reference/scaffold/recipes/extend-a-base-entity.md +8 -8
  146. package/reference/scaffold/recipes/extend-crm.md +3 -3
  147. package/reference/scaffold/recipes/extend-lead-gen.md +400 -400
  148. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +118 -118
  149. package/reference/scaffold/recipes/index.md +46 -46
  150. package/reference/scaffold/recipes/query-the-knowledge-graph.md +197 -170
  151. package/reference/scaffold/reference/contracts.md +2101 -2096
  152. package/reference/scaffold/reference/glossary.md +76 -76
  153. package/reference/scaffold/ui/composition-extensibility.mdx +233 -233
  154. package/reference/scaffold/ui/customization.md +243 -243
  155. package/reference/scaffold/ui/feature-flags-and-gating.md +46 -46
  156. package/reference/scaffold/ui/feature-shell.mdx +72 -72
  157. package/reference/scaffold/ui/recipes.md +221 -214
  158. package/reference/spine/spine-primer.md +96 -96
  159. package/reference/templates/index.mdx +47 -47
  160. package/reference/troubleshooting.mdx +223 -223
@@ -258,6 +258,12 @@ export type OrganizationModelObjective = z.infer<typeof ObjectiveSchema>
258
258
  export type OrganizationModelKeyResult = z.infer<typeof KeyResultSchema>
259
259
  ```
260
260
 
261
+ ### `OrganizationModelOntology`
262
+
263
+ ```typescript
264
+ export type OrganizationModelOntology = z.infer<typeof OntologyScopeSchema>
265
+ ```
266
+
261
267
  ### `OrganizationModelSystems`
262
268
 
263
269
  ```typescript
@@ -270,6 +276,12 @@ export type OrganizationModelSystems = z.infer<typeof SystemsDomainSchema>
270
276
  export type OrganizationModelSystemEntry = z.infer<typeof SystemEntrySchema>
271
277
  ```
272
278
 
279
+ ### `OrganizationModelSystemConfig`
280
+
281
+ ```typescript
282
+ export type OrganizationModelSystemConfig = z.infer<typeof SystemConfigSchema>
283
+ ```
284
+
273
285
  ### `OrganizationModelSystemId`
274
286
 
275
287
  ```typescript
@@ -297,7 +309,7 @@ export type OrganizationModelSystemLifecycle = z.infer<typeof SystemLifecycleSch
297
309
  ### `OrganizationModelSystemStatus`
298
310
 
299
311
  ```typescript
300
- /** @deprecated Use OrganizationModelSystemLifecycle. Accepted for one publish cycle. */
312
+ /** @deprecated Use OrganizationModelSystemLifecycle. Accepted for one publish cycle. */
301
313
  export type OrganizationModelSystemStatus = z.infer<typeof SystemStatusSchema>
302
314
  ```
303
315
 
@@ -319,6 +331,18 @@ export type OrganizationModelResourceEntry = z.infer<typeof ResourceEntrySchema>
319
331
  export type OrganizationModelResourceId = z.infer<typeof ResourceIdSchema>
320
332
  ```
321
333
 
334
+ ### `OrganizationModelCodeReference`
335
+
336
+ ```typescript
337
+ export type OrganizationModelCodeReference = z.infer<typeof CodeReferenceSchema>
338
+ ```
339
+
340
+ ### `OrganizationModelCodeReferenceRole`
341
+
342
+ ```typescript
343
+ export type OrganizationModelCodeReferenceRole = z.infer<typeof CodeReferenceRoleSchema>
344
+ ```
345
+
322
346
  ### `EventId`
323
347
 
324
348
  ```typescript
@@ -349,6 +373,12 @@ export type OrganizationModelResourceKind = z.infer<typeof ResourceKindSchema>
349
373
  export type OrganizationModelResourceGovernanceStatus = z.infer<typeof ResourceGovernanceStatusSchema>
350
374
  ```
351
375
 
376
+ ### `OrganizationModelResourceOntologyBinding`
377
+
378
+ ```typescript
379
+ export type OrganizationModelResourceOntologyBinding = z.infer<typeof ResourceOntologyBindingSchema>
380
+ ```
381
+
352
382
  ### `OrganizationModelAgentKind`
353
383
 
354
384
  ```typescript
@@ -562,7 +592,7 @@ export type OrganizationModelBuiltinIconToken = z.infer<typeof OrganizationModel
562
592
  ### `DeepPartial`
563
593
 
564
594
  ```typescript
565
- export type DeepPartial<T> =
595
+ export type DeepPartial<T> =
566
596
  T extends Array<infer U> ? Array<DeepPartial<U>> : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T
567
597
  ```
568
598
 
@@ -571,8 +601,8 @@ export type DeepPartial<T> =
571
601
  ### `ElevasisOrganizationModel`
572
602
 
573
603
  ```typescript
574
- export type ElevasisOrganizationModel = Omit<OrganizationModel, 'knowledge'> & {
575
- knowledge?: OrganizationModel['knowledge']
604
+ export type ElevasisOrganizationModel = Omit<OrganizationModel, 'knowledge'> & {
605
+ knowledge?: OrganizationModel['knowledge']
576
606
  }
577
607
  ```
578
608
 
@@ -597,107 +627,107 @@ export type SystemSidebarWidthResolver = number | ((context: { currentPath: stri
597
627
  ### `SystemModule`
598
628
 
599
629
  ```typescript
600
- export interface SystemModule {
601
- /** Unique stable identifier for this UI system module. */
602
- key: string
603
- /** Organization Model system id this module presents. Omit for navigation-only app surfaces. */
604
- systemId?: string
605
- /** Route prefixes owned by navigation-only app surfaces. */
606
- routePrefixes?: string[]
607
- /** Capability identifiers contributed by this system module. */
608
- capabilityIds?: string[]
609
- /** Icon used when this system node appears in shell navigation. */
610
- icon?: SystemIconComponent
611
- /** Sidebar component rendered when this system's subtree route is active. */
612
- sidebar?: SystemSidebarComponent
613
- /** Optional shell sidebar width override. Defaults to 250px. */
614
- sidebarWidth?: SystemSidebarWidthResolver
615
- /** Operations-only bridge connecting this system to the organization graph node. */
616
- organizationGraph?: OrganizationGraphSystemBridge
630
+ export interface SystemModule {
631
+ /** Unique stable identifier for this UI system module. */
632
+ key: string
633
+ /** Organization Model system id this module presents. Omit for navigation-only app surfaces. */
634
+ systemId?: string
635
+ /** Route prefixes owned by navigation-only app surfaces. */
636
+ routePrefixes?: string[]
637
+ /** Capability identifiers contributed by this system module. */
638
+ capabilityIds?: string[]
639
+ /** Icon used when this system node appears in shell navigation. */
640
+ icon?: SystemIconComponent
641
+ /** Sidebar component rendered when this system's subtree route is active. */
642
+ sidebar?: SystemSidebarComponent
643
+ /** Optional shell sidebar width override. Defaults to 250px. */
644
+ sidebarWidth?: SystemSidebarWidthResolver
645
+ /** Operations-only bridge connecting this system to the organization graph node. */
646
+ organizationGraph?: OrganizationGraphSystemBridge
617
647
  }
618
648
  ```
619
649
 
620
650
  ### `ResolvedSystemAccess`
621
651
 
622
652
  ```typescript
623
- export interface ResolvedSystemAccess {
624
- featureKey: string
625
- systemId?: string
626
- enabled: boolean
653
+ export interface ResolvedSystemAccess {
654
+ featureKey: string
655
+ systemId?: string
656
+ enabled: boolean
627
657
  }
628
658
  ```
629
659
 
630
660
  ### `ResolvedSystemSemantics`
631
661
 
632
662
  ```typescript
633
- export interface ResolvedSystemSemantics {
634
- capabilityIds: string[]
663
+ export interface ResolvedSystemSemantics {
664
+ capabilityIds: string[]
635
665
  }
636
666
  ```
637
667
 
638
668
  ### `ResolvedSystemModule`
639
669
 
640
670
  ```typescript
641
- export interface ResolvedSystemModule extends SystemModule {
642
- access: ResolvedSystemAccess
643
- semantics: ResolvedSystemSemantics
671
+ export interface ResolvedSystemModule extends SystemModule {
672
+ access: ResolvedSystemAccess
673
+ semantics: ResolvedSystemSemantics
644
674
  }
645
675
  ```
646
676
 
647
677
  ### `ResolvedShellSystem`
648
678
 
649
679
  ```typescript
650
- export type ResolvedShellSystem = OrganizationModelSystemEntry & {
651
- label: string
652
- iconComponent?: SystemIconComponent
680
+ export type ResolvedShellSystem = OrganizationModelSystemEntry & {
681
+ label: string
682
+ iconComponent?: SystemIconComponent
653
683
  }
654
684
  ```
655
685
 
656
686
  ### `ResolvedShellModel`
657
687
 
658
688
  ```typescript
659
- export interface ResolvedShellModel {
660
- systems: readonly ResolvedShellSystem[]
661
- findByPath: (path: string) => ResolvedShellSystem | undefined
662
- findById: (id: string) => ResolvedShellSystem | undefined
663
- childrenOf: (id: string) => ResolvedShellSystem[]
664
- ancestorsOf: (id: string) => ResolvedShellSystem[]
665
- parentOf: (id: string) => ResolvedShellSystem | undefined
666
- topLevel: () => ResolvedShellSystem[]
667
- requiresAdminFor: (id: string) => boolean
668
- devOnlyFor: (id: string) => boolean
689
+ export interface ResolvedShellModel {
690
+ systems: readonly ResolvedShellSystem[]
691
+ findByPath: (path: string) => ResolvedShellSystem | undefined
692
+ findById: (id: string) => ResolvedShellSystem | undefined
693
+ childrenOf: (id: string) => ResolvedShellSystem[]
694
+ ancestorsOf: (id: string) => ResolvedShellSystem[]
695
+ parentOf: (id: string) => ResolvedShellSystem | undefined
696
+ topLevel: () => ResolvedShellSystem[]
697
+ requiresAdminFor: (id: string) => boolean
698
+ devOnlyFor: (id: string) => boolean
669
699
  }
670
700
  ```
671
701
 
672
702
  ### `ShellSidebarLinkItem`
673
703
 
674
704
  ```typescript
675
- export interface ShellSidebarLinkItem {
676
- label: string
677
- link: string
678
- exact?: boolean
679
- activeMatchPaths?: string[]
705
+ export interface ShellSidebarLinkItem {
706
+ label: string
707
+ link: string
708
+ exact?: boolean
709
+ activeMatchPaths?: string[]
680
710
  }
681
711
  ```
682
712
 
683
713
  ### `ShellSidebarLinkGroup`
684
714
 
685
715
  ```typescript
686
- export interface ShellSidebarLinkGroup {
687
- icon: SystemIconComponent
688
- label: string
689
- links?: ShellSidebarLinkItem[]
690
- link?: string
716
+ export interface ShellSidebarLinkGroup {
717
+ icon: SystemIconComponent
718
+ label: string
719
+ links?: ShellSidebarLinkItem[]
720
+ link?: string
691
721
  }
692
722
  ```
693
723
 
694
724
  ### `ShellSidebarProjectionOptions`
695
725
 
696
726
  ```typescript
697
- export interface ShellSidebarProjectionOptions {
698
- isPlatformAdmin?: boolean
699
- isDev?: boolean
700
- section?: 'primary' | 'bottom'
727
+ export interface ShellSidebarProjectionOptions {
728
+ isPlatformAdmin?: boolean
729
+ isDev?: boolean
730
+ section?: 'primary' | 'bottom'
701
731
  }
702
732
  ```
703
733
 
@@ -710,75 +740,75 @@ export type ShellRouteMatchStatus = 'matched' | 'hidden' | 'unmatched'
710
740
  ### `ResolvedShellRouteMatch`
711
741
 
712
742
  ```typescript
713
- export interface ResolvedShellRouteMatch {
714
- status: ShellRouteMatchStatus
715
- path: string
716
- system?: ResolvedSystemModule
717
- node?: ResolvedShellSystem
743
+ export interface ResolvedShellRouteMatch {
744
+ status: ShellRouteMatchStatus
745
+ path: string
746
+ system?: ResolvedSystemModule
747
+ node?: ResolvedShellSystem
718
748
  }
719
749
  ```
720
750
 
721
751
  ### `ShellRuntime`
722
752
 
723
753
  ```typescript
724
- export interface ShellRuntime {
725
- resolveRoute: (path: string) => ResolvedShellRouteMatch
754
+ export interface ShellRuntime {
755
+ resolveRoute: (path: string) => ResolvedShellRouteMatch
726
756
  }
727
757
  ```
728
758
 
729
759
  ### `OrganizationGraphSystemBridge`
730
760
 
731
761
  ```typescript
732
- export interface OrganizationGraphSystemBridge {
733
- systemId?: string
762
+ export interface OrganizationGraphSystemBridge {
763
+ systemId?: string
734
764
  }
735
765
  ```
736
766
 
737
767
  ### `OrganizationGraphContextValue`
738
768
 
739
769
  ```typescript
740
- export interface OrganizationGraphContextValue {
741
- available: boolean
742
- systemId?: string
743
- systemPath?: string
770
+ export interface OrganizationGraphContextValue {
771
+ available: boolean
772
+ systemId?: string
773
+ systemPath?: string
744
774
  }
745
775
  ```
746
776
 
747
777
  ### `ElevasisSystemsProviderProps`
748
778
 
749
779
  ```typescript
750
- export interface ElevasisSystemsProviderProps {
751
- systems?: SystemModule[]
752
- organizationModel?: ElevasisOrganizationModel
753
- timeRange?: TimeRange
754
- operationsApiUrl?: string
755
- operationsSSEManager?: SSEConnectionManagerLike
756
- deliveryApiUrl?: string
757
- deliverySSEManager?: SSEConnectionManagerLike
758
- disabledSubsectionPaths?: string[]
759
- children: ReactNode
780
+ export interface ElevasisSystemsProviderProps {
781
+ systems?: SystemModule[]
782
+ organizationModel?: ElevasisOrganizationModel
783
+ timeRange?: TimeRange
784
+ operationsApiUrl?: string
785
+ operationsSSEManager?: SSEConnectionManagerLike
786
+ deliveryApiUrl?: string
787
+ deliverySSEManager?: SSEConnectionManagerLike
788
+ disabledSubsectionPaths?: string[]
789
+ children: ReactNode
760
790
  }
761
791
  ```
762
792
 
763
793
  ### `ElevasisSystemsContextValue`
764
794
 
765
795
  ```typescript
766
- export interface ElevasisSystemsContextValue {
767
- shellModel: ResolvedShellModel
768
- shellRuntime: ShellRuntime
769
- getSidebarLinks: (options?: ShellSidebarProjectionOptions) => ShellSidebarLinkGroup[]
770
- enabledResolvedSystems: ResolvedSystemModule[]
771
- resolvedSystems: ResolvedSystemModule[]
772
- organizationGraph: OrganizationGraphContextValue
773
- organizationModel?: OrganizationModel
774
- timeRange?: TimeRange
775
- operationsApiUrl?: string
776
- operationsSSEManager?: SSEConnectionManagerLike
777
- deliveryApiUrl?: string
778
- deliverySSEManager?: SSEConnectionManagerLike
779
- disabledSubsectionPaths: string[]
780
- isSystemEnabled: (key: string) => boolean
781
- getResolvedSystem: (key: string) => ResolvedSystemModule | undefined
796
+ export interface ElevasisSystemsContextValue {
797
+ shellModel: ResolvedShellModel
798
+ shellRuntime: ShellRuntime
799
+ getSidebarLinks: (options?: ShellSidebarProjectionOptions) => ShellSidebarLinkGroup[]
800
+ enabledResolvedSystems: ResolvedSystemModule[]
801
+ resolvedSystems: ResolvedSystemModule[]
802
+ organizationGraph: OrganizationGraphContextValue
803
+ organizationModel?: OrganizationModel
804
+ timeRange?: TimeRange
805
+ operationsApiUrl?: string
806
+ operationsSSEManager?: SSEConnectionManagerLike
807
+ deliveryApiUrl?: string
808
+ deliverySSEManager?: SSEConnectionManagerLike
809
+ disabledSubsectionPaths: string[]
810
+ isSystemEnabled: (key: string) => boolean
811
+ getResolvedSystem: (key: string) => ResolvedSystemModule | undefined
782
812
  }
783
813
  ```
784
814
 
@@ -787,29 +817,29 @@ export interface ElevasisSystemsContextValue {
787
817
  ### `ResourceStatus`
788
818
 
789
819
  ```typescript
790
- /**
791
- * Environment/deployment status for resources
792
- */
820
+ /**
821
+ * Environment/deployment status for resources
822
+ */
793
823
  export type ResourceStatus = 'dev' | 'prod'
794
824
  ```
795
825
 
796
826
  ### `ResourceType`
797
827
 
798
828
  ```typescript
799
- /**
800
- * All resource types in the platform
801
- * Used as the discriminator field in ResourceDefinition
802
- */
829
+ /**
830
+ * All resource types in the platform
831
+ * Used as the discriminator field in ResourceDefinition
832
+ */
803
833
  export type ResourceType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human'
804
834
  ```
805
835
 
806
836
  ### `ExecutableResourceType`
807
837
 
808
838
  ```typescript
809
- /**
810
- * Executable resource types (subset of ResourceType)
811
- * These resources can be directly executed by the execution engine
812
- */
839
+ /**
840
+ * Executable resource types (subset of ResourceType)
841
+ * These resources can be directly executed by the execution engine
842
+ */
813
843
  export type ExecutableResourceType = 'workflow' | 'agent'
814
844
  ```
815
845
 
@@ -822,52 +852,52 @@ export type ResourceSystemSummary = Pick<SystemEntry, 'id' | 'title' | 'descript
822
852
  ### `ResourceDefinition`
823
853
 
824
854
  ```typescript
825
- /**
826
- * Base interface for ALL platform resources
827
- * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
828
- */
829
- export interface ResourceDefinition {
830
- /** Unique resource identifier */
831
- resourceId: string
832
-
833
- /** Display name */
834
- name: string
835
-
836
- /** Purpose and functionality description */
837
- description: string
838
-
839
- /** Version for change tracking and evolution */
840
- version: string
841
-
842
- /** Resource type discriminator */
843
- type: ResourceType
844
-
845
- /** Environment/deployment status */
846
- status: ResourceStatus
847
-
848
- /** Graph links to Organization Model nodes */
849
- links?: ResourceLink[]
850
-
851
- /** Infrastructure category for filtering */
852
- category?: ResourceCategory
853
-
854
- /** Whether the agent supports multi-turn sessions (agents only) */
855
- sessionCapable?: boolean
856
-
857
- /** Whether the resource is local (monorepo) or remote (externally deployed) */
858
- origin?: 'local' | 'remote'
859
-
860
- /** OM System membership — dot-separated system path (e.g. "sys.lead-gen"), when backed by a Resource descriptor */
861
- systemPath?: string
862
-
863
- /** Display metadata for the owning OM System */
864
- system?: ResourceSystemSummary
865
-
866
- /** Governance lifecycle status from the OM Resource descriptor */
867
- governanceStatus?: ResourceGovernanceStatus
868
-
869
- /** Whether this resource is archived and should be excluded from registration and deployment */
870
- archived?: boolean
855
+ /**
856
+ * Base interface for ALL platform resources
857
+ * Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
858
+ */
859
+ export interface ResourceDefinition {
860
+ /** Unique resource identifier */
861
+ resourceId: string
862
+
863
+ /** Display name */
864
+ name: string
865
+
866
+ /** Purpose and functionality description */
867
+ description: string
868
+
869
+ /** Version for change tracking and evolution */
870
+ version: string
871
+
872
+ /** Resource type discriminator */
873
+ type: ResourceType
874
+
875
+ /** Environment/deployment status */
876
+ status: ResourceStatus
877
+
878
+ /** Graph links to Organization Model nodes */
879
+ links?: ResourceLink[]
880
+
881
+ /** Infrastructure category for filtering */
882
+ category?: ResourceCategory
883
+
884
+ /** Whether the agent supports multi-turn sessions (agents only) */
885
+ sessionCapable?: boolean
886
+
887
+ /** Whether the resource is local (monorepo) or remote (externally deployed) */
888
+ origin?: 'local' | 'remote'
889
+
890
+ /** OM System membership — dot-separated system path (e.g. "sys.lead-gen"), when backed by a Resource descriptor */
891
+ systemPath?: string
892
+
893
+ /** Display metadata for the owning OM System */
894
+ system?: ResourceSystemSummary
895
+
896
+ /** Governance lifecycle status from the OM Resource descriptor */
897
+ governanceStatus?: ResourceGovernanceStatus
898
+
899
+ /** Whether this resource is archived and should be excluded from registration and deployment */
900
+ archived?: boolean
871
901
  }
872
902
  ```
873
903
 
@@ -880,371 +910,371 @@ export type RuntimeResourceDescriptor = Extract<ResourceEntry, { kind: 'workflow
880
910
  ### `DescriptorBackedResourceDefinition`
881
911
 
882
912
  ```typescript
883
- export type DescriptorBackedResourceDefinition<
884
- TResource extends RuntimeResourceDescriptor = RuntimeResourceDescriptor
885
- > = Omit<ResourceDefinition, 'resourceId' | 'type'> & {
886
- /** OM descriptor that owns canonical identity and governance metadata. */
887
- resource: TResource
888
- resourceId?: never
889
- type?: never
913
+ export type DescriptorBackedResourceDefinition<
914
+ TResource extends RuntimeResourceDescriptor = RuntimeResourceDescriptor
915
+ > = Omit<ResourceDefinition, 'resourceId' | 'type'> & {
916
+ /** OM descriptor that owns canonical identity and governance metadata. */
917
+ resource: TResource
918
+ resourceId?: never
919
+ type?: never
890
920
  }
891
921
  ```
892
922
 
893
923
  ### `BoundResourceDefinition`
894
924
 
895
925
  ```typescript
896
- export type BoundResourceDefinition<TResource extends RuntimeResourceDescriptor = RuntimeResourceDescriptor> = Omit<
897
- DescriptorBackedResourceDefinition<TResource>,
898
- 'resource'
899
- > &
900
- ResourceDefinition & {
901
- resource: TResource
902
- resourceId: TResource['id']
903
- type: TResource['kind']
926
+ export type BoundResourceDefinition<TResource extends RuntimeResourceDescriptor = RuntimeResourceDescriptor> = Omit<
927
+ DescriptorBackedResourceDefinition<TResource>,
928
+ 'resource'
929
+ > &
930
+ ResourceDefinition & {
931
+ resource: TResource
932
+ resourceId: TResource['id']
933
+ type: TResource['kind']
904
934
  }
905
935
  ```
906
936
 
907
937
  ### `ResourceList`
908
938
 
909
939
  ```typescript
910
- /**
911
- * Resource list for organization
912
- * Returns ResourceDefinition metadata (not full definitions)
913
- */
914
- export interface ResourceList {
915
- workflows: ResourceDefinition[]
916
- agents: ResourceDefinition[]
917
- total: number
918
- organizationName: string
919
- environment?: 'dev' | 'prod'
940
+ /**
941
+ * Resource list for organization
942
+ * Returns ResourceDefinition metadata (not full definitions)
943
+ */
944
+ export interface ResourceList {
945
+ workflows: ResourceDefinition[]
946
+ agents: ResourceDefinition[]
947
+ total: number
948
+ organizationName: string
949
+ environment?: 'dev' | 'prod'
920
950
  }
921
951
  ```
922
952
 
923
953
  ### `WebhookProviderType`
924
954
 
925
955
  ```typescript
926
- /** Webhook provider identifiers */
956
+ /** Webhook provider identifiers */
927
957
  export type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'instantly' | 'apify' | 'test'
928
958
  ```
929
959
 
930
960
  ### `WebhookTriggerConfig`
931
961
 
932
962
  ```typescript
933
- /** Webhook trigger configuration */
934
- export interface WebhookTriggerConfig {
935
- /** Provider identifier */
936
- provider: WebhookProviderType
937
- /** Event type for documentation (not used for matching - workflow handles routing) */
938
- event?: string
939
- /** Optional filtering (e.g., specific form ID for Fillout) */
940
- filter?: Record<string, string>
941
- /** References credential in credentials table for per-org webhook secrets */
942
- credentialName?: string
963
+ /** Webhook trigger configuration */
964
+ export interface WebhookTriggerConfig {
965
+ /** Provider identifier */
966
+ provider: WebhookProviderType
967
+ /** Event type for documentation (not used for matching - workflow handles routing) */
968
+ event?: string
969
+ /** Optional filtering (e.g., specific form ID for Fillout) */
970
+ filter?: Record<string, string>
971
+ /** References credential in credentials table for per-org webhook secrets */
972
+ credentialName?: string
943
973
  }
944
974
  ```
945
975
 
946
976
  ### `ScheduleTriggerConfig`
947
977
 
948
978
  ```typescript
949
- /** Schedule trigger configuration */
950
- export interface ScheduleTriggerConfig {
951
- /** Cron expression (e.g., '0 6 * * *') */
952
- cron: string
953
- /** Optional timezone (default: UTC) */
954
- timezone?: string
979
+ /** Schedule trigger configuration */
980
+ export interface ScheduleTriggerConfig {
981
+ /** Cron expression (e.g., '0 6 * * *') */
982
+ cron: string
983
+ /** Optional timezone (default: UTC) */
984
+ timezone?: string
955
985
  }
956
986
  ```
957
987
 
958
988
  ### `EventTriggerConfig`
959
989
 
960
990
  ```typescript
961
- /** Event trigger configuration */
962
- export interface EventTriggerConfig {
963
- /** Internal event type */
964
- eventType: string
965
- /** Event source */
966
- source?: string
991
+ /** Event trigger configuration */
992
+ export interface EventTriggerConfig {
993
+ /** Internal event type */
994
+ eventType: string
995
+ /** Event source */
996
+ source?: string
967
997
  }
968
998
  ```
969
999
 
970
1000
  ### `TriggerConfig`
971
1001
 
972
1002
  ```typescript
973
- /** Union of all trigger configs */
1003
+ /** Union of all trigger configs */
974
1004
  export type TriggerConfig = WebhookTriggerConfig | ScheduleTriggerConfig | EventTriggerConfig
975
1005
  ```
976
1006
 
977
1007
  ### `TriggerDefinition`
978
1008
 
979
1009
  ```typescript
980
- /**
981
- * Trigger metadata - entry points that initiate resource execution
982
- *
983
- * Triggers represent how executions start: webhooks from external services,
984
- * scheduled cron jobs, platform events, or manual user actions.
985
- *
986
- * BREAKING CHANGES (2025-11-30):
987
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
988
- * - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
989
- * - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
990
- * - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
991
- * - triggers object now includes `externalResources` option
992
- *
993
- * @example
994
- * // TriggerDefinition - metadata only
995
- * {
996
- * resourceId: 'trigger-new-order',
997
- * type: 'trigger',
998
- * triggerType: 'webhook',
999
- * name: 'New Order',
1000
- * description: 'Webhook from Shopify on new orders',
1001
- * version: '1.0.0',
1002
- * status: 'prod',
1003
- * webhookPath: '/webhooks/shopify/orders'
1004
- * }
1005
- *
1006
- * // Relationships declared in ResourceRelationships (not on TriggerDefinition):
1007
- * // relationships: {
1008
- * // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
1009
- * // }
1010
- */
1011
- export interface TriggerDefinition extends ResourceDefinition {
1012
- /** Resource type discriminator (narrowed from base union) */
1013
- type: 'trigger'
1014
-
1015
- /** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
1016
- triggerType: 'webhook' | 'schedule' | 'manual' | 'event'
1017
-
1018
- /** Type-specific configuration */
1019
- config?: TriggerConfig
1020
-
1021
- // Legacy fields (deprecated, use config instead)
1022
- /** For webhook triggers: path like '/webhooks/shopify/orders' */
1023
- webhookPath?: string
1024
- /** For schedule triggers: cron expression like '0 6 * * *' */
1025
- schedule?: string
1026
- /** For event triggers: event type like 'low-stock-alert' */
1027
- eventType?: string
1028
-
1029
- // NOTE: What this trigger starts is declared in ResourceRelationships, not here
1030
- // This prevents duplication - triggers are forward-declared in relationships
1010
+ /**
1011
+ * Trigger metadata - entry points that initiate resource execution
1012
+ *
1013
+ * Triggers represent how executions start: webhooks from external services,
1014
+ * scheduled cron jobs, platform events, or manual user actions.
1015
+ *
1016
+ * BREAKING CHANGES (2025-11-30):
1017
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
1018
+ * - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
1019
+ * - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
1020
+ * - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
1021
+ * - triggers object now includes `externalResources` option
1022
+ *
1023
+ * @example
1024
+ * // TriggerDefinition - metadata only
1025
+ * {
1026
+ * resourceId: 'trigger-new-order',
1027
+ * type: 'trigger',
1028
+ * triggerType: 'webhook',
1029
+ * name: 'New Order',
1030
+ * description: 'Webhook from Shopify on new orders',
1031
+ * version: '1.0.0',
1032
+ * status: 'prod',
1033
+ * webhookPath: '/webhooks/shopify/orders'
1034
+ * }
1035
+ *
1036
+ * // Relationships declared in ResourceRelationships (not on TriggerDefinition):
1037
+ * // relationships: {
1038
+ * // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
1039
+ * // }
1040
+ */
1041
+ export interface TriggerDefinition extends ResourceDefinition {
1042
+ /** Resource type discriminator (narrowed from base union) */
1043
+ type: 'trigger'
1044
+
1045
+ /** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
1046
+ triggerType: 'webhook' | 'schedule' | 'manual' | 'event'
1047
+
1048
+ /** Type-specific configuration */
1049
+ config?: TriggerConfig
1050
+
1051
+ // Legacy fields (deprecated, use config instead)
1052
+ /** For webhook triggers: path like '/webhooks/shopify/orders' */
1053
+ webhookPath?: string
1054
+ /** For schedule triggers: cron expression like '0 6 * * *' */
1055
+ schedule?: string
1056
+ /** For event triggers: event type like 'low-stock-alert' */
1057
+ eventType?: string
1058
+
1059
+ // NOTE: What this trigger starts is declared in ResourceRelationships, not here
1060
+ // This prevents duplication - triggers are forward-declared in relationships
1031
1061
  }
1032
1062
  ```
1033
1063
 
1034
1064
  ### `IntegrationDefinition`
1035
1065
 
1036
1066
  ```typescript
1037
- /**
1038
- * Integration metadata - external service connections
1039
- *
1040
- * References credentials table for actual connection. No connection status
1041
- * stored here (queried at runtime from credentials table).
1042
- *
1043
- * BREAKING CHANGES (2025-11-30):
1044
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
1045
- * - Field renames: `id` -> `resourceId` (inherited)
1046
- * - New required field: `status` (inherited) - organizations must add status to all integrations
1047
- * - New required field: `version` (inherited) - organizations must add version to all integrations
1048
- * - New required field: `type: 'integration'` (inherited) - resource type discriminator
1049
- *
1050
- * @example
1051
- * {
1052
- * resourceId: 'integration-shopify-prod',
1053
- * type: 'integration',
1054
- * provider: 'shopify',
1055
- * credentialName: 'shopify-prod',
1056
- * name: 'Shopify Production',
1057
- * description: 'E-commerce platform',
1058
- * version: '1.0.0',
1059
- * status: 'prod'
1060
- * }
1061
- */
1062
- export interface IntegrationDefinition extends ResourceDefinition {
1063
- /** Resource type discriminator (narrowed from base union) */
1064
- type: 'integration'
1065
-
1066
- /** OM descriptor that owns canonical identity and governance metadata. */
1067
- resource?: Extract<ResourceEntry, { kind: 'integration' }>
1068
-
1069
- /** Integration provider type */
1070
- provider: IntegrationType
1071
- /** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
1072
- credentialName: string
1067
+ /**
1068
+ * Integration metadata - external service connections
1069
+ *
1070
+ * References credentials table for actual connection. No connection status
1071
+ * stored here (queried at runtime from credentials table).
1072
+ *
1073
+ * BREAKING CHANGES (2025-11-30):
1074
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
1075
+ * - Field renames: `id` -> `resourceId` (inherited)
1076
+ * - New required field: `status` (inherited) - organizations must add status to all integrations
1077
+ * - New required field: `version` (inherited) - organizations must add version to all integrations
1078
+ * - New required field: `type: 'integration'` (inherited) - resource type discriminator
1079
+ *
1080
+ * @example
1081
+ * {
1082
+ * resourceId: 'integration-shopify-prod',
1083
+ * type: 'integration',
1084
+ * provider: 'shopify',
1085
+ * credentialName: 'shopify-prod',
1086
+ * name: 'Shopify Production',
1087
+ * description: 'E-commerce platform',
1088
+ * version: '1.0.0',
1089
+ * status: 'prod'
1090
+ * }
1091
+ */
1092
+ export interface IntegrationDefinition extends ResourceDefinition {
1093
+ /** Resource type discriminator (narrowed from base union) */
1094
+ type: 'integration'
1095
+
1096
+ /** OM descriptor that owns canonical identity and governance metadata. */
1097
+ resource?: Extract<ResourceEntry, { kind: 'integration' }>
1098
+
1099
+ /** Integration provider type */
1100
+ provider: IntegrationType
1101
+ /** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
1102
+ credentialName: string
1073
1103
  }
1074
1104
  ```
1075
1105
 
1076
1106
  ### `RelationshipDeclaration`
1077
1107
 
1078
1108
  ```typescript
1079
- /**
1080
- * Explicit resource relationship declaration
1081
- *
1082
- * Single-direction only - Command View derives reverse relationships.
1083
- * Agents/workflows declare what they trigger and use.
1084
- *
1085
- * @example
1086
- * {
1087
- * triggers: { workflows: ['order-fulfillment-workflow'] },
1088
- * uses: { integrations: ['integration-shopify-prod', 'integration-postgres'] }
1089
- * }
1090
- */
1091
- export interface RelationshipDeclaration {
1092
- /** Resources this resource triggers */
1093
- triggers?: {
1094
- /** Agent resourceIds this resource triggers */
1095
- agents?: string[]
1096
- /** Workflow resourceIds this resource triggers */
1097
- workflows?: string[]
1098
- }
1099
- /** Integrations this resource uses */
1100
- uses?: {
1101
- /** Integration IDs this resource uses */
1102
- integrations?: string[]
1103
- }
1109
+ /**
1110
+ * Explicit resource relationship declaration
1111
+ *
1112
+ * Single-direction only - Command View derives reverse relationships.
1113
+ * Agents/workflows declare what they trigger and use.
1114
+ *
1115
+ * @example
1116
+ * {
1117
+ * triggers: { workflows: ['order-fulfillment-workflow'] },
1118
+ * uses: { integrations: ['integration-shopify-prod', 'integration-postgres'] }
1119
+ * }
1120
+ */
1121
+ export interface RelationshipDeclaration {
1122
+ /** Resources this resource triggers */
1123
+ triggers?: {
1124
+ /** Agent resourceIds this resource triggers */
1125
+ agents?: string[]
1126
+ /** Workflow resourceIds this resource triggers */
1127
+ workflows?: string[]
1128
+ }
1129
+ /** Integrations this resource uses */
1130
+ uses?: {
1131
+ /** Integration IDs this resource uses */
1132
+ integrations?: string[]
1133
+ }
1104
1134
  }
1105
1135
  ```
1106
1136
 
1107
1137
  ### `ResourceRelationships`
1108
1138
 
1109
1139
  ```typescript
1110
- /**
1111
- * Resource relationships map
1112
- * Maps resourceId to its relationship declarations
1113
- *
1114
- * @example
1115
- * {
1116
- * 'order-processor-agent': {
1117
- * triggers: { workflows: ['order-fulfillment-workflow'] },
1118
- * uses: { integrations: ['integration-shopify-prod'] }
1119
- * }
1120
- * }
1121
- */
1140
+ /**
1141
+ * Resource relationships map
1142
+ * Maps resourceId to its relationship declarations
1143
+ *
1144
+ * @example
1145
+ * {
1146
+ * 'order-processor-agent': {
1147
+ * triggers: { workflows: ['order-fulfillment-workflow'] },
1148
+ * uses: { integrations: ['integration-shopify-prod'] }
1149
+ * }
1150
+ * }
1151
+ */
1122
1152
  export type ResourceRelationships = Record<string, RelationshipDeclaration>
1123
1153
  ```
1124
1154
 
1125
1155
  ### `ExternalPlatform`
1126
1156
 
1127
1157
  ```typescript
1128
- /**
1129
- * External platform type
1130
- * Supported third-party automation platforms
1131
- */
1158
+ /**
1159
+ * External platform type
1160
+ * Supported third-party automation platforms
1161
+ */
1132
1162
  export type ExternalPlatform = 'n8n' | 'make' | 'zapier' | 'other'
1133
1163
  ```
1134
1164
 
1135
1165
  ### `ExternalResourceDefinition`
1136
1166
 
1137
1167
  ```typescript
1138
- /**
1139
- * External automation resource metadata
1140
- *
1141
- * Represents workflows/automations running on third-party platforms
1142
- * (n8n, Make, Zapier, etc.) for visualization in Command View.
1143
- *
1144
- * NOTE: This is metadata ONLY for visualization. No execution logic,
1145
- * no API integration with external platforms, no status syncing.
1146
- *
1147
- * BREAKING CHANGES (2025-11-30):
1148
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
1149
- * - Field renames: `id` -> `resourceId` (inherited)
1150
- * - New required field: `version` (inherited) - organizations must add version to all external resources
1151
- * - New required field: `type: 'external'` (inherited) - resource type discriminator
1152
- * - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
1153
- *
1154
- * @example
1155
- * {
1156
- * resourceId: 'external-n8n-order-sync',
1157
- * type: 'external',
1158
- * version: '1.0.0',
1159
- * platform: 'n8n',
1160
- * name: 'Shopify Order Sync',
1161
- * description: 'Legacy n8n workflow for syncing Shopify orders',
1162
- * status: 'prod',
1163
- * platformUrl: 'https://n8n.client.com/workflow/123',
1164
- * triggers: { workflows: ['order-fulfillment-workflow'] },
1165
- * uses: { integrations: ['integration-shopify-prod'] }
1166
- * }
1167
- */
1168
- export interface ExternalResourceDefinition extends ResourceDefinition {
1169
- /** Resource type discriminator (narrowed from base union) */
1170
- type: 'external'
1171
-
1172
- /** Platform type */
1173
- platform: ExternalPlatform
1174
-
1175
- // Optional platform-specific metadata
1176
- /** Link to external platform (e.g., n8n workflow editor URL) */
1177
- platformUrl?: string
1178
- /** Platform's internal ID/reference */
1179
- externalId?: string
1180
-
1181
- /** What this external resource triggers (external -> internal) */
1182
- triggers?: {
1183
- /** Elevasis workflow resourceIds this external automation triggers */
1184
- workflows?: string[]
1185
- /** Elevasis agent resourceIds this external automation triggers */
1186
- agents?: string[]
1187
- }
1188
-
1189
- /** Integrations this external resource uses (shared credentials) */
1190
- uses?: {
1191
- /** Integration IDs this external automation uses */
1192
- integrations?: string[]
1193
- }
1194
-
1195
- // NOTE: triggeredBy field removed - per relationship-consolidation design,
1196
- // all relationships are forward-only declarations. Graph edges are built
1197
- // from forward declarations only.
1168
+ /**
1169
+ * External automation resource metadata
1170
+ *
1171
+ * Represents workflows/automations running on third-party platforms
1172
+ * (n8n, Make, Zapier, etc.) for visualization in Command View.
1173
+ *
1174
+ * NOTE: This is metadata ONLY for visualization. No execution logic,
1175
+ * no API integration with external platforms, no status syncing.
1176
+ *
1177
+ * BREAKING CHANGES (2025-11-30):
1178
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
1179
+ * - Field renames: `id` -> `resourceId` (inherited)
1180
+ * - New required field: `version` (inherited) - organizations must add version to all external resources
1181
+ * - New required field: `type: 'external'` (inherited) - resource type discriminator
1182
+ * - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
1183
+ *
1184
+ * @example
1185
+ * {
1186
+ * resourceId: 'external-n8n-order-sync',
1187
+ * type: 'external',
1188
+ * version: '1.0.0',
1189
+ * platform: 'n8n',
1190
+ * name: 'Shopify Order Sync',
1191
+ * description: 'Legacy n8n workflow for syncing Shopify orders',
1192
+ * status: 'prod',
1193
+ * platformUrl: 'https://n8n.client.com/workflow/123',
1194
+ * triggers: { workflows: ['order-fulfillment-workflow'] },
1195
+ * uses: { integrations: ['integration-shopify-prod'] }
1196
+ * }
1197
+ */
1198
+ export interface ExternalResourceDefinition extends ResourceDefinition {
1199
+ /** Resource type discriminator (narrowed from base union) */
1200
+ type: 'external'
1201
+
1202
+ /** Platform type */
1203
+ platform: ExternalPlatform
1204
+
1205
+ // Optional platform-specific metadata
1206
+ /** Link to external platform (e.g., n8n workflow editor URL) */
1207
+ platformUrl?: string
1208
+ /** Platform's internal ID/reference */
1209
+ externalId?: string
1210
+
1211
+ /** What this external resource triggers (external -> internal) */
1212
+ triggers?: {
1213
+ /** Elevasis workflow resourceIds this external automation triggers */
1214
+ workflows?: string[]
1215
+ /** Elevasis agent resourceIds this external automation triggers */
1216
+ agents?: string[]
1217
+ }
1218
+
1219
+ /** Integrations this external resource uses (shared credentials) */
1220
+ uses?: {
1221
+ /** Integration IDs this external automation uses */
1222
+ integrations?: string[]
1223
+ }
1224
+
1225
+ // NOTE: triggeredBy field removed - per relationship-consolidation design,
1226
+ // all relationships are forward-only declarations. Graph edges are built
1227
+ // from forward declarations only.
1198
1228
  }
1199
1229
  ```
1200
1230
 
1201
1231
  ### `HumanCheckpointDefinition`
1202
1232
 
1203
1233
  ```typescript
1204
- /**
1205
- * Human Checkpoint definition - human decision points in automation
1206
- *
1207
- * Represents where human judgment is deployed in the automation landscape.
1208
- * Tasks with matching command_queue_group are routed to this checkpoint.
1209
- *
1210
- * BREAKING CHANGES (2025-11-30):
1211
- * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
1212
- * - Field renames: `id` -> `resourceId` (inherited)
1213
- * - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
1214
- * - New required field: `version` (inherited) - organizations must add version to all human checkpoints
1215
- * - New required field: `type: 'human'` (inherited) - resource type discriminator
1216
- *
1217
- * @example
1218
- * {
1219
- * resourceId: 'sales-approval',
1220
- * type: 'human',
1221
- * name: 'Sales Approval Queue',
1222
- * description: 'High-value order approvals for sales team',
1223
- * version: '1.0.0',
1224
- * status: 'prod',
1225
- * requestedBy: { agents: ['order-processor-agent'] },
1226
- * routesTo: { agents: ['order-fulfillment-agent'] }
1227
- * }
1228
- */
1229
- export interface HumanCheckpointDefinition extends ResourceDefinition {
1230
- /** Resource type discriminator (narrowed from base union) */
1231
- type: 'human'
1232
-
1233
- /** Resources that create tasks for this checkpoint */
1234
- requestedBy?: {
1235
- /** Agent resourceIds that request approval here */
1236
- agents?: string[]
1237
- /** Workflow resourceIds that request approval here */
1238
- workflows?: string[]
1239
- }
1240
-
1241
- /** Resources that receive approved decisions */
1242
- routesTo?: {
1243
- /** Agent resourceIds that handle approved tasks */
1244
- agents?: string[]
1245
- /** Workflow resourceIds that handle approved tasks */
1246
- workflows?: string[]
1247
- }
1234
+ /**
1235
+ * Human Checkpoint definition - human decision points in automation
1236
+ *
1237
+ * Represents where human judgment is deployed in the automation landscape.
1238
+ * Tasks with matching command_queue_group are routed to this checkpoint.
1239
+ *
1240
+ * BREAKING CHANGES (2025-11-30):
1241
+ * - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, links, category)
1242
+ * - Field renames: `id` -> `resourceId` (inherited)
1243
+ * - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
1244
+ * - New required field: `version` (inherited) - organizations must add version to all human checkpoints
1245
+ * - New required field: `type: 'human'` (inherited) - resource type discriminator
1246
+ *
1247
+ * @example
1248
+ * {
1249
+ * resourceId: 'sales-approval',
1250
+ * type: 'human',
1251
+ * name: 'Sales Approval Queue',
1252
+ * description: 'High-value order approvals for sales team',
1253
+ * version: '1.0.0',
1254
+ * status: 'prod',
1255
+ * requestedBy: { agents: ['order-processor-agent'] },
1256
+ * routesTo: { agents: ['order-fulfillment-agent'] }
1257
+ * }
1258
+ */
1259
+ export interface HumanCheckpointDefinition extends ResourceDefinition {
1260
+ /** Resource type discriminator (narrowed from base union) */
1261
+ type: 'human'
1262
+
1263
+ /** Resources that create tasks for this checkpoint */
1264
+ requestedBy?: {
1265
+ /** Agent resourceIds that request approval here */
1266
+ agents?: string[]
1267
+ /** Workflow resourceIds that request approval here */
1268
+ workflows?: string[]
1269
+ }
1270
+
1271
+ /** Resources that receive approved decisions */
1272
+ routesTo?: {
1273
+ /** Agent resourceIds that handle approved tasks */
1274
+ agents?: string[]
1275
+ /** Workflow resourceIds that handle approved tasks */
1276
+ workflows?: string[]
1277
+ }
1248
1278
  }
1249
1279
  ```
1250
1280
 
@@ -1253,36 +1283,36 @@ export interface HumanCheckpointDefinition extends ResourceDefinition {
1253
1283
  ### `DeploymentSpec`
1254
1284
 
1255
1285
  ```typescript
1256
- /**
1257
- * Organization-specific resource collection
1258
- *
1259
- * Complete manifest of all automation resources for an organization.
1260
- * Used by ResourceRegistry for discovery and Command View for visualization.
1261
- */
1262
- export interface DeploymentSpec {
1263
- /** Deployment version (semver) */
1264
- version: string
1265
- /** Optional Organization Model governance catalog used for OM-code validation */
1266
- organizationModel?: {
1267
- systems?: OrganizationModelSystems
1268
- resources?: OrganizationModelResources
1269
- }
1270
- /** Workflow definitions */
1271
- workflows?: WorkflowDefinition[]
1272
- /** Agent definitions */
1273
- agents?: AgentDefinition[]
1274
-
1275
- // Resource Manifest fields (optional for backwards compatibility)
1276
- /** Trigger definitions - entry points that initiate executions */
1277
- triggers?: TriggerDefinition[]
1278
- /** Integration definitions - external service connections */
1279
- integrations?: IntegrationDefinition[]
1280
- /** Explicit relationship declarations between resources */
1281
- relationships?: ResourceRelationships
1282
- /** External automation resources (n8n, Make, Zapier, etc.) */
1283
- externalResources?: ExternalResourceDefinition[]
1284
- /** Human checkpoint definitions - human decision points in automation */
1285
- humanCheckpoints?: HumanCheckpointDefinition[]
1286
+ /**
1287
+ * Organization-specific resource collection
1288
+ *
1289
+ * Complete manifest of all automation resources for an organization.
1290
+ * Used by ResourceRegistry for discovery and Command View for visualization.
1291
+ */
1292
+ export interface DeploymentSpec {
1293
+ /** Deployment version (semver) */
1294
+ version: string
1295
+ /** Optional Organization Model governance catalog used for OM-code validation */
1296
+ organizationModel?: {
1297
+ systems?: OrganizationModelSystems
1298
+ resources?: OrganizationModelResources
1299
+ }
1300
+ /** Workflow definitions */
1301
+ workflows?: WorkflowDefinition[]
1302
+ /** Agent definitions */
1303
+ agents?: AgentDefinition[]
1304
+
1305
+ // Resource Manifest fields (optional for backwards compatibility)
1306
+ /** Trigger definitions - entry points that initiate executions */
1307
+ triggers?: TriggerDefinition[]
1308
+ /** Integration definitions - external service connections */
1309
+ integrations?: IntegrationDefinition[]
1310
+ /** Explicit relationship declarations between resources */
1311
+ relationships?: ResourceRelationships
1312
+ /** External automation resources (n8n, Make, Zapier, etc.) */
1313
+ externalResources?: ExternalResourceDefinition[]
1314
+ /** Human checkpoint definitions - human decision points in automation */
1315
+ humanCheckpoints?: HumanCheckpointDefinition[]
1286
1316
  }
1287
1317
  ```
1288
1318
 
@@ -1291,77 +1321,77 @@ export interface DeploymentSpec {
1291
1321
  ### `AcqCompany`
1292
1322
 
1293
1323
  ```typescript
1294
- /**
1295
- * Company record in the acquisition database.
1296
- * Contains enriched company data from various sources.
1297
- * Transformed from AcqCompanyRow with camelCase properties.
1298
- */
1299
- export interface AcqCompany {
1300
- id: string
1301
- organizationId: string
1302
- name: string
1303
- domain: string | null
1304
- linkedinUrl: string | null
1305
- website: string | null
1306
- numEmployees: number | null
1307
- foundedYear: number | null
1308
- locationCity: string | null
1309
- locationState: string | null
1310
- category: string | null
1311
- categoryPain: string | null
1312
- segment: string | null
1313
- processingState: CompanyProcessingState | null
1314
- /** @deprecated Use `processingState`. This legacy DB column has been removed; responses return null. */
1315
- pipelineStatus?: LegacyPipelineStatus | null
1316
- enrichmentData: CompanyEnrichmentData | null
1317
- source: string | null
1318
- batchId: string | null
1319
- status: 'active' | 'invalid'
1320
- verticalResearch: string | null
1321
- /** Track A: flat qualification score (null until a scoring rubric is defined). Added by W1 migration. */
1322
- qualificationScore: number | null
1323
- /** Track A: flat qualification signals jsonb preserving the result payload shape. Added by W1 migration. */
1324
- qualificationSignals: Record<string, unknown> | null
1325
- /** Track A: key identifying the rubric used for qualification. Added by W1 migration. */
1326
- qualificationRubricKey: string | null
1327
- createdAt: Date
1328
- updatedAt: Date
1324
+ /**
1325
+ * Company record in the acquisition database.
1326
+ * Contains enriched company data from various sources.
1327
+ * Transformed from AcqCompanyRow with camelCase properties.
1328
+ */
1329
+ export interface AcqCompany {
1330
+ id: string
1331
+ organizationId: string
1332
+ name: string
1333
+ domain: string | null
1334
+ linkedinUrl: string | null
1335
+ website: string | null
1336
+ numEmployees: number | null
1337
+ foundedYear: number | null
1338
+ locationCity: string | null
1339
+ locationState: string | null
1340
+ category: string | null
1341
+ categoryPain: string | null
1342
+ segment: string | null
1343
+ processingState: CompanyProcessingState | null
1344
+ /** @deprecated Use `processingState`. This legacy DB column has been removed; responses return null. */
1345
+ pipelineStatus?: LegacyPipelineStatus | null
1346
+ enrichmentData: CompanyEnrichmentData | null
1347
+ source: string | null
1348
+ batchId: string | null
1349
+ status: 'active' | 'invalid'
1350
+ verticalResearch: string | null
1351
+ /** Track A: flat qualification score (null until a scoring rubric is defined). Added by W1 migration. */
1352
+ qualificationScore: number | null
1353
+ /** Track A: flat qualification signals jsonb preserving the result payload shape. Added by W1 migration. */
1354
+ qualificationSignals: Record<string, unknown> | null
1355
+ /** Track A: key identifying the rubric used for qualification. Added by W1 migration. */
1356
+ qualificationRubricKey: string | null
1357
+ createdAt: Date
1358
+ updatedAt: Date
1329
1359
  }
1330
1360
  ```
1331
1361
 
1332
1362
  ### `AcqContact`
1333
1363
 
1334
1364
  ```typescript
1335
- /**
1336
- * Contact record in the acquisition database.
1337
- * Contains enriched contact data and personalization content.
1338
- * Transformed from AcqContactRow with camelCase properties.
1339
- */
1340
- export interface AcqContact {
1341
- id: string
1342
- organizationId: string
1343
- companyId: string | null
1344
- email: string
1345
- emailValid: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN' | null
1346
- firstName: string | null
1347
- lastName: string | null
1348
- linkedinUrl: string | null
1349
- title: string | null
1350
- headline: string | null
1351
- filterReason: string | null
1352
- openingLine: string | null
1353
- source: string | null
1354
- sourceId: string | null
1355
- processingState: ContactProcessingState | null
1356
- /** @deprecated Use `processingState`. This legacy DB column has been removed; responses return null. */
1357
- pipelineStatus?: LegacyPipelineStatus | null
1358
- enrichmentData: ContactEnrichmentData | null
1359
- /** Attio Person record ID - set when contact responds and is added to CRM */
1360
- attioPersonId: string | null
1361
- batchId: string | null
1362
- status: 'active' | 'invalid'
1363
- createdAt: Date
1364
- updatedAt: Date
1365
+ /**
1366
+ * Contact record in the acquisition database.
1367
+ * Contains enriched contact data and personalization content.
1368
+ * Transformed from AcqContactRow with camelCase properties.
1369
+ */
1370
+ export interface AcqContact {
1371
+ id: string
1372
+ organizationId: string
1373
+ companyId: string | null
1374
+ email: string
1375
+ emailValid: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN' | null
1376
+ firstName: string | null
1377
+ lastName: string | null
1378
+ linkedinUrl: string | null
1379
+ title: string | null
1380
+ headline: string | null
1381
+ filterReason: string | null
1382
+ openingLine: string | null
1383
+ source: string | null
1384
+ sourceId: string | null
1385
+ processingState: ContactProcessingState | null
1386
+ /** @deprecated Use `processingState`. This legacy DB column has been removed; responses return null. */
1387
+ pipelineStatus?: LegacyPipelineStatus | null
1388
+ enrichmentData: ContactEnrichmentData | null
1389
+ /** Attio Person record ID - set when contact responds and is added to CRM */
1390
+ attioPersonId: string | null
1391
+ batchId: string | null
1392
+ status: 'active' | 'invalid'
1393
+ createdAt: Date
1394
+ updatedAt: Date
1365
1395
  }
1366
1396
  ```
1367
1397
 
@@ -1380,23 +1410,23 @@ export type DealPriorityBucketKey = 'needs_response' | 'follow_up_due' | 'waitin
1380
1410
  ### `DealPriority`
1381
1411
 
1382
1412
  ```typescript
1383
- export interface DealPriority {
1384
- bucketKey: DealPriorityBucketKey
1385
- rank: number
1386
- label: string
1387
- color: string
1388
- reason: string
1389
- latestActivityAt: string | null
1390
- nextActionAt: string | null
1413
+ export interface DealPriority {
1414
+ bucketKey: DealPriorityBucketKey
1415
+ rank: number
1416
+ label: string
1417
+ color: string
1418
+ reason: string
1419
+ latestActivityAt: string | null
1420
+ nextActionAt: string | null
1391
1421
  }
1392
1422
  ```
1393
1423
 
1394
1424
  ### `KanbanStageConfig`
1395
1425
 
1396
1426
  ```typescript
1397
- export interface KanbanStageConfig {
1398
- color: string // Mantine color token (e.g. 'blue', 'teal')
1399
- label?: string // Optional display label override
1427
+ export interface KanbanStageConfig {
1428
+ color: string // Mantine color token (e.g. 'blue', 'teal')
1429
+ label?: string // Optional display label override
1400
1430
  }
1401
1431
  ```
1402
1432
 
@@ -1409,49 +1439,49 @@ export type KanbanBoardConfig = Partial<Record<DealStage, KanbanStageConfig>>
1409
1439
  ### `DealContact`
1410
1440
 
1411
1441
  ```typescript
1412
- export interface DealContact {
1413
- id: string
1414
- first_name: string | null
1415
- last_name: string | null
1416
- email: string
1417
- title: string | null
1418
- headline: string | null
1419
- linkedin_url: string | null
1420
- processing_state: Record<string, unknown> | null
1421
- enrichment_data: Record<string, unknown> | null
1422
- company: {
1423
- id: string
1424
- name: string
1425
- domain: string | null
1426
- website: string | null
1427
- linkedin_url: string | null
1428
- segment: string | null
1429
- category: string | null
1430
- num_employees: number | null
1431
- } | null
1442
+ export interface DealContact {
1443
+ id: string
1444
+ first_name: string | null
1445
+ last_name: string | null
1446
+ email: string
1447
+ title: string | null
1448
+ headline: string | null
1449
+ linkedin_url: string | null
1450
+ processing_state: Record<string, unknown> | null
1451
+ enrichment_data: Record<string, unknown> | null
1452
+ company: {
1453
+ id: string
1454
+ name: string
1455
+ domain: string | null
1456
+ website: string | null
1457
+ linkedin_url: string | null
1458
+ segment: string | null
1459
+ category: string | null
1460
+ num_employees: number | null
1461
+ } | null
1432
1462
  }
1433
1463
  ```
1434
1464
 
1435
1465
  ### `DealFilters`
1436
1466
 
1437
1467
  ```typescript
1438
- export interface DealFilters {
1439
- stage?: DealStage
1440
- search?: string
1441
- limit?: number
1442
- offset?: number
1468
+ export interface DealFilters {
1469
+ stage?: DealStage
1470
+ search?: string
1471
+ limit?: number
1472
+ offset?: number
1443
1473
  }
1444
1474
  ```
1445
1475
 
1446
1476
  ### `DealListItem`
1447
1477
 
1448
1478
  ```typescript
1449
- /** Deal list item with joined contact and company data */
1450
- export interface DealListItem extends AcqDealRow {
1451
- priority: DealPriority
1452
- ownership: 'us' | 'them' | null
1453
- nextAction: string | null
1454
- contact: DealContact | null
1479
+ /** Deal list item with joined contact and company data */
1480
+ export interface DealListItem extends AcqDealRow {
1481
+ priority: DealPriority
1482
+ ownership: 'us' | 'them' | null
1483
+ nextAction: string | null
1484
+ contact: DealContact | null
1455
1485
  }
1456
1486
  ```
1457
1487
 
@@ -1464,31 +1494,31 @@ export type DealDetail = DealListItem
1464
1494
  ### `AcqDealTaskKind`
1465
1495
 
1466
1496
  ```typescript
1467
- /** Task kind options for a deal task (human follow-up action type) */
1497
+ /** Task kind options for a deal task (human follow-up action type) */
1468
1498
  export type AcqDealTaskKind = 'call' | 'email' | 'meeting' | 'other'
1469
1499
  ```
1470
1500
 
1471
1501
  ### `AcqDealTask`
1472
1502
 
1473
1503
  ```typescript
1474
- /**
1475
- * A CRM to-do item attached to a deal representing a human follow-up action.
1476
- * Transformed from AcqDealTaskRow with camelCase properties.
1477
- */
1478
- export interface AcqDealTask {
1479
- id: string
1480
- organizationId: string
1481
- dealId: string
1482
- title: string
1483
- description: string | null
1484
- kind: AcqDealTaskKind
1485
- dueAt: string | null
1486
- assigneeUserId: string | null
1487
- completedAt: string | null
1488
- completedByUserId: string | null
1489
- createdAt: string
1490
- updatedAt: string
1491
- createdByUserId: string | null
1504
+ /**
1505
+ * A CRM to-do item attached to a deal representing a human follow-up action.
1506
+ * Transformed from AcqDealTaskRow with camelCase properties.
1507
+ */
1508
+ export interface AcqDealTask {
1509
+ id: string
1510
+ organizationId: string
1511
+ dealId: string
1512
+ title: string
1513
+ description: string | null
1514
+ kind: AcqDealTaskKind
1515
+ dueAt: string | null
1516
+ assigneeUserId: string | null
1517
+ completedAt: string | null
1518
+ completedByUserId: string | null
1519
+ createdAt: string
1520
+ updatedAt: string
1521
+ createdByUserId: string | null
1492
1522
  }
1493
1523
  ```
1494
1524
 
@@ -1501,54 +1531,54 @@ export type CrmPriorityBucketKey = 'needs_response' | 'follow_up_due' | 'waiting
1501
1531
  ### `CrmPriorityBucketDefinition`
1502
1532
 
1503
1533
  ```typescript
1504
- export interface CrmPriorityBucketDefinition {
1505
- bucketKey: CrmPriorityBucketKey
1506
- label: string
1507
- /** Lower ranks sort first in deal lists and pipeline columns. */
1508
- rank: number
1509
- /** UI color token. Consumers may map this to their design system. */
1510
- color: string
1534
+ export interface CrmPriorityBucketDefinition {
1535
+ bucketKey: CrmPriorityBucketKey
1536
+ label: string
1537
+ /** Lower ranks sort first in deal lists and pipeline columns. */
1538
+ rank: number
1539
+ /** UI color token. Consumers may map this to their design system. */
1540
+ color: string
1511
1541
  }
1512
1542
  ```
1513
1543
 
1514
1544
  ### `CrmPriorityRuleConfig`
1515
1545
 
1516
1546
  ```typescript
1517
- export interface CrmPriorityRuleConfig {
1518
- buckets: CrmPriorityBucketDefinition[]
1519
- closedStageKeys: string[]
1520
- followUpAfterDaysByStateKey: Record<string, number>
1521
- staleAfterDays: number
1547
+ export interface CrmPriorityRuleConfig {
1548
+ buckets: CrmPriorityBucketDefinition[]
1549
+ closedStageKeys: string[]
1550
+ followUpAfterDaysByStateKey: Record<string, number>
1551
+ staleAfterDays: number
1522
1552
  }
1523
1553
  ```
1524
1554
 
1525
1555
  ### `CRM_PRIORITY_BUCKETS`
1526
1556
 
1527
1557
  ```typescript
1528
- export const CRM_PRIORITY_BUCKETS: CrmPriorityBucketDefinition[] = [
1529
- { bucketKey: 'needs_response', label: 'Needs Response', rank: 10, color: 'red' },
1530
- { bucketKey: 'follow_up_due', label: 'Follow-up Due', rank: 20, color: 'orange' },
1531
- { bucketKey: 'waiting', label: 'Waiting', rank: 30, color: 'blue' },
1532
- { bucketKey: 'stale', label: 'Stale', rank: 40, color: 'gray' },
1533
- { bucketKey: 'closed_low', label: 'Closed', rank: 50, color: 'dark' }
1558
+ export const CRM_PRIORITY_BUCKETS: CrmPriorityBucketDefinition[] = [
1559
+ { bucketKey: 'needs_response', label: 'Needs Response', rank: 10, color: 'red' },
1560
+ { bucketKey: 'follow_up_due', label: 'Follow-up Due', rank: 20, color: 'orange' },
1561
+ { bucketKey: 'waiting', label: 'Waiting', rank: 30, color: 'blue' },
1562
+ { bucketKey: 'stale', label: 'Stale', rank: 40, color: 'gray' },
1563
+ { bucketKey: 'closed_low', label: 'Closed', rank: 50, color: 'dark' }
1534
1564
  ]
1535
1565
  ```
1536
1566
 
1537
1567
  ### `DEFAULT_CRM_PRIORITY_RULE_CONFIG`
1538
1568
 
1539
1569
  ```typescript
1540
- export const DEFAULT_CRM_PRIORITY_RULE_CONFIG: CrmPriorityRuleConfig = {
1541
- buckets: CRM_PRIORITY_BUCKETS,
1542
- closedStageKeys: ['closed_won', 'closed_lost'],
1543
- followUpAfterDaysByStateKey: {
1544
- discovery_link_sent: 3,
1545
- discovery_nudging: 2,
1546
- reply_sent: 3,
1547
- followup_1_sent: 3,
1548
- followup_2_sent: 5,
1549
- followup_3_sent: 7
1550
- },
1551
- staleAfterDays: 14
1570
+ export const DEFAULT_CRM_PRIORITY_RULE_CONFIG: CrmPriorityRuleConfig = {
1571
+ buckets: CRM_PRIORITY_BUCKETS,
1572
+ closedStageKeys: ['closed_won', 'closed_lost'],
1573
+ followUpAfterDaysByStateKey: {
1574
+ discovery_link_sent: 3,
1575
+ discovery_nudging: 2,
1576
+ reply_sent: 3,
1577
+ followup_1_sent: 3,
1578
+ followup_2_sent: 5,
1579
+ followup_3_sent: 7
1580
+ },
1581
+ staleAfterDays: 14
1552
1582
  }
1553
1583
  ```
1554
1584
 
@@ -1567,242 +1597,242 @@ export const AcqDealTaskKindSchema = z.enum(['call', 'email', 'meeting', 'other'
1567
1597
  ### `DealIdParamsSchema`
1568
1598
 
1569
1599
  ```typescript
1570
- export const DealIdParamsSchema = z.object({
1571
- dealId: UuidSchema
1600
+ export const DealIdParamsSchema = z.object({
1601
+ dealId: UuidSchema
1572
1602
  })
1573
1603
  ```
1574
1604
 
1575
1605
  ### `DealTaskIdParamsSchema`
1576
1606
 
1577
1607
  ```typescript
1578
- export const DealTaskIdParamsSchema = z.object({
1579
- dealId: UuidSchema,
1580
- taskId: UuidSchema
1608
+ export const DealTaskIdParamsSchema = z.object({
1609
+ dealId: UuidSchema,
1610
+ taskId: UuidSchema
1581
1611
  })
1582
1612
  ```
1583
1613
 
1584
1614
  ### `ListDealsQuerySchema`
1585
1615
 
1586
1616
  ```typescript
1587
- export const ListDealsQuerySchema = z
1588
- .object({
1589
- stage: DealStageSchema.optional(),
1590
- list: UuidSchema.optional(),
1591
- batch: z.string().trim().min(1).max(255).optional(),
1592
- staleSince: z.string().datetime().optional(),
1593
- search: z.string().optional(),
1594
- limit: z.coerce.number().int().positive().default(50),
1595
- offset: z.coerce.number().int().min(0).default(0)
1596
- })
1617
+ export const ListDealsQuerySchema = z
1618
+ .object({
1619
+ stage: DealStageSchema.optional(),
1620
+ list: UuidSchema.optional(),
1621
+ batch: z.string().trim().min(1).max(255).optional(),
1622
+ staleSince: z.string().datetime().optional(),
1623
+ search: z.string().optional(),
1624
+ limit: z.coerce.number().int().positive().default(50),
1625
+ offset: z.coerce.number().int().min(0).default(0)
1626
+ })
1597
1627
  .strict()
1598
1628
  ```
1599
1629
 
1600
1630
  ### `DealLookupQuerySchema`
1601
1631
 
1602
1632
  ```typescript
1603
- export const DealLookupQuerySchema = z
1604
- .object({
1605
- search: z.string().trim().min(1).max(200).optional(),
1606
- limit: z.coerce.number().int().min(1).max(25).default(10)
1607
- })
1633
+ export const DealLookupQuerySchema = z
1634
+ .object({
1635
+ search: z.string().trim().min(1).max(200).optional(),
1636
+ limit: z.coerce.number().int().min(1).max(25).default(10)
1637
+ })
1608
1638
  .strict()
1609
1639
  ```
1610
1640
 
1611
1641
  ### `ListDealTasksDueQuerySchema`
1612
1642
 
1613
1643
  ```typescript
1614
- export const ListDealTasksDueQuerySchema = z
1615
- .object({
1616
- window: z.enum(['overdue', 'today', 'today_and_overdue', 'upcoming']).optional(),
1617
- assigneeUserId: UuidSchema.optional()
1618
- })
1644
+ export const ListDealTasksDueQuerySchema = z
1645
+ .object({
1646
+ window: z.enum(['overdue', 'today', 'today_and_overdue', 'upcoming']).optional(),
1647
+ assigneeUserId: UuidSchema.optional()
1648
+ })
1619
1649
  .strict()
1620
1650
  ```
1621
1651
 
1622
1652
  ### `CreateDealNoteRequestSchema`
1623
1653
 
1624
1654
  ```typescript
1625
- export const CreateDealNoteRequestSchema = z
1626
- .object({
1627
- body: z.string().trim().min(1).max(10000)
1628
- })
1655
+ export const CreateDealNoteRequestSchema = z
1656
+ .object({
1657
+ body: z.string().trim().min(1).max(10000)
1658
+ })
1629
1659
  .strict()
1630
1660
  ```
1631
1661
 
1632
1662
  ### `CreateDealTaskRequestSchema`
1633
1663
 
1634
1664
  ```typescript
1635
- export const CreateDealTaskRequestSchema = z
1636
- .object({
1637
- title: z.string().trim().min(1).max(255),
1638
- description: z.string().nullable().optional(),
1639
- kind: AcqDealTaskKindSchema.optional(),
1640
- dueAt: z.string().datetime().nullable().optional(),
1641
- assigneeUserId: UuidSchema.nullable().optional()
1642
- })
1665
+ export const CreateDealTaskRequestSchema = z
1666
+ .object({
1667
+ title: z.string().trim().min(1).max(255),
1668
+ description: z.string().nullable().optional(),
1669
+ kind: AcqDealTaskKindSchema.optional(),
1670
+ dueAt: z.string().datetime().nullable().optional(),
1671
+ assigneeUserId: UuidSchema.nullable().optional()
1672
+ })
1643
1673
  .strict()
1644
1674
  ```
1645
1675
 
1646
1676
  ### `TransitionItemRequestSchema`
1647
1677
 
1648
1678
  ```typescript
1649
- export const TransitionItemRequestSchema = z
1650
- .object({
1651
- pipelineKey: z.string().min(1),
1652
- stageKey: z.string().min(1),
1653
- stateKey: z.string().min(1).nullable().optional(),
1654
- reason: z.string().optional(),
1655
- expectedUpdatedAt: z.string().datetime().optional()
1656
- })
1679
+ export const TransitionItemRequestSchema = z
1680
+ .object({
1681
+ pipelineKey: z.string().min(1),
1682
+ stageKey: z.string().min(1),
1683
+ stateKey: z.string().min(1).nullable().optional(),
1684
+ reason: z.string().optional(),
1685
+ expectedUpdatedAt: z.string().datetime().optional()
1686
+ })
1657
1687
  .strict()
1658
1688
  ```
1659
1689
 
1660
1690
  ### `ExecuteActionParamsSchema`
1661
1691
 
1662
1692
  ```typescript
1663
- export const ExecuteActionParamsSchema = z
1664
- .object({
1665
- dealId: UuidSchema,
1666
- actionKey: NonEmptyStringSchema
1667
- })
1693
+ export const ExecuteActionParamsSchema = z
1694
+ .object({
1695
+ dealId: UuidSchema,
1696
+ actionKey: NonEmptyStringSchema
1697
+ })
1668
1698
  .strict()
1669
1699
  ```
1670
1700
 
1671
1701
  ### `ExecuteActionRequestSchema`
1672
1702
 
1673
1703
  ```typescript
1674
- export const ExecuteActionRequestSchema = z
1675
- .object({
1676
- payload: z.record(z.string(), z.unknown()).optional()
1677
- })
1704
+ export const ExecuteActionRequestSchema = z
1705
+ .object({
1706
+ payload: z.record(z.string(), z.unknown()).optional()
1707
+ })
1678
1708
  .strict()
1679
1709
  ```
1680
1710
 
1681
1711
  ### `DealContactSummarySchema`
1682
1712
 
1683
1713
  ```typescript
1684
- /**
1685
- * Contact summary nested inside DealListItem / DealDetailResponse.
1686
- * Matches the joined shape returned by useDeals / useDealDetail Supabase queries.
1687
- */
1688
- export const DealContactSummarySchema = z.object({
1689
- id: z.string(),
1690
- first_name: z.string().nullable(),
1691
- last_name: z.string().nullable(),
1692
- email: z.string(),
1693
- title: z.string().nullable(),
1694
- headline: z.string().nullable(),
1695
- linkedin_url: z.string().nullable(),
1696
- processing_state: ProcessingStateSchema.nullable(),
1697
- enrichment_data: z.record(z.string(), z.unknown()).nullable(),
1698
- company: z
1699
- .object({
1700
- id: z.string(),
1701
- name: z.string(),
1702
- domain: z.string().nullable(),
1703
- website: z.string().nullable(),
1704
- linkedin_url: z.string().nullable(),
1705
- segment: z.string().nullable(),
1706
- category: z.string().nullable(),
1707
- num_employees: z.number().nullable()
1708
- })
1709
- .nullable()
1714
+ /**
1715
+ * Contact summary nested inside DealListItem / DealDetailResponse.
1716
+ * Matches the joined shape returned by useDeals / useDealDetail Supabase queries.
1717
+ */
1718
+ export const DealContactSummarySchema = z.object({
1719
+ id: z.string(),
1720
+ first_name: z.string().nullable(),
1721
+ last_name: z.string().nullable(),
1722
+ email: z.string(),
1723
+ title: z.string().nullable(),
1724
+ headline: z.string().nullable(),
1725
+ linkedin_url: z.string().nullable(),
1726
+ processing_state: ProcessingStateSchema.nullable(),
1727
+ enrichment_data: z.record(z.string(), z.unknown()).nullable(),
1728
+ company: z
1729
+ .object({
1730
+ id: z.string(),
1731
+ name: z.string(),
1732
+ domain: z.string().nullable(),
1733
+ website: z.string().nullable(),
1734
+ linkedin_url: z.string().nullable(),
1735
+ segment: z.string().nullable(),
1736
+ category: z.string().nullable(),
1737
+ num_employees: z.number().nullable()
1738
+ })
1739
+ .nullable()
1710
1740
  })
1711
1741
  ```
1712
1742
 
1713
1743
  ### `DealPrioritySchema`
1714
1744
 
1715
1745
  ```typescript
1716
- export const DealPrioritySchema = z.object({
1717
- bucketKey: z.enum(['needs_response', 'follow_up_due', 'waiting', 'stale', 'closed_low']),
1718
- rank: z.number().int(),
1719
- label: z.string(),
1720
- color: z.string(),
1721
- reason: z.string(),
1722
- latestActivityAt: z.string().nullable(),
1723
- nextActionAt: z.string().nullable()
1746
+ export const DealPrioritySchema = z.object({
1747
+ bucketKey: z.enum(['needs_response', 'follow_up_due', 'waiting', 'stale', 'closed_low']),
1748
+ rank: z.number().int(),
1749
+ label: z.string(),
1750
+ color: z.string(),
1751
+ reason: z.string(),
1752
+ latestActivityAt: z.string().nullable(),
1753
+ nextActionAt: z.string().nullable()
1724
1754
  })
1725
1755
  ```
1726
1756
 
1727
1757
  ### `DealListItemSchema`
1728
1758
 
1729
1759
  ```typescript
1730
- /**
1731
- * Deal list item with joined contact (and company via contact).
1732
- * Matches DealListItem from @repo/core types.
1733
- */
1734
- export const DealListItemSchema = z.object({
1735
- // acq_deals columns
1736
- id: z.string(),
1737
- organization_id: z.string(),
1738
- client_id: z.string().nullable().optional(),
1739
- contact_id: z.string().nullable(),
1740
- contact_email: z.string(),
1741
- pipeline_key: z.string(),
1742
- stage_key: z.string().nullable(),
1743
- state_key: z.string().nullable(),
1744
- activity_log: z.unknown(),
1745
- discovery_data: z.unknown().nullable(),
1746
- discovery_submitted_at: z.string().nullable(),
1747
- discovery_submitted_by: z.string().nullable(),
1748
- proposal_data: z.unknown().nullable(),
1749
- proposal_sent_at: z.string().nullable(),
1750
- proposal_pdf_url: z.string().nullable(),
1751
- signature_envelope_id: z.string().nullable(),
1752
- source_list_id: z.string().nullable(),
1753
- source_type: z.string().nullable(),
1754
- initial_fee: z.number().nullable(),
1755
- monthly_fee: z.number().nullable(),
1756
- closed_lost_at: z.string().nullable(),
1757
- closed_lost_reason: z.string().nullable(),
1758
- created_at: z.string(),
1759
- updated_at: z.string(),
1760
- priority: DealPrioritySchema,
1761
- ownership: z.enum(['us', 'them']).nullable(),
1762
- nextAction: z.string().nullable(),
1763
- // joined relation
1764
- contact: DealContactSummarySchema.nullable()
1760
+ /**
1761
+ * Deal list item with joined contact (and company via contact).
1762
+ * Matches DealListItem from @repo/core types.
1763
+ */
1764
+ export const DealListItemSchema = z.object({
1765
+ // acq_deals columns
1766
+ id: z.string(),
1767
+ organization_id: z.string(),
1768
+ client_id: z.string().nullable().optional(),
1769
+ contact_id: z.string().nullable(),
1770
+ contact_email: z.string(),
1771
+ pipeline_key: z.string(),
1772
+ stage_key: z.string().nullable(),
1773
+ state_key: z.string().nullable(),
1774
+ activity_log: z.unknown(),
1775
+ discovery_data: z.unknown().nullable(),
1776
+ discovery_submitted_at: z.string().nullable(),
1777
+ discovery_submitted_by: z.string().nullable(),
1778
+ proposal_data: z.unknown().nullable(),
1779
+ proposal_sent_at: z.string().nullable(),
1780
+ proposal_pdf_url: z.string().nullable(),
1781
+ signature_envelope_id: z.string().nullable(),
1782
+ source_list_id: z.string().nullable(),
1783
+ source_type: z.string().nullable(),
1784
+ initial_fee: z.number().nullable(),
1785
+ monthly_fee: z.number().nullable(),
1786
+ closed_lost_at: z.string().nullable(),
1787
+ closed_lost_reason: z.string().nullable(),
1788
+ created_at: z.string(),
1789
+ updated_at: z.string(),
1790
+ priority: DealPrioritySchema,
1791
+ ownership: z.enum(['us', 'them']).nullable(),
1792
+ nextAction: z.string().nullable(),
1793
+ // joined relation
1794
+ contact: DealContactSummarySchema.nullable()
1765
1795
  })
1766
1796
  ```
1767
1797
 
1768
1798
  ### `DealListResponseSchema`
1769
1799
 
1770
1800
  ```typescript
1771
- export const DealListResponseSchema = z.object({
1772
- data: z.array(DealListItemSchema),
1773
- total: z.number().int(),
1774
- limit: z.number().int(),
1775
- offset: z.number().int()
1801
+ export const DealListResponseSchema = z.object({
1802
+ data: z.array(DealListItemSchema),
1803
+ total: z.number().int(),
1804
+ limit: z.number().int(),
1805
+ offset: z.number().int()
1776
1806
  })
1777
1807
  ```
1778
1808
 
1779
1809
  ### `DealDetailResponseSchema`
1780
1810
 
1781
1811
  ```typescript
1782
- /**
1783
- * Deal detail shape — currently the same as a list item (full joined record).
1784
- * Additive fields keep existing DealListItem callers compatible.
1785
- */
1786
- export const DealDetailResponseSchema = DealListItemSchema.extend({
1787
- conversation: DealConversationSchema,
1788
- lineage: DealLineageSchema.optional()
1812
+ /**
1813
+ * Deal detail shape — currently the same as a list item (full joined record).
1814
+ * Additive fields keep existing DealListItem callers compatible.
1815
+ */
1816
+ export const DealDetailResponseSchema = DealListItemSchema.extend({
1817
+ conversation: DealConversationSchema,
1818
+ lineage: DealLineageSchema.optional()
1789
1819
  })
1790
1820
  ```
1791
1821
 
1792
1822
  ### `DealNoteResponseSchema`
1793
1823
 
1794
1824
  ```typescript
1795
- /**
1796
- * Single acq_deal_notes row (camelCase API representation).
1797
- */
1798
- export const DealNoteResponseSchema = z.object({
1799
- id: z.string(),
1800
- dealId: z.string(),
1801
- organizationId: z.string(),
1802
- authorUserId: z.string().nullable(),
1803
- body: z.string(),
1804
- createdAt: z.string(),
1805
- updatedAt: z.string()
1825
+ /**
1826
+ * Single acq_deal_notes row (camelCase API representation).
1827
+ */
1828
+ export const DealNoteResponseSchema = z.object({
1829
+ id: z.string(),
1830
+ dealId: z.string(),
1831
+ organizationId: z.string(),
1832
+ authorUserId: z.string().nullable(),
1833
+ body: z.string(),
1834
+ createdAt: z.string(),
1835
+ updatedAt: z.string()
1806
1836
  })
1807
1837
  ```
1808
1838
 
@@ -1815,24 +1845,24 @@ export const DealNoteListResponseSchema = z.array(DealNoteResponseSchema)
1815
1845
  ### `DealTaskResponseSchema`
1816
1846
 
1817
1847
  ```typescript
1818
- /**
1819
- * Single acq_deal_tasks row (camelCase API representation).
1820
- * Matches AcqDealTask domain type from types.ts.
1821
- */
1822
- export const DealTaskResponseSchema = z.object({
1823
- id: z.string(),
1824
- organizationId: z.string(),
1825
- dealId: z.string(),
1826
- title: z.string(),
1827
- description: z.string().nullable(),
1828
- kind: AcqDealTaskKindSchema,
1829
- dueAt: z.string().nullable(),
1830
- assigneeUserId: z.string().nullable(),
1831
- completedAt: z.string().nullable(),
1832
- completedByUserId: z.string().nullable(),
1833
- createdAt: z.string(),
1834
- updatedAt: z.string(),
1835
- createdByUserId: z.string().nullable()
1848
+ /**
1849
+ * Single acq_deal_tasks row (camelCase API representation).
1850
+ * Matches AcqDealTask domain type from types.ts.
1851
+ */
1852
+ export const DealTaskResponseSchema = z.object({
1853
+ id: z.string(),
1854
+ organizationId: z.string(),
1855
+ dealId: z.string(),
1856
+ title: z.string(),
1857
+ description: z.string().nullable(),
1858
+ kind: AcqDealTaskKindSchema,
1859
+ dueAt: z.string().nullable(),
1860
+ assigneeUserId: z.string().nullable(),
1861
+ completedAt: z.string().nullable(),
1862
+ completedByUserId: z.string().nullable(),
1863
+ createdAt: z.string(),
1864
+ updatedAt: z.string(),
1865
+ createdByUserId: z.string().nullable()
1836
1866
  })
1837
1867
  ```
1838
1868
 
@@ -1845,44 +1875,44 @@ export const DealTaskListResponseSchema = z.array(DealTaskResponseSchema)
1845
1875
  ### `DealSchemas`
1846
1876
 
1847
1877
  ```typescript
1848
- export const DealSchemas = {
1849
- // Primitives
1850
- CrmStageKey: CrmStageKeySchema,
1851
- CrmStateKey: CrmStateKeySchema,
1852
- DealStage: DealStageSchema,
1853
-
1854
- // Params
1855
- DealIdParams: DealIdParamsSchema,
1856
- DealTaskIdParams: DealTaskIdParamsSchema,
1857
-
1858
- // Queries
1859
- ListDealsQuery: ListDealsQuerySchema,
1860
- DealLookupQuery: DealLookupQuerySchema,
1861
- ListDealTasksDueQuery: ListDealTasksDueQuerySchema,
1862
-
1863
- // Request bodies
1864
- CreateDealNoteRequest: CreateDealNoteRequestSchema,
1865
- CreateDealTaskRequest: CreateDealTaskRequestSchema,
1866
- TransitionItemRequest: CrmTransitionItemRequestSchema,
1867
- TransitionDealStateRequest: TransitionDealStateRequestSchema,
1868
- ExecuteActionParams: ExecuteActionParamsSchema,
1869
- ExecuteActionRequest: ExecuteActionRequestSchema,
1870
-
1871
- // Responses
1872
- DealPriority: DealPrioritySchema,
1873
- DealListResponse: DealListResponseSchema,
1874
- DealSummaryResponse: DealSummaryResponseSchema,
1875
- DealLookupResponse: DealLookupResponseSchema,
1876
- ConversationMessage: ConversationMessageSchema,
1877
- DealLineageListRef: DealLineageListRefSchema,
1878
- DealLineageProjectRef: DealLineageProjectRefSchema,
1879
- DealLineageClientRef: DealLineageClientRefSchema,
1880
- DealLineage: DealLineageSchema,
1881
- DealDetailResponse: DealDetailResponseSchema,
1882
- DealNoteResponse: DealNoteResponseSchema,
1883
- DealNoteListResponse: DealNoteListResponseSchema,
1884
- DealTaskResponse: DealTaskResponseSchema,
1885
- DealTaskListResponse: DealTaskListResponseSchema
1878
+ export const DealSchemas = {
1879
+ // Primitives
1880
+ CrmStageKey: CrmStageKeySchema,
1881
+ CrmStateKey: CrmStateKeySchema,
1882
+ DealStage: DealStageSchema,
1883
+
1884
+ // Params
1885
+ DealIdParams: DealIdParamsSchema,
1886
+ DealTaskIdParams: DealTaskIdParamsSchema,
1887
+
1888
+ // Queries
1889
+ ListDealsQuery: ListDealsQuerySchema,
1890
+ DealLookupQuery: DealLookupQuerySchema,
1891
+ ListDealTasksDueQuery: ListDealTasksDueQuerySchema,
1892
+
1893
+ // Request bodies
1894
+ CreateDealNoteRequest: CreateDealNoteRequestSchema,
1895
+ CreateDealTaskRequest: CreateDealTaskRequestSchema,
1896
+ TransitionItemRequest: CrmTransitionItemRequestSchema,
1897
+ TransitionDealStateRequest: TransitionDealStateRequestSchema,
1898
+ ExecuteActionParams: ExecuteActionParamsSchema,
1899
+ ExecuteActionRequest: ExecuteActionRequestSchema,
1900
+
1901
+ // Responses
1902
+ DealPriority: DealPrioritySchema,
1903
+ DealListResponse: DealListResponseSchema,
1904
+ DealSummaryResponse: DealSummaryResponseSchema,
1905
+ DealLookupResponse: DealLookupResponseSchema,
1906
+ ConversationMessage: ConversationMessageSchema,
1907
+ DealLineageListRef: DealLineageListRefSchema,
1908
+ DealLineageProjectRef: DealLineageProjectRefSchema,
1909
+ DealLineageClientRef: DealLineageClientRefSchema,
1910
+ DealLineage: DealLineageSchema,
1911
+ DealDetailResponse: DealDetailResponseSchema,
1912
+ DealNoteResponse: DealNoteResponseSchema,
1913
+ DealNoteListResponse: DealNoteListResponseSchema,
1914
+ DealTaskResponse: DealTaskResponseSchema,
1915
+ DealTaskListResponse: DealTaskListResponseSchema
1886
1916
  }
1887
1917
  ```
1888
1918
 
@@ -1899,12 +1929,12 @@ export interface Action {
1899
1929
  ### `ActionDef`
1900
1930
 
1901
1931
  ```typescript
1902
- export interface ActionDef {
1903
- key: string
1904
- label: string
1905
- isAvailableFor: (deal: AcqDealRow) => boolean
1906
- workflowId: string
1907
- payloadSchema?: z.ZodTypeAny
1932
+ export interface ActionDef {
1933
+ key: string
1934
+ label: string
1935
+ isAvailableFor: (deal: AcqDealRow) => boolean
1936
+ workflowId: string
1937
+ payloadSchema?: z.ZodTypeAny
1908
1938
  }
1909
1939
  ```
1910
1940
 
@@ -1912,66 +1942,42 @@ export interface ActionDef {
1912
1942
 
1913
1943
  ```typescript
1914
1944
  export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
1915
- {
1916
- key: 'move_to_proposal',
1917
- label: 'Move to Proposal',
1918
- isAvailableFor: (deal) => deal.stage_key === 'interested',
1919
- workflowId: 'move_to_proposal-workflow'
1920
- },
1921
- {
1922
- key: 'move_to_closing',
1923
- label: 'Move to Closing',
1924
- isAvailableFor: (deal) => deal.stage_key === 'proposal',
1925
- workflowId: 'move_to_closing-workflow'
1926
- },
1927
- {
1928
- key: 'move_to_closed_won',
1929
- label: 'Close Won',
1930
- isAvailableFor: (deal) => deal.stage_key === 'closing',
1931
- workflowId: 'move_to_closed_won-workflow'
1932
- },
1933
- {
1934
- key: 'move_to_closed_lost',
1935
- label: 'Close Lost',
1945
+ crmAction('move_to_proposal', {
1946
+ isAvailableFor: (deal) => deal.stage_key === 'interested'
1947
+ }),
1948
+ crmAction('move_to_closing', {
1949
+ isAvailableFor: (deal) => deal.stage_key === 'proposal'
1950
+ }),
1951
+ crmAction('move_to_closed_won', {
1952
+ isAvailableFor: (deal) => deal.stage_key === 'closing'
1953
+ }),
1954
+ crmAction('move_to_closed_lost', {
1936
1955
  isAvailableFor: (deal) =>
1937
- deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
1938
- workflowId: 'move_to_closed_lost-workflow'
1939
- },
1940
- {
1941
- key: 'move_to_nurturing',
1942
- label: 'Move to Nurturing',
1956
+ deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing'
1957
+ }),
1958
+ crmAction('move_to_nurturing', {
1943
1959
  isAvailableFor: (deal) =>
1944
- deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
1945
- workflowId: 'move_to_nurturing-workflow'
1946
- },
1947
- {
1948
- key: 'send_reply',
1949
- label: 'Send Reply',
1950
- isAvailableFor: (deal) =>
1951
- deal.stage_key === 'interested' &&
1952
- isOurReplyAction(deal) &&
1953
- (deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey ||
1954
- deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
1955
- deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
1956
- workflowId: 'crm-send-reply-workflow',
1960
+ deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing'
1961
+ }),
1962
+ crmAction('send_reply', {
1963
+ isAvailableFor: (deal) =>
1964
+ deal.stage_key === 'interested' &&
1965
+ isOurReplyAction(deal) &&
1966
+ (deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey ||
1967
+ deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
1968
+ deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
1957
1969
  payloadSchema: SendReplyActionPayloadSchema
1958
- },
1959
- {
1960
- key: 'send_link',
1961
- label: 'Send Booking Link',
1970
+ }),
1971
+ crmAction('send_link', {
1962
1972
  isAvailableFor: (deal) =>
1963
- deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey,
1964
- workflowId: 'crm-send-booking-link-workflow'
1965
- },
1966
- {
1967
- key: 'send_nudge',
1968
- label: 'Send Nudge',
1973
+ deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey
1974
+ }),
1975
+ crmAction('send_nudge', {
1969
1976
  isAvailableFor: (deal) =>
1970
1977
  deal.stage_key === 'interested' &&
1971
1978
  (deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
1972
- deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
1973
- workflowId: 'crm-send-nudge-workflow'
1974
- },
1979
+ deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey)
1980
+ }),
1975
1981
  {
1976
1982
  key: 'mark_no_show',
1977
1983
  label: 'Mark No-Show',
@@ -1982,32 +1988,29 @@ export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
1982
1988
  // event captures operator intent and distinguishes the manual variant from the timed one.
1983
1989
  workflowId: 'mark_no_show-workflow'
1984
1990
  },
1985
- {
1986
- key: 'rebook',
1987
- label: 'Rebook',
1991
+ crmAction('rebook', {
1988
1992
  isAvailableFor: (deal) =>
1989
- deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_BOOKING_CANCELLED_STATE.stateKey,
1990
- workflowId: 'crm-rebook-workflow'
1991
- }
1993
+ deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_BOOKING_CANCELLED_STATE.stateKey
1994
+ })
1992
1995
  ]
1993
1996
  ```
1994
1997
 
1995
1998
  ### `CrmToolMap`
1996
1999
 
1997
2000
  ```typescript
1998
- export type CrmToolMap = {
1999
- getRecentActivity: { params: CrmRecentActivityParams; result: RecentActivityEntry[] }
2000
- listDeals: { params: CrmListDealsParams; result: DealListItem[] }
2001
- getDeal: { params: CrmGetDealParams; result: DealDetail | null }
2002
- getDealByEmail: { params: CrmGetDealByEmailParams; result: DealDetail | null }
2003
- createDealNote: { params: CrmDealNoteParams; result: AcqDealNote }
2004
- listDealNotes: { params: Omit<ListDealNotesParams, 'organizationId'>; result: AcqDealNote[] }
2005
- createDealTask: { params: CrmDealTaskParams; result: AcqDealTask }
2006
- listDealTasks: { params: Omit<ListDealTasksParams, 'organizationId'>; result: AcqDealTask[] }
2007
- listDealTasksDue: { params: CrmTaskDueParams; result: AcqDealTask[] }
2008
- completeDealTask: { params: Omit<CompleteDealTaskParams, 'organizationId'>; result: AcqDealTask }
2009
- recordActivity: { params: CrmRecordActivityParams; result: void }
2010
- deleteDeal: { params: CrmDeleteDealParams; result: void }
2001
+ export type CrmToolMap = {
2002
+ getRecentActivity: { params: CrmRecentActivityParams; result: RecentActivityEntry[] }
2003
+ listDeals: { params: CrmListDealsParams; result: DealListItem[] }
2004
+ getDeal: { params: CrmGetDealParams; result: DealDetail | null }
2005
+ getDealByEmail: { params: CrmGetDealByEmailParams; result: DealDetail | null }
2006
+ createDealNote: { params: CrmDealNoteParams; result: AcqDealNote }
2007
+ listDealNotes: { params: Omit<ListDealNotesParams, 'organizationId'>; result: AcqDealNote[] }
2008
+ createDealTask: { params: CrmDealTaskParams; result: AcqDealTask }
2009
+ listDealTasks: { params: Omit<ListDealTasksParams, 'organizationId'>; result: AcqDealTask[] }
2010
+ listDealTasksDue: { params: CrmTaskDueParams; result: AcqDealTask[] }
2011
+ completeDealTask: { params: Omit<CompleteDealTaskParams, 'organizationId'>; result: AcqDealTask }
2012
+ recordActivity: { params: CrmRecordActivityParams; result: void }
2013
+ deleteDeal: { params: CrmDeleteDealParams; result: void }
2011
2014
  }
2012
2015
  ```
2013
2016
 
@@ -2016,402 +2019,402 @@ export type CrmToolMap = {
2016
2019
  ### `WebPost`
2017
2020
 
2018
2021
  ```typescript
2019
- /**
2020
- * Represents a web post from company website scraping.
2021
- * Used for recent blog posts, news, or announcements.
2022
- */
2023
- export interface WebPost {
2024
- /** ISO date string of when the post was published */
2025
- date: string
2026
- /** Title of the web post */
2027
- title: string
2028
- /** Brief summary of the post content */
2029
- summary: string
2030
- /** AI-generated insight about the post's relevance */
2031
- aiInsight?: string
2022
+ /**
2023
+ * Represents a web post from company website scraping.
2024
+ * Used for recent blog posts, news, or announcements.
2025
+ */
2026
+ export interface WebPost {
2027
+ /** ISO date string of when the post was published */
2028
+ date: string
2029
+ /** Title of the web post */
2030
+ title: string
2031
+ /** Brief summary of the post content */
2032
+ summary: string
2033
+ /** AI-generated insight about the post's relevance */
2034
+ aiInsight?: string
2032
2035
  }
2033
2036
  ```
2034
2037
 
2035
2038
  ### `CompanyEnrichmentData`
2036
2039
 
2037
2040
  ```typescript
2038
- /**
2039
- * Enrichment data collected for a company from various sources.
2040
- */
2041
- export interface CompanyEnrichmentData {
2042
- googleMaps?: {
2043
- placeId?: string
2044
- totalScore?: number
2045
- reviewsCount?: number
2046
- address?: string
2047
- phone?: string
2048
- categoryName?: string
2049
- googleMapsUrl?: string
2050
- scrapedAt?: string
2051
- }
2052
- websiteCrawl?: {
2053
- companyDescription?: string
2054
- services?: string[]
2055
- specialties?: string[]
2056
- staff?: Array<{ name: string; title?: string; email?: string }>
2057
- automationGaps?: string[]
2058
- targetAudience?: string
2059
- category?: string
2060
- segment?: string
2061
- recentWin?: string
2062
- emailCount?: number
2063
- pageCount?: number
2064
- totalChars?: number
2065
- crawledAt?: string
2066
- extractedAt?: string
2067
- }
2068
- website?: {
2069
- missionVision?: string
2070
- uniqueAttributes?: string
2071
- coreOfferings?: string
2072
- targetAudience?: string
2073
- companyValues?: string
2074
- businessDescription?: string
2075
- recentPosts?: Array<{ date?: string; title?: string; summary?: string; aiInsight?: string }>
2076
- }
2077
- tomba?: {
2078
- waterfallEmail?: {
2079
- email: string
2080
- name?: string
2081
- title?: string
2082
- department?: string
2083
- } | null
2084
- genericEmail?: string | null
2085
- totalFound?: number
2086
- searchedAt?: string
2087
- }
2041
+ /**
2042
+ * Enrichment data collected for a company from various sources.
2043
+ */
2044
+ export interface CompanyEnrichmentData {
2045
+ googleMaps?: {
2046
+ placeId?: string
2047
+ totalScore?: number
2048
+ reviewsCount?: number
2049
+ address?: string
2050
+ phone?: string
2051
+ categoryName?: string
2052
+ googleMapsUrl?: string
2053
+ scrapedAt?: string
2054
+ }
2055
+ websiteCrawl?: {
2056
+ companyDescription?: string
2057
+ services?: string[]
2058
+ specialties?: string[]
2059
+ staff?: Array<{ name: string; title?: string; email?: string }>
2060
+ automationGaps?: string[]
2061
+ targetAudience?: string
2062
+ category?: string
2063
+ segment?: string
2064
+ recentWin?: string
2065
+ emailCount?: number
2066
+ pageCount?: number
2067
+ totalChars?: number
2068
+ crawledAt?: string
2069
+ extractedAt?: string
2070
+ }
2071
+ website?: {
2072
+ missionVision?: string
2073
+ uniqueAttributes?: string
2074
+ coreOfferings?: string
2075
+ targetAudience?: string
2076
+ companyValues?: string
2077
+ businessDescription?: string
2078
+ recentPosts?: Array<{ date?: string; title?: string; summary?: string; aiInsight?: string }>
2079
+ }
2080
+ tomba?: {
2081
+ waterfallEmail?: {
2082
+ email: string
2083
+ name?: string
2084
+ title?: string
2085
+ department?: string
2086
+ } | null
2087
+ genericEmail?: string | null
2088
+ totalFound?: number
2089
+ searchedAt?: string
2090
+ }
2088
2091
  }
2089
2092
  ```
2090
2093
 
2091
2094
  ### `ContactEnrichmentData`
2092
2095
 
2093
2096
  ```typescript
2094
- /**
2095
- * Enrichment data collected for a contact from various sources.
2096
- */
2097
- export interface ContactEnrichmentData {
2098
- linkedin?: {
2099
- summary?: string
2100
- pastExperience?: string
2101
- education?: string
2102
- activity?: Array<{ date?: string; content?: string }>
2103
- }
2097
+ /**
2098
+ * Enrichment data collected for a contact from various sources.
2099
+ */
2100
+ export interface ContactEnrichmentData {
2101
+ linkedin?: {
2102
+ summary?: string
2103
+ pastExperience?: string
2104
+ education?: string
2105
+ activity?: Array<{ date?: string; content?: string }>
2106
+ }
2104
2107
  }
2105
2108
  ```
2106
2109
 
2107
2110
  ### `AcqList`
2108
2111
 
2109
2112
  ```typescript
2110
- export interface AcqList {
2111
- id: string
2112
- organizationId: string
2113
- name: string
2114
- description: string | null
2115
- batchIds: string[]
2116
- instantlyCampaignId: string | null
2117
- status: ListStatus
2118
- scrapingConfig: ScrapingConfig
2119
- icp: IcpRubric
2120
- pipelineConfig: PipelineConfig
2121
- metadata: AcqListMetadata
2122
- launchedAt: Date | null
2123
- completedAt: Date | null
2124
- createdAt: Date
2113
+ export interface AcqList {
2114
+ id: string
2115
+ organizationId: string
2116
+ name: string
2117
+ description: string | null
2118
+ batchIds: string[]
2119
+ instantlyCampaignId: string | null
2120
+ status: ListStatus
2121
+ scrapingConfig: ScrapingConfig
2122
+ icp: IcpRubric
2123
+ pipelineConfig: PipelineConfig
2124
+ metadata: AcqListMetadata
2125
+ launchedAt: Date | null
2126
+ completedAt: Date | null
2127
+ createdAt: Date
2125
2128
  }
2126
2129
  ```
2127
2130
 
2128
2131
  ### `AcqCompany`
2129
2132
 
2130
2133
  ```typescript
2131
- /**
2132
- * Company record in the acquisition database.
2133
- * Contains enriched company data from various sources.
2134
- * Transformed from AcqCompanyRow with camelCase properties.
2135
- */
2136
- export interface AcqCompany {
2137
- id: string
2138
- organizationId: string
2139
- name: string
2140
- domain: string | null
2141
- linkedinUrl: string | null
2142
- website: string | null
2143
- numEmployees: number | null
2144
- foundedYear: number | null
2145
- locationCity: string | null
2146
- locationState: string | null
2147
- category: string | null
2148
- categoryPain: string | null
2149
- segment: string | null
2150
- processingState: CompanyProcessingState | null
2151
- /** @deprecated Use `processingState`. This legacy DB column has been removed; responses return null. */
2152
- pipelineStatus?: LegacyPipelineStatus | null
2153
- enrichmentData: CompanyEnrichmentData | null
2154
- source: string | null
2155
- batchId: string | null
2156
- status: 'active' | 'invalid'
2157
- verticalResearch: string | null
2158
- /** Track A: flat qualification score (null until a scoring rubric is defined). Added by W1 migration. */
2159
- qualificationScore: number | null
2160
- /** Track A: flat qualification signals jsonb preserving the result payload shape. Added by W1 migration. */
2161
- qualificationSignals: Record<string, unknown> | null
2162
- /** Track A: key identifying the rubric used for qualification. Added by W1 migration. */
2163
- qualificationRubricKey: string | null
2164
- createdAt: Date
2165
- updatedAt: Date
2134
+ /**
2135
+ * Company record in the acquisition database.
2136
+ * Contains enriched company data from various sources.
2137
+ * Transformed from AcqCompanyRow with camelCase properties.
2138
+ */
2139
+ export interface AcqCompany {
2140
+ id: string
2141
+ organizationId: string
2142
+ name: string
2143
+ domain: string | null
2144
+ linkedinUrl: string | null
2145
+ website: string | null
2146
+ numEmployees: number | null
2147
+ foundedYear: number | null
2148
+ locationCity: string | null
2149
+ locationState: string | null
2150
+ category: string | null
2151
+ categoryPain: string | null
2152
+ segment: string | null
2153
+ processingState: CompanyProcessingState | null
2154
+ /** @deprecated Use `processingState`. This legacy DB column has been removed; responses return null. */
2155
+ pipelineStatus?: LegacyPipelineStatus | null
2156
+ enrichmentData: CompanyEnrichmentData | null
2157
+ source: string | null
2158
+ batchId: string | null
2159
+ status: 'active' | 'invalid'
2160
+ verticalResearch: string | null
2161
+ /** Track A: flat qualification score (null until a scoring rubric is defined). Added by W1 migration. */
2162
+ qualificationScore: number | null
2163
+ /** Track A: flat qualification signals jsonb preserving the result payload shape. Added by W1 migration. */
2164
+ qualificationSignals: Record<string, unknown> | null
2165
+ /** Track A: key identifying the rubric used for qualification. Added by W1 migration. */
2166
+ qualificationRubricKey: string | null
2167
+ createdAt: Date
2168
+ updatedAt: Date
2166
2169
  }
2167
2170
  ```
2168
2171
 
2169
2172
  ### `AcqContact`
2170
2173
 
2171
2174
  ```typescript
2172
- /**
2173
- * Contact record in the acquisition database.
2174
- * Contains enriched contact data and personalization content.
2175
- * Transformed from AcqContactRow with camelCase properties.
2176
- */
2177
- export interface AcqContact {
2178
- id: string
2179
- organizationId: string
2180
- companyId: string | null
2181
- email: string
2182
- emailValid: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN' | null
2183
- firstName: string | null
2184
- lastName: string | null
2185
- linkedinUrl: string | null
2186
- title: string | null
2187
- headline: string | null
2188
- filterReason: string | null
2189
- openingLine: string | null
2190
- source: string | null
2191
- sourceId: string | null
2192
- processingState: ContactProcessingState | null
2193
- /** @deprecated Use `processingState`. This legacy DB column has been removed; responses return null. */
2194
- pipelineStatus?: LegacyPipelineStatus | null
2195
- enrichmentData: ContactEnrichmentData | null
2196
- /** Attio Person record ID - set when contact responds and is added to CRM */
2197
- attioPersonId: string | null
2198
- batchId: string | null
2199
- status: 'active' | 'invalid'
2200
- createdAt: Date
2201
- updatedAt: Date
2175
+ /**
2176
+ * Contact record in the acquisition database.
2177
+ * Contains enriched contact data and personalization content.
2178
+ * Transformed from AcqContactRow with camelCase properties.
2179
+ */
2180
+ export interface AcqContact {
2181
+ id: string
2182
+ organizationId: string
2183
+ companyId: string | null
2184
+ email: string
2185
+ emailValid: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN' | null
2186
+ firstName: string | null
2187
+ lastName: string | null
2188
+ linkedinUrl: string | null
2189
+ title: string | null
2190
+ headline: string | null
2191
+ filterReason: string | null
2192
+ openingLine: string | null
2193
+ source: string | null
2194
+ sourceId: string | null
2195
+ processingState: ContactProcessingState | null
2196
+ /** @deprecated Use `processingState`. This legacy DB column has been removed; responses return null. */
2197
+ pipelineStatus?: LegacyPipelineStatus | null
2198
+ enrichmentData: ContactEnrichmentData | null
2199
+ /** Attio Person record ID - set when contact responds and is added to CRM */
2200
+ attioPersonId: string | null
2201
+ batchId: string | null
2202
+ status: 'active' | 'invalid'
2203
+ createdAt: Date
2204
+ updatedAt: Date
2202
2205
  }
2203
2206
  ```
2204
2207
 
2205
2208
  ### `ListTelemetry`
2206
2209
 
2207
2210
  ```typescript
2208
- /**
2209
- * Live-scan aggregate telemetry for a single list, computed on demand from
2210
- * the list junction tables and current contact deliverability state.
2211
- * `stageCounts` are attempted counts from list-row processing_state.
2212
- */
2213
- export interface ListTelemetry {
2214
- listId: string
2215
- totalCompanies: number
2216
- totalContacts: number
2217
- stageCounts: {
2218
- populated: number
2219
- extracted: number
2220
- qualified: number
2221
- discovered: number
2222
- verified: number
2223
- personalized: number
2224
- uploaded: number
2225
- }
2226
- deliverability: {
2227
- valid: number
2228
- risky: number
2229
- invalid: number
2230
- unknown: number
2231
- bounced: number
2232
- }
2233
- /** Reserved -- active workflow IDs associated with this list. */
2234
- activeWorkflows?: string[]
2211
+ /**
2212
+ * Live-scan aggregate telemetry for a single list, computed on demand from
2213
+ * the list junction tables and current contact deliverability state.
2214
+ * `stageCounts` are attempted counts from list-row processing_state.
2215
+ */
2216
+ export interface ListTelemetry {
2217
+ listId: string
2218
+ totalCompanies: number
2219
+ totalContacts: number
2220
+ stageCounts: {
2221
+ populated: number
2222
+ extracted: number
2223
+ qualified: number
2224
+ discovered: number
2225
+ verified: number
2226
+ personalized: number
2227
+ uploaded: number
2228
+ }
2229
+ deliverability: {
2230
+ valid: number
2231
+ risky: number
2232
+ invalid: number
2233
+ unknown: number
2234
+ bounced: number
2235
+ }
2236
+ /** Reserved -- active workflow IDs associated with this list. */
2237
+ activeWorkflows?: string[]
2235
2238
  }
2236
2239
  ```
2237
2240
 
2238
2241
  ### `ListStageCountsSchema`
2239
2242
 
2240
2243
  ```typescript
2241
- export const ListStageCountsSchema = z.object({
2242
- // Attempted counts by canonical lead-gen stage. The detailed status
2243
- // distribution lives on ListProgress; telemetry keeps the overview payload small.
2244
- stageCounts: z.object({
2245
- populated: z.number().int(),
2246
- extracted: z.number().int(),
2247
- qualified: z.number().int(),
2248
- discovered: z.number().int(),
2249
- verified: z.number().int(),
2250
- personalized: z.number().int(),
2251
- uploaded: z.number().int()
2252
- }),
2253
- deliverability: z.object({
2254
- valid: z.number().int(),
2255
- risky: z.number().int(),
2256
- invalid: z.number().int(),
2257
- unknown: z.number().int(),
2258
- bounced: z.number().int()
2259
- })
2244
+ export const ListStageCountsSchema = z.object({
2245
+ // Attempted counts by canonical lead-gen stage. The detailed status
2246
+ // distribution lives on ListProgress; telemetry keeps the overview payload small.
2247
+ stageCounts: z.object({
2248
+ populated: z.number().int(),
2249
+ extracted: z.number().int(),
2250
+ qualified: z.number().int(),
2251
+ discovered: z.number().int(),
2252
+ verified: z.number().int(),
2253
+ personalized: z.number().int(),
2254
+ uploaded: z.number().int()
2255
+ }),
2256
+ deliverability: z.object({
2257
+ valid: z.number().int(),
2258
+ risky: z.number().int(),
2259
+ invalid: z.number().int(),
2260
+ unknown: z.number().int(),
2261
+ bounced: z.number().int()
2262
+ })
2260
2263
  })
2261
2264
  ```
2262
2265
 
2263
2266
  ### `ListTelemetrySchema`
2264
2267
 
2265
2268
  ```typescript
2266
- export const ListTelemetrySchema = z.object({
2267
- listId: UuidSchema,
2268
- totalCompanies: z.number().int(),
2269
- totalContacts: z.number().int(),
2270
- stageCounts: ListStageCountsSchema.shape.stageCounts,
2271
- deliverability: ListStageCountsSchema.shape.deliverability,
2272
- activeWorkflows: z.array(z.string()).optional()
2269
+ export const ListTelemetrySchema = z.object({
2270
+ listId: UuidSchema,
2271
+ totalCompanies: z.number().int(),
2272
+ totalContacts: z.number().int(),
2273
+ stageCounts: ListStageCountsSchema.shape.stageCounts,
2274
+ deliverability: ListStageCountsSchema.shape.deliverability,
2275
+ activeWorkflows: z.array(z.string()).optional()
2273
2276
  })
2274
2277
  ```
2275
2278
 
2276
2279
  ### `ListIdParamsSchema`
2277
2280
 
2278
2281
  ```typescript
2279
- export const ListIdParamsSchema = z.object({
2280
- listId: UuidSchema
2282
+ export const ListIdParamsSchema = z.object({
2283
+ listId: UuidSchema
2281
2284
  })
2282
2285
  ```
2283
2286
 
2284
2287
  ### `CreateListRequestSchema`
2285
2288
 
2286
2289
  ```typescript
2287
- export const CreateListRequestSchema = z
2288
- .object({
2289
- name: z.string().trim().min(1).max(255),
2290
- description: z.string().trim().nullable().optional(),
2291
- status: ListStatusSchema.optional(),
2292
- buildTemplateId: ProspectingBuildTemplateIdSchema.optional(),
2293
- scrapingConfig: ScrapingConfigSchema.optional(),
2294
- icp: IcpRubricSchema.optional(),
2295
- pipelineConfig: PipelineConfigSchema.optional()
2296
- })
2290
+ export const CreateListRequestSchema = z
2291
+ .object({
2292
+ name: z.string().trim().min(1).max(255),
2293
+ description: z.string().trim().nullable().optional(),
2294
+ status: ListStatusSchema.optional(),
2295
+ buildTemplateId: ProspectingBuildTemplateIdSchema.optional(),
2296
+ scrapingConfig: ScrapingConfigSchema.optional(),
2297
+ icp: IcpRubricSchema.optional(),
2298
+ pipelineConfig: PipelineConfigSchema.optional()
2299
+ })
2297
2300
  .strict()
2298
2301
  ```
2299
2302
 
2300
2303
  ### `UpdateListRequestSchema`
2301
2304
 
2302
2305
  ```typescript
2303
- export const UpdateListRequestSchema = z
2304
- .object({
2305
- name: z.string().trim().min(1).max(255).optional(),
2306
- description: z.string().trim().nullable().optional(),
2307
- batchIds: z.array(z.string()).optional(),
2308
- buildTemplateId: ProspectingBuildTemplateIdSchema.optional(),
2309
- confirmBuildTemplateChange: z.literal(true).optional()
2310
- })
2311
- .strict()
2312
- .refine(
2313
- (data) =>
2314
- data.name !== undefined ||
2315
- data.description !== undefined ||
2316
- data.batchIds !== undefined ||
2317
- data.buildTemplateId !== undefined,
2318
- {
2319
- message: 'At least one field (name, description, batchIds, or buildTemplateId) must be provided'
2320
- }
2321
- )
2322
- .refine((data) => data.buildTemplateId === undefined || data.confirmBuildTemplateChange === true, {
2323
- message: 'confirmBuildTemplateChange must be true when changing buildTemplateId',
2324
- path: ['confirmBuildTemplateChange']
2306
+ export const UpdateListRequestSchema = z
2307
+ .object({
2308
+ name: z.string().trim().min(1).max(255).optional(),
2309
+ description: z.string().trim().nullable().optional(),
2310
+ batchIds: z.array(z.string()).optional(),
2311
+ buildTemplateId: ProspectingBuildTemplateIdSchema.optional(),
2312
+ confirmBuildTemplateChange: z.literal(true).optional()
2313
+ })
2314
+ .strict()
2315
+ .refine(
2316
+ (data) =>
2317
+ data.name !== undefined ||
2318
+ data.description !== undefined ||
2319
+ data.batchIds !== undefined ||
2320
+ data.buildTemplateId !== undefined,
2321
+ {
2322
+ message: 'At least one field (name, description, batchIds, or buildTemplateId) must be provided'
2323
+ }
2324
+ )
2325
+ .refine((data) => data.buildTemplateId === undefined || data.confirmBuildTemplateChange === true, {
2326
+ message: 'confirmBuildTemplateChange must be true when changing buildTemplateId',
2327
+ path: ['confirmBuildTemplateChange']
2325
2328
  })
2326
2329
  ```
2327
2330
 
2328
2331
  ### `UpdateListConfigRequestSchema`
2329
2332
 
2330
2333
  ```typescript
2331
- /**
2332
- * Partial patch for the three jsonb config columns. UI sends only the edited
2333
- * subtree; server writes the field as-is (no deep merge — each column is
2334
- * replaced atomically when present in the patch).
2335
- */
2336
- export const UpdateListConfigRequestSchema = z
2337
- .object({
2338
- scrapingConfig: ScrapingConfigSchema.partial().optional(),
2339
- icp: IcpRubricSchema.partial().optional(),
2340
- pipelineConfig: PipelineConfigSchema.partial().optional()
2341
- })
2342
- .strict()
2343
- .refine((data) => data.scrapingConfig !== undefined || data.icp !== undefined || data.pipelineConfig !== undefined, {
2344
- message: 'At least one of scrapingConfig, icp, or pipelineConfig must be provided'
2334
+ /**
2335
+ * Partial patch for the three jsonb config columns. UI sends only the edited
2336
+ * subtree; server writes the field as-is (no deep merge — each column is
2337
+ * replaced atomically when present in the patch).
2338
+ */
2339
+ export const UpdateListConfigRequestSchema = z
2340
+ .object({
2341
+ scrapingConfig: ScrapingConfigSchema.partial().optional(),
2342
+ icp: IcpRubricSchema.partial().optional(),
2343
+ pipelineConfig: PipelineConfigSchema.partial().optional()
2344
+ })
2345
+ .strict()
2346
+ .refine((data) => data.scrapingConfig !== undefined || data.icp !== undefined || data.pipelineConfig !== undefined, {
2347
+ message: 'At least one of scrapingConfig, icp, or pipelineConfig must be provided'
2345
2348
  })
2346
2349
  ```
2347
2350
 
2348
2351
  ### `AddCompaniesToListRequestSchema`
2349
2352
 
2350
2353
  ```typescript
2351
- export const AddCompaniesToListRequestSchema = z
2352
- .object({
2353
- companyIds: z.array(UuidSchema).min(1).max(1000)
2354
- })
2354
+ export const AddCompaniesToListRequestSchema = z
2355
+ .object({
2356
+ companyIds: z.array(UuidSchema).min(1).max(1000)
2357
+ })
2355
2358
  .strict()
2356
2359
  ```
2357
2360
 
2358
2361
  ### `RemoveCompaniesFromListRequestSchema`
2359
2362
 
2360
2363
  ```typescript
2361
- export const RemoveCompaniesFromListRequestSchema = z
2362
- .object({
2363
- companyIds: z.array(UuidSchema).min(1).max(1000)
2364
- })
2364
+ export const RemoveCompaniesFromListRequestSchema = z
2365
+ .object({
2366
+ companyIds: z.array(UuidSchema).min(1).max(1000)
2367
+ })
2365
2368
  .strict()
2366
2369
  ```
2367
2370
 
2368
2371
  ### `AddContactsToListRequestSchema`
2369
2372
 
2370
2373
  ```typescript
2371
- export const AddContactsToListRequestSchema = z
2372
- .object({
2373
- contactIds: z.array(UuidSchema).min(1).max(1000)
2374
- })
2374
+ export const AddContactsToListRequestSchema = z
2375
+ .object({
2376
+ contactIds: z.array(UuidSchema).min(1).max(1000)
2377
+ })
2375
2378
  .strict()
2376
2379
  ```
2377
2380
 
2378
2381
  ### `RecordListExecutionRequestSchema`
2379
2382
 
2380
2383
  ```typescript
2381
- export const RecordListExecutionRequestSchema = z
2382
- .object({
2383
- executionId: UuidSchema,
2384
- configSnapshot: z.record(z.string(), z.unknown()).optional()
2385
- })
2384
+ export const RecordListExecutionRequestSchema = z
2385
+ .object({
2386
+ executionId: UuidSchema,
2387
+ configSnapshot: z.record(z.string(), z.unknown()).optional()
2388
+ })
2386
2389
  .strict()
2387
2390
  ```
2388
2391
 
2389
2392
  ### `AcqListResponseSchema`
2390
2393
 
2391
2394
  ```typescript
2392
- /**
2393
- * Single list as returned by /api/acquisition/lists/:id etc.
2394
- * Camel-cased domain shape matching AcqList in types.ts.
2395
- */
2396
- export const AcqListResponseSchema = z.object({
2397
- id: z.string(),
2398
- organizationId: z.string(),
2399
- name: z.string(),
2400
- description: z.string().nullable(),
2401
- batchIds: z.array(z.string()),
2402
- instantlyCampaignId: z.string().nullable(),
2403
- /** Lifecycle status (draft | enriching | launched | closing | archived). */
2404
- status: ListStatusSchema,
2405
- metadata: AcqListMetadataSchema,
2406
- launchedAt: z.string().nullable(),
2407
- completedAt: z.string().nullable(),
2408
- createdAt: z.string(),
2409
- /** Scraping criteria stored as jsonb on the row. */
2410
- scrapingConfig: ScrapingConfigSchema,
2411
- /** ICP / qualification rubric stored as jsonb on the row. */
2412
- icp: IcpRubricSchema,
2413
- /** Pipeline presentation contract stored as jsonb on the row. */
2414
- pipelineConfig: PipelineConfigSchema
2395
+ /**
2396
+ * Single list as returned by /api/acquisition/lists/:id etc.
2397
+ * Camel-cased domain shape matching AcqList in types.ts.
2398
+ */
2399
+ export const AcqListResponseSchema = z.object({
2400
+ id: z.string(),
2401
+ organizationId: z.string(),
2402
+ name: z.string(),
2403
+ description: z.string().nullable(),
2404
+ batchIds: z.array(z.string()),
2405
+ instantlyCampaignId: z.string().nullable(),
2406
+ /** Lifecycle status (draft | enriching | launched | closing | archived). */
2407
+ status: ListStatusSchema,
2408
+ metadata: AcqListMetadataSchema,
2409
+ launchedAt: z.string().nullable(),
2410
+ completedAt: z.string().nullable(),
2411
+ createdAt: z.string(),
2412
+ /** Scraping criteria stored as jsonb on the row. */
2413
+ scrapingConfig: ScrapingConfigSchema,
2414
+ /** ICP / qualification rubric stored as jsonb on the row. */
2415
+ icp: IcpRubricSchema,
2416
+ /** Pipeline presentation contract stored as jsonb on the row. */
2417
+ pipelineConfig: PipelineConfigSchema
2415
2418
  })
2416
2419
  ```
2417
2420
 
@@ -2436,18 +2439,18 @@ export const ListTelemetryListResponseSchema = z.array(ListTelemetrySchema)
2436
2439
  ### `ListExecutionSummarySchema`
2437
2440
 
2438
2441
  ```typescript
2439
- /**
2440
- * Row from acq_list_executions joined with the execution summary,
2441
- * shaped for the /lists/:id/executions response.
2442
- */
2443
- export const ListExecutionSummarySchema = z.object({
2444
- executionId: z.string(),
2445
- resourceId: z.string(),
2446
- status: z.string(),
2447
- createdAt: z.string(),
2448
- completedAt: z.string().nullable(),
2449
- durationMs: z.number().int().nullable(),
2450
- input: z.unknown().nullable().optional()
2442
+ /**
2443
+ * Row from acq_list_executions joined with the execution summary,
2444
+ * shaped for the /lists/:id/executions response.
2445
+ */
2446
+ export const ListExecutionSummarySchema = z.object({
2447
+ executionId: z.string(),
2448
+ resourceId: z.string(),
2449
+ status: z.string(),
2450
+ createdAt: z.string(),
2451
+ completedAt: z.string().nullable(),
2452
+ durationMs: z.number().int().nullable(),
2453
+ input: z.unknown().nullable().optional()
2451
2454
  })
2452
2455
  ```
2453
2456
 
@@ -2478,299 +2481,299 @@ export const AcqEmailValidSchema = z.enum(['VALID', 'INVALID', 'RISKY', 'UNKNOWN
2478
2481
  ### `CompanyIdParamsSchema`
2479
2482
 
2480
2483
  ```typescript
2481
- export const CompanyIdParamsSchema = z.object({
2482
- companyId: UuidSchema
2484
+ export const CompanyIdParamsSchema = z.object({
2485
+ companyId: UuidSchema
2483
2486
  })
2484
2487
  ```
2485
2488
 
2486
2489
  ### `ContactIdParamsSchema`
2487
2490
 
2488
2491
  ```typescript
2489
- export const ContactIdParamsSchema = z.object({
2490
- contactId: UuidSchema
2492
+ export const ContactIdParamsSchema = z.object({
2493
+ contactId: UuidSchema
2491
2494
  })
2492
2495
  ```
2493
2496
 
2494
2497
  ### `ListCompaniesQuerySchema`
2495
2498
 
2496
2499
  ```typescript
2497
- export const ListCompaniesQuerySchema = z
2498
- .object({
2499
- search: z.string().trim().min(1).max(200).optional(),
2500
- listId: UuidSchema.optional(),
2501
- domain: z.string().trim().min(1).max(255).optional(),
2502
- website: z.string().trim().min(1).max(2048).optional(),
2503
- segment: z.string().trim().min(1).max(255).optional(),
2504
- category: z.string().trim().min(1).max(255).optional(),
2505
- pipelineStatus: z.unknown().optional(),
2506
- batchId: z.string().trim().min(1).max(255).optional(),
2507
- status: AcqCompanyStatusSchema.optional(),
2508
- includeAll: QueryBooleanSchema.optional(),
2509
- limit: z.coerce.number().int().min(1).max(5000).default(50),
2510
- offset: z.coerce.number().int().min(0).default(0)
2511
- })
2500
+ export const ListCompaniesQuerySchema = z
2501
+ .object({
2502
+ search: z.string().trim().min(1).max(200).optional(),
2503
+ listId: UuidSchema.optional(),
2504
+ domain: z.string().trim().min(1).max(255).optional(),
2505
+ website: z.string().trim().min(1).max(2048).optional(),
2506
+ segment: z.string().trim().min(1).max(255).optional(),
2507
+ category: z.string().trim().min(1).max(255).optional(),
2508
+ pipelineStatus: z.unknown().optional(),
2509
+ batchId: z.string().trim().min(1).max(255).optional(),
2510
+ status: AcqCompanyStatusSchema.optional(),
2511
+ includeAll: QueryBooleanSchema.optional(),
2512
+ limit: z.coerce.number().int().min(1).max(5000).default(50),
2513
+ offset: z.coerce.number().int().min(0).default(0)
2514
+ })
2512
2515
  .strict()
2513
2516
  ```
2514
2517
 
2515
2518
  ### `ListContactsQuerySchema`
2516
2519
 
2517
2520
  ```typescript
2518
- export const ListContactsQuerySchema = z
2519
- .object({
2520
- search: z.string().trim().min(1).max(200).optional(),
2521
- listId: UuidSchema.optional(),
2522
- openingLineIsNull: QueryBooleanSchema.optional(),
2523
- batchId: z.string().trim().min(1).max(255).optional(),
2524
- contactStatus: AcqContactStatusSchema.optional(),
2525
- limit: z.coerce.number().int().min(1).max(5000).default(5000),
2526
- offset: z.coerce.number().int().min(0).default(0)
2527
- })
2521
+ export const ListContactsQuerySchema = z
2522
+ .object({
2523
+ search: z.string().trim().min(1).max(200).optional(),
2524
+ listId: UuidSchema.optional(),
2525
+ openingLineIsNull: QueryBooleanSchema.optional(),
2526
+ batchId: z.string().trim().min(1).max(255).optional(),
2527
+ contactStatus: AcqContactStatusSchema.optional(),
2528
+ limit: z.coerce.number().int().min(1).max(5000).default(5000),
2529
+ offset: z.coerce.number().int().min(0).default(0)
2530
+ })
2528
2531
  .strict()
2529
2532
  ```
2530
2533
 
2531
2534
  ### `CreateCompanyRequestSchema`
2532
2535
 
2533
2536
  ```typescript
2534
- export const CreateCompanyRequestSchema = z
2535
- .object({
2536
- name: z.string().trim().min(1).max(255),
2537
- clientId: UuidSchema.nullable().optional(),
2538
- domain: z.string().trim().min(1).max(255).optional(),
2539
- linkedinUrl: z.string().trim().url().optional(),
2540
- website: z.string().trim().url().optional(),
2541
- numEmployees: z.number().int().min(0).optional(),
2542
- foundedYear: z.number().int().optional(),
2543
- locationCity: z.string().trim().min(1).max(255).optional(),
2544
- locationState: z.string().trim().min(1).max(255).optional(),
2545
- category: z.string().trim().min(1).max(255).optional(),
2546
- source: z.string().trim().min(1).max(255).optional(),
2547
- batchId: z.string().trim().min(1).max(255).optional(),
2548
- pipelineStatus: z.unknown().optional(),
2549
- verticalResearch: z.string().trim().min(1).max(5000).optional()
2550
- })
2537
+ export const CreateCompanyRequestSchema = z
2538
+ .object({
2539
+ name: z.string().trim().min(1).max(255),
2540
+ clientId: UuidSchema.nullable().optional(),
2541
+ domain: z.string().trim().min(1).max(255).optional(),
2542
+ linkedinUrl: z.string().trim().url().optional(),
2543
+ website: z.string().trim().url().optional(),
2544
+ numEmployees: z.number().int().min(0).optional(),
2545
+ foundedYear: z.number().int().optional(),
2546
+ locationCity: z.string().trim().min(1).max(255).optional(),
2547
+ locationState: z.string().trim().min(1).max(255).optional(),
2548
+ category: z.string().trim().min(1).max(255).optional(),
2549
+ source: z.string().trim().min(1).max(255).optional(),
2550
+ batchId: z.string().trim().min(1).max(255).optional(),
2551
+ pipelineStatus: z.unknown().optional(),
2552
+ verticalResearch: z.string().trim().min(1).max(5000).optional()
2553
+ })
2551
2554
  .strict()
2552
2555
  ```
2553
2556
 
2554
2557
  ### `UpdateCompanyRequestSchema`
2555
2558
 
2556
2559
  ```typescript
2557
- export const UpdateCompanyRequestSchema = z
2558
- .object({
2559
- name: z.string().trim().min(1).max(255).optional(),
2560
- clientId: UuidSchema.nullable().optional(),
2561
- domain: z.string().trim().min(1).max(255).optional(),
2562
- linkedinUrl: z.string().trim().url().optional(),
2563
- website: z.string().trim().url().optional(),
2564
- numEmployees: z.number().int().min(0).optional(),
2565
- foundedYear: z.number().int().optional(),
2566
- locationCity: z.string().trim().min(1).max(255).optional(),
2567
- locationState: z.string().trim().min(1).max(255).optional(),
2568
- category: z.string().trim().min(1).max(255).optional(),
2569
- segment: z.string().trim().min(1).max(255).optional(),
2570
- processingState: CompanyProcessingStateSchema.optional(),
2571
- pipelineStatus: z.unknown().optional(),
2572
- enrichmentData: z.record(z.string(), z.unknown()).optional(),
2573
- source: z.string().trim().min(1).max(255).optional(),
2574
- batchId: z.string().trim().min(1).max(255).optional(),
2575
- status: AcqCompanyStatusSchema.optional(),
2576
- verticalResearch: z.string().trim().min(1).max(5000).nullable().optional()
2577
- })
2578
- .strict()
2579
- .refine(
2580
- (data) =>
2581
- data.name !== undefined ||
2582
- data.clientId !== undefined ||
2583
- data.domain !== undefined ||
2584
- data.linkedinUrl !== undefined ||
2585
- data.website !== undefined ||
2586
- data.numEmployees !== undefined ||
2587
- data.foundedYear !== undefined ||
2588
- data.locationCity !== undefined ||
2589
- data.locationState !== undefined ||
2590
- data.category !== undefined ||
2591
- data.segment !== undefined ||
2592
- data.processingState !== undefined ||
2593
- data.pipelineStatus !== undefined ||
2594
- data.enrichmentData !== undefined ||
2595
- data.source !== undefined ||
2596
- data.batchId !== undefined ||
2597
- data.status !== undefined ||
2598
- data.verticalResearch !== undefined,
2599
- {
2600
- message: 'At least one field must be provided'
2601
- }
2560
+ export const UpdateCompanyRequestSchema = z
2561
+ .object({
2562
+ name: z.string().trim().min(1).max(255).optional(),
2563
+ clientId: UuidSchema.nullable().optional(),
2564
+ domain: z.string().trim().min(1).max(255).optional(),
2565
+ linkedinUrl: z.string().trim().url().optional(),
2566
+ website: z.string().trim().url().optional(),
2567
+ numEmployees: z.number().int().min(0).optional(),
2568
+ foundedYear: z.number().int().optional(),
2569
+ locationCity: z.string().trim().min(1).max(255).optional(),
2570
+ locationState: z.string().trim().min(1).max(255).optional(),
2571
+ category: z.string().trim().min(1).max(255).optional(),
2572
+ segment: z.string().trim().min(1).max(255).optional(),
2573
+ processingState: CompanyProcessingStateSchema.optional(),
2574
+ pipelineStatus: z.unknown().optional(),
2575
+ enrichmentData: z.record(z.string(), z.unknown()).optional(),
2576
+ source: z.string().trim().min(1).max(255).optional(),
2577
+ batchId: z.string().trim().min(1).max(255).optional(),
2578
+ status: AcqCompanyStatusSchema.optional(),
2579
+ verticalResearch: z.string().trim().min(1).max(5000).nullable().optional()
2580
+ })
2581
+ .strict()
2582
+ .refine(
2583
+ (data) =>
2584
+ data.name !== undefined ||
2585
+ data.clientId !== undefined ||
2586
+ data.domain !== undefined ||
2587
+ data.linkedinUrl !== undefined ||
2588
+ data.website !== undefined ||
2589
+ data.numEmployees !== undefined ||
2590
+ data.foundedYear !== undefined ||
2591
+ data.locationCity !== undefined ||
2592
+ data.locationState !== undefined ||
2593
+ data.category !== undefined ||
2594
+ data.segment !== undefined ||
2595
+ data.processingState !== undefined ||
2596
+ data.pipelineStatus !== undefined ||
2597
+ data.enrichmentData !== undefined ||
2598
+ data.source !== undefined ||
2599
+ data.batchId !== undefined ||
2600
+ data.status !== undefined ||
2601
+ data.verticalResearch !== undefined,
2602
+ {
2603
+ message: 'At least one field must be provided'
2604
+ }
2602
2605
  )
2603
2606
  ```
2604
2607
 
2605
2608
  ### `CreateContactRequestSchema`
2606
2609
 
2607
2610
  ```typescript
2608
- export const CreateContactRequestSchema = z
2609
- .object({
2610
- email: z.string().trim().email(),
2611
- clientId: UuidSchema.nullable().optional(),
2612
- companyId: UuidSchema.optional(),
2613
- firstName: z.string().trim().min(1).max(255).optional(),
2614
- lastName: z.string().trim().min(1).max(255).optional(),
2615
- linkedinUrl: z.string().trim().url().optional(),
2616
- title: z.string().trim().min(1).max(255).optional(),
2617
- source: z.string().trim().min(1).max(255).optional(),
2618
- sourceId: z.string().trim().min(1).max(255).optional(),
2619
- batchId: z.string().trim().min(1).max(255).optional(),
2620
- pipelineStatus: z.unknown().optional()
2621
- })
2611
+ export const CreateContactRequestSchema = z
2612
+ .object({
2613
+ email: z.string().trim().email(),
2614
+ clientId: UuidSchema.nullable().optional(),
2615
+ companyId: UuidSchema.optional(),
2616
+ firstName: z.string().trim().min(1).max(255).optional(),
2617
+ lastName: z.string().trim().min(1).max(255).optional(),
2618
+ linkedinUrl: z.string().trim().url().optional(),
2619
+ title: z.string().trim().min(1).max(255).optional(),
2620
+ source: z.string().trim().min(1).max(255).optional(),
2621
+ sourceId: z.string().trim().min(1).max(255).optional(),
2622
+ batchId: z.string().trim().min(1).max(255).optional(),
2623
+ pipelineStatus: z.unknown().optional()
2624
+ })
2622
2625
  .strict()
2623
2626
  ```
2624
2627
 
2625
2628
  ### `UpdateContactRequestSchema`
2626
2629
 
2627
2630
  ```typescript
2628
- export const UpdateContactRequestSchema = z
2629
- .object({
2630
- companyId: UuidSchema.optional(),
2631
- clientId: UuidSchema.nullable().optional(),
2632
- emailValid: AcqEmailValidSchema.optional(),
2633
- firstName: z.string().trim().min(1).max(255).optional(),
2634
- lastName: z.string().trim().min(1).max(255).optional(),
2635
- linkedinUrl: z.string().trim().url().optional(),
2636
- title: z.string().trim().min(1).max(255).optional(),
2637
- headline: z.string().trim().min(1).max(5000).optional(),
2638
- filterReason: z.string().trim().min(1).max(5000).optional(),
2639
- openingLine: z.string().trim().min(1).max(5000).optional(),
2640
- processingState: ContactProcessingStateSchema.optional(),
2641
- pipelineStatus: z.unknown().optional(),
2642
- enrichmentData: z.record(z.string(), z.unknown()).optional(),
2643
- status: AcqContactStatusSchema.optional()
2644
- })
2645
- .strict()
2646
- .refine(
2647
- (data) =>
2648
- data.companyId !== undefined ||
2649
- data.clientId !== undefined ||
2650
- data.emailValid !== undefined ||
2651
- data.firstName !== undefined ||
2652
- data.lastName !== undefined ||
2653
- data.linkedinUrl !== undefined ||
2654
- data.title !== undefined ||
2655
- data.headline !== undefined ||
2656
- data.filterReason !== undefined ||
2657
- data.openingLine !== undefined ||
2658
- data.processingState !== undefined ||
2659
- data.pipelineStatus !== undefined ||
2660
- data.enrichmentData !== undefined ||
2661
- data.status !== undefined,
2662
- {
2663
- message: 'At least one field must be provided'
2664
- }
2631
+ export const UpdateContactRequestSchema = z
2632
+ .object({
2633
+ companyId: UuidSchema.optional(),
2634
+ clientId: UuidSchema.nullable().optional(),
2635
+ emailValid: AcqEmailValidSchema.optional(),
2636
+ firstName: z.string().trim().min(1).max(255).optional(),
2637
+ lastName: z.string().trim().min(1).max(255).optional(),
2638
+ linkedinUrl: z.string().trim().url().optional(),
2639
+ title: z.string().trim().min(1).max(255).optional(),
2640
+ headline: z.string().trim().min(1).max(5000).optional(),
2641
+ filterReason: z.string().trim().min(1).max(5000).optional(),
2642
+ openingLine: z.string().trim().min(1).max(5000).optional(),
2643
+ processingState: ContactProcessingStateSchema.optional(),
2644
+ pipelineStatus: z.unknown().optional(),
2645
+ enrichmentData: z.record(z.string(), z.unknown()).optional(),
2646
+ status: AcqContactStatusSchema.optional()
2647
+ })
2648
+ .strict()
2649
+ .refine(
2650
+ (data) =>
2651
+ data.companyId !== undefined ||
2652
+ data.clientId !== undefined ||
2653
+ data.emailValid !== undefined ||
2654
+ data.firstName !== undefined ||
2655
+ data.lastName !== undefined ||
2656
+ data.linkedinUrl !== undefined ||
2657
+ data.title !== undefined ||
2658
+ data.headline !== undefined ||
2659
+ data.filterReason !== undefined ||
2660
+ data.openingLine !== undefined ||
2661
+ data.processingState !== undefined ||
2662
+ data.pipelineStatus !== undefined ||
2663
+ data.enrichmentData !== undefined ||
2664
+ data.status !== undefined,
2665
+ {
2666
+ message: 'At least one field must be provided'
2667
+ }
2665
2668
  )
2666
2669
  ```
2667
2670
 
2668
2671
  ### `AcqCompanyResponseSchema`
2669
2672
 
2670
2673
  ```typescript
2671
- export const AcqCompanyResponseSchema = z.object({
2672
- id: z.string(),
2673
- organizationId: z.string(),
2674
- clientId: z.string().nullable().optional(),
2675
- name: z.string(),
2676
- domain: z.string().nullable(),
2677
- linkedinUrl: z.string().nullable(),
2678
- website: z.string().nullable(),
2679
- numEmployees: z.number().nullable(),
2680
- foundedYear: z.number().nullable(),
2681
- locationCity: z.string().nullable(),
2682
- locationState: z.string().nullable(),
2683
- category: z.string().nullable(),
2684
- categoryPain: z.string().nullable(),
2685
- segment: z.string().nullable(),
2686
- processingState: CompanyProcessingStateSchema.nullable(),
2687
- pipelineStatus: z.unknown().nullable().optional(),
2688
- enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2689
- source: z.string().nullable(),
2690
- batchId: z.string().nullable(),
2691
- status: AcqCompanyStatusSchema,
2692
- contactCount: z.number().int().min(0),
2693
- verticalResearch: z.string().nullable(),
2694
- createdAt: z.string(),
2695
- updatedAt: z.string()
2674
+ export const AcqCompanyResponseSchema = z.object({
2675
+ id: z.string(),
2676
+ organizationId: z.string(),
2677
+ clientId: z.string().nullable().optional(),
2678
+ name: z.string(),
2679
+ domain: z.string().nullable(),
2680
+ linkedinUrl: z.string().nullable(),
2681
+ website: z.string().nullable(),
2682
+ numEmployees: z.number().nullable(),
2683
+ foundedYear: z.number().nullable(),
2684
+ locationCity: z.string().nullable(),
2685
+ locationState: z.string().nullable(),
2686
+ category: z.string().nullable(),
2687
+ categoryPain: z.string().nullable(),
2688
+ segment: z.string().nullable(),
2689
+ processingState: CompanyProcessingStateSchema.nullable(),
2690
+ pipelineStatus: z.unknown().nullable().optional(),
2691
+ enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2692
+ source: z.string().nullable(),
2693
+ batchId: z.string().nullable(),
2694
+ status: AcqCompanyStatusSchema,
2695
+ contactCount: z.number().int().min(0),
2696
+ verticalResearch: z.string().nullable(),
2697
+ createdAt: z.string(),
2698
+ updatedAt: z.string()
2696
2699
  })
2697
2700
  ```
2698
2701
 
2699
2702
  ### `AcqCompanyListResponseSchema`
2700
2703
 
2701
2704
  ```typescript
2702
- export const AcqCompanyListResponseSchema = z.object({
2703
- data: z.array(AcqCompanyResponseSchema),
2704
- total: z.number().int(),
2705
- limit: z.number().int(),
2706
- offset: z.number().int()
2705
+ export const AcqCompanyListResponseSchema = z.object({
2706
+ data: z.array(AcqCompanyResponseSchema),
2707
+ total: z.number().int(),
2708
+ limit: z.number().int(),
2709
+ offset: z.number().int()
2707
2710
  })
2708
2711
  ```
2709
2712
 
2710
2713
  ### `AcqCompanyFacetsResponseSchema`
2711
2714
 
2712
2715
  ```typescript
2713
- export const AcqCompanyFacetsResponseSchema = z.object({
2714
- segments: z.array(z.string()),
2715
- categories: z.array(z.string()),
2716
- statuses: z.array(AcqCompanyStatusSchema)
2716
+ export const AcqCompanyFacetsResponseSchema = z.object({
2717
+ segments: z.array(z.string()),
2718
+ categories: z.array(z.string()),
2719
+ statuses: z.array(AcqCompanyStatusSchema)
2717
2720
  })
2718
2721
  ```
2719
2722
 
2720
2723
  ### `AcqContactCompanySummarySchema`
2721
2724
 
2722
2725
  ```typescript
2723
- export const AcqContactCompanySummarySchema = z.object({
2724
- id: z.string(),
2725
- name: z.string(),
2726
- domain: z.string().nullable(),
2727
- website: z.string().nullable(),
2728
- linkedinUrl: z.string().nullable(),
2729
- segment: z.string().nullable(),
2730
- category: z.string().nullable(),
2731
- status: AcqCompanyStatusSchema
2726
+ export const AcqContactCompanySummarySchema = z.object({
2727
+ id: z.string(),
2728
+ name: z.string(),
2729
+ domain: z.string().nullable(),
2730
+ website: z.string().nullable(),
2731
+ linkedinUrl: z.string().nullable(),
2732
+ segment: z.string().nullable(),
2733
+ category: z.string().nullable(),
2734
+ status: AcqCompanyStatusSchema
2732
2735
  })
2733
2736
  ```
2734
2737
 
2735
2738
  ### `AcqContactResponseSchema`
2736
2739
 
2737
2740
  ```typescript
2738
- export const AcqContactResponseSchema = z.object({
2739
- id: z.string(),
2740
- organizationId: z.string(),
2741
- clientId: z.string().nullable().optional(),
2742
- companyId: z.string().nullable(),
2743
- email: z.string(),
2744
- emailValid: AcqEmailValidSchema.nullable(),
2745
- firstName: z.string().nullable(),
2746
- lastName: z.string().nullable(),
2747
- linkedinUrl: z.string().nullable(),
2748
- title: z.string().nullable(),
2749
- headline: z.string().nullable(),
2750
- filterReason: z.string().nullable(),
2751
- openingLine: z.string().nullable(),
2752
- source: z.string().nullable(),
2753
- sourceId: z.string().nullable(),
2754
- processingState: ContactProcessingStateSchema.nullable(),
2755
- pipelineStatus: z.unknown().nullable().optional(),
2756
- enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2757
- attioPersonId: z.string().nullable(),
2758
- batchId: z.string().nullable(),
2759
- status: AcqContactStatusSchema,
2760
- company: AcqContactCompanySummarySchema.nullable().optional(),
2761
- createdAt: z.string(),
2762
- updatedAt: z.string()
2741
+ export const AcqContactResponseSchema = z.object({
2742
+ id: z.string(),
2743
+ organizationId: z.string(),
2744
+ clientId: z.string().nullable().optional(),
2745
+ companyId: z.string().nullable(),
2746
+ email: z.string(),
2747
+ emailValid: AcqEmailValidSchema.nullable(),
2748
+ firstName: z.string().nullable(),
2749
+ lastName: z.string().nullable(),
2750
+ linkedinUrl: z.string().nullable(),
2751
+ title: z.string().nullable(),
2752
+ headline: z.string().nullable(),
2753
+ filterReason: z.string().nullable(),
2754
+ openingLine: z.string().nullable(),
2755
+ source: z.string().nullable(),
2756
+ sourceId: z.string().nullable(),
2757
+ processingState: ContactProcessingStateSchema.nullable(),
2758
+ pipelineStatus: z.unknown().nullable().optional(),
2759
+ enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2760
+ attioPersonId: z.string().nullable(),
2761
+ batchId: z.string().nullable(),
2762
+ status: AcqContactStatusSchema,
2763
+ company: AcqContactCompanySummarySchema.nullable().optional(),
2764
+ createdAt: z.string(),
2765
+ updatedAt: z.string()
2763
2766
  })
2764
2767
  ```
2765
2768
 
2766
2769
  ### `AcqContactListResponseSchema`
2767
2770
 
2768
2771
  ```typescript
2769
- export const AcqContactListResponseSchema = z.object({
2770
- data: z.array(AcqContactResponseSchema),
2771
- total: z.number().int(),
2772
- limit: z.number().int(),
2773
- offset: z.number().int()
2772
+ export const AcqContactListResponseSchema = z.object({
2773
+ data: z.array(AcqContactResponseSchema),
2774
+ total: z.number().int(),
2775
+ limit: z.number().int(),
2776
+ offset: z.number().int()
2774
2777
  })
2775
2778
  ```
2776
2779
 
@@ -2783,524 +2786,524 @@ export const AcqArtifactOwnerKindSchema = z.enum(['company', 'contact', 'deal',
2783
2786
  ### `ListArtifactsQuerySchema`
2784
2787
 
2785
2788
  ```typescript
2786
- export const ListArtifactsQuerySchema = z
2787
- .object({
2788
- ownerKind: AcqArtifactOwnerKindSchema,
2789
- ownerId: UuidSchema
2790
- })
2789
+ export const ListArtifactsQuerySchema = z
2790
+ .object({
2791
+ ownerKind: AcqArtifactOwnerKindSchema,
2792
+ ownerId: UuidSchema
2793
+ })
2791
2794
  .strict()
2792
2795
  ```
2793
2796
 
2794
2797
  ### `CreateArtifactRequestSchema`
2795
2798
 
2796
2799
  ```typescript
2797
- export const CreateArtifactRequestSchema = z
2798
- .object({
2799
- ownerKind: AcqArtifactOwnerKindSchema,
2800
- ownerId: UuidSchema,
2801
- kind: z.string().trim().min(1).max(255),
2802
- content: z.record(z.string(), z.unknown()),
2803
- sourceExecutionId: UuidSchema.optional()
2804
- })
2800
+ export const CreateArtifactRequestSchema = z
2801
+ .object({
2802
+ ownerKind: AcqArtifactOwnerKindSchema,
2803
+ ownerId: UuidSchema,
2804
+ kind: z.string().trim().min(1).max(255),
2805
+ content: z.record(z.string(), z.unknown()),
2806
+ sourceExecutionId: UuidSchema.optional()
2807
+ })
2805
2808
  .strict()
2806
2809
  ```
2807
2810
 
2808
2811
  ### `AcqArtifactResponseSchema`
2809
2812
 
2810
2813
  ```typescript
2811
- export const AcqArtifactResponseSchema = z.object({
2812
- id: z.string(),
2813
- organizationId: z.string(),
2814
- ownerKind: z.string(),
2815
- ownerId: z.string(),
2816
- kind: z.string(),
2817
- content: z.record(z.string(), z.unknown()),
2818
- sourceExecutionId: z.string().nullable(),
2819
- createdBy: z.string().nullable(),
2820
- createdAt: z.string(),
2821
- version: z.number().int()
2814
+ export const AcqArtifactResponseSchema = z.object({
2815
+ id: z.string(),
2816
+ organizationId: z.string(),
2817
+ ownerKind: z.string(),
2818
+ ownerId: z.string(),
2819
+ kind: z.string(),
2820
+ content: z.record(z.string(), z.unknown()),
2821
+ sourceExecutionId: z.string().nullable(),
2822
+ createdBy: z.string().nullable(),
2823
+ createdAt: z.string(),
2824
+ version: z.number().int()
2822
2825
  })
2823
2826
  ```
2824
2827
 
2825
2828
  ### `AcqArtifactListResponseSchema`
2826
2829
 
2827
2830
  ```typescript
2828
- export const AcqArtifactListResponseSchema = z.object({
2829
- artifacts: z.array(AcqArtifactResponseSchema)
2831
+ export const AcqArtifactListResponseSchema = z.object({
2832
+ artifacts: z.array(AcqArtifactResponseSchema)
2830
2833
  })
2831
2834
  ```
2832
2835
 
2833
2836
  ### `ListMembersQuerySchema`
2834
2837
 
2835
2838
  ```typescript
2836
- export const ListMembersQuerySchema = z
2837
- .object({
2838
- limit: z.coerce.number().int().min(1).max(500).default(50),
2839
- offset: z.coerce.number().int().min(0).default(0)
2840
- })
2839
+ export const ListMembersQuerySchema = z
2840
+ .object({
2841
+ limit: z.coerce.number().int().min(1).max(500).default(50),
2842
+ offset: z.coerce.number().int().min(0).default(0)
2843
+ })
2841
2844
  .strict()
2842
2845
  ```
2843
2846
 
2844
2847
  ### `MemberIdParamsSchema`
2845
2848
 
2846
2849
  ```typescript
2847
- export const MemberIdParamsSchema = z.object({
2848
- memberId: UuidSchema
2850
+ export const MemberIdParamsSchema = z.object({
2851
+ memberId: UuidSchema
2849
2852
  })
2850
2853
  ```
2851
2854
 
2852
2855
  ### `AcqListMemberContactSummarySchema`
2853
2856
 
2854
2857
  ```typescript
2855
- export const AcqListMemberContactSummarySchema = z.object({
2856
- id: z.string(),
2857
- email: z.string(),
2858
- firstName: z.string().nullable(),
2859
- lastName: z.string().nullable(),
2860
- title: z.string().nullable(),
2861
- linkedinUrl: z.string().nullable(),
2862
- companyId: z.string().nullable()
2858
+ export const AcqListMemberContactSummarySchema = z.object({
2859
+ id: z.string(),
2860
+ email: z.string(),
2861
+ firstName: z.string().nullable(),
2862
+ lastName: z.string().nullable(),
2863
+ title: z.string().nullable(),
2864
+ linkedinUrl: z.string().nullable(),
2865
+ companyId: z.string().nullable()
2863
2866
  })
2864
2867
  ```
2865
2868
 
2866
2869
  ### `AcqListMemberResponseSchema`
2867
2870
 
2868
2871
  ```typescript
2869
- export const AcqListMemberResponseSchema = z.object({
2870
- id: z.string(),
2871
- listId: z.string(),
2872
- contactId: z.string(),
2873
- pipelineKey: z.string(),
2874
- stageKey: z.string(),
2875
- stateKey: z.string(),
2876
- activityLog: z.unknown(),
2877
- addedAt: z.string(),
2878
- addedBy: z.string().nullable(),
2879
- sourceExecutionId: z.string().nullable(),
2880
- contact: AcqListMemberContactSummarySchema.nullable()
2872
+ export const AcqListMemberResponseSchema = z.object({
2873
+ id: z.string(),
2874
+ listId: z.string(),
2875
+ contactId: z.string(),
2876
+ pipelineKey: z.string(),
2877
+ stageKey: z.string(),
2878
+ stateKey: z.string(),
2879
+ activityLog: z.unknown(),
2880
+ addedAt: z.string(),
2881
+ addedBy: z.string().nullable(),
2882
+ sourceExecutionId: z.string().nullable(),
2883
+ contact: AcqListMemberContactSummarySchema.nullable()
2881
2884
  })
2882
2885
  ```
2883
2886
 
2884
2887
  ### `AcqListMembersResponseSchema`
2885
2888
 
2886
2889
  ```typescript
2887
- export const AcqListMembersResponseSchema = z.object({
2888
- members: z.array(AcqListMemberResponseSchema)
2890
+ export const AcqListMembersResponseSchema = z.object({
2891
+ members: z.array(AcqListMemberResponseSchema)
2889
2892
  })
2890
2893
  ```
2891
2894
 
2892
2895
  ### `ListCompanyIdParamsSchema`
2893
2896
 
2894
2897
  ```typescript
2895
- export const ListCompanyIdParamsSchema = z.object({
2896
- listCompanyId: UuidSchema
2898
+ export const ListCompanyIdParamsSchema = z.object({
2899
+ listCompanyId: UuidSchema
2897
2900
  })
2898
2901
  ```
2899
2902
 
2900
2903
  ### `AcqListCompanyResponseSchema`
2901
2904
 
2902
2905
  ```typescript
2903
- export const AcqListCompanyResponseSchema = z.object({
2904
- id: z.string(),
2905
- listId: z.string(),
2906
- companyId: z.string(),
2907
- pipelineKey: z.string(),
2908
- stageKey: z.string(),
2909
- stateKey: z.string(),
2910
- activityLog: z.unknown(),
2911
- addedAt: z.string(),
2912
- addedBy: z.string().nullable(),
2913
- sourceExecutionId: z.string().nullable()
2906
+ export const AcqListCompanyResponseSchema = z.object({
2907
+ id: z.string(),
2908
+ listId: z.string(),
2909
+ companyId: z.string(),
2910
+ pipelineKey: z.string(),
2911
+ stageKey: z.string(),
2912
+ stateKey: z.string(),
2913
+ activityLog: z.unknown(),
2914
+ addedAt: z.string(),
2915
+ addedBy: z.string().nullable(),
2916
+ sourceExecutionId: z.string().nullable()
2914
2917
  })
2915
2918
  ```
2916
2919
 
2917
2920
  ### `AcqCompanySchemas`
2918
2921
 
2919
2922
  ```typescript
2920
- export const AcqCompanySchemas = {
2921
- CompanyProcessingState: CompanyProcessingStateSchema,
2922
- CompanyIdParams: CompanyIdParamsSchema,
2923
- ListCompaniesQuery: ListCompaniesQuerySchema,
2924
- CreateCompanyRequest: CreateCompanyRequestSchema,
2925
- UpdateCompanyRequest: UpdateCompanyRequestSchema,
2926
- AcqCompanyResponse: AcqCompanyResponseSchema,
2927
- AcqCompanyListResponse: AcqCompanyListResponseSchema,
2928
- AcqCompanyFacetsResponse: AcqCompanyFacetsResponseSchema
2923
+ export const AcqCompanySchemas = {
2924
+ CompanyProcessingState: CompanyProcessingStateSchema,
2925
+ CompanyIdParams: CompanyIdParamsSchema,
2926
+ ListCompaniesQuery: ListCompaniesQuerySchema,
2927
+ CreateCompanyRequest: CreateCompanyRequestSchema,
2928
+ UpdateCompanyRequest: UpdateCompanyRequestSchema,
2929
+ AcqCompanyResponse: AcqCompanyResponseSchema,
2930
+ AcqCompanyListResponse: AcqCompanyListResponseSchema,
2931
+ AcqCompanyFacetsResponse: AcqCompanyFacetsResponseSchema
2929
2932
  }
2930
2933
  ```
2931
2934
 
2932
2935
  ### `AcqContactSchemas`
2933
2936
 
2934
2937
  ```typescript
2935
- export const AcqContactSchemas = {
2936
- ContactProcessingState: ContactProcessingStateSchema,
2937
- ContactIdParams: ContactIdParamsSchema,
2938
- ListContactsQuery: ListContactsQuerySchema,
2939
- CreateContactRequest: CreateContactRequestSchema,
2940
- UpdateContactRequest: UpdateContactRequestSchema,
2941
- AcqContactResponse: AcqContactResponseSchema,
2942
- AcqContactListResponse: AcqContactListResponseSchema
2938
+ export const AcqContactSchemas = {
2939
+ ContactProcessingState: ContactProcessingStateSchema,
2940
+ ContactIdParams: ContactIdParamsSchema,
2941
+ ListContactsQuery: ListContactsQuerySchema,
2942
+ CreateContactRequest: CreateContactRequestSchema,
2943
+ UpdateContactRequest: UpdateContactRequestSchema,
2944
+ AcqContactResponse: AcqContactResponseSchema,
2945
+ AcqContactListResponse: AcqContactListResponseSchema
2943
2946
  }
2944
2947
  ```
2945
2948
 
2946
2949
  ### `AcqListSchemas`
2947
2950
 
2948
2951
  ```typescript
2949
- export const AcqListSchemas = {
2950
- // Params
2951
- ListIdParams: ListIdParamsSchema,
2952
-
2953
- // Primitives (for UI / tests)
2954
- ListStatus: ListStatusSchema,
2955
- ScrapingConfig: ScrapingConfigSchema,
2956
- IcpRubric: IcpRubricSchema,
2957
- PipelineConfig: PipelineConfigSchema,
2958
- PipelineStage: PipelineStageSchema,
2959
- BuildPlanSnapshot: BuildPlanSnapshotSchema,
2960
- BuildPlanSnapshotStep: BuildPlanSnapshotStepSchema,
2961
- AcqListMetadata: AcqListMetadataSchema,
2962
- LeadGenStageKey: LeadGenStageKeySchema,
2963
- LeadGenActionKey: LeadGenActionKeySchema,
2964
- ProcessingStageStatus: ProcessingStageStatusSchema,
2965
- ProcessingState: ProcessingStateSchema,
2966
- ListStageCounts: ListStageCountsSchema,
2967
- ListTelemetry: ListTelemetrySchema,
2968
-
2969
- // Requests
2970
- ListReadQuery: ListReadQuerySchema,
2971
- GetListQuery: GetListQuerySchema,
2972
- CreateListRequest: CreateListRequestSchema,
2973
- UpdateListRequest: UpdateListRequestSchema,
2974
- UpdateListStatusRequest: UpdateListStatusRequestSchema,
2975
- UpdateListConfigRequest: UpdateListConfigRequestSchema,
2976
- AddCompaniesToListRequest: AddCompaniesToListRequestSchema,
2977
- RemoveCompaniesFromListRequest: RemoveCompaniesFromListRequestSchema,
2978
- AddContactsToListRequest: AddContactsToListRequestSchema,
2979
- RecordListExecutionRequest: RecordListExecutionRequestSchema,
2980
-
2981
- // Responses
2982
- AcqListResponse: AcqListResponseSchema,
2983
- AcqListDetailResponse: AcqListDetailResponseSchema,
2984
- AcqListListResponse: AcqListListResponseSchema,
2985
- AcqListDealRef: AcqListDealRefSchema,
2986
- AcqListLineage: AcqListLineageSchema,
2987
- AcqListStatusResponse: AcqListStatusResponseSchema,
2988
- ListTelemetryResponse: ListTelemetryResponseSchema,
2989
- ListTelemetryListResponse: ListTelemetryListResponseSchema,
2990
- ListExecutionsResponse: ListExecutionsResponseSchema,
2991
- ListProgressResponse: ListProgressResponseSchema
2952
+ export const AcqListSchemas = {
2953
+ // Params
2954
+ ListIdParams: ListIdParamsSchema,
2955
+
2956
+ // Primitives (for UI / tests)
2957
+ ListStatus: ListStatusSchema,
2958
+ ScrapingConfig: ScrapingConfigSchema,
2959
+ IcpRubric: IcpRubricSchema,
2960
+ PipelineConfig: PipelineConfigSchema,
2961
+ PipelineStage: PipelineStageSchema,
2962
+ BuildPlanSnapshot: BuildPlanSnapshotSchema,
2963
+ BuildPlanSnapshotStep: BuildPlanSnapshotStepSchema,
2964
+ AcqListMetadata: AcqListMetadataSchema,
2965
+ LeadGenStageKey: LeadGenStageKeySchema,
2966
+ LeadGenActionKey: LeadGenActionKeySchema,
2967
+ ProcessingStageStatus: ProcessingStageStatusSchema,
2968
+ ProcessingState: ProcessingStateSchema,
2969
+ ListStageCounts: ListStageCountsSchema,
2970
+ ListTelemetry: ListTelemetrySchema,
2971
+
2972
+ // Requests
2973
+ ListReadQuery: ListReadQuerySchema,
2974
+ GetListQuery: GetListQuerySchema,
2975
+ CreateListRequest: CreateListRequestSchema,
2976
+ UpdateListRequest: UpdateListRequestSchema,
2977
+ UpdateListStatusRequest: UpdateListStatusRequestSchema,
2978
+ UpdateListConfigRequest: UpdateListConfigRequestSchema,
2979
+ AddCompaniesToListRequest: AddCompaniesToListRequestSchema,
2980
+ RemoveCompaniesFromListRequest: RemoveCompaniesFromListRequestSchema,
2981
+ AddContactsToListRequest: AddContactsToListRequestSchema,
2982
+ RecordListExecutionRequest: RecordListExecutionRequestSchema,
2983
+
2984
+ // Responses
2985
+ AcqListResponse: AcqListResponseSchema,
2986
+ AcqListDetailResponse: AcqListDetailResponseSchema,
2987
+ AcqListListResponse: AcqListListResponseSchema,
2988
+ AcqListDealRef: AcqListDealRefSchema,
2989
+ AcqListLineage: AcqListLineageSchema,
2990
+ AcqListStatusResponse: AcqListStatusResponseSchema,
2991
+ ListTelemetryResponse: ListTelemetryResponseSchema,
2992
+ ListTelemetryListResponse: ListTelemetryListResponseSchema,
2993
+ ListExecutionsResponse: ListExecutionsResponseSchema,
2994
+ ListProgressResponse: ListProgressResponseSchema
2992
2995
  }
2993
2996
  ```
2994
2997
 
2995
2998
  ### `AcqSubstrateSchemas`
2996
2999
 
2997
3000
  ```typescript
2998
- export const AcqSubstrateSchemas = {
2999
- // Artifacts
3000
- ListArtifactsQuery: ListArtifactsQuerySchema,
3001
- CreateArtifactRequest: CreateArtifactRequestSchema,
3002
- AcqArtifactResponse: AcqArtifactResponseSchema,
3003
- AcqArtifactListResponse: AcqArtifactListResponseSchema,
3004
-
3005
- // List members
3006
- ListMembersQuery: ListMembersQuerySchema,
3007
- ListRecordsQuery: ListRecordsQuerySchema,
3008
- MemberIdParams: MemberIdParamsSchema,
3009
- AcqListMemberResponse: AcqListMemberResponseSchema,
3010
- AcqListMembersResponse: AcqListMembersResponseSchema,
3011
- AcqListCompanyRecordRow: AcqListCompanyRecordRowSchema,
3012
- AcqListContactRecordRow: AcqListContactRecordRowSchema,
3013
- ListRecordRow: ListRecordRowSchema,
3014
- ListRecordsResponse: ListRecordsResponseSchema,
3015
-
3016
- // List companies
3017
- ListCompanyIdParams: ListCompanyIdParamsSchema,
3018
- AcqListCompanyResponse: AcqListCompanyResponseSchema,
3019
-
3020
- // Transition (generic stateful substrate)
3021
- TransitionItemRequest: TransitionItemRequestSchema
3001
+ export const AcqSubstrateSchemas = {
3002
+ // Artifacts
3003
+ ListArtifactsQuery: ListArtifactsQuerySchema,
3004
+ CreateArtifactRequest: CreateArtifactRequestSchema,
3005
+ AcqArtifactResponse: AcqArtifactResponseSchema,
3006
+ AcqArtifactListResponse: AcqArtifactListResponseSchema,
3007
+
3008
+ // List members
3009
+ ListMembersQuery: ListMembersQuerySchema,
3010
+ ListRecordsQuery: ListRecordsQuerySchema,
3011
+ MemberIdParams: MemberIdParamsSchema,
3012
+ AcqListMemberResponse: AcqListMemberResponseSchema,
3013
+ AcqListMembersResponse: AcqListMembersResponseSchema,
3014
+ AcqListCompanyRecordRow: AcqListCompanyRecordRowSchema,
3015
+ AcqListContactRecordRow: AcqListContactRecordRowSchema,
3016
+ ListRecordRow: ListRecordRowSchema,
3017
+ ListRecordsResponse: ListRecordsResponseSchema,
3018
+
3019
+ // List companies
3020
+ ListCompanyIdParams: ListCompanyIdParamsSchema,
3021
+ AcqListCompanyResponse: AcqListCompanyResponseSchema,
3022
+
3023
+ // Transition (generic stateful substrate)
3024
+ TransitionItemRequest: TransitionItemRequestSchema
3022
3025
  }
3023
3026
  ```
3024
3027
 
3025
3028
  ### `Stateful`
3026
3029
 
3027
3030
  ```typescript
3028
- /**
3029
- * Stateful trait — the (pipeline_key, stage_key, state_key, activity_log) quartet
3030
- * applied to acq_deals (CRM HITL, shipped 2026-04-27) and being generalized to
3031
- * acq_lists / acq_list_members / acq_list_companies via Track B.
3032
- */
3033
- export interface Stateful {
3034
- pipeline_key: string
3035
- stage_key: string
3036
- state_key: string
3037
- activity_log: ActivityEvent[]
3031
+ /**
3032
+ * Stateful trait — the (pipeline_key, stage_key, state_key, activity_log) quartet
3033
+ * applied to acq_deals (CRM HITL, shipped 2026-04-27) and being generalized to
3034
+ * acq_lists / acq_list_members / acq_list_companies via Track B.
3035
+ */
3036
+ export interface Stateful {
3037
+ pipeline_key: string
3038
+ stage_key: string
3039
+ state_key: string
3040
+ activity_log: ActivityEvent[]
3038
3041
  }
3039
3042
  ```
3040
3043
 
3041
3044
  ### `TransitionItem`
3042
3045
 
3043
3046
  ```typescript
3044
- /** Generic transition shape — concrete per-entity transitionItem implementations satisfy this. */
3045
- export type TransitionItem<T extends Stateful, TEvent extends ActivityEvent> = (
3046
- item: T,
3047
- transition: { stage_key?: string; state_key?: string; event: TEvent }
3047
+ /** Generic transition shape — concrete per-entity transitionItem implementations satisfy this. */
3048
+ export type TransitionItem<T extends Stateful, TEvent extends ActivityEvent> = (
3049
+ item: T,
3050
+ transition: { stage_key?: string; state_key?: string; event: TEvent }
3048
3051
  ) => T
3049
3052
  ```
3050
3053
 
3051
3054
  ### `DeriveActions`
3052
3055
 
3053
3056
  ```typescript
3054
- /** Generic action-derivation shape — concrete per-entity deriveActions implementations satisfy this. */
3057
+ /** Generic action-derivation shape — concrete per-entity deriveActions implementations satisfy this. */
3055
3058
  export type DeriveActions<T extends Stateful, TAction> = (item: T) => TAction[]
3056
3059
  ```
3057
3060
 
3058
3061
  ### `StatefulSchema`
3059
3062
 
3060
3063
  ```typescript
3061
- export const StatefulSchema = z.object({
3062
- pipeline_key: z.string(),
3063
- stage_key: z.string(),
3064
- state_key: z.string(),
3065
- activity_log: z.array(ActivityEventSchema)
3064
+ export const StatefulSchema = z.object({
3065
+ pipeline_key: z.string(),
3066
+ stage_key: z.string(),
3067
+ state_key: z.string(),
3068
+ activity_log: z.array(ActivityEventSchema)
3066
3069
  })
3067
3070
  ```
3068
3071
 
3069
3072
  ### `StatefulStateDefinition`
3070
3073
 
3071
3074
  ```typescript
3072
- /** One state within a stage — minimal shape: key + display label. */
3073
- export interface StatefulStateDefinition {
3074
- /** Matches state_key values written by workflow steps. */
3075
- stateKey: string
3076
- label: string
3075
+ /** One state within a stage — minimal shape: key + display label. */
3076
+ export interface StatefulStateDefinition {
3077
+ /** Matches state_key values written by workflow steps. */
3078
+ stateKey: string
3079
+ label: string
3077
3080
  }
3078
3081
  ```
3079
3082
 
3080
3083
  ### `StatefulStageDefinition`
3081
3084
 
3082
3085
  ```typescript
3083
- /** One stage within a pipeline — has a stage_key and an ordered list of valid states. */
3084
- export interface StatefulStageDefinition {
3085
- /** Matches stage_key values written by workflow steps. */
3086
- stageKey: string
3087
- label: string
3088
- /** UI color token. Consumers may map this to their design system. */
3089
- color?: string
3090
- states: StatefulStateDefinition[]
3086
+ /** One stage within a pipeline — has a stage_key and an ordered list of valid states. */
3087
+ export interface StatefulStageDefinition {
3088
+ /** Matches stage_key values written by workflow steps. */
3089
+ stageKey: string
3090
+ label: string
3091
+ /** UI color token. Consumers may map this to their design system. */
3092
+ color?: string
3093
+ states: StatefulStateDefinition[]
3091
3094
  }
3092
3095
  ```
3093
3096
 
3094
3097
  ### `StatefulPipelineDefinition`
3095
3098
 
3096
3099
  ```typescript
3097
- /**
3098
- * Pipeline definition for a single entity participating in the Stateful trait.
3099
- * Parallel to acq_deals' pipeline_key concept but structured for lead-gen entities.
3100
- */
3101
- export interface StatefulPipelineDefinition {
3102
- /** Matches pipeline_key values in the database (e.g. 'lead-gen'). */
3103
- pipelineKey: string
3104
- label: string
3105
- /** Entity this pipeline applies to (e.g. 'acq.list', 'acq.list-member', 'acq.list-company'). */
3106
- entityKey: string
3107
- stages: StatefulStageDefinition[]
3100
+ /**
3101
+ * Pipeline definition for a single entity participating in the Stateful trait.
3102
+ * Parallel to acq_deals' pipeline_key concept but structured for lead-gen entities.
3103
+ */
3104
+ export interface StatefulPipelineDefinition {
3105
+ /** Matches pipeline_key values in the database (e.g. 'lead-gen'). */
3106
+ pipelineKey: string
3107
+ label: string
3108
+ /** Entity this pipeline applies to (e.g. 'acq.list', 'acq.list-member', 'acq.list-company'). */
3109
+ entityKey: string
3110
+ stages: StatefulStageDefinition[]
3108
3111
  }
3109
3112
  ```
3110
3113
 
3111
3114
  ### `ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE`
3112
3115
 
3113
3116
  ```typescript
3114
- /**
3115
- * Lead-gen pipeline definition for acq_list_members (contacts).
3116
- * Three stages matching the post-restructure sales subdomain tree.
3117
- *
3118
- * Note: members visit outreach and prospecting states depending on which
3119
- * workflow last processed them. stage_key is set per-transition by the workflow.
3120
- */
3121
- export const ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
3122
- pipelineKey: 'lead-gen',
3123
- label: 'Lead Generation',
3124
- entityKey: 'acq.list-member',
3125
- stages: [
3126
- {
3127
- stageKey: 'outreach',
3128
- label: 'Outreach',
3129
- states: [
3130
- PENDING_STATE,
3131
- { stateKey: 'personalized', label: 'Personalized' },
3132
- { stateKey: 'uploaded', label: 'Uploaded' },
3133
- { stateKey: 'interested', label: 'Interested' }
3134
- ]
3135
- },
3136
- {
3137
- stageKey: 'prospecting',
3138
- label: 'Prospecting',
3139
- states: [
3140
- PENDING_STATE,
3141
- { stateKey: 'discovered', label: 'Discovered' },
3142
- { stateKey: 'verified', label: 'Verified' }
3143
- ]
3144
- },
3145
- {
3146
- stageKey: 'qualification',
3147
- label: 'Qualification',
3148
- states: [PENDING_STATE]
3149
- }
3150
- ]
3117
+ /**
3118
+ * Lead-gen pipeline definition for acq_list_members (contacts).
3119
+ * Three stages matching the post-restructure sales subdomain tree.
3120
+ *
3121
+ * Note: members visit outreach and prospecting states depending on which
3122
+ * workflow last processed them. stage_key is set per-transition by the workflow.
3123
+ */
3124
+ export const ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
3125
+ pipelineKey: 'lead-gen',
3126
+ label: 'Lead Generation',
3127
+ entityKey: 'acq.list-member',
3128
+ stages: [
3129
+ {
3130
+ stageKey: 'outreach',
3131
+ label: 'Outreach',
3132
+ states: [
3133
+ PENDING_STATE,
3134
+ { stateKey: 'personalized', label: 'Personalized' },
3135
+ { stateKey: 'uploaded', label: 'Uploaded' },
3136
+ { stateKey: 'interested', label: 'Interested' }
3137
+ ]
3138
+ },
3139
+ {
3140
+ stageKey: 'prospecting',
3141
+ label: 'Prospecting',
3142
+ states: [
3143
+ PENDING_STATE,
3144
+ { stateKey: 'discovered', label: 'Discovered' },
3145
+ { stateKey: 'verified', label: 'Verified' }
3146
+ ]
3147
+ },
3148
+ {
3149
+ stageKey: 'qualification',
3150
+ label: 'Qualification',
3151
+ states: [PENDING_STATE]
3152
+ }
3153
+ ]
3151
3154
  }
3152
3155
  ```
3153
3156
 
3154
3157
  ### `ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE`
3155
3158
 
3156
3159
  ```typescript
3157
- /**
3158
- * Lead-gen pipeline definition for acq_list_companies.
3159
- * Three stages matching the post-restructure sales subdomain tree.
3160
- *
3161
- * Note: companies visit prospecting and qualification states depending on which
3162
- * workflow last processed them. stage_key is set per-transition by the workflow.
3163
- */
3164
- export const ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
3165
- pipelineKey: 'lead-gen',
3166
- label: 'Lead Generation',
3167
- entityKey: 'acq.list-company',
3168
- stages: [
3169
- {
3170
- stageKey: 'outreach',
3171
- label: 'Outreach',
3172
- states: [PENDING_STATE, { stateKey: 'uploaded', label: 'Uploaded' }]
3173
- },
3174
- {
3175
- stageKey: 'prospecting',
3176
- label: 'Prospecting',
3177
- states: [
3178
- PENDING_STATE,
3179
- { stateKey: 'populated', label: 'Populated' },
3180
- { stateKey: 'extracted', label: 'Extracted' }
3181
- ]
3182
- },
3183
- {
3184
- stageKey: 'qualification',
3185
- label: 'Qualification',
3186
- states: [PENDING_STATE, { stateKey: 'qualified', label: 'Qualified' }]
3187
- }
3188
- ]
3160
+ /**
3161
+ * Lead-gen pipeline definition for acq_list_companies.
3162
+ * Three stages matching the post-restructure sales subdomain tree.
3163
+ *
3164
+ * Note: companies visit prospecting and qualification states depending on which
3165
+ * workflow last processed them. stage_key is set per-transition by the workflow.
3166
+ */
3167
+ export const ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
3168
+ pipelineKey: 'lead-gen',
3169
+ label: 'Lead Generation',
3170
+ entityKey: 'acq.list-company',
3171
+ stages: [
3172
+ {
3173
+ stageKey: 'outreach',
3174
+ label: 'Outreach',
3175
+ states: [PENDING_STATE, { stateKey: 'uploaded', label: 'Uploaded' }]
3176
+ },
3177
+ {
3178
+ stageKey: 'prospecting',
3179
+ label: 'Prospecting',
3180
+ states: [
3181
+ PENDING_STATE,
3182
+ { stateKey: 'populated', label: 'Populated' },
3183
+ { stateKey: 'extracted', label: 'Extracted' }
3184
+ ]
3185
+ },
3186
+ {
3187
+ stageKey: 'qualification',
3188
+ label: 'Qualification',
3189
+ states: [PENDING_STATE, { stateKey: 'qualified', label: 'Qualified' }]
3190
+ }
3191
+ ]
3189
3192
  }
3190
3193
  ```
3191
3194
 
3192
3195
  ### `LEAD_GEN_PIPELINE_DEFINITIONS`
3193
3196
 
3194
3197
  ```typescript
3195
- /**
3196
- * All lead-gen pipeline definitions indexed by entity key.
3197
- * Use findPipeline() to locate a definition by pipeline_key within any of these arrays.
3198
- */
3199
- export const LEAD_GEN_PIPELINE_DEFINITIONS: Record<string, StatefulPipelineDefinition[]> = {
3200
- 'acq.list-member': [ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE],
3201
- 'acq.list-company': [ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE]
3198
+ /**
3199
+ * All lead-gen pipeline definitions indexed by entity key.
3200
+ * Use findPipeline() to locate a definition by pipeline_key within any of these arrays.
3201
+ */
3202
+ export const LEAD_GEN_PIPELINE_DEFINITIONS: Record<string, StatefulPipelineDefinition[]> = {
3203
+ 'acq.list-member': [ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE],
3204
+ 'acq.list-company': [ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE]
3202
3205
  }
3203
3206
  ```
3204
3207
 
3205
3208
  ### `PaginationParams`
3206
3209
 
3207
3210
  ```typescript
3208
- export interface PaginationParams {
3209
- limit: number
3210
- offset: number
3211
+ export interface PaginationParams {
3212
+ limit: number
3213
+ offset: number
3211
3214
  }
3212
3215
  ```
3213
3216
 
3214
3217
  ### `PaginatedResult`
3215
3218
 
3216
3219
  ```typescript
3217
- export interface PaginatedResult<T> {
3218
- data: T[]
3219
- total: number
3220
- limit: number
3221
- offset: number
3220
+ export interface PaginatedResult<T> {
3221
+ data: T[]
3222
+ total: number
3223
+ limit: number
3224
+ offset: number
3222
3225
  }
3223
3226
  ```
3224
3227
 
3225
3228
  ### `CreateListParams`
3226
3229
 
3227
3230
  ```typescript
3228
- export interface CreateListParams {
3229
- organizationId: string
3230
- name: string
3231
- description?: string
3232
- type?: string
3233
- batchIds?: string[]
3234
- instantlyCampaignId?: string
3235
- status?: ListStatus
3236
- buildTemplateId?: string
3237
- metadata?: Record<string, unknown>
3238
- scrapingConfig?: ScrapingConfig
3239
- icp?: IcpRubric
3240
- pipelineConfig?: PipelineConfig
3231
+ export interface CreateListParams {
3232
+ organizationId: string
3233
+ name: string
3234
+ description?: string
3235
+ type?: string
3236
+ batchIds?: string[]
3237
+ instantlyCampaignId?: string
3238
+ status?: ListStatus
3239
+ buildTemplateId?: string
3240
+ metadata?: Record<string, unknown>
3241
+ scrapingConfig?: ScrapingConfig
3242
+ icp?: IcpRubric
3243
+ pipelineConfig?: PipelineConfig
3241
3244
  }
3242
3245
  ```
3243
3246
 
3244
3247
  ### `UpdateListParams`
3245
3248
 
3246
3249
  ```typescript
3247
- export interface UpdateListParams {
3248
- name?: string
3249
- description?: string
3250
- batchIds?: string[]
3250
+ export interface UpdateListParams {
3251
+ name?: string
3252
+ description?: string
3253
+ batchIds?: string[]
3251
3254
  }
3252
3255
  ```
3253
3256
 
3254
3257
  ### `CreateCompanyParams`
3255
3258
 
3256
3259
  ```typescript
3257
- export interface CreateCompanyParams {
3258
- organizationId: string
3259
- name: string
3260
- domain?: string
3261
- linkedinUrl?: string
3262
- website?: string
3263
- numEmployees?: number
3264
- foundedYear?: number
3265
- locationCity?: string
3266
- locationState?: string
3267
- category?: string
3268
- source?: string
3269
- batchId?: string
3270
- verticalResearch?: string
3271
- /** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
3272
- pipelineStatus?: unknown
3260
+ export interface CreateCompanyParams {
3261
+ organizationId: string
3262
+ name: string
3263
+ domain?: string
3264
+ linkedinUrl?: string
3265
+ website?: string
3266
+ numEmployees?: number
3267
+ foundedYear?: number
3268
+ locationCity?: string
3269
+ locationState?: string
3270
+ category?: string
3271
+ source?: string
3272
+ batchId?: string
3273
+ verticalResearch?: string
3274
+ /** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
3275
+ pipelineStatus?: unknown
3273
3276
  }
3274
3277
  ```
3275
3278
 
3276
3279
  ### `UpdateCompanyParams`
3277
3280
 
3278
3281
  ```typescript
3279
- export interface UpdateCompanyParams {
3280
- name?: string
3281
- domain?: string
3282
- linkedinUrl?: string
3283
- website?: string
3284
- numEmployees?: number
3285
- foundedYear?: number
3286
- locationCity?: string
3287
- locationState?: string
3288
- category?: string
3289
- segment?: string
3290
- processingState?: ProcessingState
3291
- /** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
3292
- pipelineStatus?: unknown
3293
- enrichmentData?: Record<string, unknown>
3294
- source?: string
3295
- batchId?: string
3296
- status?: 'active' | 'invalid'
3297
- verticalResearch?: string | null
3298
- /** Track A: flat qualification score column (null until a scoring rubric is defined) */
3299
- qualificationScore?: number | null
3300
- /** Track A: flat qualification signals jsonb */
3301
- qualificationSignals?: Record<string, unknown> | null
3302
- /** Track A: key identifying the rubric used for qualification */
3303
- qualificationRubricKey?: string | null
3282
+ export interface UpdateCompanyParams {
3283
+ name?: string
3284
+ domain?: string
3285
+ linkedinUrl?: string
3286
+ website?: string
3287
+ numEmployees?: number
3288
+ foundedYear?: number
3289
+ locationCity?: string
3290
+ locationState?: string
3291
+ category?: string
3292
+ segment?: string
3293
+ processingState?: ProcessingState
3294
+ /** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
3295
+ pipelineStatus?: unknown
3296
+ enrichmentData?: Record<string, unknown>
3297
+ source?: string
3298
+ batchId?: string
3299
+ status?: 'active' | 'invalid'
3300
+ verticalResearch?: string | null
3301
+ /** Track A: flat qualification score column (null until a scoring rubric is defined) */
3302
+ qualificationScore?: number | null
3303
+ /** Track A: flat qualification signals jsonb */
3304
+ qualificationSignals?: Record<string, unknown> | null
3305
+ /** Track A: key identifying the rubric used for qualification */
3306
+ qualificationRubricKey?: string | null
3304
3307
  }
3305
3308
  ```
3306
3309
 
@@ -3313,63 +3316,63 @@ export type UpsertCompanyParams = CreateCompanyParams
3313
3316
  ### `CompanyFilters`
3314
3317
 
3315
3318
  ```typescript
3316
- export interface CompanyFilters {
3317
- listId?: string // Filter to companies in a specific list (via acq_list_companies)
3318
- search?: string
3319
- domain?: string
3320
- website?: string
3321
- segment?: string
3322
- category?: string
3323
- processingState?: ProcessingState
3324
- /** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
3325
- pipelineStatus?: unknown
3326
- /** Exclude companies whose processing state contains this value (PostgREST NOT contains) */
3327
- processingStateNot?: ProcessingState
3328
- batchId?: string
3329
- status?: 'active' | 'invalid'
3330
- includeAll?: boolean
3331
- excludeColumns?: Array<'enrichmentData' | 'processingState'>
3332
- limit?: number
3319
+ export interface CompanyFilters {
3320
+ listId?: string // Filter to companies in a specific list (via acq_list_companies)
3321
+ search?: string
3322
+ domain?: string
3323
+ website?: string
3324
+ segment?: string
3325
+ category?: string
3326
+ processingState?: ProcessingState
3327
+ /** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
3328
+ pipelineStatus?: unknown
3329
+ /** Exclude companies whose processing state contains this value (PostgREST NOT contains) */
3330
+ processingStateNot?: ProcessingState
3331
+ batchId?: string
3332
+ status?: 'active' | 'invalid'
3333
+ includeAll?: boolean
3334
+ excludeColumns?: Array<'enrichmentData' | 'processingState'>
3335
+ limit?: number
3333
3336
  }
3334
3337
  ```
3335
3338
 
3336
3339
  ### `CreateContactParams`
3337
3340
 
3338
3341
  ```typescript
3339
- export interface CreateContactParams {
3340
- organizationId: string
3341
- email: string
3342
- companyId?: string
3343
- firstName?: string
3344
- lastName?: string
3345
- linkedinUrl?: string
3346
- title?: string
3347
- source?: string
3348
- sourceId?: string
3349
- batchId?: string
3350
- /** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
3351
- pipelineStatus?: unknown
3342
+ export interface CreateContactParams {
3343
+ organizationId: string
3344
+ email: string
3345
+ companyId?: string
3346
+ firstName?: string
3347
+ lastName?: string
3348
+ linkedinUrl?: string
3349
+ title?: string
3350
+ source?: string
3351
+ sourceId?: string
3352
+ batchId?: string
3353
+ /** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
3354
+ pipelineStatus?: unknown
3352
3355
  }
3353
3356
  ```
3354
3357
 
3355
3358
  ### `UpdateContactParams`
3356
3359
 
3357
3360
  ```typescript
3358
- export interface UpdateContactParams {
3359
- companyId?: string
3360
- emailValid?: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN'
3361
- firstName?: string
3362
- lastName?: string
3363
- linkedinUrl?: string
3364
- title?: string
3365
- headline?: string
3366
- filterReason?: string
3367
- openingLine?: string
3368
- processingState?: ProcessingState
3369
- /** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
3370
- pipelineStatus?: unknown
3371
- enrichmentData?: Record<string, unknown>
3372
- status?: 'active' | 'invalid'
3361
+ export interface UpdateContactParams {
3362
+ companyId?: string
3363
+ emailValid?: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN'
3364
+ firstName?: string
3365
+ lastName?: string
3366
+ linkedinUrl?: string
3367
+ title?: string
3368
+ headline?: string
3369
+ filterReason?: string
3370
+ openingLine?: string
3371
+ processingState?: ProcessingState
3372
+ /** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
3373
+ pipelineStatus?: unknown
3374
+ enrichmentData?: Record<string, unknown>
3375
+ status?: 'active' | 'invalid'
3373
3376
  }
3374
3377
  ```
3375
3378
 
@@ -3382,400 +3385,400 @@ export type UpsertContactParams = CreateContactParams
3382
3385
  ### `ContactFilters`
3383
3386
 
3384
3387
  ```typescript
3385
- export interface ContactFilters {
3386
- listId?: string // Filter to contacts in a specific list (via acq_list_members)
3387
- search?: string
3388
- openingLineIsNull?: boolean // Filter to contacts without personalization
3389
- processingState?: ProcessingState
3390
- /** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
3391
- pipelineStatus?: unknown
3392
- batchId?: string
3393
- contactStatus?: 'active' | 'invalid' // Filter by contact status (soft-delete flag)
3388
+ export interface ContactFilters {
3389
+ listId?: string // Filter to contacts in a specific list (via acq_list_members)
3390
+ search?: string
3391
+ openingLineIsNull?: boolean // Filter to contacts without personalization
3392
+ processingState?: ProcessingState
3393
+ /** @deprecated Use processingState. Accepted as a no-op compatibility bridge for external tenants. */
3394
+ pipelineStatus?: unknown
3395
+ batchId?: string
3396
+ contactStatus?: 'active' | 'invalid' // Filter by contact status (soft-delete flag)
3394
3397
  }
3395
3398
  ```
3396
3399
 
3397
3400
  ### `UpsertSocialPostParams`
3398
3401
 
3399
3402
  ```typescript
3400
- export interface UpsertSocialPostParams {
3401
- organizationId: string
3402
- platform: string
3403
- platformPostId: string
3404
- authorName: string
3405
- authorUrl?: string | null
3406
- postTitle: string
3407
- postText: string
3408
- postUrl: string
3409
- engagementCount?: number
3410
- commentsCount?: number
3411
- postedAt: string
3412
- metadata?: Record<string, unknown>
3413
- relevanceScore?: number
3414
- matchedKeywords?: string[]
3415
- matchedQuery?: string | null
3416
- initialDraft?: string | null
3417
- finalResponse?: string | null
3418
- sourceCategory?: string | null
3403
+ export interface UpsertSocialPostParams {
3404
+ organizationId: string
3405
+ platform: string
3406
+ platformPostId: string
3407
+ authorName: string
3408
+ authorUrl?: string | null
3409
+ postTitle: string
3410
+ postText: string
3411
+ postUrl: string
3412
+ engagementCount?: number
3413
+ commentsCount?: number
3414
+ postedAt: string
3415
+ metadata?: Record<string, unknown>
3416
+ relevanceScore?: number
3417
+ matchedKeywords?: string[]
3418
+ matchedQuery?: string | null
3419
+ initialDraft?: string | null
3420
+ finalResponse?: string | null
3421
+ sourceCategory?: string | null
3419
3422
  }
3420
3423
  ```
3421
3424
 
3422
3425
  ### `UpsertSocialPostsParams`
3423
3426
 
3424
3427
  ```typescript
3425
- export interface UpsertSocialPostsParams {
3426
- organizationId: string
3427
- posts: Omit<UpsertSocialPostParams, 'organizationId'>[]
3428
+ export interface UpsertSocialPostsParams {
3429
+ organizationId: string
3430
+ posts: Omit<UpsertSocialPostParams, 'organizationId'>[]
3428
3431
  }
3429
3432
  ```
3430
3433
 
3431
3434
  ### `UpsertSocialPostsResult`
3432
3435
 
3433
3436
  ```typescript
3434
- export interface UpsertSocialPostsResult {
3435
- inserted: number
3436
- duplicatesSkipped: number
3437
+ export interface UpsertSocialPostsResult {
3438
+ inserted: number
3439
+ duplicatesSkipped: number
3437
3440
  }
3438
3441
  ```
3439
3442
 
3440
3443
  ### `AddContactsToListParams`
3441
3444
 
3442
3445
  ```typescript
3443
- export interface AddContactsToListParams {
3444
- organizationId: string
3445
- listId: string
3446
- contactIds: string[]
3446
+ export interface AddContactsToListParams {
3447
+ organizationId: string
3448
+ listId: string
3449
+ contactIds: string[]
3447
3450
  }
3448
3451
  ```
3449
3452
 
3450
3453
  ### `AddContactsToListResult`
3451
3454
 
3452
3455
  ```typescript
3453
- export interface AddContactsToListResult {
3454
- added: number
3455
- alreadyExisted: number
3456
+ export interface AddContactsToListResult {
3457
+ added: number
3458
+ alreadyExisted: number
3456
3459
  }
3457
3460
  ```
3458
3461
 
3459
3462
  ### `UpdateListConfigParams`
3460
3463
 
3461
3464
  ```typescript
3462
- export interface UpdateListConfigParams {
3463
- organizationId: string
3464
- listId: string
3465
- scrapingConfig?: ScrapingConfig
3466
- icp?: IcpRubric
3467
- pipelineConfig?: PipelineConfig
3465
+ export interface UpdateListConfigParams {
3466
+ organizationId: string
3467
+ listId: string
3468
+ scrapingConfig?: ScrapingConfig
3469
+ icp?: IcpRubric
3470
+ pipelineConfig?: PipelineConfig
3468
3471
  }
3469
3472
  ```
3470
3473
 
3471
3474
  ### `UpdateCompanyStageParams`
3472
3475
 
3473
3476
  ```typescript
3474
- export interface UpdateCompanyStageParams {
3475
- organizationId: string
3476
- listId: string
3477
- companyId: string
3478
- stage: string
3479
- status?: ProcessingStageStatus
3480
- executionId?: string
3477
+ export interface UpdateCompanyStageParams {
3478
+ organizationId: string
3479
+ listId: string
3480
+ companyId: string
3481
+ stage: string
3482
+ status?: ProcessingStageStatus
3483
+ executionId?: string
3481
3484
  }
3482
3485
  ```
3483
3486
 
3484
3487
  ### `UpdateContactStageParams`
3485
3488
 
3486
3489
  ```typescript
3487
- export interface UpdateContactStageParams {
3488
- organizationId: string
3489
- listId: string
3490
- contactId: string
3491
- stage: string
3492
- status?: ProcessingStageStatus
3493
- executionId?: string
3490
+ export interface UpdateContactStageParams {
3491
+ organizationId: string
3492
+ listId: string
3493
+ contactId: string
3494
+ stage: string
3495
+ status?: ProcessingStageStatus
3496
+ executionId?: string
3494
3497
  }
3495
3498
  ```
3496
3499
 
3497
3500
  ### `AddCompaniesToListParams`
3498
3501
 
3499
3502
  ```typescript
3500
- export interface AddCompaniesToListParams {
3501
- organizationId: string
3502
- listId: string
3503
- companyIds: string[]
3503
+ export interface AddCompaniesToListParams {
3504
+ organizationId: string
3505
+ listId: string
3506
+ companyIds: string[]
3504
3507
  }
3505
3508
  ```
3506
3509
 
3507
3510
  ### `AddCompaniesToListResult`
3508
3511
 
3509
3512
  ```typescript
3510
- export interface AddCompaniesToListResult {
3511
- added: number
3512
- alreadyExisted: number
3513
+ export interface AddCompaniesToListResult {
3514
+ added: number
3515
+ alreadyExisted: number
3513
3516
  }
3514
3517
  ```
3515
3518
 
3516
3519
  ### `RemoveCompaniesFromListParams`
3517
3520
 
3518
3521
  ```typescript
3519
- export interface RemoveCompaniesFromListParams {
3520
- organizationId: string
3521
- listId: string
3522
- companyIds: string[]
3522
+ export interface RemoveCompaniesFromListParams {
3523
+ organizationId: string
3524
+ listId: string
3525
+ companyIds: string[]
3523
3526
  }
3524
3527
  ```
3525
3528
 
3526
3529
  ### `RemoveCompaniesFromListResult`
3527
3530
 
3528
3531
  ```typescript
3529
- export interface RemoveCompaniesFromListResult {
3530
- removed: number
3532
+ export interface RemoveCompaniesFromListResult {
3533
+ removed: number
3531
3534
  }
3532
3535
  ```
3533
3536
 
3534
3537
  ### `RecordListExecutionParams`
3535
3538
 
3536
3539
  ```typescript
3537
- export interface RecordListExecutionParams {
3538
- organizationId: string
3539
- listId: string
3540
- executionId: string
3541
- configSnapshot?: Record<string, unknown>
3540
+ export interface RecordListExecutionParams {
3541
+ organizationId: string
3542
+ listId: string
3543
+ executionId: string
3544
+ configSnapshot?: Record<string, unknown>
3542
3545
  }
3543
3546
  ```
3544
3547
 
3545
3548
  ### `ListExecutionSummary`
3546
3549
 
3547
3550
  ```typescript
3548
- export interface ListExecutionSummary {
3549
- executionId: string
3550
- resourceId: string
3551
- status: string
3552
- createdAt: string
3553
- completedAt: string | null
3554
- durationMs: number | null
3551
+ export interface ListExecutionSummary {
3552
+ executionId: string
3553
+ resourceId: string
3554
+ status: string
3555
+ createdAt: string
3556
+ completedAt: string | null
3557
+ durationMs: number | null
3555
3558
  }
3556
3559
  ```
3557
3560
 
3558
3561
  ### `BulkImportParams`
3559
3562
 
3560
3563
  ```typescript
3561
- export interface BulkImportParams {
3562
- organizationId: string
3563
- contacts: CreateContactParams[]
3564
- listId?: string
3564
+ export interface BulkImportParams {
3565
+ organizationId: string
3566
+ contacts: CreateContactParams[]
3567
+ listId?: string
3565
3568
  }
3566
3569
  ```
3567
3570
 
3568
3571
  ### `BulkImportResult`
3569
3572
 
3570
3573
  ```typescript
3571
- export interface BulkImportResult {
3572
- created: number
3573
- updated: number
3574
- errors: Array<{ email: string; error: string }>
3574
+ export interface BulkImportResult {
3575
+ created: number
3576
+ updated: number
3577
+ errors: Array<{ email: string; error: string }>
3575
3578
  }
3576
3579
  ```
3577
3580
 
3578
3581
  ### `BulkImportCompanyEntry`
3579
3582
 
3580
3583
  ```typescript
3581
- export interface BulkImportCompanyEntry {
3582
- name: string
3583
- domain: string
3584
- website?: string
3585
- locationCity?: string
3586
- locationState?: string
3587
- category?: string
3588
- source?: string
3589
- enrichmentData?: Record<string, unknown>
3590
- processingState?: ProcessingState
3584
+ export interface BulkImportCompanyEntry {
3585
+ name: string
3586
+ domain: string
3587
+ website?: string
3588
+ locationCity?: string
3589
+ locationState?: string
3590
+ category?: string
3591
+ source?: string
3592
+ enrichmentData?: Record<string, unknown>
3593
+ processingState?: ProcessingState
3591
3594
  }
3592
3595
  ```
3593
3596
 
3594
3597
  ### `BulkImportCompaniesParams`
3595
3598
 
3596
3599
  ```typescript
3597
- export interface BulkImportCompaniesParams {
3598
- organizationId: string
3599
- batchId: string
3600
- companies: BulkImportCompanyEntry[]
3600
+ export interface BulkImportCompaniesParams {
3601
+ organizationId: string
3602
+ batchId: string
3603
+ companies: BulkImportCompanyEntry[]
3601
3604
  }
3602
3605
  ```
3603
3606
 
3604
3607
  ### `BulkImportCompaniesResult`
3605
3608
 
3606
3609
  ```typescript
3607
- export interface BulkImportCompaniesResult {
3608
- created: number
3609
- skipped: number
3610
- errors: Array<{ companyName: string; error: string }>
3610
+ export interface BulkImportCompaniesResult {
3611
+ created: number
3612
+ skipped: number
3613
+ errors: Array<{ companyName: string; error: string }>
3611
3614
  }
3612
3615
  ```
3613
3616
 
3614
3617
  ### `LeadToolMap`
3615
3618
 
3616
3619
  ```typescript
3617
- export type LeadToolMap = {
3618
- // List operations
3619
- listLists: { params: Record<string, never>; result: AcqList[] }
3620
- createList: { params: Omit<CreateListParams, 'organizationId'>; result: AcqList }
3621
- updateList: { params: { id: string } & UpdateListParams; result: AcqList }
3622
- deleteList: { params: { id: string }; result: void }
3623
- addContactsToList: { params: Omit<AddContactsToListParams, 'organizationId'>; result: AddContactsToListResult }
3624
- addCompaniesToList: { params: Omit<AddCompaniesToListParams, 'organizationId'>; result: AddCompaniesToListResult }
3625
- updateCompanyStage: {
3626
- params: Omit<UpdateCompanyStageParams, 'organizationId'>
3627
- result: void
3628
- }
3629
- updateContactStage: {
3630
- params: Omit<UpdateContactStageParams, 'organizationId'>
3631
- result: void
3632
- }
3633
- // Company operations
3634
- createCompany: { params: Omit<CreateCompanyParams, 'organizationId'>; result: AcqCompany }
3635
- upsertCompany: { params: Omit<UpsertCompanyParams, 'organizationId'>; result: AcqCompany }
3636
- updateCompany: { params: { id: string } & UpdateCompanyParams; result: AcqCompany }
3637
- getCompany: { params: { id: string }; result: AcqCompany | null }
3638
- listCompanies: { params: CompanyFilters; result: AcqCompany[] }
3639
- deleteCompany: { params: { id: string }; result: void }
3640
- // Contact operations
3641
- createContact: { params: Omit<CreateContactParams, 'organizationId'>; result: AcqContact }
3642
- upsertContact: { params: Omit<UpsertContactParams, 'organizationId'>; result: AcqContact }
3643
- updateContact: { params: { id: string } & UpdateContactParams; result: AcqContact }
3644
- getContact: { params: { id: string }; result: AcqContact | null }
3645
- getContactByEmail: { params: { email: string }; result: AcqContact | null }
3646
- listContacts: {
3647
- params: ContactFilters & { limit?: number; offset?: number }
3648
- result: PaginatedResult<AcqContact>
3649
- }
3650
- deleteContact: { params: { id: string }; result: void }
3651
- bulkImportContacts: { params: Omit<BulkImportParams, 'organizationId'>; result: BulkImportResult }
3652
- bulkImportCompanies: {
3653
- params: Omit<BulkImportCompaniesParams, 'organizationId'>
3654
- result: BulkImportCompaniesResult
3655
- }
3656
- deactivateContactsByCompany: {
3657
- params: { companyId: string }
3658
- result: { deactivated: number }
3659
- }
3660
- // Deal operations
3661
- upsertDeal: { params: Omit<UpsertDealParams, 'organizationId'>; result: AcqDeal }
3662
- getDealByEmail: { params: { email: string }; result: AcqDeal | null }
3663
- getDealByEnvelopeId: { params: { envelopeId: string }; result: AcqDeal | null }
3664
- updateDealEnvelopeId: { params: { dealId: string; envelopeId: string }; result: AcqDeal | null }
3665
- getDealById: { params: Omit<GetDealByIdParams, 'organizationId'>; result: AcqDeal | null }
3666
- getContactById: { params: Omit<GetContactByIdParams, 'organizationId'>; result: AcqContact | null }
3667
- getCompanyById: { params: Omit<GetCompanyByIdParams, 'organizationId'>; result: AcqCompany | null }
3668
- // Deal-sync operations
3669
- updateDiscoveryData: { params: Omit<UpdateDiscoveryDataParams, 'organizationId'>; result: void }
3670
- updateProposalData: { params: Omit<UpdateProposalDataParams, 'organizationId'>; result: void }
3671
- markProposalSent: { params: Omit<MarkProposalSentParams, 'organizationId'>; result: void }
3672
- markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
3673
- updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
3674
- updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
3675
- cacheInstantlyThreadIds: { params: Omit<CacheInstantlyThreadIdsParams, 'organizationId'>; result: void }
3676
- transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
3677
- setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
3678
- cancelSchedulesAndHitlByEmail: {
3679
- params: Omit<CancelSchedulesAndHitlByEmailParams, 'organizationId'>
3680
- result: { schedulesCancelled: number; hitlDeleted: number }
3681
- }
3682
- cancelHitlByDealId: { params: Omit<CancelHitlByDealIdParams, 'organizationId'>; result: { hitlDeleted: number } }
3683
- clearDealFields: { params: Omit<ClearDealFieldsParams, 'organizationId'>; result: void }
3684
- deleteDeal: { params: Omit<DeleteDealParams, 'organizationId'>; result: void }
3685
- recordDealActivity: {
3686
- params: Omit<RecordDealActivityParams, 'organizationId'>
3687
- result: void
3688
- }
3689
- // Deal note operations
3690
- createDealNote: {
3691
- params: Omit<CreateDealNoteParams, 'organizationId'>
3692
- result: AcqDealNote
3693
- }
3694
- listDealNotes: {
3695
- params: Omit<ListDealNotesParams, 'organizationId'>
3696
- result: AcqDealNote[]
3697
- }
3698
- // Deal task operations
3699
- createDealTask: {
3700
- params: Omit<CreateDealTaskParams, 'organizationId'>
3701
- result: AcqDealTask
3702
- }
3703
- listDealTasks: {
3704
- params: Omit<ListDealTasksParams, 'organizationId'>
3705
- result: AcqDealTask[]
3706
- }
3707
- listDealTasksDue: {
3708
- params: Omit<ListDealTasksDueParams, 'organizationId'>
3709
- result: AcqDealTask[]
3710
- }
3711
- completeDealTask: {
3712
- params: Omit<CompleteDealTaskParams, 'organizationId'>
3713
- result: AcqDealTask
3714
- }
3715
- // Deal query & analytics operations
3716
- listDeals: { params: DealFilters; result: AcqDeal[] }
3717
- getDealPipelineAnalytics: { params: { recentLimit?: number }; result: DealPipelineAnalytics }
3718
- // Enrichment data operations
3719
- mergeEnrichmentData: {
3720
- params: { id: string; table: 'acq_companies' | 'acq_contacts'; data: Record<string, unknown> }
3721
- result: void
3722
- }
3723
- // Social monitoring operations
3724
- upsertSocialPosts: {
3725
- params: { posts: Omit<UpsertSocialPostParams, 'organizationId'>[] }
3726
- result: UpsertSocialPostsResult
3727
- }
3728
- setDealStateKey: {
3729
- params: {
3730
- dealId: string
3731
- stateKey: string
3732
- }
3733
- result: { ok: true }
3734
- }
3735
- // CRM workflow helpers
3736
- transitionDeal: {
3737
- params: {
3738
- dealId: string
3739
- toStage: string
3740
- toState?: string
3741
- }
3742
- result: { deal: AcqDeal }
3743
- }
3744
- loadDeal: {
3745
- params: { dealId: string }
3746
- result: DealDetail | null
3747
- }
3620
+ export type LeadToolMap = {
3621
+ // List operations
3622
+ listLists: { params: Record<string, never>; result: AcqList[] }
3623
+ createList: { params: Omit<CreateListParams, 'organizationId'>; result: AcqList }
3624
+ updateList: { params: { id: string } & UpdateListParams; result: AcqList }
3625
+ deleteList: { params: { id: string }; result: void }
3626
+ addContactsToList: { params: Omit<AddContactsToListParams, 'organizationId'>; result: AddContactsToListResult }
3627
+ addCompaniesToList: { params: Omit<AddCompaniesToListParams, 'organizationId'>; result: AddCompaniesToListResult }
3628
+ updateCompanyStage: {
3629
+ params: Omit<UpdateCompanyStageParams, 'organizationId'>
3630
+ result: void
3631
+ }
3632
+ updateContactStage: {
3633
+ params: Omit<UpdateContactStageParams, 'organizationId'>
3634
+ result: void
3635
+ }
3636
+ // Company operations
3637
+ createCompany: { params: Omit<CreateCompanyParams, 'organizationId'>; result: AcqCompany }
3638
+ upsertCompany: { params: Omit<UpsertCompanyParams, 'organizationId'>; result: AcqCompany }
3639
+ updateCompany: { params: { id: string } & UpdateCompanyParams; result: AcqCompany }
3640
+ getCompany: { params: { id: string }; result: AcqCompany | null }
3641
+ listCompanies: { params: CompanyFilters; result: AcqCompany[] }
3642
+ deleteCompany: { params: { id: string }; result: void }
3643
+ // Contact operations
3644
+ createContact: { params: Omit<CreateContactParams, 'organizationId'>; result: AcqContact }
3645
+ upsertContact: { params: Omit<UpsertContactParams, 'organizationId'>; result: AcqContact }
3646
+ updateContact: { params: { id: string } & UpdateContactParams; result: AcqContact }
3647
+ getContact: { params: { id: string }; result: AcqContact | null }
3648
+ getContactByEmail: { params: { email: string }; result: AcqContact | null }
3649
+ listContacts: {
3650
+ params: ContactFilters & { limit?: number; offset?: number }
3651
+ result: PaginatedResult<AcqContact>
3652
+ }
3653
+ deleteContact: { params: { id: string }; result: void }
3654
+ bulkImportContacts: { params: Omit<BulkImportParams, 'organizationId'>; result: BulkImportResult }
3655
+ bulkImportCompanies: {
3656
+ params: Omit<BulkImportCompaniesParams, 'organizationId'>
3657
+ result: BulkImportCompaniesResult
3658
+ }
3659
+ deactivateContactsByCompany: {
3660
+ params: { companyId: string }
3661
+ result: { deactivated: number }
3662
+ }
3663
+ // Deal operations
3664
+ upsertDeal: { params: Omit<UpsertDealParams, 'organizationId'>; result: AcqDeal }
3665
+ getDealByEmail: { params: { email: string }; result: AcqDeal | null }
3666
+ getDealByEnvelopeId: { params: { envelopeId: string }; result: AcqDeal | null }
3667
+ updateDealEnvelopeId: { params: { dealId: string; envelopeId: string }; result: AcqDeal | null }
3668
+ getDealById: { params: Omit<GetDealByIdParams, 'organizationId'>; result: AcqDeal | null }
3669
+ getContactById: { params: Omit<GetContactByIdParams, 'organizationId'>; result: AcqContact | null }
3670
+ getCompanyById: { params: Omit<GetCompanyByIdParams, 'organizationId'>; result: AcqCompany | null }
3671
+ // Deal-sync operations
3672
+ updateDiscoveryData: { params: Omit<UpdateDiscoveryDataParams, 'organizationId'>; result: void }
3673
+ updateProposalData: { params: Omit<UpdateProposalDataParams, 'organizationId'>; result: void }
3674
+ markProposalSent: { params: Omit<MarkProposalSentParams, 'organizationId'>; result: void }
3675
+ markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
3676
+ updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
3677
+ updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
3678
+ cacheInstantlyThreadIds: { params: Omit<CacheInstantlyThreadIdsParams, 'organizationId'>; result: void }
3679
+ transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
3680
+ setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
3681
+ cancelSchedulesAndHitlByEmail: {
3682
+ params: Omit<CancelSchedulesAndHitlByEmailParams, 'organizationId'>
3683
+ result: { schedulesCancelled: number; hitlDeleted: number }
3684
+ }
3685
+ cancelHitlByDealId: { params: Omit<CancelHitlByDealIdParams, 'organizationId'>; result: { hitlDeleted: number } }
3686
+ clearDealFields: { params: Omit<ClearDealFieldsParams, 'organizationId'>; result: void }
3687
+ deleteDeal: { params: Omit<DeleteDealParams, 'organizationId'>; result: void }
3688
+ recordDealActivity: {
3689
+ params: Omit<RecordDealActivityParams, 'organizationId'>
3690
+ result: void
3691
+ }
3692
+ // Deal note operations
3693
+ createDealNote: {
3694
+ params: Omit<CreateDealNoteParams, 'organizationId'>
3695
+ result: AcqDealNote
3696
+ }
3697
+ listDealNotes: {
3698
+ params: Omit<ListDealNotesParams, 'organizationId'>
3699
+ result: AcqDealNote[]
3700
+ }
3701
+ // Deal task operations
3702
+ createDealTask: {
3703
+ params: Omit<CreateDealTaskParams, 'organizationId'>
3704
+ result: AcqDealTask
3705
+ }
3706
+ listDealTasks: {
3707
+ params: Omit<ListDealTasksParams, 'organizationId'>
3708
+ result: AcqDealTask[]
3709
+ }
3710
+ listDealTasksDue: {
3711
+ params: Omit<ListDealTasksDueParams, 'organizationId'>
3712
+ result: AcqDealTask[]
3713
+ }
3714
+ completeDealTask: {
3715
+ params: Omit<CompleteDealTaskParams, 'organizationId'>
3716
+ result: AcqDealTask
3717
+ }
3718
+ // Deal query & analytics operations
3719
+ listDeals: { params: DealFilters; result: AcqDeal[] }
3720
+ getDealPipelineAnalytics: { params: { recentLimit?: number }; result: DealPipelineAnalytics }
3721
+ // Enrichment data operations
3722
+ mergeEnrichmentData: {
3723
+ params: { id: string; table: 'acq_companies' | 'acq_contacts'; data: Record<string, unknown> }
3724
+ result: void
3725
+ }
3726
+ // Social monitoring operations
3727
+ upsertSocialPosts: {
3728
+ params: { posts: Omit<UpsertSocialPostParams, 'organizationId'>[] }
3729
+ result: UpsertSocialPostsResult
3730
+ }
3731
+ setDealStateKey: {
3732
+ params: {
3733
+ dealId: string
3734
+ stateKey: string
3735
+ }
3736
+ result: { ok: true }
3737
+ }
3738
+ // CRM workflow helpers
3739
+ transitionDeal: {
3740
+ params: {
3741
+ dealId: string
3742
+ toStage: string
3743
+ toState?: string
3744
+ }
3745
+ result: { deal: AcqDeal }
3746
+ }
3747
+ loadDeal: {
3748
+ params: { dealId: string }
3749
+ result: DealDetail | null
3750
+ }
3748
3751
  }
3749
3752
  ```
3750
3753
 
3751
3754
  ### `ListToolMap`
3752
3755
 
3753
3756
  ```typescript
3754
- export type ListToolMap = {
3755
- getConfig: {
3756
- params: { listId: string }
3757
- result: { scrapingConfig: ScrapingConfig; icp: IcpRubric; pipelineConfig: PipelineConfig }
3758
- }
3759
- recordExecution: {
3760
- params: Omit<RecordListExecutionParams, 'organizationId'>
3761
- result: void
3762
- }
3763
- updateCompanyStage: {
3764
- params: Omit<UpdateCompanyStageParams, 'organizationId'>
3765
- result: void
3766
- }
3767
- updateContactStage: {
3768
- params: Omit<UpdateContactStageParams, 'organizationId'>
3769
- result: void
3770
- }
3771
- listPendingCompanyIds: {
3772
- params: Omit<ListPendingCompanyIdsParams, 'organizationId'>
3773
- result: string[]
3774
- }
3775
- listPendingContactIds: {
3776
- params: Omit<ListPendingContactIdsParams, 'organizationId'>
3777
- result: string[]
3778
- }
3757
+ export type ListToolMap = {
3758
+ getConfig: {
3759
+ params: { listId: string }
3760
+ result: { scrapingConfig: ScrapingConfig; icp: IcpRubric; pipelineConfig: PipelineConfig }
3761
+ }
3762
+ recordExecution: {
3763
+ params: Omit<RecordListExecutionParams, 'organizationId'>
3764
+ result: void
3765
+ }
3766
+ updateCompanyStage: {
3767
+ params: Omit<UpdateCompanyStageParams, 'organizationId'>
3768
+ result: void
3769
+ }
3770
+ updateContactStage: {
3771
+ params: Omit<UpdateContactStageParams, 'organizationId'>
3772
+ result: void
3773
+ }
3774
+ listPendingCompanyIds: {
3775
+ params: Omit<ListPendingCompanyIdsParams, 'organizationId'>
3776
+ result: string[]
3777
+ }
3778
+ listPendingContactIds: {
3779
+ params: Omit<ListPendingContactIdsParams, 'organizationId'>
3780
+ result: string[]
3781
+ }
3779
3782
  }
3780
3783
  ```
3781
3784
 
@@ -3784,47 +3787,49 @@ export type ListToolMap = {
3784
3787
  ### `KnowledgeLinkSchema`
3785
3788
 
3786
3789
  ```typescript
3787
- export const KnowledgeLinkSchema = z
3788
- .union([CanonicalKnowledgeLinkSchema, LegacyKnowledgeLinkSchema])
3789
- .transform((link) => {
3790
- const target = 'target' in link ? link.target : targetFromNodeId(link.nodeId)
3791
- return {
3792
- target,
3793
- nodeId: nodeIdFromTarget(target)
3794
- }
3790
+ export const KnowledgeLinkSchema = z
3791
+ .union([CanonicalKnowledgeLinkSchema, LegacyKnowledgeLinkSchema])
3792
+ .transform((link) => {
3793
+ const target = 'target' in link ? link.target : targetFromNodeId(link.nodeId)
3794
+ return {
3795
+ target,
3796
+ nodeId: nodeIdFromTarget(target)
3797
+ }
3795
3798
  })
3796
3799
  ```
3797
3800
 
3798
3801
  ### `OrgKnowledgeKindSchema`
3799
3802
 
3800
3803
  ```typescript
3801
- export const OrgKnowledgeKindSchema = z
3802
- .enum(['playbook', 'strategy', 'reference'])
3804
+ export const OrgKnowledgeKindSchema = z
3805
+ .enum(['playbook', 'strategy', 'reference'])
3803
3806
  .meta({ label: 'Knowledge kind', color: 'grape' })
3804
3807
  ```
3805
3808
 
3806
3809
  ### `OrgKnowledgeNodeSchema`
3807
3810
 
3808
3811
  ```typescript
3809
- export const OrgKnowledgeNodeSchema = z.object({
3810
- id: ModelIdSchema,
3811
- kind: OrgKnowledgeKindSchema,
3812
- title: z.string().trim().min(1).max(200),
3813
- summary: z.string().trim().min(1).max(1000),
3812
+ export const OrgKnowledgeNodeSchema = z.object({
3813
+ id: ModelIdSchema,
3814
+ kind: OrgKnowledgeKindSchema,
3815
+ title: z.string().trim().min(1).max(200),
3816
+ summary: z.string().trim().min(1).max(1000),
3814
3817
  icon: IconNameSchema.optional(),
3815
3818
  /** Canonical documentation URL when body content is a local summary. */
3816
3819
  externalUrl: z.string().trim().url().max(500).optional(),
3820
+ /** Optional generated source file path for local MDX-backed knowledge nodes. */
3821
+ sourceFilePath: z.string().trim().min(1).max(500).optional(),
3817
3822
  /** Raw MDX string. Phase 2 will introduce a structured block format. */
3818
3823
  body: z.string().trim().min(1),
3819
- /**
3820
- * Graph links to other OM nodes this knowledge node governs.
3821
- * Each link emits a `governs` edge: knowledge-node -> target node.
3822
- */
3823
- links: z.array(KnowledgeLinkSchema).default([]),
3824
- /** Role identifiers that own this knowledge node. */
3825
- ownerIds: z.array(RoleIdSchema.meta({ ref: 'role' })).default([]),
3826
- /** ISO date string (YYYY-MM-DD or full ISO 8601) of last meaningful update. */
3827
- updatedAt: z.string().trim().min(1).max(50)
3824
+ /**
3825
+ * Graph links to other OM nodes this knowledge node governs.
3826
+ * Each link emits a `governs` edge: knowledge-node -> target node.
3827
+ */
3828
+ links: z.array(KnowledgeLinkSchema).default([]),
3829
+ /** Role identifiers that own this knowledge node. */
3830
+ ownerIds: z.array(RoleIdSchema.meta({ ref: 'role' })).default([]),
3831
+ /** ISO date string (YYYY-MM-DD or full ISO 8601) of last meaningful update. */
3832
+ updatedAt: z.string().trim().min(1).max(50)
3828
3833
  })
3829
3834
  ```
3830
3835