@elevasis/sdk 1.21.0 → 1.22.1

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