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