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