@elevasis/core 0.26.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/index.d.ts +162 -105
  2. package/dist/index.js +280 -174
  3. package/dist/knowledge/index.d.ts +43 -43
  4. package/dist/organization-model/index.d.ts +162 -105
  5. package/dist/organization-model/index.js +280 -174
  6. package/dist/test-utils/index.d.ts +20 -20
  7. package/dist/test-utils/index.js +184 -126
  8. package/package.json +3 -3
  9. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +976 -1063
  10. package/src/business/acquisition/api-schemas.test.ts +1962 -1841
  11. package/src/business/acquisition/api-schemas.ts +1461 -1464
  12. package/src/business/acquisition/crm-next-action.test.ts +45 -25
  13. package/src/business/acquisition/crm-next-action.ts +227 -220
  14. package/src/business/acquisition/crm-priority.test.ts +41 -8
  15. package/src/business/acquisition/crm-priority.ts +365 -349
  16. package/src/business/acquisition/crm-state-actions.test.ts +208 -153
  17. package/src/business/acquisition/derive-actions.test.ts +90 -13
  18. package/src/business/acquisition/derive-actions.ts +8 -139
  19. package/src/business/acquisition/ontology-validation.ts +72 -158
  20. package/src/business/pdf/sections/investment.ts +1 -1
  21. package/src/business/pdf/sections/summary-investment.ts +1 -1
  22. package/src/execution/engine/tools/tool-maps.ts +872 -831
  23. package/src/organization-model/__tests__/cross-ref.test.ts +167 -0
  24. package/src/organization-model/__tests__/define-domain-record.test.ts +289 -0
  25. package/src/organization-model/__tests__/om-spine-doc-contract.test.ts +56 -0
  26. package/src/organization-model/__tests__/published-zero-leak.test.ts +60 -1
  27. package/src/organization-model/__tests__/resolve.test.ts +1 -1
  28. package/src/organization-model/__tests__/schema-refinements.test.ts +72 -0
  29. package/src/organization-model/cross-ref.ts +175 -0
  30. package/src/organization-model/domains/actions.ts +13 -0
  31. package/src/organization-model/domains/branding.ts +6 -6
  32. package/src/organization-model/domains/customers.ts +95 -78
  33. package/src/organization-model/domains/entities.ts +157 -144
  34. package/src/organization-model/domains/goals.ts +100 -83
  35. package/src/organization-model/domains/knowledge.ts +106 -93
  36. package/src/organization-model/domains/offerings.ts +88 -71
  37. package/src/organization-model/domains/policies.ts +115 -102
  38. package/src/organization-model/domains/roles.ts +109 -96
  39. package/src/organization-model/domains/sales.test.ts +104 -218
  40. package/src/organization-model/domains/sales.ts +212 -375
  41. package/src/organization-model/domains/statuses.ts +351 -339
  42. package/src/organization-model/domains/systems.ts +176 -164
  43. package/src/organization-model/helpers.ts +331 -306
  44. package/src/organization-model/index.ts +43 -0
  45. package/src/organization-model/published.ts +27 -2
  46. package/src/organization-model/schema-refinements.ts +667 -0
  47. package/src/organization-model/schema.ts +8 -715
  48. package/src/platform/constants/versions.ts +1 -1
  49. package/src/reference/_generated/contracts.md +1000 -1087
@@ -1578,54 +1578,24 @@ export type CrmPriorityBucketKey = 'needs_response' | 'follow_up_due' | 'waiting
1578
1578
  ### `CrmPriorityBucketDefinition`
1579
1579
 
1580
1580
  ```typescript
1581
- export interface CrmPriorityBucketDefinition {
1582
- bucketKey: CrmPriorityBucketKey
1583
- label: string
1584
- /** Lower ranks sort first in deal lists and pipeline columns. */
1585
- rank: number
1586
- /** UI color token. Consumers may map this to their design system. */
1587
- color: string
1581
+ export interface CrmPriorityBucketDefinition {
1582
+ bucketKey: CrmPriorityBucketKey
1583
+ label: string
1584
+ /** Lower ranks sort first in deal lists and pipeline columns. */
1585
+ rank: number
1586
+ /** UI color token. Consumers may map this to their design system. */
1587
+ color: string
1588
1588
  }
1589
1589
  ```
1590
1590
 
1591
1591
  ### `CrmPriorityRuleConfig`
1592
1592
 
1593
1593
  ```typescript
1594
- export interface CrmPriorityRuleConfig {
1595
- buckets: CrmPriorityBucketDefinition[]
1596
- closedStageKeys: string[]
1597
- followUpAfterDaysByStateKey: Record<string, number>
1598
- staleAfterDays: number
1599
- }
1600
- ```
1601
-
1602
- ### `CRM_PRIORITY_BUCKETS`
1603
-
1604
- ```typescript
1605
- export const CRM_PRIORITY_BUCKETS: CrmPriorityBucketDefinition[] = [
1606
- { bucketKey: 'needs_response', label: 'Needs Response', rank: 10, color: 'red' },
1607
- { bucketKey: 'follow_up_due', label: 'Follow-up Due', rank: 20, color: 'orange' },
1608
- { bucketKey: 'waiting', label: 'Waiting', rank: 30, color: 'blue' },
1609
- { bucketKey: 'stale', label: 'Stale', rank: 40, color: 'gray' },
1610
- { bucketKey: 'closed_low', label: 'Closed', rank: 50, color: 'dark' }
1611
- ]
1612
- ```
1613
-
1614
- ### `DEFAULT_CRM_PRIORITY_RULE_CONFIG`
1615
-
1616
- ```typescript
1617
- export const DEFAULT_CRM_PRIORITY_RULE_CONFIG: CrmPriorityRuleConfig = {
1618
- buckets: CRM_PRIORITY_BUCKETS,
1619
- closedStageKeys: ['closed_won', 'closed_lost'],
1620
- followUpAfterDaysByStateKey: {
1621
- discovery_link_sent: 3,
1622
- discovery_nudging: 2,
1623
- reply_sent: 3,
1624
- followup_1_sent: 3,
1625
- followup_2_sent: 5,
1626
- followup_3_sent: 7
1627
- },
1628
- staleAfterDays: 14
1594
+ export interface CrmPriorityRuleConfig {
1595
+ buckets: CrmPriorityBucketDefinition[]
1596
+ closedStageKeys: string[]
1597
+ followUpAfterDaysByStateKey: Record<string, number>
1598
+ staleAfterDays: number
1629
1599
  }
1630
1600
  ```
1631
1601
 
@@ -1644,242 +1614,242 @@ export const AcqDealTaskKindSchema = z.enum(['call', 'email', 'meeting', 'other'
1644
1614
  ### `DealIdParamsSchema`
1645
1615
 
1646
1616
  ```typescript
1647
- export const DealIdParamsSchema = z.object({
1648
- dealId: UuidSchema
1617
+ export const DealIdParamsSchema = z.object({
1618
+ dealId: UuidSchema
1649
1619
  })
1650
1620
  ```
1651
1621
 
1652
1622
  ### `DealTaskIdParamsSchema`
1653
1623
 
1654
1624
  ```typescript
1655
- export const DealTaskIdParamsSchema = z.object({
1656
- dealId: UuidSchema,
1657
- taskId: UuidSchema
1625
+ export const DealTaskIdParamsSchema = z.object({
1626
+ dealId: UuidSchema,
1627
+ taskId: UuidSchema
1658
1628
  })
1659
1629
  ```
1660
1630
 
1661
1631
  ### `ListDealsQuerySchema`
1662
1632
 
1663
1633
  ```typescript
1664
- export const ListDealsQuerySchema = z
1665
- .object({
1666
- stage: DealStageSchema.optional(),
1667
- list: UuidSchema.optional(),
1668
- batch: z.string().trim().min(1).max(255).optional(),
1669
- staleSince: z.string().datetime().optional(),
1670
- search: z.string().optional(),
1671
- limit: z.coerce.number().int().positive().default(50),
1672
- offset: z.coerce.number().int().min(0).default(0)
1673
- })
1634
+ export const ListDealsQuerySchema = z
1635
+ .object({
1636
+ stage: DealStageSchema.optional(),
1637
+ list: UuidSchema.optional(),
1638
+ batch: z.string().trim().min(1).max(255).optional(),
1639
+ staleSince: z.string().datetime().optional(),
1640
+ search: z.string().optional(),
1641
+ limit: z.coerce.number().int().positive().default(50),
1642
+ offset: z.coerce.number().int().min(0).default(0)
1643
+ })
1674
1644
  .strict()
1675
1645
  ```
1676
1646
 
1677
1647
  ### `DealLookupQuerySchema`
1678
1648
 
1679
1649
  ```typescript
1680
- export const DealLookupQuerySchema = z
1681
- .object({
1682
- search: z.string().trim().min(1).max(200).optional(),
1683
- limit: z.coerce.number().int().min(1).max(25).default(10)
1684
- })
1650
+ export const DealLookupQuerySchema = z
1651
+ .object({
1652
+ search: z.string().trim().min(1).max(200).optional(),
1653
+ limit: z.coerce.number().int().min(1).max(25).default(10)
1654
+ })
1685
1655
  .strict()
1686
1656
  ```
1687
1657
 
1688
1658
  ### `ListDealTasksDueQuerySchema`
1689
1659
 
1690
1660
  ```typescript
1691
- export const ListDealTasksDueQuerySchema = z
1692
- .object({
1693
- window: z.enum(['overdue', 'today', 'today_and_overdue', 'upcoming']).optional(),
1694
- assigneeUserId: UuidSchema.optional()
1695
- })
1661
+ export const ListDealTasksDueQuerySchema = z
1662
+ .object({
1663
+ window: z.enum(['overdue', 'today', 'today_and_overdue', 'upcoming']).optional(),
1664
+ assigneeUserId: UuidSchema.optional()
1665
+ })
1696
1666
  .strict()
1697
1667
  ```
1698
1668
 
1699
1669
  ### `CreateDealNoteRequestSchema`
1700
1670
 
1701
1671
  ```typescript
1702
- export const CreateDealNoteRequestSchema = z
1703
- .object({
1704
- body: z.string().trim().min(1).max(10000)
1705
- })
1672
+ export const CreateDealNoteRequestSchema = z
1673
+ .object({
1674
+ body: z.string().trim().min(1).max(10000)
1675
+ })
1706
1676
  .strict()
1707
1677
  ```
1708
1678
 
1709
1679
  ### `CreateDealTaskRequestSchema`
1710
1680
 
1711
1681
  ```typescript
1712
- export const CreateDealTaskRequestSchema = z
1713
- .object({
1714
- title: z.string().trim().min(1).max(255),
1715
- description: z.string().nullable().optional(),
1716
- kind: AcqDealTaskKindSchema.optional(),
1717
- dueAt: z.string().datetime().nullable().optional(),
1718
- assigneeUserId: UuidSchema.nullable().optional()
1719
- })
1682
+ export const CreateDealTaskRequestSchema = z
1683
+ .object({
1684
+ title: z.string().trim().min(1).max(255),
1685
+ description: z.string().nullable().optional(),
1686
+ kind: AcqDealTaskKindSchema.optional(),
1687
+ dueAt: z.string().datetime().nullable().optional(),
1688
+ assigneeUserId: UuidSchema.nullable().optional()
1689
+ })
1720
1690
  .strict()
1721
1691
  ```
1722
1692
 
1723
1693
  ### `TransitionItemRequestSchema`
1724
1694
 
1725
1695
  ```typescript
1726
- export const TransitionItemRequestSchema = z
1727
- .object({
1728
- pipelineKey: z.string().min(1),
1729
- stageKey: z.string().min(1),
1730
- stateKey: z.string().min(1).nullable().optional(),
1731
- reason: z.string().optional(),
1732
- expectedUpdatedAt: z.string().datetime().optional()
1733
- })
1696
+ export const TransitionItemRequestSchema = z
1697
+ .object({
1698
+ pipelineKey: z.string().min(1),
1699
+ stageKey: z.string().min(1),
1700
+ stateKey: z.string().min(1).nullable().optional(),
1701
+ reason: z.string().optional(),
1702
+ expectedUpdatedAt: z.string().datetime().optional()
1703
+ })
1734
1704
  .strict()
1735
1705
  ```
1736
1706
 
1737
1707
  ### `ExecuteActionParamsSchema`
1738
1708
 
1739
1709
  ```typescript
1740
- export const ExecuteActionParamsSchema = z
1741
- .object({
1742
- dealId: UuidSchema,
1743
- actionKey: NonEmptyStringSchema
1744
- })
1710
+ export const ExecuteActionParamsSchema = z
1711
+ .object({
1712
+ dealId: UuidSchema,
1713
+ actionKey: NonEmptyStringSchema
1714
+ })
1745
1715
  .strict()
1746
1716
  ```
1747
1717
 
1748
1718
  ### `ExecuteActionRequestSchema`
1749
1719
 
1750
1720
  ```typescript
1751
- export const ExecuteActionRequestSchema = z
1752
- .object({
1753
- payload: z.record(z.string(), z.unknown()).optional()
1754
- })
1721
+ export const ExecuteActionRequestSchema = z
1722
+ .object({
1723
+ payload: z.record(z.string(), z.unknown()).optional()
1724
+ })
1755
1725
  .strict()
1756
1726
  ```
1757
1727
 
1758
1728
  ### `DealContactSummarySchema`
1759
1729
 
1760
1730
  ```typescript
1761
- /**
1762
- * Contact summary nested inside DealListItem / DealDetailResponse.
1763
- * Matches the joined shape returned by useDeals / useDealDetail Supabase queries.
1764
- */
1765
- export const DealContactSummarySchema = z.object({
1766
- id: z.string(),
1767
- first_name: z.string().nullable(),
1768
- last_name: z.string().nullable(),
1769
- email: z.string(),
1770
- title: z.string().nullable(),
1771
- headline: z.string().nullable(),
1772
- linkedin_url: z.string().nullable(),
1773
- processing_state: ProcessingStateSchema.nullable(),
1774
- enrichment_data: z.record(z.string(), z.unknown()).nullable(),
1775
- company: z
1776
- .object({
1777
- id: z.string(),
1778
- name: z.string(),
1779
- domain: z.string().nullable(),
1780
- website: z.string().nullable(),
1781
- linkedin_url: z.string().nullable(),
1782
- segment: z.string().nullable(),
1783
- category: z.string().nullable(),
1784
- num_employees: z.number().nullable()
1785
- })
1786
- .nullable()
1731
+ /**
1732
+ * Contact summary nested inside DealListItem / DealDetailResponse.
1733
+ * Matches the joined shape returned by useDeals / useDealDetail Supabase queries.
1734
+ */
1735
+ export const DealContactSummarySchema = z.object({
1736
+ id: z.string(),
1737
+ first_name: z.string().nullable(),
1738
+ last_name: z.string().nullable(),
1739
+ email: z.string(),
1740
+ title: z.string().nullable(),
1741
+ headline: z.string().nullable(),
1742
+ linkedin_url: z.string().nullable(),
1743
+ processing_state: ProcessingStateSchema.nullable(),
1744
+ enrichment_data: z.record(z.string(), z.unknown()).nullable(),
1745
+ company: z
1746
+ .object({
1747
+ id: z.string(),
1748
+ name: z.string(),
1749
+ domain: z.string().nullable(),
1750
+ website: z.string().nullable(),
1751
+ linkedin_url: z.string().nullable(),
1752
+ segment: z.string().nullable(),
1753
+ category: z.string().nullable(),
1754
+ num_employees: z.number().nullable()
1755
+ })
1756
+ .nullable()
1787
1757
  })
1788
1758
  ```
1789
1759
 
1790
1760
  ### `DealPrioritySchema`
1791
1761
 
1792
1762
  ```typescript
1793
- export const DealPrioritySchema = z.object({
1794
- bucketKey: z.enum(['needs_response', 'follow_up_due', 'waiting', 'stale', 'closed_low']),
1795
- rank: z.number().int(),
1796
- label: z.string(),
1797
- color: z.string(),
1798
- reason: z.string(),
1799
- latestActivityAt: z.string().nullable(),
1800
- nextActionAt: z.string().nullable()
1763
+ export const DealPrioritySchema = z.object({
1764
+ bucketKey: z.enum(['needs_response', 'follow_up_due', 'waiting', 'stale', 'closed_low']),
1765
+ rank: z.number().int(),
1766
+ label: z.string(),
1767
+ color: z.string(),
1768
+ reason: z.string(),
1769
+ latestActivityAt: z.string().nullable(),
1770
+ nextActionAt: z.string().nullable()
1801
1771
  })
1802
1772
  ```
1803
1773
 
1804
1774
  ### `DealListItemSchema`
1805
1775
 
1806
1776
  ```typescript
1807
- /**
1808
- * Deal list item with joined contact (and company via contact).
1809
- * Matches DealListItem from @repo/core types.
1810
- */
1811
- export const DealListItemSchema = z.object({
1812
- // acq_deals columns
1813
- id: z.string(),
1814
- organization_id: z.string(),
1815
- client_id: z.string().nullable().optional(),
1816
- contact_id: z.string().nullable(),
1817
- contact_email: z.string(),
1818
- pipeline_key: z.string(),
1819
- stage_key: z.string().nullable(),
1820
- state_key: z.string().nullable(),
1821
- activity_log: z.unknown(),
1822
- discovery_data: z.unknown().nullable(),
1823
- discovery_submitted_at: z.string().nullable(),
1824
- discovery_submitted_by: z.string().nullable(),
1825
- proposal_data: z.unknown().nullable(),
1826
- proposal_sent_at: z.string().nullable(),
1827
- proposal_pdf_url: z.string().nullable(),
1828
- signature_envelope_id: z.string().nullable(),
1829
- source_list_id: z.string().nullable(),
1830
- source_type: z.string().nullable(),
1831
- initial_fee: z.number().nullable(),
1832
- monthly_fee: z.number().nullable(),
1833
- closed_lost_at: z.string().nullable(),
1834
- closed_lost_reason: z.string().nullable(),
1835
- created_at: z.string(),
1836
- updated_at: z.string(),
1837
- priority: DealPrioritySchema,
1838
- ownership: z.enum(['us', 'them']).nullable(),
1839
- nextAction: z.string().nullable(),
1840
- // joined relation
1841
- contact: DealContactSummarySchema.nullable()
1777
+ /**
1778
+ * Deal list item with joined contact (and company via contact).
1779
+ * Matches DealListItem from @repo/core types.
1780
+ */
1781
+ export const DealListItemSchema = z.object({
1782
+ // acq_deals columns
1783
+ id: z.string(),
1784
+ organization_id: z.string(),
1785
+ client_id: z.string().nullable().optional(),
1786
+ contact_id: z.string().nullable(),
1787
+ contact_email: z.string(),
1788
+ pipeline_key: z.string(),
1789
+ stage_key: z.string().nullable(),
1790
+ state_key: z.string().nullable(),
1791
+ activity_log: z.unknown(),
1792
+ discovery_data: z.unknown().nullable(),
1793
+ discovery_submitted_at: z.string().nullable(),
1794
+ discovery_submitted_by: z.string().nullable(),
1795
+ proposal_data: z.unknown().nullable(),
1796
+ proposal_sent_at: z.string().nullable(),
1797
+ proposal_pdf_url: z.string().nullable(),
1798
+ signature_envelope_id: z.string().nullable(),
1799
+ source_list_id: z.string().nullable(),
1800
+ source_type: z.string().nullable(),
1801
+ initial_fee: z.number().nullable(),
1802
+ monthly_fee: z.number().nullable(),
1803
+ closed_lost_at: z.string().nullable(),
1804
+ closed_lost_reason: z.string().nullable(),
1805
+ created_at: z.string(),
1806
+ updated_at: z.string(),
1807
+ priority: DealPrioritySchema,
1808
+ ownership: z.enum(['us', 'them']).nullable(),
1809
+ nextAction: z.string().nullable(),
1810
+ // joined relation
1811
+ contact: DealContactSummarySchema.nullable()
1842
1812
  })
1843
1813
  ```
1844
1814
 
1845
1815
  ### `DealListResponseSchema`
1846
1816
 
1847
1817
  ```typescript
1848
- export const DealListResponseSchema = z.object({
1849
- data: z.array(DealListItemSchema),
1850
- total: z.number().int(),
1851
- limit: z.number().int(),
1852
- offset: z.number().int()
1818
+ export const DealListResponseSchema = z.object({
1819
+ data: z.array(DealListItemSchema),
1820
+ total: z.number().int(),
1821
+ limit: z.number().int(),
1822
+ offset: z.number().int()
1853
1823
  })
1854
1824
  ```
1855
1825
 
1856
1826
  ### `DealDetailResponseSchema`
1857
1827
 
1858
1828
  ```typescript
1859
- /**
1860
- * Deal detail shape — currently the same as a list item (full joined record).
1861
- * Additive fields keep existing DealListItem callers compatible.
1862
- */
1863
- export const DealDetailResponseSchema = DealListItemSchema.extend({
1864
- conversation: DealConversationSchema,
1865
- lineage: DealLineageSchema.optional()
1829
+ /**
1830
+ * Deal detail shape — currently the same as a list item (full joined record).
1831
+ * Additive fields keep existing DealListItem callers compatible.
1832
+ */
1833
+ export const DealDetailResponseSchema = DealListItemSchema.extend({
1834
+ conversation: DealConversationSchema,
1835
+ lineage: DealLineageSchema.optional()
1866
1836
  })
1867
1837
  ```
1868
1838
 
1869
1839
  ### `DealNoteResponseSchema`
1870
1840
 
1871
1841
  ```typescript
1872
- /**
1873
- * Single acq_deal_notes row (camelCase API representation).
1874
- */
1875
- export const DealNoteResponseSchema = z.object({
1876
- id: z.string(),
1877
- dealId: z.string(),
1878
- organizationId: z.string(),
1879
- authorUserId: z.string().nullable(),
1880
- body: z.string(),
1881
- createdAt: z.string(),
1882
- updatedAt: z.string()
1842
+ /**
1843
+ * Single acq_deal_notes row (camelCase API representation).
1844
+ */
1845
+ export const DealNoteResponseSchema = z.object({
1846
+ id: z.string(),
1847
+ dealId: z.string(),
1848
+ organizationId: z.string(),
1849
+ authorUserId: z.string().nullable(),
1850
+ body: z.string(),
1851
+ createdAt: z.string(),
1852
+ updatedAt: z.string()
1883
1853
  })
1884
1854
  ```
1885
1855
 
@@ -1892,24 +1862,24 @@ export const DealNoteListResponseSchema = z.array(DealNoteResponseSchema)
1892
1862
  ### `DealTaskResponseSchema`
1893
1863
 
1894
1864
  ```typescript
1895
- /**
1896
- * Single acq_deal_tasks row (camelCase API representation).
1897
- * Matches AcqDealTask domain type from types.ts.
1898
- */
1899
- export const DealTaskResponseSchema = z.object({
1900
- id: z.string(),
1901
- organizationId: z.string(),
1902
- dealId: z.string(),
1903
- title: z.string(),
1904
- description: z.string().nullable(),
1905
- kind: AcqDealTaskKindSchema,
1906
- dueAt: z.string().nullable(),
1907
- assigneeUserId: z.string().nullable(),
1908
- completedAt: z.string().nullable(),
1909
- completedByUserId: z.string().nullable(),
1910
- createdAt: z.string(),
1911
- updatedAt: z.string(),
1912
- createdByUserId: z.string().nullable()
1865
+ /**
1866
+ * Single acq_deal_tasks row (camelCase API representation).
1867
+ * Matches AcqDealTask domain type from types.ts.
1868
+ */
1869
+ export const DealTaskResponseSchema = z.object({
1870
+ id: z.string(),
1871
+ organizationId: z.string(),
1872
+ dealId: z.string(),
1873
+ title: z.string(),
1874
+ description: z.string().nullable(),
1875
+ kind: AcqDealTaskKindSchema,
1876
+ dueAt: z.string().nullable(),
1877
+ assigneeUserId: z.string().nullable(),
1878
+ completedAt: z.string().nullable(),
1879
+ completedByUserId: z.string().nullable(),
1880
+ createdAt: z.string(),
1881
+ updatedAt: z.string(),
1882
+ createdByUserId: z.string().nullable()
1913
1883
  })
1914
1884
  ```
1915
1885
 
@@ -1922,44 +1892,44 @@ export const DealTaskListResponseSchema = z.array(DealTaskResponseSchema)
1922
1892
  ### `DealSchemas`
1923
1893
 
1924
1894
  ```typescript
1925
- export const DealSchemas = {
1926
- // Primitives
1927
- CrmStageKey: CrmStageKeySchema,
1928
- CrmStateKey: CrmStateKeySchema,
1929
- DealStage: DealStageSchema,
1930
-
1931
- // Params
1932
- DealIdParams: DealIdParamsSchema,
1933
- DealTaskIdParams: DealTaskIdParamsSchema,
1934
-
1935
- // Queries
1936
- ListDealsQuery: ListDealsQuerySchema,
1937
- DealLookupQuery: DealLookupQuerySchema,
1938
- ListDealTasksDueQuery: ListDealTasksDueQuerySchema,
1939
-
1940
- // Request bodies
1941
- CreateDealNoteRequest: CreateDealNoteRequestSchema,
1942
- CreateDealTaskRequest: CreateDealTaskRequestSchema,
1943
- TransitionItemRequest: CrmTransitionItemRequestSchema,
1944
- TransitionDealStateRequest: TransitionDealStateRequestSchema,
1945
- ExecuteActionParams: ExecuteActionParamsSchema,
1946
- ExecuteActionRequest: ExecuteActionRequestSchema,
1947
-
1948
- // Responses
1949
- DealPriority: DealPrioritySchema,
1950
- DealListResponse: DealListResponseSchema,
1951
- DealSummaryResponse: DealSummaryResponseSchema,
1952
- DealLookupResponse: DealLookupResponseSchema,
1953
- ConversationMessage: ConversationMessageSchema,
1954
- DealLineageListRef: DealLineageListRefSchema,
1955
- DealLineageProjectRef: DealLineageProjectRefSchema,
1956
- DealLineageClientRef: DealLineageClientRefSchema,
1957
- DealLineage: DealLineageSchema,
1958
- DealDetailResponse: DealDetailResponseSchema,
1959
- DealNoteResponse: DealNoteResponseSchema,
1960
- DealNoteListResponse: DealNoteListResponseSchema,
1961
- DealTaskResponse: DealTaskResponseSchema,
1962
- DealTaskListResponse: DealTaskListResponseSchema
1895
+ export const DealSchemas = {
1896
+ // Primitives
1897
+ CrmStageKey: CrmStageKeySchema,
1898
+ CrmStateKey: CrmStateKeySchema,
1899
+ DealStage: DealStageSchema,
1900
+
1901
+ // Params
1902
+ DealIdParams: DealIdParamsSchema,
1903
+ DealTaskIdParams: DealTaskIdParamsSchema,
1904
+
1905
+ // Queries
1906
+ ListDealsQuery: ListDealsQuerySchema,
1907
+ DealLookupQuery: DealLookupQuerySchema,
1908
+ ListDealTasksDueQuery: ListDealTasksDueQuerySchema,
1909
+
1910
+ // Request bodies
1911
+ CreateDealNoteRequest: CreateDealNoteRequestSchema,
1912
+ CreateDealTaskRequest: CreateDealTaskRequestSchema,
1913
+ TransitionItemRequest: CrmTransitionItemRequestSchema,
1914
+ TransitionDealStateRequest: TransitionDealStateRequestSchema,
1915
+ ExecuteActionParams: ExecuteActionParamsSchema,
1916
+ ExecuteActionRequest: ExecuteActionRequestSchema,
1917
+
1918
+ // Responses
1919
+ DealPriority: DealPrioritySchema,
1920
+ DealListResponse: DealListResponseSchema,
1921
+ DealSummaryResponse: DealSummaryResponseSchema,
1922
+ DealLookupResponse: DealLookupResponseSchema,
1923
+ ConversationMessage: ConversationMessageSchema,
1924
+ DealLineageListRef: DealLineageListRefSchema,
1925
+ DealLineageProjectRef: DealLineageProjectRefSchema,
1926
+ DealLineageClientRef: DealLineageClientRefSchema,
1927
+ DealLineage: DealLineageSchema,
1928
+ DealDetailResponse: DealDetailResponseSchema,
1929
+ DealNoteResponse: DealNoteResponseSchema,
1930
+ DealNoteListResponse: DealNoteListResponseSchema,
1931
+ DealTaskResponse: DealTaskResponseSchema,
1932
+ DealTaskListResponse: DealTaskListResponseSchema
1963
1933
  }
1964
1934
  ```
1965
1935
 
@@ -1985,79 +1955,22 @@ export interface ActionDef {
1985
1955
  }
1986
1956
  ```
1987
1957
 
1988
- ### `DEFAULT_CRM_ACTIONS`
1989
-
1990
- ```typescript
1991
- export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
1992
- crmAction('move_to_proposal', {
1993
- isAvailableFor: (deal) => deal.stage_key === 'interested'
1994
- }),
1995
- crmAction('move_to_closing', {
1996
- isAvailableFor: (deal) => deal.stage_key === 'proposal'
1997
- }),
1998
- crmAction('move_to_closed_won', {
1999
- isAvailableFor: (deal) => deal.stage_key === 'closing'
2000
- }),
2001
- crmAction('move_to_closed_lost', {
2002
- isAvailableFor: (deal) =>
2003
- deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing'
2004
- }),
2005
- crmAction('move_to_nurturing', {
2006
- isAvailableFor: (deal) =>
2007
- deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing'
2008
- }),
2009
- crmAction('send_reply', {
2010
- isAvailableFor: (deal) =>
2011
- deal.stage_key === 'interested' &&
2012
- isOurReplyAction(deal) &&
2013
- (deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey ||
2014
- deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
2015
- deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
2016
- payloadSchema: SendReplyActionPayloadSchema
2017
- }),
2018
- crmAction('send_link', {
2019
- isAvailableFor: (deal) =>
2020
- deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey
2021
- }),
2022
- crmAction('send_nudge', {
2023
- isAvailableFor: (deal) =>
2024
- deal.stage_key === 'interested' &&
2025
- (deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
2026
- deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey)
2027
- }),
2028
- {
2029
- key: 'mark_no_show',
2030
- label: 'Mark No-Show',
2031
- isAvailableFor: (deal) =>
2032
- deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey,
2033
- // Mirrors the auto-timeout precedent in operations/sales/crm/pipeline/timeout-actions.ts:
2034
- // both manual-click and timeout move the deal to closed_lost. The action_taken activity
2035
- // event captures operator intent and distinguishes the manual variant from the timed one.
2036
- workflowId: 'mark_no_show-workflow'
2037
- },
2038
- crmAction('rebook', {
2039
- isAvailableFor: (deal) =>
2040
- deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_BOOKING_CANCELLED_STATE.stateKey
2041
- })
2042
- ]
2043
- ```
2044
-
2045
1958
  ### `CrmToolMap`
2046
1959
 
2047
1960
  ```typescript
2048
- export type CrmToolMap = {
2049
- getRecentActivity: { params: CrmRecentActivityParams; result: RecentActivityEntry[] }
2050
- listDeals: { params: CrmListDealsParams; result: DealListItem[] }
2051
- getDeal: { params: CrmGetDealParams; result: DealDetail | null }
2052
- getDealByEmail: { params: CrmGetDealByEmailParams; result: DealDetail | null }
2053
- createDealNote: { params: CrmDealNoteParams; result: AcqDealNote }
2054
- listDealNotes: { params: Omit<ListDealNotesParams, 'organizationId'>; result: AcqDealNote[] }
2055
- createDealTask: { params: CrmDealTaskParams; result: AcqDealTask }
2056
- listDealTasks: { params: Omit<ListDealTasksParams, 'organizationId'>; result: AcqDealTask[] }
2057
- listDealTasksDue: { params: CrmTaskDueParams; result: AcqDealTask[] }
2058
- completeDealTask: { params: Omit<CompleteDealTaskParams, 'organizationId'>; result: AcqDealTask }
2059
- recordActivity: { params: CrmRecordActivityParams; result: void }
2060
- deleteDeal: { params: CrmDeleteDealParams; result: void }
1961
+ export type CrmToolMap = {
1962
+ getRecentActivity: { params: CrmRecentActivityParams; result: RecentActivityEntry[] }
1963
+ listDeals: { params: CrmListDealsParams; result: DealListItem[] }
1964
+ getDeal: { params: CrmGetDealParams; result: DealDetail | null }
1965
+ getDealByEmail: { params: CrmGetDealByEmailParams; result: DealDetail | null }
1966
+ createDealNote: { params: CrmDealNoteParams; result: AcqDealNote }
1967
+ listDealNotes: { params: Omit<ListDealNotesParams, 'organizationId'>; result: AcqDealNote[] }
1968
+ createDealTask: { params: CrmDealTaskParams; result: AcqDealTask }
1969
+ listDealTasks: { params: Omit<ListDealTasksParams, 'organizationId'>; result: AcqDealTask[] }
1970
+ listDealTasksDue: { params: CrmTaskDueParams; result: AcqDealTask[] }
1971
+ completeDealTask: { params: Omit<CompleteDealTaskParams, 'organizationId'>; result: AcqDealTask }
1972
+ recordActivity: { params: CrmRecordActivityParams; result: void }
1973
+ deleteDeal: { params: CrmDeleteDealParams; result: void }
2061
1974
  }
2062
1975
  ```
2063
1976
 
@@ -2288,180 +2201,180 @@ export interface ListTelemetry {
2288
2201
  ### `ListStageCountsSchema`
2289
2202
 
2290
2203
  ```typescript
2291
- export const ListStageCountsSchema = z.object({
2292
- // Attempted counts by canonical lead-gen stage. The detailed status
2293
- // distribution lives on ListProgress; telemetry keeps the overview payload small.
2294
- stageCounts: z.object({
2295
- populated: z.number().int(),
2296
- extracted: z.number().int(),
2297
- qualified: z.number().int(),
2298
- discovered: z.number().int(),
2299
- verified: z.number().int(),
2300
- personalized: z.number().int(),
2301
- uploaded: z.number().int()
2302
- }),
2303
- deliverability: z.object({
2304
- valid: z.number().int(),
2305
- risky: z.number().int(),
2306
- invalid: z.number().int(),
2307
- unknown: z.number().int(),
2308
- bounced: z.number().int()
2309
- })
2204
+ export const ListStageCountsSchema = z.object({
2205
+ // Attempted counts by canonical lead-gen stage. The detailed status
2206
+ // distribution lives on ListProgress; telemetry keeps the overview payload small.
2207
+ stageCounts: z.object({
2208
+ populated: z.number().int(),
2209
+ extracted: z.number().int(),
2210
+ qualified: z.number().int(),
2211
+ discovered: z.number().int(),
2212
+ verified: z.number().int(),
2213
+ personalized: z.number().int(),
2214
+ uploaded: z.number().int()
2215
+ }),
2216
+ deliverability: z.object({
2217
+ valid: z.number().int(),
2218
+ risky: z.number().int(),
2219
+ invalid: z.number().int(),
2220
+ unknown: z.number().int(),
2221
+ bounced: z.number().int()
2222
+ })
2310
2223
  })
2311
2224
  ```
2312
2225
 
2313
2226
  ### `ListTelemetrySchema`
2314
2227
 
2315
2228
  ```typescript
2316
- export const ListTelemetrySchema = z.object({
2317
- listId: UuidSchema,
2318
- totalCompanies: z.number().int(),
2319
- totalContacts: z.number().int(),
2320
- stageCounts: ListStageCountsSchema.shape.stageCounts,
2321
- deliverability: ListStageCountsSchema.shape.deliverability,
2322
- activeWorkflows: z.array(z.string()).optional()
2229
+ export const ListTelemetrySchema = z.object({
2230
+ listId: UuidSchema,
2231
+ totalCompanies: z.number().int(),
2232
+ totalContacts: z.number().int(),
2233
+ stageCounts: ListStageCountsSchema.shape.stageCounts,
2234
+ deliverability: ListStageCountsSchema.shape.deliverability,
2235
+ activeWorkflows: z.array(z.string()).optional()
2323
2236
  })
2324
2237
  ```
2325
2238
 
2326
2239
  ### `ListIdParamsSchema`
2327
2240
 
2328
2241
  ```typescript
2329
- export const ListIdParamsSchema = z.object({
2330
- listId: UuidSchema
2242
+ export const ListIdParamsSchema = z.object({
2243
+ listId: UuidSchema
2331
2244
  })
2332
2245
  ```
2333
2246
 
2334
2247
  ### `CreateListRequestSchema`
2335
2248
 
2336
2249
  ```typescript
2337
- export const CreateListRequestSchema = z
2338
- .object({
2339
- name: z.string().trim().min(1).max(255),
2340
- description: z.string().trim().nullable().optional(),
2341
- status: ListStatusSchema.optional(),
2342
- buildTemplateId: ProspectingBuildTemplateIdSchema.optional(),
2343
- scrapingConfig: ScrapingConfigSchema.optional(),
2344
- icp: IcpRubricSchema.optional(),
2345
- pipelineConfig: PipelineConfigSchema.optional()
2346
- })
2250
+ export const CreateListRequestSchema = z
2251
+ .object({
2252
+ name: z.string().trim().min(1).max(255),
2253
+ description: z.string().trim().nullable().optional(),
2254
+ status: ListStatusSchema.optional(),
2255
+ buildTemplateId: ProspectingBuildTemplateIdSchema.optional(),
2256
+ scrapingConfig: ScrapingConfigSchema.optional(),
2257
+ icp: IcpRubricSchema.optional(),
2258
+ pipelineConfig: PipelineConfigSchema.optional()
2259
+ })
2347
2260
  .strict()
2348
2261
  ```
2349
2262
 
2350
2263
  ### `UpdateListRequestSchema`
2351
2264
 
2352
2265
  ```typescript
2353
- export const UpdateListRequestSchema = z
2354
- .object({
2355
- name: z.string().trim().min(1).max(255).optional(),
2356
- description: z.string().trim().nullable().optional(),
2357
- batchIds: z.array(z.string()).optional(),
2358
- buildTemplateId: ProspectingBuildTemplateIdSchema.optional(),
2359
- confirmBuildTemplateChange: z.literal(true).optional()
2360
- })
2361
- .strict()
2362
- .refine(
2363
- (data) =>
2364
- data.name !== undefined ||
2365
- data.description !== undefined ||
2366
- data.batchIds !== undefined ||
2367
- data.buildTemplateId !== undefined,
2368
- {
2369
- message: 'At least one field (name, description, batchIds, or buildTemplateId) must be provided'
2370
- }
2371
- )
2372
- .refine((data) => data.buildTemplateId === undefined || data.confirmBuildTemplateChange === true, {
2373
- message: 'confirmBuildTemplateChange must be true when changing buildTemplateId',
2374
- path: ['confirmBuildTemplateChange']
2266
+ export const UpdateListRequestSchema = z
2267
+ .object({
2268
+ name: z.string().trim().min(1).max(255).optional(),
2269
+ description: z.string().trim().nullable().optional(),
2270
+ batchIds: z.array(z.string()).optional(),
2271
+ buildTemplateId: ProspectingBuildTemplateIdSchema.optional(),
2272
+ confirmBuildTemplateChange: z.literal(true).optional()
2273
+ })
2274
+ .strict()
2275
+ .refine(
2276
+ (data) =>
2277
+ data.name !== undefined ||
2278
+ data.description !== undefined ||
2279
+ data.batchIds !== undefined ||
2280
+ data.buildTemplateId !== undefined,
2281
+ {
2282
+ message: 'At least one field (name, description, batchIds, or buildTemplateId) must be provided'
2283
+ }
2284
+ )
2285
+ .refine((data) => data.buildTemplateId === undefined || data.confirmBuildTemplateChange === true, {
2286
+ message: 'confirmBuildTemplateChange must be true when changing buildTemplateId',
2287
+ path: ['confirmBuildTemplateChange']
2375
2288
  })
2376
2289
  ```
2377
2290
 
2378
2291
  ### `UpdateListConfigRequestSchema`
2379
2292
 
2380
2293
  ```typescript
2381
- /**
2382
- * Partial patch for the three jsonb config columns. UI sends only the edited
2383
- * subtree; server writes the field as-is (no deep merge — each column is
2384
- * replaced atomically when present in the patch).
2385
- */
2386
- export const UpdateListConfigRequestSchema = z
2387
- .object({
2388
- scrapingConfig: ScrapingConfigSchema.partial().optional(),
2389
- icp: IcpRubricSchema.partial().optional(),
2390
- pipelineConfig: PipelineConfigSchema.partial().optional()
2391
- })
2392
- .strict()
2393
- .refine((data) => data.scrapingConfig !== undefined || data.icp !== undefined || data.pipelineConfig !== undefined, {
2394
- message: 'At least one of scrapingConfig, icp, or pipelineConfig must be provided'
2294
+ /**
2295
+ * Partial patch for the three jsonb config columns. UI sends only the edited
2296
+ * subtree; server writes the field as-is (no deep merge — each column is
2297
+ * replaced atomically when present in the patch).
2298
+ */
2299
+ export const UpdateListConfigRequestSchema = z
2300
+ .object({
2301
+ scrapingConfig: ScrapingConfigSchema.partial().optional(),
2302
+ icp: IcpRubricSchema.partial().optional(),
2303
+ pipelineConfig: PipelineConfigSchema.partial().optional()
2304
+ })
2305
+ .strict()
2306
+ .refine((data) => data.scrapingConfig !== undefined || data.icp !== undefined || data.pipelineConfig !== undefined, {
2307
+ message: 'At least one of scrapingConfig, icp, or pipelineConfig must be provided'
2395
2308
  })
2396
2309
  ```
2397
2310
 
2398
2311
  ### `AddCompaniesToListRequestSchema`
2399
2312
 
2400
2313
  ```typescript
2401
- export const AddCompaniesToListRequestSchema = z
2402
- .object({
2403
- companyIds: z.array(UuidSchema).min(1).max(1000)
2404
- })
2314
+ export const AddCompaniesToListRequestSchema = z
2315
+ .object({
2316
+ companyIds: z.array(UuidSchema).min(1).max(1000)
2317
+ })
2405
2318
  .strict()
2406
2319
  ```
2407
2320
 
2408
2321
  ### `RemoveCompaniesFromListRequestSchema`
2409
2322
 
2410
2323
  ```typescript
2411
- export const RemoveCompaniesFromListRequestSchema = z
2412
- .object({
2413
- companyIds: z.array(UuidSchema).min(1).max(1000)
2414
- })
2324
+ export const RemoveCompaniesFromListRequestSchema = z
2325
+ .object({
2326
+ companyIds: z.array(UuidSchema).min(1).max(1000)
2327
+ })
2415
2328
  .strict()
2416
2329
  ```
2417
2330
 
2418
2331
  ### `AddContactsToListRequestSchema`
2419
2332
 
2420
2333
  ```typescript
2421
- export const AddContactsToListRequestSchema = z
2422
- .object({
2423
- contactIds: z.array(UuidSchema).min(1).max(1000)
2424
- })
2334
+ export const AddContactsToListRequestSchema = z
2335
+ .object({
2336
+ contactIds: z.array(UuidSchema).min(1).max(1000)
2337
+ })
2425
2338
  .strict()
2426
2339
  ```
2427
2340
 
2428
2341
  ### `RecordListExecutionRequestSchema`
2429
2342
 
2430
2343
  ```typescript
2431
- export const RecordListExecutionRequestSchema = z
2432
- .object({
2433
- executionId: UuidSchema,
2434
- configSnapshot: z.record(z.string(), z.unknown()).optional()
2435
- })
2344
+ export const RecordListExecutionRequestSchema = z
2345
+ .object({
2346
+ executionId: UuidSchema,
2347
+ configSnapshot: z.record(z.string(), z.unknown()).optional()
2348
+ })
2436
2349
  .strict()
2437
2350
  ```
2438
2351
 
2439
2352
  ### `AcqListResponseSchema`
2440
2353
 
2441
2354
  ```typescript
2442
- /**
2443
- * Single list as returned by /api/acquisition/lists/:id etc.
2444
- * Camel-cased domain shape matching AcqList in types.ts.
2445
- */
2446
- export const AcqListResponseSchema = z.object({
2447
- id: z.string(),
2448
- organizationId: z.string(),
2449
- name: z.string(),
2450
- description: z.string().nullable(),
2451
- batchIds: z.array(z.string()),
2452
- instantlyCampaignId: z.string().nullable(),
2453
- /** Lifecycle status (draft | enriching | launched | closing | archived). */
2454
- status: ListStatusSchema,
2455
- metadata: AcqListMetadataSchema,
2456
- launchedAt: z.string().nullable(),
2457
- completedAt: z.string().nullable(),
2458
- createdAt: z.string(),
2459
- /** Scraping criteria stored as jsonb on the row. */
2460
- scrapingConfig: ScrapingConfigSchema,
2461
- /** ICP / qualification rubric stored as jsonb on the row. */
2462
- icp: IcpRubricSchema,
2463
- /** Pipeline presentation contract stored as jsonb on the row. */
2464
- pipelineConfig: PipelineConfigSchema
2355
+ /**
2356
+ * Single list as returned by /api/acquisition/lists/:id etc.
2357
+ * Camel-cased domain shape matching AcqList in types.ts.
2358
+ */
2359
+ export const AcqListResponseSchema = z.object({
2360
+ id: z.string(),
2361
+ organizationId: z.string(),
2362
+ name: z.string(),
2363
+ description: z.string().nullable(),
2364
+ batchIds: z.array(z.string()),
2365
+ instantlyCampaignId: z.string().nullable(),
2366
+ /** Lifecycle status (draft | enriching | launched | closing | archived). */
2367
+ status: ListStatusSchema,
2368
+ metadata: AcqListMetadataSchema,
2369
+ launchedAt: z.string().nullable(),
2370
+ completedAt: z.string().nullable(),
2371
+ createdAt: z.string(),
2372
+ /** Scraping criteria stored as jsonb on the row. */
2373
+ scrapingConfig: ScrapingConfigSchema,
2374
+ /** ICP / qualification rubric stored as jsonb on the row. */
2375
+ icp: IcpRubricSchema,
2376
+ /** Pipeline presentation contract stored as jsonb on the row. */
2377
+ pipelineConfig: PipelineConfigSchema
2465
2378
  })
2466
2379
  ```
2467
2380
 
@@ -2486,18 +2399,18 @@ export const ListTelemetryListResponseSchema = z.array(ListTelemetrySchema)
2486
2399
  ### `ListExecutionSummarySchema`
2487
2400
 
2488
2401
  ```typescript
2489
- /**
2490
- * Row from acq_list_executions joined with the execution summary,
2491
- * shaped for the /lists/:id/executions response.
2492
- */
2493
- export const ListExecutionSummarySchema = z.object({
2494
- executionId: z.string(),
2495
- resourceId: z.string(),
2496
- status: z.string(),
2497
- createdAt: z.string(),
2498
- completedAt: z.string().nullable(),
2499
- durationMs: z.number().int().nullable(),
2500
- input: z.unknown().nullable().optional()
2402
+ /**
2403
+ * Row from acq_list_executions joined with the execution summary,
2404
+ * shaped for the /lists/:id/executions response.
2405
+ */
2406
+ export const ListExecutionSummarySchema = z.object({
2407
+ executionId: z.string(),
2408
+ resourceId: z.string(),
2409
+ status: z.string(),
2410
+ createdAt: z.string(),
2411
+ completedAt: z.string().nullable(),
2412
+ durationMs: z.number().int().nullable(),
2413
+ input: z.unknown().nullable().optional()
2501
2414
  })
2502
2415
  ```
2503
2416
 
@@ -2528,299 +2441,299 @@ export const AcqEmailValidSchema = z.enum(['VALID', 'INVALID', 'RISKY', 'UNKNOWN
2528
2441
  ### `CompanyIdParamsSchema`
2529
2442
 
2530
2443
  ```typescript
2531
- export const CompanyIdParamsSchema = z.object({
2532
- companyId: UuidSchema
2444
+ export const CompanyIdParamsSchema = z.object({
2445
+ companyId: UuidSchema
2533
2446
  })
2534
2447
  ```
2535
2448
 
2536
2449
  ### `ContactIdParamsSchema`
2537
2450
 
2538
2451
  ```typescript
2539
- export const ContactIdParamsSchema = z.object({
2540
- contactId: UuidSchema
2452
+ export const ContactIdParamsSchema = z.object({
2453
+ contactId: UuidSchema
2541
2454
  })
2542
2455
  ```
2543
2456
 
2544
2457
  ### `ListCompaniesQuerySchema`
2545
2458
 
2546
2459
  ```typescript
2547
- export const ListCompaniesQuerySchema = z
2548
- .object({
2549
- search: z.string().trim().min(1).max(200).optional(),
2550
- listId: UuidSchema.optional(),
2551
- domain: z.string().trim().min(1).max(255).optional(),
2552
- website: z.string().trim().min(1).max(2048).optional(),
2553
- segment: z.string().trim().min(1).max(255).optional(),
2554
- category: z.string().trim().min(1).max(255).optional(),
2555
- pipelineStatus: z.unknown().optional(),
2556
- batchId: z.string().trim().min(1).max(255).optional(),
2557
- status: AcqCompanyStatusSchema.optional(),
2558
- includeAll: QueryBooleanSchema.optional(),
2559
- limit: z.coerce.number().int().min(1).max(5000).default(50),
2560
- offset: z.coerce.number().int().min(0).default(0)
2561
- })
2460
+ export const ListCompaniesQuerySchema = z
2461
+ .object({
2462
+ search: z.string().trim().min(1).max(200).optional(),
2463
+ listId: UuidSchema.optional(),
2464
+ domain: z.string().trim().min(1).max(255).optional(),
2465
+ website: z.string().trim().min(1).max(2048).optional(),
2466
+ segment: z.string().trim().min(1).max(255).optional(),
2467
+ category: z.string().trim().min(1).max(255).optional(),
2468
+ pipelineStatus: z.unknown().optional(),
2469
+ batchId: z.string().trim().min(1).max(255).optional(),
2470
+ status: AcqCompanyStatusSchema.optional(),
2471
+ includeAll: QueryBooleanSchema.optional(),
2472
+ limit: z.coerce.number().int().min(1).max(5000).default(50),
2473
+ offset: z.coerce.number().int().min(0).default(0)
2474
+ })
2562
2475
  .strict()
2563
2476
  ```
2564
2477
 
2565
2478
  ### `ListContactsQuerySchema`
2566
2479
 
2567
2480
  ```typescript
2568
- export const ListContactsQuerySchema = z
2569
- .object({
2570
- search: z.string().trim().min(1).max(200).optional(),
2571
- listId: UuidSchema.optional(),
2572
- openingLineIsNull: QueryBooleanSchema.optional(),
2573
- batchId: z.string().trim().min(1).max(255).optional(),
2574
- contactStatus: AcqContactStatusSchema.optional(),
2575
- limit: z.coerce.number().int().min(1).max(5000).default(5000),
2576
- offset: z.coerce.number().int().min(0).default(0)
2577
- })
2481
+ export const ListContactsQuerySchema = z
2482
+ .object({
2483
+ search: z.string().trim().min(1).max(200).optional(),
2484
+ listId: UuidSchema.optional(),
2485
+ openingLineIsNull: QueryBooleanSchema.optional(),
2486
+ batchId: z.string().trim().min(1).max(255).optional(),
2487
+ contactStatus: AcqContactStatusSchema.optional(),
2488
+ limit: z.coerce.number().int().min(1).max(5000).default(5000),
2489
+ offset: z.coerce.number().int().min(0).default(0)
2490
+ })
2578
2491
  .strict()
2579
2492
  ```
2580
2493
 
2581
2494
  ### `CreateCompanyRequestSchema`
2582
2495
 
2583
2496
  ```typescript
2584
- export const CreateCompanyRequestSchema = z
2585
- .object({
2586
- name: z.string().trim().min(1).max(255),
2587
- clientId: UuidSchema.nullable().optional(),
2588
- domain: z.string().trim().min(1).max(255).optional(),
2589
- linkedinUrl: z.string().trim().url().optional(),
2590
- website: z.string().trim().url().optional(),
2591
- numEmployees: z.number().int().min(0).optional(),
2592
- foundedYear: z.number().int().optional(),
2593
- locationCity: z.string().trim().min(1).max(255).optional(),
2594
- locationState: z.string().trim().min(1).max(255).optional(),
2595
- category: z.string().trim().min(1).max(255).optional(),
2596
- source: z.string().trim().min(1).max(255).optional(),
2597
- batchId: z.string().trim().min(1).max(255).optional(),
2598
- pipelineStatus: z.unknown().optional(),
2599
- verticalResearch: z.string().trim().min(1).max(5000).optional()
2600
- })
2497
+ export const CreateCompanyRequestSchema = z
2498
+ .object({
2499
+ name: z.string().trim().min(1).max(255),
2500
+ clientId: UuidSchema.nullable().optional(),
2501
+ domain: z.string().trim().min(1).max(255).optional(),
2502
+ linkedinUrl: z.string().trim().url().optional(),
2503
+ website: z.string().trim().url().optional(),
2504
+ numEmployees: z.number().int().min(0).optional(),
2505
+ foundedYear: z.number().int().optional(),
2506
+ locationCity: z.string().trim().min(1).max(255).optional(),
2507
+ locationState: z.string().trim().min(1).max(255).optional(),
2508
+ category: z.string().trim().min(1).max(255).optional(),
2509
+ source: z.string().trim().min(1).max(255).optional(),
2510
+ batchId: z.string().trim().min(1).max(255).optional(),
2511
+ pipelineStatus: z.unknown().optional(),
2512
+ verticalResearch: z.string().trim().min(1).max(5000).optional()
2513
+ })
2601
2514
  .strict()
2602
2515
  ```
2603
2516
 
2604
2517
  ### `UpdateCompanyRequestSchema`
2605
2518
 
2606
2519
  ```typescript
2607
- export const UpdateCompanyRequestSchema = z
2608
- .object({
2609
- name: z.string().trim().min(1).max(255).optional(),
2610
- clientId: UuidSchema.nullable().optional(),
2611
- domain: z.string().trim().min(1).max(255).optional(),
2612
- linkedinUrl: z.string().trim().url().optional(),
2613
- website: z.string().trim().url().optional(),
2614
- numEmployees: z.number().int().min(0).optional(),
2615
- foundedYear: z.number().int().optional(),
2616
- locationCity: z.string().trim().min(1).max(255).optional(),
2617
- locationState: z.string().trim().min(1).max(255).optional(),
2618
- category: z.string().trim().min(1).max(255).optional(),
2619
- segment: z.string().trim().min(1).max(255).optional(),
2620
- processingState: CompanyProcessingStateSchema.optional(),
2621
- pipelineStatus: z.unknown().optional(),
2622
- enrichmentData: z.record(z.string(), z.unknown()).optional(),
2623
- source: z.string().trim().min(1).max(255).optional(),
2624
- batchId: z.string().trim().min(1).max(255).optional(),
2625
- status: AcqCompanyStatusSchema.optional(),
2626
- verticalResearch: z.string().trim().min(1).max(5000).nullable().optional()
2627
- })
2628
- .strict()
2629
- .refine(
2630
- (data) =>
2631
- data.name !== undefined ||
2632
- data.clientId !== undefined ||
2633
- data.domain !== undefined ||
2634
- data.linkedinUrl !== undefined ||
2635
- data.website !== undefined ||
2636
- data.numEmployees !== undefined ||
2637
- data.foundedYear !== undefined ||
2638
- data.locationCity !== undefined ||
2639
- data.locationState !== undefined ||
2640
- data.category !== undefined ||
2641
- data.segment !== undefined ||
2642
- data.processingState !== undefined ||
2643
- data.pipelineStatus !== undefined ||
2644
- data.enrichmentData !== undefined ||
2645
- data.source !== undefined ||
2646
- data.batchId !== undefined ||
2647
- data.status !== undefined ||
2648
- data.verticalResearch !== undefined,
2649
- {
2650
- message: 'At least one field must be provided'
2651
- }
2520
+ export const UpdateCompanyRequestSchema = z
2521
+ .object({
2522
+ name: z.string().trim().min(1).max(255).optional(),
2523
+ clientId: UuidSchema.nullable().optional(),
2524
+ domain: z.string().trim().min(1).max(255).optional(),
2525
+ linkedinUrl: z.string().trim().url().optional(),
2526
+ website: z.string().trim().url().optional(),
2527
+ numEmployees: z.number().int().min(0).optional(),
2528
+ foundedYear: z.number().int().optional(),
2529
+ locationCity: z.string().trim().min(1).max(255).optional(),
2530
+ locationState: z.string().trim().min(1).max(255).optional(),
2531
+ category: z.string().trim().min(1).max(255).optional(),
2532
+ segment: z.string().trim().min(1).max(255).optional(),
2533
+ processingState: CompanyProcessingStateSchema.optional(),
2534
+ pipelineStatus: z.unknown().optional(),
2535
+ enrichmentData: z.record(z.string(), z.unknown()).optional(),
2536
+ source: z.string().trim().min(1).max(255).optional(),
2537
+ batchId: z.string().trim().min(1).max(255).optional(),
2538
+ status: AcqCompanyStatusSchema.optional(),
2539
+ verticalResearch: z.string().trim().min(1).max(5000).nullable().optional()
2540
+ })
2541
+ .strict()
2542
+ .refine(
2543
+ (data) =>
2544
+ data.name !== undefined ||
2545
+ data.clientId !== undefined ||
2546
+ data.domain !== undefined ||
2547
+ data.linkedinUrl !== undefined ||
2548
+ data.website !== undefined ||
2549
+ data.numEmployees !== undefined ||
2550
+ data.foundedYear !== undefined ||
2551
+ data.locationCity !== undefined ||
2552
+ data.locationState !== undefined ||
2553
+ data.category !== undefined ||
2554
+ data.segment !== undefined ||
2555
+ data.processingState !== undefined ||
2556
+ data.pipelineStatus !== undefined ||
2557
+ data.enrichmentData !== undefined ||
2558
+ data.source !== undefined ||
2559
+ data.batchId !== undefined ||
2560
+ data.status !== undefined ||
2561
+ data.verticalResearch !== undefined,
2562
+ {
2563
+ message: 'At least one field must be provided'
2564
+ }
2652
2565
  )
2653
2566
  ```
2654
2567
 
2655
2568
  ### `CreateContactRequestSchema`
2656
2569
 
2657
2570
  ```typescript
2658
- export const CreateContactRequestSchema = z
2659
- .object({
2660
- email: z.string().trim().email(),
2661
- clientId: UuidSchema.nullable().optional(),
2662
- companyId: UuidSchema.optional(),
2663
- firstName: z.string().trim().min(1).max(255).optional(),
2664
- lastName: z.string().trim().min(1).max(255).optional(),
2665
- linkedinUrl: z.string().trim().url().optional(),
2666
- title: z.string().trim().min(1).max(255).optional(),
2667
- source: z.string().trim().min(1).max(255).optional(),
2668
- sourceId: z.string().trim().min(1).max(255).optional(),
2669
- batchId: z.string().trim().min(1).max(255).optional(),
2670
- pipelineStatus: z.unknown().optional()
2671
- })
2571
+ export const CreateContactRequestSchema = z
2572
+ .object({
2573
+ email: z.string().trim().email(),
2574
+ clientId: UuidSchema.nullable().optional(),
2575
+ companyId: UuidSchema.optional(),
2576
+ firstName: z.string().trim().min(1).max(255).optional(),
2577
+ lastName: z.string().trim().min(1).max(255).optional(),
2578
+ linkedinUrl: z.string().trim().url().optional(),
2579
+ title: z.string().trim().min(1).max(255).optional(),
2580
+ source: z.string().trim().min(1).max(255).optional(),
2581
+ sourceId: z.string().trim().min(1).max(255).optional(),
2582
+ batchId: z.string().trim().min(1).max(255).optional(),
2583
+ pipelineStatus: z.unknown().optional()
2584
+ })
2672
2585
  .strict()
2673
2586
  ```
2674
2587
 
2675
2588
  ### `UpdateContactRequestSchema`
2676
2589
 
2677
2590
  ```typescript
2678
- export const UpdateContactRequestSchema = z
2679
- .object({
2680
- companyId: UuidSchema.optional(),
2681
- clientId: UuidSchema.nullable().optional(),
2682
- emailValid: AcqEmailValidSchema.optional(),
2683
- firstName: z.string().trim().min(1).max(255).optional(),
2684
- lastName: z.string().trim().min(1).max(255).optional(),
2685
- linkedinUrl: z.string().trim().url().optional(),
2686
- title: z.string().trim().min(1).max(255).optional(),
2687
- headline: z.string().trim().min(1).max(5000).optional(),
2688
- filterReason: z.string().trim().min(1).max(5000).optional(),
2689
- openingLine: z.string().trim().min(1).max(5000).optional(),
2690
- processingState: ContactProcessingStateSchema.optional(),
2691
- pipelineStatus: z.unknown().optional(),
2692
- enrichmentData: z.record(z.string(), z.unknown()).optional(),
2693
- status: AcqContactStatusSchema.optional()
2694
- })
2695
- .strict()
2696
- .refine(
2697
- (data) =>
2698
- data.companyId !== undefined ||
2699
- data.clientId !== undefined ||
2700
- data.emailValid !== undefined ||
2701
- data.firstName !== undefined ||
2702
- data.lastName !== undefined ||
2703
- data.linkedinUrl !== undefined ||
2704
- data.title !== undefined ||
2705
- data.headline !== undefined ||
2706
- data.filterReason !== undefined ||
2707
- data.openingLine !== undefined ||
2708
- data.processingState !== undefined ||
2709
- data.pipelineStatus !== undefined ||
2710
- data.enrichmentData !== undefined ||
2711
- data.status !== undefined,
2712
- {
2713
- message: 'At least one field must be provided'
2714
- }
2591
+ export const UpdateContactRequestSchema = z
2592
+ .object({
2593
+ companyId: UuidSchema.optional(),
2594
+ clientId: UuidSchema.nullable().optional(),
2595
+ emailValid: AcqEmailValidSchema.optional(),
2596
+ firstName: z.string().trim().min(1).max(255).optional(),
2597
+ lastName: z.string().trim().min(1).max(255).optional(),
2598
+ linkedinUrl: z.string().trim().url().optional(),
2599
+ title: z.string().trim().min(1).max(255).optional(),
2600
+ headline: z.string().trim().min(1).max(5000).optional(),
2601
+ filterReason: z.string().trim().min(1).max(5000).optional(),
2602
+ openingLine: z.string().trim().min(1).max(5000).optional(),
2603
+ processingState: ContactProcessingStateSchema.optional(),
2604
+ pipelineStatus: z.unknown().optional(),
2605
+ enrichmentData: z.record(z.string(), z.unknown()).optional(),
2606
+ status: AcqContactStatusSchema.optional()
2607
+ })
2608
+ .strict()
2609
+ .refine(
2610
+ (data) =>
2611
+ data.companyId !== undefined ||
2612
+ data.clientId !== undefined ||
2613
+ data.emailValid !== undefined ||
2614
+ data.firstName !== undefined ||
2615
+ data.lastName !== undefined ||
2616
+ data.linkedinUrl !== undefined ||
2617
+ data.title !== undefined ||
2618
+ data.headline !== undefined ||
2619
+ data.filterReason !== undefined ||
2620
+ data.openingLine !== undefined ||
2621
+ data.processingState !== undefined ||
2622
+ data.pipelineStatus !== undefined ||
2623
+ data.enrichmentData !== undefined ||
2624
+ data.status !== undefined,
2625
+ {
2626
+ message: 'At least one field must be provided'
2627
+ }
2715
2628
  )
2716
2629
  ```
2717
2630
 
2718
2631
  ### `AcqCompanyResponseSchema`
2719
2632
 
2720
2633
  ```typescript
2721
- export const AcqCompanyResponseSchema = z.object({
2722
- id: z.string(),
2723
- organizationId: z.string(),
2724
- clientId: z.string().nullable().optional(),
2725
- name: z.string(),
2726
- domain: z.string().nullable(),
2727
- linkedinUrl: z.string().nullable(),
2728
- website: z.string().nullable(),
2729
- numEmployees: z.number().nullable(),
2730
- foundedYear: z.number().nullable(),
2731
- locationCity: z.string().nullable(),
2732
- locationState: z.string().nullable(),
2733
- category: z.string().nullable(),
2734
- categoryPain: z.string().nullable(),
2735
- segment: z.string().nullable(),
2736
- processingState: CompanyProcessingStateSchema.nullable(),
2737
- pipelineStatus: z.unknown().nullable().optional(),
2738
- enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2739
- source: z.string().nullable(),
2740
- batchId: z.string().nullable(),
2741
- status: AcqCompanyStatusSchema,
2742
- contactCount: z.number().int().min(0),
2743
- verticalResearch: z.string().nullable(),
2744
- createdAt: z.string(),
2745
- updatedAt: z.string()
2634
+ export const AcqCompanyResponseSchema = z.object({
2635
+ id: z.string(),
2636
+ organizationId: z.string(),
2637
+ clientId: z.string().nullable().optional(),
2638
+ name: z.string(),
2639
+ domain: z.string().nullable(),
2640
+ linkedinUrl: z.string().nullable(),
2641
+ website: z.string().nullable(),
2642
+ numEmployees: z.number().nullable(),
2643
+ foundedYear: z.number().nullable(),
2644
+ locationCity: z.string().nullable(),
2645
+ locationState: z.string().nullable(),
2646
+ category: z.string().nullable(),
2647
+ categoryPain: z.string().nullable(),
2648
+ segment: z.string().nullable(),
2649
+ processingState: CompanyProcessingStateSchema.nullable(),
2650
+ pipelineStatus: z.unknown().nullable().optional(),
2651
+ enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2652
+ source: z.string().nullable(),
2653
+ batchId: z.string().nullable(),
2654
+ status: AcqCompanyStatusSchema,
2655
+ contactCount: z.number().int().min(0),
2656
+ verticalResearch: z.string().nullable(),
2657
+ createdAt: z.string(),
2658
+ updatedAt: z.string()
2746
2659
  })
2747
2660
  ```
2748
2661
 
2749
2662
  ### `AcqCompanyListResponseSchema`
2750
2663
 
2751
2664
  ```typescript
2752
- export const AcqCompanyListResponseSchema = z.object({
2753
- data: z.array(AcqCompanyResponseSchema),
2754
- total: z.number().int(),
2755
- limit: z.number().int(),
2756
- offset: z.number().int()
2665
+ export const AcqCompanyListResponseSchema = z.object({
2666
+ data: z.array(AcqCompanyResponseSchema),
2667
+ total: z.number().int(),
2668
+ limit: z.number().int(),
2669
+ offset: z.number().int()
2757
2670
  })
2758
2671
  ```
2759
2672
 
2760
2673
  ### `AcqCompanyFacetsResponseSchema`
2761
2674
 
2762
2675
  ```typescript
2763
- export const AcqCompanyFacetsResponseSchema = z.object({
2764
- segments: z.array(z.string()),
2765
- categories: z.array(z.string()),
2766
- statuses: z.array(AcqCompanyStatusSchema)
2676
+ export const AcqCompanyFacetsResponseSchema = z.object({
2677
+ segments: z.array(z.string()),
2678
+ categories: z.array(z.string()),
2679
+ statuses: z.array(AcqCompanyStatusSchema)
2767
2680
  })
2768
2681
  ```
2769
2682
 
2770
2683
  ### `AcqContactCompanySummarySchema`
2771
2684
 
2772
2685
  ```typescript
2773
- export const AcqContactCompanySummarySchema = z.object({
2774
- id: z.string(),
2775
- name: z.string(),
2776
- domain: z.string().nullable(),
2777
- website: z.string().nullable(),
2778
- linkedinUrl: z.string().nullable(),
2779
- segment: z.string().nullable(),
2780
- category: z.string().nullable(),
2781
- status: AcqCompanyStatusSchema
2686
+ export const AcqContactCompanySummarySchema = z.object({
2687
+ id: z.string(),
2688
+ name: z.string(),
2689
+ domain: z.string().nullable(),
2690
+ website: z.string().nullable(),
2691
+ linkedinUrl: z.string().nullable(),
2692
+ segment: z.string().nullable(),
2693
+ category: z.string().nullable(),
2694
+ status: AcqCompanyStatusSchema
2782
2695
  })
2783
2696
  ```
2784
2697
 
2785
2698
  ### `AcqContactResponseSchema`
2786
2699
 
2787
2700
  ```typescript
2788
- export const AcqContactResponseSchema = z.object({
2789
- id: z.string(),
2790
- organizationId: z.string(),
2791
- clientId: z.string().nullable().optional(),
2792
- companyId: z.string().nullable(),
2793
- email: z.string(),
2794
- emailValid: AcqEmailValidSchema.nullable(),
2795
- firstName: z.string().nullable(),
2796
- lastName: z.string().nullable(),
2797
- linkedinUrl: z.string().nullable(),
2798
- title: z.string().nullable(),
2799
- headline: z.string().nullable(),
2800
- filterReason: z.string().nullable(),
2801
- openingLine: z.string().nullable(),
2802
- source: z.string().nullable(),
2803
- sourceId: z.string().nullable(),
2804
- processingState: ContactProcessingStateSchema.nullable(),
2805
- pipelineStatus: z.unknown().nullable().optional(),
2806
- enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2807
- attioPersonId: z.string().nullable(),
2808
- batchId: z.string().nullable(),
2809
- status: AcqContactStatusSchema,
2810
- company: AcqContactCompanySummarySchema.nullable().optional(),
2811
- createdAt: z.string(),
2812
- updatedAt: z.string()
2701
+ export const AcqContactResponseSchema = z.object({
2702
+ id: z.string(),
2703
+ organizationId: z.string(),
2704
+ clientId: z.string().nullable().optional(),
2705
+ companyId: z.string().nullable(),
2706
+ email: z.string(),
2707
+ emailValid: AcqEmailValidSchema.nullable(),
2708
+ firstName: z.string().nullable(),
2709
+ lastName: z.string().nullable(),
2710
+ linkedinUrl: z.string().nullable(),
2711
+ title: z.string().nullable(),
2712
+ headline: z.string().nullable(),
2713
+ filterReason: z.string().nullable(),
2714
+ openingLine: z.string().nullable(),
2715
+ source: z.string().nullable(),
2716
+ sourceId: z.string().nullable(),
2717
+ processingState: ContactProcessingStateSchema.nullable(),
2718
+ pipelineStatus: z.unknown().nullable().optional(),
2719
+ enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2720
+ attioPersonId: z.string().nullable(),
2721
+ batchId: z.string().nullable(),
2722
+ status: AcqContactStatusSchema,
2723
+ company: AcqContactCompanySummarySchema.nullable().optional(),
2724
+ createdAt: z.string(),
2725
+ updatedAt: z.string()
2813
2726
  })
2814
2727
  ```
2815
2728
 
2816
2729
  ### `AcqContactListResponseSchema`
2817
2730
 
2818
2731
  ```typescript
2819
- export const AcqContactListResponseSchema = z.object({
2820
- data: z.array(AcqContactResponseSchema),
2821
- total: z.number().int(),
2822
- limit: z.number().int(),
2823
- offset: z.number().int()
2732
+ export const AcqContactListResponseSchema = z.object({
2733
+ data: z.array(AcqContactResponseSchema),
2734
+ total: z.number().int(),
2735
+ limit: z.number().int(),
2736
+ offset: z.number().int()
2824
2737
  })
2825
2738
  ```
2826
2739
 
@@ -2833,242 +2746,242 @@ export const AcqArtifactOwnerKindSchema = z.enum(['company', 'contact', 'deal',
2833
2746
  ### `ListArtifactsQuerySchema`
2834
2747
 
2835
2748
  ```typescript
2836
- export const ListArtifactsQuerySchema = z
2837
- .object({
2838
- ownerKind: AcqArtifactOwnerKindSchema,
2839
- ownerId: UuidSchema
2840
- })
2749
+ export const ListArtifactsQuerySchema = z
2750
+ .object({
2751
+ ownerKind: AcqArtifactOwnerKindSchema,
2752
+ ownerId: UuidSchema
2753
+ })
2841
2754
  .strict()
2842
2755
  ```
2843
2756
 
2844
2757
  ### `CreateArtifactRequestSchema`
2845
2758
 
2846
2759
  ```typescript
2847
- export const CreateArtifactRequestSchema = z
2848
- .object({
2849
- ownerKind: AcqArtifactOwnerKindSchema,
2850
- ownerId: UuidSchema,
2851
- kind: z.string().trim().min(1).max(255),
2852
- content: z.record(z.string(), z.unknown()),
2853
- sourceExecutionId: UuidSchema.optional()
2854
- })
2760
+ export const CreateArtifactRequestSchema = z
2761
+ .object({
2762
+ ownerKind: AcqArtifactOwnerKindSchema,
2763
+ ownerId: UuidSchema,
2764
+ kind: z.string().trim().min(1).max(255),
2765
+ content: z.record(z.string(), z.unknown()),
2766
+ sourceExecutionId: UuidSchema.optional()
2767
+ })
2855
2768
  .strict()
2856
2769
  ```
2857
2770
 
2858
2771
  ### `AcqArtifactResponseSchema`
2859
2772
 
2860
2773
  ```typescript
2861
- export const AcqArtifactResponseSchema = z.object({
2862
- id: z.string(),
2863
- organizationId: z.string(),
2864
- ownerKind: z.string(),
2865
- ownerId: z.string(),
2866
- kind: z.string(),
2867
- content: z.record(z.string(), z.unknown()),
2868
- sourceExecutionId: z.string().nullable(),
2869
- createdBy: z.string().nullable(),
2870
- createdAt: z.string(),
2871
- version: z.number().int()
2774
+ export const AcqArtifactResponseSchema = z.object({
2775
+ id: z.string(),
2776
+ organizationId: z.string(),
2777
+ ownerKind: z.string(),
2778
+ ownerId: z.string(),
2779
+ kind: z.string(),
2780
+ content: z.record(z.string(), z.unknown()),
2781
+ sourceExecutionId: z.string().nullable(),
2782
+ createdBy: z.string().nullable(),
2783
+ createdAt: z.string(),
2784
+ version: z.number().int()
2872
2785
  })
2873
2786
  ```
2874
2787
 
2875
2788
  ### `AcqArtifactListResponseSchema`
2876
2789
 
2877
2790
  ```typescript
2878
- export const AcqArtifactListResponseSchema = z.object({
2879
- artifacts: z.array(AcqArtifactResponseSchema)
2791
+ export const AcqArtifactListResponseSchema = z.object({
2792
+ artifacts: z.array(AcqArtifactResponseSchema)
2880
2793
  })
2881
2794
  ```
2882
2795
 
2883
2796
  ### `ListMembersQuerySchema`
2884
2797
 
2885
2798
  ```typescript
2886
- export const ListMembersQuerySchema = z
2887
- .object({
2888
- limit: z.coerce.number().int().min(1).max(500).default(50),
2889
- offset: z.coerce.number().int().min(0).default(0)
2890
- })
2799
+ export const ListMembersQuerySchema = z
2800
+ .object({
2801
+ limit: z.coerce.number().int().min(1).max(500).default(50),
2802
+ offset: z.coerce.number().int().min(0).default(0)
2803
+ })
2891
2804
  .strict()
2892
2805
  ```
2893
2806
 
2894
2807
  ### `MemberIdParamsSchema`
2895
2808
 
2896
2809
  ```typescript
2897
- export const MemberIdParamsSchema = z.object({
2898
- memberId: UuidSchema
2810
+ export const MemberIdParamsSchema = z.object({
2811
+ memberId: UuidSchema
2899
2812
  })
2900
2813
  ```
2901
2814
 
2902
2815
  ### `AcqListMemberContactSummarySchema`
2903
2816
 
2904
2817
  ```typescript
2905
- export const AcqListMemberContactSummarySchema = z.object({
2906
- id: z.string(),
2907
- email: z.string(),
2908
- firstName: z.string().nullable(),
2909
- lastName: z.string().nullable(),
2910
- title: z.string().nullable(),
2911
- linkedinUrl: z.string().nullable(),
2912
- companyId: z.string().nullable()
2818
+ export const AcqListMemberContactSummarySchema = z.object({
2819
+ id: z.string(),
2820
+ email: z.string(),
2821
+ firstName: z.string().nullable(),
2822
+ lastName: z.string().nullable(),
2823
+ title: z.string().nullable(),
2824
+ linkedinUrl: z.string().nullable(),
2825
+ companyId: z.string().nullable()
2913
2826
  })
2914
2827
  ```
2915
2828
 
2916
2829
  ### `AcqListMemberResponseSchema`
2917
2830
 
2918
2831
  ```typescript
2919
- export const AcqListMemberResponseSchema = z.object({
2920
- id: z.string(),
2921
- listId: z.string(),
2922
- contactId: z.string(),
2923
- pipelineKey: z.string(),
2924
- stageKey: z.string(),
2925
- stateKey: z.string(),
2926
- activityLog: z.unknown(),
2927
- addedAt: z.string(),
2928
- addedBy: z.string().nullable(),
2929
- sourceExecutionId: z.string().nullable(),
2930
- contact: AcqListMemberContactSummarySchema.nullable()
2832
+ export const AcqListMemberResponseSchema = z.object({
2833
+ id: z.string(),
2834
+ listId: z.string(),
2835
+ contactId: z.string(),
2836
+ pipelineKey: z.string(),
2837
+ stageKey: z.string(),
2838
+ stateKey: z.string(),
2839
+ activityLog: z.unknown(),
2840
+ addedAt: z.string(),
2841
+ addedBy: z.string().nullable(),
2842
+ sourceExecutionId: z.string().nullable(),
2843
+ contact: AcqListMemberContactSummarySchema.nullable()
2931
2844
  })
2932
2845
  ```
2933
2846
 
2934
2847
  ### `AcqListMembersResponseSchema`
2935
2848
 
2936
2849
  ```typescript
2937
- export const AcqListMembersResponseSchema = z.object({
2938
- members: z.array(AcqListMemberResponseSchema)
2850
+ export const AcqListMembersResponseSchema = z.object({
2851
+ members: z.array(AcqListMemberResponseSchema)
2939
2852
  })
2940
2853
  ```
2941
2854
 
2942
2855
  ### `ListCompanyIdParamsSchema`
2943
2856
 
2944
2857
  ```typescript
2945
- export const ListCompanyIdParamsSchema = z.object({
2946
- listCompanyId: UuidSchema
2858
+ export const ListCompanyIdParamsSchema = z.object({
2859
+ listCompanyId: UuidSchema
2947
2860
  })
2948
2861
  ```
2949
2862
 
2950
2863
  ### `AcqListCompanyResponseSchema`
2951
2864
 
2952
2865
  ```typescript
2953
- export const AcqListCompanyResponseSchema = z.object({
2954
- id: z.string(),
2955
- listId: z.string(),
2956
- companyId: z.string(),
2957
- pipelineKey: z.string(),
2958
- stageKey: z.string(),
2959
- stateKey: z.string(),
2960
- activityLog: z.unknown(),
2961
- addedAt: z.string(),
2962
- addedBy: z.string().nullable(),
2963
- sourceExecutionId: z.string().nullable()
2866
+ export const AcqListCompanyResponseSchema = z.object({
2867
+ id: z.string(),
2868
+ listId: z.string(),
2869
+ companyId: z.string(),
2870
+ pipelineKey: z.string(),
2871
+ stageKey: z.string(),
2872
+ stateKey: z.string(),
2873
+ activityLog: z.unknown(),
2874
+ addedAt: z.string(),
2875
+ addedBy: z.string().nullable(),
2876
+ sourceExecutionId: z.string().nullable()
2964
2877
  })
2965
2878
  ```
2966
2879
 
2967
2880
  ### `AcqCompanySchemas`
2968
2881
 
2969
2882
  ```typescript
2970
- export const AcqCompanySchemas = {
2971
- CompanyProcessingState: CompanyProcessingStateSchema,
2972
- CompanyIdParams: CompanyIdParamsSchema,
2973
- ListCompaniesQuery: ListCompaniesQuerySchema,
2974
- CreateCompanyRequest: CreateCompanyRequestSchema,
2975
- UpdateCompanyRequest: UpdateCompanyRequestSchema,
2976
- AcqCompanyResponse: AcqCompanyResponseSchema,
2977
- AcqCompanyListResponse: AcqCompanyListResponseSchema,
2978
- AcqCompanyFacetsResponse: AcqCompanyFacetsResponseSchema
2883
+ export const AcqCompanySchemas = {
2884
+ CompanyProcessingState: CompanyProcessingStateSchema,
2885
+ CompanyIdParams: CompanyIdParamsSchema,
2886
+ ListCompaniesQuery: ListCompaniesQuerySchema,
2887
+ CreateCompanyRequest: CreateCompanyRequestSchema,
2888
+ UpdateCompanyRequest: UpdateCompanyRequestSchema,
2889
+ AcqCompanyResponse: AcqCompanyResponseSchema,
2890
+ AcqCompanyListResponse: AcqCompanyListResponseSchema,
2891
+ AcqCompanyFacetsResponse: AcqCompanyFacetsResponseSchema
2979
2892
  }
2980
2893
  ```
2981
2894
 
2982
2895
  ### `AcqContactSchemas`
2983
2896
 
2984
2897
  ```typescript
2985
- export const AcqContactSchemas = {
2986
- ContactProcessingState: ContactProcessingStateSchema,
2987
- ContactIdParams: ContactIdParamsSchema,
2988
- ListContactsQuery: ListContactsQuerySchema,
2989
- CreateContactRequest: CreateContactRequestSchema,
2990
- UpdateContactRequest: UpdateContactRequestSchema,
2991
- AcqContactResponse: AcqContactResponseSchema,
2992
- AcqContactListResponse: AcqContactListResponseSchema
2898
+ export const AcqContactSchemas = {
2899
+ ContactProcessingState: ContactProcessingStateSchema,
2900
+ ContactIdParams: ContactIdParamsSchema,
2901
+ ListContactsQuery: ListContactsQuerySchema,
2902
+ CreateContactRequest: CreateContactRequestSchema,
2903
+ UpdateContactRequest: UpdateContactRequestSchema,
2904
+ AcqContactResponse: AcqContactResponseSchema,
2905
+ AcqContactListResponse: AcqContactListResponseSchema
2993
2906
  }
2994
2907
  ```
2995
2908
 
2996
2909
  ### `AcqListSchemas`
2997
2910
 
2998
2911
  ```typescript
2999
- export const AcqListSchemas = {
3000
- // Params
3001
- ListIdParams: ListIdParamsSchema,
3002
-
3003
- // Primitives (for UI / tests)
3004
- ListStatus: ListStatusSchema,
3005
- ScrapingConfig: ScrapingConfigSchema,
3006
- IcpRubric: IcpRubricSchema,
3007
- PipelineConfig: PipelineConfigSchema,
3008
- PipelineStage: PipelineStageSchema,
3009
- BuildPlanSnapshot: BuildPlanSnapshotSchema,
3010
- BuildPlanSnapshotStep: BuildPlanSnapshotStepSchema,
3011
- AcqListMetadata: AcqListMetadataSchema,
3012
- LeadGenStageKey: LeadGenStageKeySchema,
3013
- LeadGenActionKey: LeadGenActionKeySchema,
3014
- ProcessingStageStatus: ProcessingStageStatusSchema,
3015
- ProcessingState: ProcessingStateSchema,
3016
- ListStageCounts: ListStageCountsSchema,
3017
- ListTelemetry: ListTelemetrySchema,
3018
-
3019
- // Requests
3020
- ListReadQuery: ListReadQuerySchema,
3021
- GetListQuery: GetListQuerySchema,
3022
- CreateListRequest: CreateListRequestSchema,
3023
- UpdateListRequest: UpdateListRequestSchema,
3024
- UpdateListStatusRequest: UpdateListStatusRequestSchema,
3025
- UpdateListConfigRequest: UpdateListConfigRequestSchema,
3026
- AddCompaniesToListRequest: AddCompaniesToListRequestSchema,
3027
- RemoveCompaniesFromListRequest: RemoveCompaniesFromListRequestSchema,
3028
- AddContactsToListRequest: AddContactsToListRequestSchema,
3029
- RecordListExecutionRequest: RecordListExecutionRequestSchema,
3030
-
3031
- // Responses
3032
- AcqListResponse: AcqListResponseSchema,
3033
- AcqListDetailResponse: AcqListDetailResponseSchema,
3034
- AcqListListResponse: AcqListListResponseSchema,
3035
- AcqListDealRef: AcqListDealRefSchema,
3036
- AcqListLineage: AcqListLineageSchema,
3037
- AcqListStatusResponse: AcqListStatusResponseSchema,
3038
- ListTelemetryResponse: ListTelemetryResponseSchema,
3039
- ListTelemetryListResponse: ListTelemetryListResponseSchema,
3040
- ListExecutionsResponse: ListExecutionsResponseSchema,
3041
- ListProgressResponse: ListProgressResponseSchema
2912
+ export const AcqListSchemas = {
2913
+ // Params
2914
+ ListIdParams: ListIdParamsSchema,
2915
+
2916
+ // Primitives (for UI / tests)
2917
+ ListStatus: ListStatusSchema,
2918
+ ScrapingConfig: ScrapingConfigSchema,
2919
+ IcpRubric: IcpRubricSchema,
2920
+ PipelineConfig: PipelineConfigSchema,
2921
+ PipelineStage: PipelineStageSchema,
2922
+ BuildPlanSnapshot: BuildPlanSnapshotSchema,
2923
+ BuildPlanSnapshotStep: BuildPlanSnapshotStepSchema,
2924
+ AcqListMetadata: AcqListMetadataSchema,
2925
+ LeadGenStageKey: LeadGenStageKeySchema,
2926
+ LeadGenActionKey: LeadGenActionKeySchema,
2927
+ ProcessingStageStatus: ProcessingStageStatusSchema,
2928
+ ProcessingState: ProcessingStateSchema,
2929
+ ListStageCounts: ListStageCountsSchema,
2930
+ ListTelemetry: ListTelemetrySchema,
2931
+
2932
+ // Requests
2933
+ ListReadQuery: ListReadQuerySchema,
2934
+ GetListQuery: GetListQuerySchema,
2935
+ CreateListRequest: CreateListRequestSchema,
2936
+ UpdateListRequest: UpdateListRequestSchema,
2937
+ UpdateListStatusRequest: UpdateListStatusRequestSchema,
2938
+ UpdateListConfigRequest: UpdateListConfigRequestSchema,
2939
+ AddCompaniesToListRequest: AddCompaniesToListRequestSchema,
2940
+ RemoveCompaniesFromListRequest: RemoveCompaniesFromListRequestSchema,
2941
+ AddContactsToListRequest: AddContactsToListRequestSchema,
2942
+ RecordListExecutionRequest: RecordListExecutionRequestSchema,
2943
+
2944
+ // Responses
2945
+ AcqListResponse: AcqListResponseSchema,
2946
+ AcqListDetailResponse: AcqListDetailResponseSchema,
2947
+ AcqListListResponse: AcqListListResponseSchema,
2948
+ AcqListDealRef: AcqListDealRefSchema,
2949
+ AcqListLineage: AcqListLineageSchema,
2950
+ AcqListStatusResponse: AcqListStatusResponseSchema,
2951
+ ListTelemetryResponse: ListTelemetryResponseSchema,
2952
+ ListTelemetryListResponse: ListTelemetryListResponseSchema,
2953
+ ListExecutionsResponse: ListExecutionsResponseSchema,
2954
+ ListProgressResponse: ListProgressResponseSchema
3042
2955
  }
3043
2956
  ```
3044
2957
 
3045
2958
  ### `AcqSubstrateSchemas`
3046
2959
 
3047
2960
  ```typescript
3048
- export const AcqSubstrateSchemas = {
3049
- // Artifacts
3050
- ListArtifactsQuery: ListArtifactsQuerySchema,
3051
- CreateArtifactRequest: CreateArtifactRequestSchema,
3052
- AcqArtifactResponse: AcqArtifactResponseSchema,
3053
- AcqArtifactListResponse: AcqArtifactListResponseSchema,
3054
-
3055
- // List members
3056
- ListMembersQuery: ListMembersQuerySchema,
3057
- ListRecordsQuery: ListRecordsQuerySchema,
3058
- MemberIdParams: MemberIdParamsSchema,
3059
- AcqListMemberResponse: AcqListMemberResponseSchema,
3060
- AcqListMembersResponse: AcqListMembersResponseSchema,
3061
- AcqListCompanyRecordRow: AcqListCompanyRecordRowSchema,
3062
- AcqListContactRecordRow: AcqListContactRecordRowSchema,
3063
- ListRecordRow: ListRecordRowSchema,
3064
- ListRecordsResponse: ListRecordsResponseSchema,
3065
-
3066
- // List companies
3067
- ListCompanyIdParams: ListCompanyIdParamsSchema,
3068
- AcqListCompanyResponse: AcqListCompanyResponseSchema,
3069
-
3070
- // Transition (generic stateful substrate)
3071
- TransitionItemRequest: TransitionItemRequestSchema
2961
+ export const AcqSubstrateSchemas = {
2962
+ // Artifacts
2963
+ ListArtifactsQuery: ListArtifactsQuerySchema,
2964
+ CreateArtifactRequest: CreateArtifactRequestSchema,
2965
+ AcqArtifactResponse: AcqArtifactResponseSchema,
2966
+ AcqArtifactListResponse: AcqArtifactListResponseSchema,
2967
+
2968
+ // List members
2969
+ ListMembersQuery: ListMembersQuerySchema,
2970
+ ListRecordsQuery: ListRecordsQuerySchema,
2971
+ MemberIdParams: MemberIdParamsSchema,
2972
+ AcqListMemberResponse: AcqListMemberResponseSchema,
2973
+ AcqListMembersResponse: AcqListMembersResponseSchema,
2974
+ AcqListCompanyRecordRow: AcqListCompanyRecordRowSchema,
2975
+ AcqListContactRecordRow: AcqListContactRecordRowSchema,
2976
+ ListRecordRow: ListRecordRowSchema,
2977
+ ListRecordsResponse: ListRecordsResponseSchema,
2978
+
2979
+ // List companies
2980
+ ListCompanyIdParams: ListCompanyIdParamsSchema,
2981
+ AcqListCompanyResponse: AcqListCompanyResponseSchema,
2982
+
2983
+ // Transition (generic stateful substrate)
2984
+ TransitionItemRequest: TransitionItemRequestSchema
3072
2985
  }
3073
2986
  ```
3074
2987
 
@@ -3119,136 +3032,136 @@ export const StatefulSchema = z.object({
3119
3032
  ### `StatefulStateDefinition`
3120
3033
 
3121
3034
  ```typescript
3122
- /** One state within a stage minimal shape: key + display label. */
3123
- export interface StatefulStateDefinition {
3124
- /** Matches state_key values written by workflow steps. */
3125
- stateKey: string
3126
- label: string
3035
+ /** One state within a stage: minimal shape of key + display label. */
3036
+ export interface StatefulStateDefinition {
3037
+ /** Matches state_key values written by workflow steps. */
3038
+ stateKey: string
3039
+ label: string
3127
3040
  }
3128
3041
  ```
3129
3042
 
3130
3043
  ### `StatefulStageDefinition`
3131
3044
 
3132
3045
  ```typescript
3133
- /** One stage within a pipeline has a stage_key and an ordered list of valid states. */
3134
- export interface StatefulStageDefinition {
3135
- /** Matches stage_key values written by workflow steps. */
3136
- stageKey: string
3137
- label: string
3138
- /** UI color token. Consumers may map this to their design system. */
3139
- color?: string
3140
- states: StatefulStateDefinition[]
3046
+ /** One stage within a pipeline: has a stage_key and ordered valid states. */
3047
+ export interface StatefulStageDefinition {
3048
+ /** Matches stage_key values written by workflow steps. */
3049
+ stageKey: string
3050
+ label: string
3051
+ /** UI color token. Consumers may map this to their design system. */
3052
+ color?: string
3053
+ states: StatefulStateDefinition[]
3141
3054
  }
3142
3055
  ```
3143
3056
 
3144
3057
  ### `StatefulPipelineDefinition`
3145
3058
 
3146
3059
  ```typescript
3147
- /**
3148
- * Pipeline definition for a single entity participating in the Stateful trait.
3149
- * Parallel to acq_deals' pipeline_key concept but structured for lead-gen entities.
3150
- */
3151
- export interface StatefulPipelineDefinition {
3152
- /** Matches pipeline_key values in the database (e.g. 'lead-gen'). */
3153
- pipelineKey: string
3154
- label: string
3155
- /** Entity this pipeline applies to (e.g. 'acq.list', 'acq.list-member', 'acq.list-company'). */
3156
- entityKey: string
3157
- stages: StatefulStageDefinition[]
3060
+ /**
3061
+ * Pipeline definition for a single entity participating in the Stateful trait.
3062
+ * Parallel to acq_deals' pipeline_key concept but structured for any entity.
3063
+ */
3064
+ export interface StatefulPipelineDefinition {
3065
+ /** Matches pipeline_key values in the database. */
3066
+ pipelineKey: string
3067
+ label: string
3068
+ /** Entity this pipeline applies to. */
3069
+ entityKey: string
3070
+ stages: StatefulStageDefinition[]
3158
3071
  }
3159
3072
  ```
3160
3073
 
3161
3074
  ### `ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE`
3162
3075
 
3163
3076
  ```typescript
3164
- /**
3165
- * Lead-gen pipeline definition for acq_list_members (contacts).
3166
- * Three stages matching the post-restructure sales subdomain tree.
3167
- *
3168
- * Note: members visit outreach and prospecting states depending on which
3169
- * workflow last processed them. stage_key is set per-transition by the workflow.
3170
- */
3171
- export const ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
3172
- pipelineKey: 'lead-gen',
3173
- label: 'Lead Generation',
3174
- entityKey: 'acq.list-member',
3175
- stages: [
3176
- {
3177
- stageKey: 'outreach',
3178
- label: 'Outreach',
3179
- states: [
3180
- PENDING_STATE,
3181
- { stateKey: 'personalized', label: 'Personalized' },
3182
- { stateKey: 'uploaded', label: 'Uploaded' },
3183
- { stateKey: 'interested', label: 'Interested' }
3184
- ]
3185
- },
3186
- {
3187
- stageKey: 'prospecting',
3188
- label: 'Prospecting',
3189
- states: [
3190
- PENDING_STATE,
3191
- { stateKey: 'discovered', label: 'Discovered' },
3192
- { stateKey: 'verified', label: 'Verified' }
3193
- ]
3194
- },
3195
- {
3196
- stageKey: 'qualification',
3197
- label: 'Qualification',
3198
- states: [PENDING_STATE]
3199
- }
3200
- ]
3077
+ /**
3078
+ * Lead-gen pipeline definition for acq_list_members (contacts).
3079
+ * Three stages matching the post-restructure sales subdomain tree.
3080
+ *
3081
+ * Note: members visit outreach and prospecting states depending on which
3082
+ * workflow last processed them. stage_key is set per-transition by the workflow.
3083
+ */
3084
+ export const ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
3085
+ pipelineKey: 'lead-gen',
3086
+ label: 'Lead Generation',
3087
+ entityKey: 'acq.list-member',
3088
+ stages: [
3089
+ {
3090
+ stageKey: 'outreach',
3091
+ label: 'Outreach',
3092
+ states: [
3093
+ PENDING_STATE,
3094
+ { stateKey: 'personalized', label: 'Personalized' },
3095
+ { stateKey: 'uploaded', label: 'Uploaded' },
3096
+ { stateKey: 'interested', label: 'Interested' }
3097
+ ]
3098
+ },
3099
+ {
3100
+ stageKey: 'prospecting',
3101
+ label: 'Prospecting',
3102
+ states: [
3103
+ PENDING_STATE,
3104
+ { stateKey: 'discovered', label: 'Discovered' },
3105
+ { stateKey: 'verified', label: 'Verified' }
3106
+ ]
3107
+ },
3108
+ {
3109
+ stageKey: 'qualification',
3110
+ label: 'Qualification',
3111
+ states: [PENDING_STATE]
3112
+ }
3113
+ ]
3201
3114
  }
3202
3115
  ```
3203
3116
 
3204
3117
  ### `ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE`
3205
3118
 
3206
3119
  ```typescript
3207
- /**
3208
- * Lead-gen pipeline definition for acq_list_companies.
3209
- * Three stages matching the post-restructure sales subdomain tree.
3210
- *
3211
- * Note: companies visit prospecting and qualification states depending on which
3212
- * workflow last processed them. stage_key is set per-transition by the workflow.
3213
- */
3214
- export const ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
3215
- pipelineKey: 'lead-gen',
3216
- label: 'Lead Generation',
3217
- entityKey: 'acq.list-company',
3218
- stages: [
3219
- {
3220
- stageKey: 'outreach',
3221
- label: 'Outreach',
3222
- states: [PENDING_STATE, { stateKey: 'uploaded', label: 'Uploaded' }]
3223
- },
3224
- {
3225
- stageKey: 'prospecting',
3226
- label: 'Prospecting',
3227
- states: [
3228
- PENDING_STATE,
3229
- { stateKey: 'populated', label: 'Populated' },
3230
- { stateKey: 'extracted', label: 'Extracted' }
3231
- ]
3232
- },
3233
- {
3234
- stageKey: 'qualification',
3235
- label: 'Qualification',
3236
- states: [PENDING_STATE, { stateKey: 'qualified', label: 'Qualified' }]
3237
- }
3238
- ]
3120
+ /**
3121
+ * Lead-gen pipeline definition for acq_list_companies.
3122
+ * Three stages matching the post-restructure sales subdomain tree.
3123
+ *
3124
+ * Note: companies visit prospecting and qualification states depending on which
3125
+ * workflow last processed them. stage_key is set per-transition by the workflow.
3126
+ */
3127
+ export const ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
3128
+ pipelineKey: 'lead-gen',
3129
+ label: 'Lead Generation',
3130
+ entityKey: 'acq.list-company',
3131
+ stages: [
3132
+ {
3133
+ stageKey: 'outreach',
3134
+ label: 'Outreach',
3135
+ states: [PENDING_STATE, { stateKey: 'uploaded', label: 'Uploaded' }]
3136
+ },
3137
+ {
3138
+ stageKey: 'prospecting',
3139
+ label: 'Prospecting',
3140
+ states: [
3141
+ PENDING_STATE,
3142
+ { stateKey: 'populated', label: 'Populated' },
3143
+ { stateKey: 'extracted', label: 'Extracted' }
3144
+ ]
3145
+ },
3146
+ {
3147
+ stageKey: 'qualification',
3148
+ label: 'Qualification',
3149
+ states: [PENDING_STATE, { stateKey: 'qualified', label: 'Qualified' }]
3150
+ }
3151
+ ]
3239
3152
  }
3240
3153
  ```
3241
3154
 
3242
3155
  ### `LEAD_GEN_PIPELINE_DEFINITIONS`
3243
3156
 
3244
3157
  ```typescript
3245
- /**
3246
- * All lead-gen pipeline definitions indexed by entity key.
3247
- * Use findPipeline() to locate a definition by pipeline_key within any of these arrays.
3248
- */
3249
- export const LEAD_GEN_PIPELINE_DEFINITIONS: Record<string, StatefulPipelineDefinition[]> = {
3250
- 'acq.list-member': [ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE],
3251
- 'acq.list-company': [ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE]
3158
+ /**
3159
+ * All lead-gen pipeline definitions indexed by entity key.
3160
+ * Use findPipeline() to locate a definition by pipeline_key within any array.
3161
+ */
3162
+ export const LEAD_GEN_PIPELINE_DEFINITIONS: Record<string, StatefulPipelineDefinition[]> = {
3163
+ 'acq.list-member': [ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE],
3164
+ 'acq.list-company': [ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE]
3252
3165
  }
3253
3166
  ```
3254
3167
 
@@ -3664,168 +3577,168 @@ export interface BulkImportCompaniesResult {
3664
3577
  ### `LeadToolMap`
3665
3578
 
3666
3579
  ```typescript
3667
- export type LeadToolMap = {
3668
- // List operations
3669
- listLists: { params: Record<string, never>; result: AcqList[] }
3670
- createList: { params: Omit<CreateListParams, 'organizationId'>; result: AcqList }
3671
- updateList: { params: { id: string } & UpdateListParams; result: AcqList }
3672
- deleteList: { params: { id: string }; result: void }
3673
- addContactsToList: { params: Omit<AddContactsToListParams, 'organizationId'>; result: AddContactsToListResult }
3674
- addCompaniesToList: { params: Omit<AddCompaniesToListParams, 'organizationId'>; result: AddCompaniesToListResult }
3675
- updateCompanyStage: {
3676
- params: Omit<UpdateCompanyStageParams, 'organizationId'>
3677
- result: void
3678
- }
3679
- updateContactStage: {
3680
- params: Omit<UpdateContactStageParams, 'organizationId'>
3681
- result: void
3682
- }
3683
- // Company operations
3684
- createCompany: { params: Omit<CreateCompanyParams, 'organizationId'>; result: AcqCompany }
3685
- upsertCompany: { params: Omit<UpsertCompanyParams, 'organizationId'>; result: AcqCompany }
3686
- updateCompany: { params: { id: string } & UpdateCompanyParams; result: AcqCompany }
3687
- getCompany: { params: { id: string }; result: AcqCompany | null }
3688
- listCompanies: { params: CompanyFilters; result: AcqCompany[] }
3689
- deleteCompany: { params: { id: string }; result: void }
3690
- // Contact operations
3691
- createContact: { params: Omit<CreateContactParams, 'organizationId'>; result: AcqContact }
3692
- upsertContact: { params: Omit<UpsertContactParams, 'organizationId'>; result: AcqContact }
3693
- updateContact: { params: { id: string } & UpdateContactParams; result: AcqContact }
3694
- getContact: { params: { id: string }; result: AcqContact | null }
3695
- getContactByEmail: { params: { email: string }; result: AcqContact | null }
3696
- listContacts: {
3697
- params: ContactFilters & { limit?: number; offset?: number }
3698
- result: PaginatedResult<AcqContact>
3699
- }
3700
- deleteContact: { params: { id: string }; result: void }
3701
- bulkImportContacts: { params: Omit<BulkImportParams, 'organizationId'>; result: BulkImportResult }
3702
- bulkImportCompanies: {
3703
- params: Omit<BulkImportCompaniesParams, 'organizationId'>
3704
- result: BulkImportCompaniesResult
3705
- }
3706
- deactivateContactsByCompany: {
3707
- params: { companyId: string }
3708
- result: { deactivated: number }
3709
- }
3710
- // Deal operations
3711
- upsertDeal: { params: Omit<UpsertDealParams, 'organizationId'>; result: AcqDeal }
3712
- getDealByEmail: { params: { email: string }; result: AcqDeal | null }
3713
- getDealByEnvelopeId: { params: { envelopeId: string }; result: AcqDeal | null }
3714
- updateDealEnvelopeId: { params: { dealId: string; envelopeId: string }; result: AcqDeal | null }
3715
- getDealById: { params: Omit<GetDealByIdParams, 'organizationId'>; result: AcqDeal | null }
3716
- getContactById: { params: Omit<GetContactByIdParams, 'organizationId'>; result: AcqContact | null }
3717
- getCompanyById: { params: Omit<GetCompanyByIdParams, 'organizationId'>; result: AcqCompany | null }
3718
- // Deal-sync operations
3719
- updateDiscoveryData: { params: Omit<UpdateDiscoveryDataParams, 'organizationId'>; result: void }
3720
- updateProposalData: { params: Omit<UpdateProposalDataParams, 'organizationId'>; result: void }
3721
- markProposalSent: { params: Omit<MarkProposalSentParams, 'organizationId'>; result: void }
3722
- markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
3723
- updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
3724
- updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
3725
- cacheInstantlyThreadIds: { params: Omit<CacheInstantlyThreadIdsParams, 'organizationId'>; result: void }
3726
- transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
3727
- setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
3728
- cancelSchedulesAndHitlByEmail: {
3729
- params: Omit<CancelSchedulesAndHitlByEmailParams, 'organizationId'>
3730
- result: { schedulesCancelled: number; hitlDeleted: number }
3731
- }
3732
- cancelHitlByDealId: { params: Omit<CancelHitlByDealIdParams, 'organizationId'>; result: { hitlDeleted: number } }
3733
- clearDealFields: { params: Omit<ClearDealFieldsParams, 'organizationId'>; result: void }
3734
- deleteDeal: { params: Omit<DeleteDealParams, 'organizationId'>; result: void }
3735
- recordDealActivity: {
3736
- params: Omit<RecordDealActivityParams, 'organizationId'>
3737
- result: void
3738
- }
3739
- // Deal note operations
3740
- createDealNote: {
3741
- params: Omit<CreateDealNoteParams, 'organizationId'>
3742
- result: AcqDealNote
3743
- }
3744
- listDealNotes: {
3745
- params: Omit<ListDealNotesParams, 'organizationId'>
3746
- result: AcqDealNote[]
3747
- }
3748
- // Deal task operations
3749
- createDealTask: {
3750
- params: Omit<CreateDealTaskParams, 'organizationId'>
3751
- result: AcqDealTask
3752
- }
3753
- listDealTasks: {
3754
- params: Omit<ListDealTasksParams, 'organizationId'>
3755
- result: AcqDealTask[]
3756
- }
3757
- listDealTasksDue: {
3758
- params: Omit<ListDealTasksDueParams, 'organizationId'>
3759
- result: AcqDealTask[]
3760
- }
3761
- completeDealTask: {
3762
- params: Omit<CompleteDealTaskParams, 'organizationId'>
3763
- result: AcqDealTask
3764
- }
3765
- // Deal query & analytics operations
3766
- listDeals: { params: DealFilters; result: AcqDeal[] }
3767
- getDealPipelineAnalytics: { params: { recentLimit?: number }; result: DealPipelineAnalytics }
3768
- // Enrichment data operations
3769
- mergeEnrichmentData: {
3770
- params: { id: string; table: 'acq_companies' | 'acq_contacts'; data: Record<string, unknown> }
3771
- result: void
3772
- }
3773
- // Social monitoring operations
3774
- upsertSocialPosts: {
3775
- params: { posts: Omit<UpsertSocialPostParams, 'organizationId'>[] }
3776
- result: UpsertSocialPostsResult
3777
- }
3778
- setDealStateKey: {
3779
- params: {
3780
- dealId: string
3781
- stateKey: string
3782
- }
3783
- result: { ok: true }
3784
- }
3785
- // CRM workflow helpers
3786
- transitionDeal: {
3787
- params: {
3788
- dealId: string
3789
- toStage: string
3790
- toState?: string
3791
- }
3792
- result: { deal: AcqDeal }
3793
- }
3794
- loadDeal: {
3795
- params: { dealId: string }
3796
- result: DealDetail | null
3797
- }
3580
+ export type LeadToolMap = {
3581
+ // List operations
3582
+ listLists: { params: Record<string, never>; result: AcqList[] }
3583
+ createList: { params: Omit<CreateListParams, 'organizationId'>; result: AcqList }
3584
+ updateList: { params: { id: string } & UpdateListParams; result: AcqList }
3585
+ deleteList: { params: { id: string }; result: void }
3586
+ addContactsToList: { params: Omit<AddContactsToListParams, 'organizationId'>; result: AddContactsToListResult }
3587
+ addCompaniesToList: { params: Omit<AddCompaniesToListParams, 'organizationId'>; result: AddCompaniesToListResult }
3588
+ updateCompanyStage: {
3589
+ params: Omit<UpdateCompanyStageParams, 'organizationId'>
3590
+ result: void
3591
+ }
3592
+ updateContactStage: {
3593
+ params: Omit<UpdateContactStageParams, 'organizationId'>
3594
+ result: void
3595
+ }
3596
+ // Company operations
3597
+ createCompany: { params: Omit<CreateCompanyParams, 'organizationId'>; result: AcqCompany }
3598
+ upsertCompany: { params: Omit<UpsertCompanyParams, 'organizationId'>; result: AcqCompany }
3599
+ updateCompany: { params: { id: string } & UpdateCompanyParams; result: AcqCompany }
3600
+ getCompany: { params: { id: string }; result: AcqCompany | null }
3601
+ listCompanies: { params: CompanyFilters; result: AcqCompany[] }
3602
+ deleteCompany: { params: { id: string }; result: void }
3603
+ // Contact operations
3604
+ createContact: { params: Omit<CreateContactParams, 'organizationId'>; result: AcqContact }
3605
+ upsertContact: { params: Omit<UpsertContactParams, 'organizationId'>; result: AcqContact }
3606
+ updateContact: { params: { id: string } & UpdateContactParams; result: AcqContact }
3607
+ getContact: { params: { id: string }; result: AcqContact | null }
3608
+ getContactByEmail: { params: { email: string }; result: AcqContact | null }
3609
+ listContacts: {
3610
+ params: ContactFilters & { limit?: number; offset?: number }
3611
+ result: PaginatedResult<AcqContact>
3612
+ }
3613
+ deleteContact: { params: { id: string }; result: void }
3614
+ bulkImportContacts: { params: Omit<BulkImportParams, 'organizationId'>; result: BulkImportResult }
3615
+ bulkImportCompanies: {
3616
+ params: Omit<BulkImportCompaniesParams, 'organizationId'>
3617
+ result: BulkImportCompaniesResult
3618
+ }
3619
+ deactivateContactsByCompany: {
3620
+ params: { companyId: string }
3621
+ result: { deactivated: number }
3622
+ }
3623
+ // Deal operations
3624
+ upsertDeal: { params: Omit<UpsertDealParams, 'organizationId'>; result: AcqDeal }
3625
+ getDealByEmail: { params: { email: string }; result: AcqDeal | null }
3626
+ getDealByEnvelopeId: { params: { envelopeId: string }; result: AcqDeal | null }
3627
+ updateDealEnvelopeId: { params: { dealId: string; envelopeId: string }; result: AcqDeal | null }
3628
+ getDealById: { params: Omit<GetDealByIdParams, 'organizationId'>; result: AcqDeal | null }
3629
+ getContactById: { params: Omit<GetContactByIdParams, 'organizationId'>; result: AcqContact | null }
3630
+ getCompanyById: { params: Omit<GetCompanyByIdParams, 'organizationId'>; result: AcqCompany | null }
3631
+ // Deal-sync operations
3632
+ updateDiscoveryData: { params: Omit<UpdateDiscoveryDataParams, 'organizationId'>; result: void }
3633
+ updateProposalData: { params: Omit<UpdateProposalDataParams, 'organizationId'>; result: void }
3634
+ markProposalSent: { params: Omit<MarkProposalSentParams, 'organizationId'>; result: void }
3635
+ markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
3636
+ updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
3637
+ updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
3638
+ cacheInstantlyThreadIds: { params: Omit<CacheInstantlyThreadIdsParams, 'organizationId'>; result: void }
3639
+ transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
3640
+ setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
3641
+ cancelSchedulesAndHitlByEmail: {
3642
+ params: Omit<CancelSchedulesAndHitlByEmailParams, 'organizationId'>
3643
+ result: { schedulesCancelled: number; hitlDeleted: number }
3644
+ }
3645
+ cancelHitlByDealId: { params: Omit<CancelHitlByDealIdParams, 'organizationId'>; result: { hitlDeleted: number } }
3646
+ clearDealFields: { params: Omit<ClearDealFieldsParams, 'organizationId'>; result: void }
3647
+ deleteDeal: { params: Omit<DeleteDealParams, 'organizationId'>; result: void }
3648
+ recordDealActivity: {
3649
+ params: Omit<RecordDealActivityParams, 'organizationId'>
3650
+ result: void
3651
+ }
3652
+ // Deal note operations
3653
+ createDealNote: {
3654
+ params: Omit<CreateDealNoteParams, 'organizationId'>
3655
+ result: AcqDealNote
3656
+ }
3657
+ listDealNotes: {
3658
+ params: Omit<ListDealNotesParams, 'organizationId'>
3659
+ result: AcqDealNote[]
3660
+ }
3661
+ // Deal task operations
3662
+ createDealTask: {
3663
+ params: Omit<CreateDealTaskParams, 'organizationId'>
3664
+ result: AcqDealTask
3665
+ }
3666
+ listDealTasks: {
3667
+ params: Omit<ListDealTasksParams, 'organizationId'>
3668
+ result: AcqDealTask[]
3669
+ }
3670
+ listDealTasksDue: {
3671
+ params: Omit<ListDealTasksDueParams, 'organizationId'>
3672
+ result: AcqDealTask[]
3673
+ }
3674
+ completeDealTask: {
3675
+ params: Omit<CompleteDealTaskParams, 'organizationId'>
3676
+ result: AcqDealTask
3677
+ }
3678
+ // Deal query & analytics operations
3679
+ listDeals: { params: DealFilters; result: AcqDeal[] }
3680
+ getDealPipelineAnalytics: { params: { recentLimit?: number }; result: DealPipelineAnalytics }
3681
+ // Enrichment data operations
3682
+ mergeEnrichmentData: {
3683
+ params: { id: string; table: 'acq_companies' | 'acq_contacts'; data: Record<string, unknown> }
3684
+ result: void
3685
+ }
3686
+ // Social monitoring operations
3687
+ upsertSocialPosts: {
3688
+ params: { posts: Omit<UpsertSocialPostParams, 'organizationId'>[] }
3689
+ result: UpsertSocialPostsResult
3690
+ }
3691
+ setDealStateKey: {
3692
+ params: {
3693
+ dealId: string
3694
+ stateKey: string
3695
+ }
3696
+ result: { ok: true }
3697
+ }
3698
+ // CRM workflow helpers
3699
+ transitionDeal: {
3700
+ params: {
3701
+ dealId: string
3702
+ toStage: string
3703
+ toState?: string
3704
+ }
3705
+ result: { deal: AcqDeal }
3706
+ }
3707
+ loadDeal: {
3708
+ params: { dealId: string }
3709
+ result: DealDetail | null
3710
+ }
3798
3711
  }
3799
3712
  ```
3800
3713
 
3801
3714
  ### `ListToolMap`
3802
3715
 
3803
3716
  ```typescript
3804
- export type ListToolMap = {
3805
- getConfig: {
3806
- params: { listId: string }
3807
- result: { scrapingConfig: ScrapingConfig; icp: IcpRubric; pipelineConfig: PipelineConfig }
3808
- }
3809
- recordExecution: {
3810
- params: Omit<RecordListExecutionParams, 'organizationId'>
3811
- result: void
3812
- }
3813
- updateCompanyStage: {
3814
- params: Omit<UpdateCompanyStageParams, 'organizationId'>
3815
- result: void
3816
- }
3817
- updateContactStage: {
3818
- params: Omit<UpdateContactStageParams, 'organizationId'>
3819
- result: void
3820
- }
3821
- listPendingCompanyIds: {
3822
- params: Omit<ListPendingCompanyIdsParams, 'organizationId'>
3823
- result: string[]
3824
- }
3825
- listPendingContactIds: {
3826
- params: Omit<ListPendingContactIdsParams, 'organizationId'>
3827
- result: string[]
3828
- }
3717
+ export type ListToolMap = {
3718
+ getConfig: {
3719
+ params: { listId: string }
3720
+ result: { scrapingConfig: ScrapingConfig; icp: IcpRubric; pipelineConfig: PipelineConfig }
3721
+ }
3722
+ recordExecution: {
3723
+ params: Omit<RecordListExecutionParams, 'organizationId'>
3724
+ result: void
3725
+ }
3726
+ updateCompanyStage: {
3727
+ params: Omit<UpdateCompanyStageParams, 'organizationId'>
3728
+ result: void
3729
+ }
3730
+ updateContactStage: {
3731
+ params: Omit<UpdateContactStageParams, 'organizationId'>
3732
+ result: void
3733
+ }
3734
+ listPendingCompanyIds: {
3735
+ params: Omit<ListPendingCompanyIdsParams, 'organizationId'>
3736
+ result: string[]
3737
+ }
3738
+ listPendingContactIds: {
3739
+ params: Omit<ListPendingContactIdsParams, 'organizationId'>
3740
+ result: string[]
3741
+ }
3829
3742
  }
3830
3743
  ```
3831
3744