@elevasis/core 0.15.0 → 0.16.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 (88) hide show
  1. package/dist/index.d.ts +1718 -19
  2. package/dist/index.js +369 -25
  3. package/dist/organization-model/index.d.ts +1718 -19
  4. package/dist/organization-model/index.js +369 -25
  5. package/dist/test-utils/index.d.ts +1108 -371
  6. package/dist/test-utils/index.js +357 -17
  7. package/package.json +5 -1
  8. package/src/__tests__/publish.test.ts +14 -13
  9. package/src/__tests__/template-core-compatibility.test.ts +4 -4
  10. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +1109 -882
  11. package/src/auth/multi-tenancy/index.ts +3 -0
  12. package/src/auth/multi-tenancy/theme-presets.ts +45 -0
  13. package/src/auth/multi-tenancy/types.ts +57 -83
  14. package/src/auth/multi-tenancy/users/api-schemas.ts +165 -194
  15. package/src/business/acquisition/activity-events.ts +13 -4
  16. package/src/business/acquisition/api-schemas.test.ts +315 -4
  17. package/src/business/acquisition/api-schemas.ts +122 -8
  18. package/src/business/acquisition/build-templates.ts +44 -0
  19. package/src/business/acquisition/crm-next-action.test.ts +262 -0
  20. package/src/business/acquisition/crm-next-action.ts +220 -0
  21. package/src/business/acquisition/crm-priority.test.ts +216 -0
  22. package/src/business/acquisition/crm-priority.ts +349 -0
  23. package/src/business/acquisition/crm-state-actions.test.ts +151 -160
  24. package/src/business/acquisition/deal-ownership.test.ts +351 -0
  25. package/src/business/acquisition/deal-ownership.ts +120 -0
  26. package/src/business/acquisition/derive-actions.test.ts +101 -37
  27. package/src/business/acquisition/derive-actions.ts +102 -87
  28. package/src/business/acquisition/index.ts +10 -0
  29. package/src/business/acquisition/types.ts +400 -366
  30. package/src/business/crm/api-schemas.ts +40 -0
  31. package/src/business/crm/index.ts +1 -0
  32. package/src/business/deals/api-schemas.ts +79 -0
  33. package/src/business/deals/index.ts +1 -0
  34. package/src/business/projects/types.ts +124 -88
  35. package/src/execution/core/runner-types.ts +61 -80
  36. package/src/execution/engine/index.ts +4 -3
  37. package/src/execution/engine/tools/integration/server/adapters/gmail/gmail-tools.ts +105 -104
  38. package/src/execution/engine/tools/integration/server/adapters/instantly/instantly-tools.ts +1474 -1473
  39. package/src/execution/engine/tools/integration/server/adapters/millionverifier/millionverifier-tools.ts +103 -102
  40. package/src/execution/engine/tools/integration/server/adapters/signature-api/signature-api-tools.ts +182 -179
  41. package/src/execution/engine/tools/integration/server/adapters/stripe/stripe-tools.ts +310 -309
  42. package/src/execution/engine/tools/integration/tool.ts +255 -253
  43. package/src/execution/engine/tools/lead-service-types.ts +939 -924
  44. package/src/execution/engine/tools/messages.ts +43 -0
  45. package/src/execution/engine/tools/platform/acquisition/list-tools.ts +6 -5
  46. package/src/execution/engine/tools/platform/acquisition/types.ts +5 -2
  47. package/src/execution/engine/tools/platform/email/types.ts +97 -96
  48. package/src/execution/engine/tools/registry.ts +4 -3
  49. package/src/execution/engine/tools/tool-maps.ts +3 -1
  50. package/src/execution/engine/tools/types.ts +234 -233
  51. package/src/execution/engine/workflow/types.ts +195 -193
  52. package/src/execution/external/api-schemas.ts +40 -0
  53. package/src/execution/external/index.ts +1 -0
  54. package/src/knowledge/README.md +32 -0
  55. package/src/knowledge/__tests__/queries.test.ts +504 -0
  56. package/src/knowledge/format.ts +99 -0
  57. package/src/knowledge/index.ts +5 -0
  58. package/src/knowledge/queries.ts +256 -0
  59. package/src/organization-model/__tests__/defaults.test.ts +172 -172
  60. package/src/organization-model/__tests__/foundation.test.ts +7 -7
  61. package/src/organization-model/__tests__/icons.test.ts +27 -0
  62. package/src/organization-model/__tests__/knowledge.test.ts +214 -0
  63. package/src/organization-model/contracts.ts +17 -15
  64. package/src/organization-model/defaults.ts +74 -19
  65. package/src/organization-model/domains/knowledge.ts +53 -0
  66. package/src/organization-model/domains/navigation.ts +416 -399
  67. package/src/organization-model/domains/prospecting.ts +204 -1
  68. package/src/organization-model/domains/sales.test.ts +29 -0
  69. package/src/organization-model/domains/sales.ts +102 -0
  70. package/src/organization-model/domains/shared.ts +6 -5
  71. package/src/organization-model/foundation.ts +10 -6
  72. package/src/organization-model/graph/build.ts +209 -182
  73. package/src/organization-model/graph/schema.ts +37 -34
  74. package/src/organization-model/graph/types.ts +47 -31
  75. package/src/organization-model/icons.ts +81 -0
  76. package/src/organization-model/index.ts +8 -3
  77. package/src/organization-model/organization-model.mdx +1 -1
  78. package/src/organization-model/published.ts +103 -86
  79. package/src/organization-model/schema.ts +90 -85
  80. package/src/organization-model/types.ts +42 -35
  81. package/src/platform/constants/versions.ts +1 -1
  82. package/src/platform/index.ts +23 -27
  83. package/src/platform/registry/index.ts +0 -4
  84. package/src/platform/registry/resource-registry.ts +0 -77
  85. package/src/platform/registry/serialized-types.ts +148 -219
  86. package/src/platform/registry/stats-types.ts +60 -60
  87. package/src/reference/_generated/contracts.md +829 -595
  88. package/src/supabase/database.types.ts +2978 -2958
@@ -177,15 +177,41 @@ export type OrganizationModelObjective = z.infer<typeof ObjectiveSchema>
177
177
  export type OrganizationModelKeyResult = z.infer<typeof KeyResultSchema>
178
178
  ```
179
179
 
180
+ ### `OrganizationModelKnowledge`
181
+
182
+ ```typescript
183
+ export type OrganizationModelKnowledge = z.infer<typeof KnowledgeDomainSchema>
184
+ ```
185
+
186
+ ### `OrgKnowledgeNode`
187
+
188
+ ```typescript
189
+ export type OrgKnowledgeNode = z.infer<typeof OrgKnowledgeNodeSchema>
190
+ ```
191
+
192
+ ### `OrgKnowledgeKind`
193
+
194
+ ```typescript
195
+ export type OrgKnowledgeKind = z.infer<typeof OrgKnowledgeKindSchema>
196
+ ```
197
+
180
198
  ### `DeepPartial`
181
199
 
182
200
  ```typescript
183
- export type DeepPartial<T> =
201
+ export type DeepPartial<T> =
184
202
  T extends Array<infer U> ? Array<DeepPartial<U>> : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T
185
203
  ```
186
204
 
187
205
  ## Feature System
188
206
 
207
+ ### `ElevasisOrganizationModel`
208
+
209
+ ```typescript
210
+ export type ElevasisOrganizationModel = Omit<OrganizationModel, 'knowledge'> & {
211
+ knowledge?: OrganizationModel['knowledge']
212
+ }
213
+ ```
214
+
189
215
  ### `FeatureSidebarComponent`
190
216
 
191
217
  ```typescript
@@ -324,7 +350,7 @@ export interface OrganizationGraphContextValue {
324
350
  ```typescript
325
351
  export interface ElevasisFeaturesProviderProps {
326
352
  features: FeatureModule[]
327
- organizationModel?: OrganizationModel
353
+ organizationModel?: ElevasisOrganizationModel
328
354
  timeRange?: TimeRange
329
355
  operationsApiUrl?: string
330
356
  operationsSSEManager?: SSEConnectionManagerLike
@@ -885,6 +911,26 @@ export interface AcqContact {
885
911
  export type DealStage = 'interested' | 'proposal' | 'closing' | 'closed_won' | 'closed_lost' | 'nurturing'
886
912
  ```
887
913
 
914
+ ### `DealPriorityBucketKey`
915
+
916
+ ```typescript
917
+ export type DealPriorityBucketKey = 'needs_response' | 'follow_up_due' | 'waiting' | 'stale' | 'closed_low'
918
+ ```
919
+
920
+ ### `DealPriority`
921
+
922
+ ```typescript
923
+ export interface DealPriority {
924
+ bucketKey: DealPriorityBucketKey
925
+ rank: number
926
+ label: string
927
+ color: string
928
+ reason: string
929
+ latestActivityAt: string | null
930
+ nextActionAt: string | null
931
+ }
932
+ ```
933
+
888
934
  ### `KanbanStageConfig`
889
935
 
890
936
  ```typescript
@@ -941,8 +987,11 @@ export interface DealFilters {
941
987
 
942
988
  ```typescript
943
989
  /** Deal list item with joined contact and company data */
944
- export interface DealListItem extends AcqDealRow {
945
- contact: DealContact | null
990
+ export interface DealListItem extends AcqDealRow {
991
+ priority: DealPriority
992
+ ownership: 'us' | 'them' | null
993
+ nextAction: string | null
994
+ contact: DealContact | null
946
995
  }
947
996
  ```
948
997
 
@@ -983,6 +1032,66 @@ export interface AcqDealTask {
983
1032
  }
984
1033
  ```
985
1034
 
1035
+ ### `CrmPriorityBucketKey`
1036
+
1037
+ ```typescript
1038
+ export type CrmPriorityBucketKey = 'needs_response' | 'follow_up_due' | 'waiting' | 'stale' | 'closed_low'
1039
+ ```
1040
+
1041
+ ### `CrmPriorityBucketDefinition`
1042
+
1043
+ ```typescript
1044
+ export interface CrmPriorityBucketDefinition {
1045
+ bucketKey: CrmPriorityBucketKey
1046
+ label: string
1047
+ /** Lower ranks sort first in deal lists and pipeline columns. */
1048
+ rank: number
1049
+ /** UI color token. Consumers may map this to their design system. */
1050
+ color: string
1051
+ }
1052
+ ```
1053
+
1054
+ ### `CrmPriorityRuleConfig`
1055
+
1056
+ ```typescript
1057
+ export interface CrmPriorityRuleConfig {
1058
+ buckets: CrmPriorityBucketDefinition[]
1059
+ closedStageKeys: string[]
1060
+ followUpAfterDaysByStateKey: Record<string, number>
1061
+ staleAfterDays: number
1062
+ }
1063
+ ```
1064
+
1065
+ ### `CRM_PRIORITY_BUCKETS`
1066
+
1067
+ ```typescript
1068
+ export const CRM_PRIORITY_BUCKETS: CrmPriorityBucketDefinition[] = [
1069
+ { bucketKey: 'needs_response', label: 'Needs Response', rank: 10, color: 'red' },
1070
+ { bucketKey: 'follow_up_due', label: 'Follow-up Due', rank: 20, color: 'orange' },
1071
+ { bucketKey: 'waiting', label: 'Waiting', rank: 30, color: 'blue' },
1072
+ { bucketKey: 'stale', label: 'Stale', rank: 40, color: 'gray' },
1073
+ { bucketKey: 'closed_low', label: 'Closed', rank: 50, color: 'dark' }
1074
+ ]
1075
+ ```
1076
+
1077
+ ### `DEFAULT_CRM_PRIORITY_RULE_CONFIG`
1078
+
1079
+ ```typescript
1080
+ export const DEFAULT_CRM_PRIORITY_RULE_CONFIG: CrmPriorityRuleConfig = {
1081
+ buckets: CRM_PRIORITY_BUCKETS,
1082
+ closedStageKeys: ['closed_won', 'closed_lost'],
1083
+ followUpAfterDaysByStateKey: {
1084
+ discovery_link_sent: 3,
1085
+ discovery_nudging: 2,
1086
+ reply_sent: 3,
1087
+ followup_1_sent: 3,
1088
+ followup_2_sent: 5,
1089
+ followup_3_sent: 7
1090
+ },
1091
+ staleAfterDays: 14
1092
+ }
1093
+ ```
1094
+
986
1095
  ### `DealStageSchema`
987
1096
 
988
1097
  ```typescript
@@ -998,178 +1107,195 @@ export const AcqDealTaskKindSchema = z.enum(['call', 'email', 'meeting', 'other'
998
1107
  ### `DealIdParamsSchema`
999
1108
 
1000
1109
  ```typescript
1001
- export const DealIdParamsSchema = z.object({
1002
- dealId: UuidSchema
1110
+ export const DealIdParamsSchema = z.object({
1111
+ dealId: UuidSchema
1003
1112
  })
1004
1113
  ```
1005
1114
 
1006
1115
  ### `DealTaskIdParamsSchema`
1007
1116
 
1008
1117
  ```typescript
1009
- export const DealTaskIdParamsSchema = z.object({
1010
- dealId: UuidSchema,
1011
- taskId: UuidSchema
1118
+ export const DealTaskIdParamsSchema = z.object({
1119
+ dealId: UuidSchema,
1120
+ taskId: UuidSchema
1012
1121
  })
1013
1122
  ```
1014
1123
 
1015
1124
  ### `ListDealsQuerySchema`
1016
1125
 
1017
1126
  ```typescript
1018
- export const ListDealsQuerySchema = z
1019
- .object({
1020
- stage: DealStageSchema.optional(),
1021
- search: z.string().optional(),
1022
- limit: z.coerce.number().int().positive().default(50),
1023
- offset: z.coerce.number().int().min(0).default(0)
1024
- })
1127
+ export const ListDealsQuerySchema = z
1128
+ .object({
1129
+ stage: DealStageSchema.optional(),
1130
+ search: z.string().optional(),
1131
+ limit: z.coerce.number().int().positive().default(50),
1132
+ offset: z.coerce.number().int().min(0).default(0)
1133
+ })
1025
1134
  .strict()
1026
1135
  ```
1027
1136
 
1028
1137
  ### `DealLookupQuerySchema`
1029
1138
 
1030
1139
  ```typescript
1031
- export const DealLookupQuerySchema = z
1032
- .object({
1033
- search: z.string().trim().min(1).max(200).optional(),
1034
- limit: z.coerce.number().int().min(1).max(25).default(10)
1035
- })
1140
+ export const DealLookupQuerySchema = z
1141
+ .object({
1142
+ search: z.string().trim().min(1).max(200).optional(),
1143
+ limit: z.coerce.number().int().min(1).max(25).default(10)
1144
+ })
1036
1145
  .strict()
1037
1146
  ```
1038
1147
 
1039
1148
  ### `ListDealTasksDueQuerySchema`
1040
1149
 
1041
1150
  ```typescript
1042
- export const ListDealTasksDueQuerySchema = z
1043
- .object({
1044
- window: z.enum(['overdue', 'today', 'today_and_overdue', 'upcoming']).optional(),
1045
- assigneeUserId: UuidSchema.optional()
1046
- })
1151
+ export const ListDealTasksDueQuerySchema = z
1152
+ .object({
1153
+ window: z.enum(['overdue', 'today', 'today_and_overdue', 'upcoming']).optional(),
1154
+ assigneeUserId: UuidSchema.optional()
1155
+ })
1047
1156
  .strict()
1048
1157
  ```
1049
1158
 
1050
1159
  ### `CreateDealNoteRequestSchema`
1051
1160
 
1052
1161
  ```typescript
1053
- export const CreateDealNoteRequestSchema = z
1054
- .object({
1055
- body: z.string().trim().min(1).max(10000)
1056
- })
1162
+ export const CreateDealNoteRequestSchema = z
1163
+ .object({
1164
+ body: z.string().trim().min(1).max(10000)
1165
+ })
1057
1166
  .strict()
1058
1167
  ```
1059
1168
 
1060
1169
  ### `CreateDealTaskRequestSchema`
1061
1170
 
1062
1171
  ```typescript
1063
- export const CreateDealTaskRequestSchema = z
1064
- .object({
1065
- title: z.string().trim().min(1).max(255),
1066
- description: z.string().nullable().optional(),
1067
- kind: AcqDealTaskKindSchema.optional(),
1068
- dueAt: z.string().datetime().nullable().optional(),
1069
- assigneeUserId: UuidSchema.nullable().optional()
1070
- })
1172
+ export const CreateDealTaskRequestSchema = z
1173
+ .object({
1174
+ title: z.string().trim().min(1).max(255),
1175
+ description: z.string().nullable().optional(),
1176
+ kind: AcqDealTaskKindSchema.optional(),
1177
+ dueAt: z.string().datetime().nullable().optional(),
1178
+ assigneeUserId: UuidSchema.nullable().optional()
1179
+ })
1071
1180
  .strict()
1072
1181
  ```
1073
1182
 
1074
1183
  ### `TransitionItemRequestSchema`
1075
1184
 
1076
1185
  ```typescript
1077
- export const TransitionItemRequestSchema = z
1078
- .object({
1079
- pipelineKey: z.string().min(1),
1080
- stageKey: z.string().min(1),
1081
- stateKey: z.string().nullable().optional(),
1082
- reason: z.string().optional(),
1083
- expectedUpdatedAt: z.string().datetime().optional()
1084
- })
1186
+ export const TransitionItemRequestSchema = z
1187
+ .object({
1188
+ pipelineKey: z.string().min(1),
1189
+ stageKey: z.string().min(1),
1190
+ stateKey: z.string().nullable().optional(),
1191
+ reason: z.string().optional(),
1192
+ expectedUpdatedAt: z.string().datetime().optional()
1193
+ })
1085
1194
  .strict()
1086
1195
  ```
1087
1196
 
1088
1197
  ### `ExecuteActionParamsSchema`
1089
1198
 
1090
1199
  ```typescript
1091
- export const ExecuteActionParamsSchema = z
1092
- .object({
1093
- dealId: UuidSchema,
1094
- actionKey: NonEmptyStringSchema
1095
- })
1200
+ export const ExecuteActionParamsSchema = z
1201
+ .object({
1202
+ dealId: UuidSchema,
1203
+ actionKey: NonEmptyStringSchema
1204
+ })
1096
1205
  .strict()
1097
1206
  ```
1098
1207
 
1099
1208
  ### `ExecuteActionRequestSchema`
1100
1209
 
1101
1210
  ```typescript
1102
- export const ExecuteActionRequestSchema = z
1103
- .object({
1104
- payload: z.record(z.string(), z.unknown()).optional()
1105
- })
1211
+ export const ExecuteActionRequestSchema = z
1212
+ .object({
1213
+ payload: z.record(z.string(), z.unknown()).optional()
1214
+ })
1106
1215
  .strict()
1107
1216
  ```
1108
1217
 
1109
1218
  ### `DealContactSummarySchema`
1110
1219
 
1111
1220
  ```typescript
1112
- /**
1113
- * Contact summary nested inside DealListItem / DealDetailResponse.
1114
- * Matches the joined shape returned by useDeals / useDealDetail Supabase queries.
1115
- */
1116
- export const DealContactSummarySchema = z.object({
1117
- id: z.string(),
1118
- first_name: z.string().nullable(),
1119
- last_name: z.string().nullable(),
1120
- email: z.string(),
1121
- title: z.string().nullable(),
1122
- headline: z.string().nullable(),
1123
- linkedin_url: z.string().nullable(),
1124
- pipeline_status: z.record(z.string(), z.unknown()).nullable(),
1125
- enrichment_data: z.record(z.string(), z.unknown()).nullable(),
1126
- company: z
1127
- .object({
1128
- id: z.string(),
1129
- name: z.string(),
1130
- domain: z.string().nullable(),
1131
- website: z.string().nullable(),
1132
- linkedin_url: z.string().nullable(),
1133
- segment: z.string().nullable(),
1134
- category: z.string().nullable(),
1135
- num_employees: z.number().nullable()
1136
- })
1137
- .nullable()
1221
+ /**
1222
+ * Contact summary nested inside DealListItem / DealDetailResponse.
1223
+ * Matches the joined shape returned by useDeals / useDealDetail Supabase queries.
1224
+ */
1225
+ export const DealContactSummarySchema = z.object({
1226
+ id: z.string(),
1227
+ first_name: z.string().nullable(),
1228
+ last_name: z.string().nullable(),
1229
+ email: z.string(),
1230
+ title: z.string().nullable(),
1231
+ headline: z.string().nullable(),
1232
+ linkedin_url: z.string().nullable(),
1233
+ pipeline_status: z.record(z.string(), z.unknown()).nullable(),
1234
+ enrichment_data: z.record(z.string(), z.unknown()).nullable(),
1235
+ company: z
1236
+ .object({
1237
+ id: z.string(),
1238
+ name: z.string(),
1239
+ domain: z.string().nullable(),
1240
+ website: z.string().nullable(),
1241
+ linkedin_url: z.string().nullable(),
1242
+ segment: z.string().nullable(),
1243
+ category: z.string().nullable(),
1244
+ num_employees: z.number().nullable()
1245
+ })
1246
+ .nullable()
1247
+ })
1248
+ ```
1249
+
1250
+ ### `DealPrioritySchema`
1251
+
1252
+ ```typescript
1253
+ export const DealPrioritySchema = z.object({
1254
+ bucketKey: z.enum(['needs_response', 'follow_up_due', 'waiting', 'stale', 'closed_low']),
1255
+ rank: z.number().int(),
1256
+ label: z.string(),
1257
+ color: z.string(),
1258
+ reason: z.string(),
1259
+ latestActivityAt: z.string().nullable(),
1260
+ nextActionAt: z.string().nullable()
1138
1261
  })
1139
1262
  ```
1140
1263
 
1141
1264
  ### `DealListItemSchema`
1142
1265
 
1143
1266
  ```typescript
1144
- /**
1145
- * Deal list item with joined contact (and company via contact).
1146
- * Matches DealListItem from @repo/core types.
1147
- */
1148
- export const DealListItemSchema = z.object({
1149
- // acq_deals columns
1150
- id: z.string(),
1151
- organization_id: z.string(),
1152
- contact_id: z.string().nullable(),
1153
- contact_email: z.string(),
1154
- pipeline_key: z.string(),
1155
- stage_key: z.string().nullable(),
1156
- state_key: z.string().nullable(),
1157
- activity_log: z.unknown(),
1158
- discovery_data: z.unknown().nullable(),
1159
- discovery_submitted_at: z.string().nullable(),
1160
- discovery_submitted_by: z.string().nullable(),
1161
- proposal_data: z.unknown().nullable(),
1162
- proposal_sent_at: z.string().nullable(),
1163
- proposal_pdf_url: z.string().nullable(),
1164
- signature_envelope_id: z.string().nullable(),
1165
- source_list_id: z.string().nullable(),
1166
- source_type: z.string().nullable(),
1167
- initial_fee: z.number().nullable(),
1168
- monthly_fee: z.number().nullable(),
1169
- closed_lost_at: z.string().nullable(),
1170
- closed_lost_reason: z.string().nullable(),
1267
+ /**
1268
+ * Deal list item with joined contact (and company via contact).
1269
+ * Matches DealListItem from @repo/core types.
1270
+ */
1271
+ export const DealListItemSchema = z.object({
1272
+ // acq_deals columns
1273
+ id: z.string(),
1274
+ organization_id: z.string(),
1275
+ contact_id: z.string().nullable(),
1276
+ contact_email: z.string(),
1277
+ pipeline_key: z.string(),
1278
+ stage_key: z.string().nullable(),
1279
+ state_key: z.string().nullable(),
1280
+ activity_log: z.unknown(),
1281
+ discovery_data: z.unknown().nullable(),
1282
+ discovery_submitted_at: z.string().nullable(),
1283
+ discovery_submitted_by: z.string().nullable(),
1284
+ proposal_data: z.unknown().nullable(),
1285
+ proposal_sent_at: z.string().nullable(),
1286
+ proposal_pdf_url: z.string().nullable(),
1287
+ signature_envelope_id: z.string().nullable(),
1288
+ source_list_id: z.string().nullable(),
1289
+ source_type: z.string().nullable(),
1290
+ initial_fee: z.number().nullable(),
1291
+ monthly_fee: z.number().nullable(),
1292
+ closed_lost_at: z.string().nullable(),
1293
+ closed_lost_reason: z.string().nullable(),
1171
1294
  created_at: z.string(),
1172
1295
  updated_at: z.string(),
1296
+ priority: DealPrioritySchema,
1297
+ ownership: z.enum(['us', 'them']).nullable(),
1298
+ nextAction: z.string().nullable(),
1173
1299
  // joined relation
1174
1300
  contact: DealContactSummarySchema.nullable()
1175
1301
  })
@@ -1178,38 +1304,40 @@ export const DealListItemSchema = z.object({
1178
1304
  ### `DealListResponseSchema`
1179
1305
 
1180
1306
  ```typescript
1181
- export const DealListResponseSchema = z.object({
1182
- data: z.array(DealListItemSchema),
1183
- total: z.number().int(),
1184
- limit: z.number().int(),
1185
- offset: z.number().int()
1307
+ export const DealListResponseSchema = z.object({
1308
+ data: z.array(DealListItemSchema),
1309
+ total: z.number().int(),
1310
+ limit: z.number().int(),
1311
+ offset: z.number().int()
1186
1312
  })
1187
1313
  ```
1188
1314
 
1189
1315
  ### `DealDetailResponseSchema`
1190
1316
 
1191
1317
  ```typescript
1192
- /**
1193
- * Deal detail shape — currently the same as a list item (full joined record).
1194
- * useDealDetail returns DealDetail which is typed as DealListItem.
1195
- */
1196
- export const DealDetailResponseSchema = DealListItemSchema
1318
+ /**
1319
+ * Deal detail shape — currently the same as a list item (full joined record).
1320
+ * Additive fields keep existing DealListItem callers compatible.
1321
+ */
1322
+ export const DealDetailResponseSchema = DealListItemSchema.extend({
1323
+ conversation: DealConversationSchema
1324
+ })
1197
1325
  ```
1198
1326
 
1199
1327
  ### `DealNoteResponseSchema`
1200
1328
 
1201
1329
  ```typescript
1202
- /**
1203
- * Single acq_deal_notes row (camelCase API representation).
1204
- */
1205
- export const DealNoteResponseSchema = z.object({
1206
- id: z.string(),
1207
- dealId: z.string(),
1208
- organizationId: z.string(),
1209
- authorUserId: z.string().nullable(),
1210
- body: z.string(),
1211
- createdAt: z.string(),
1212
- updatedAt: z.string()
1330
+ /**
1331
+ * Single acq_deal_notes row (camelCase API representation).
1332
+ */
1333
+ export const DealNoteResponseSchema = z.object({
1334
+ id: z.string(),
1335
+ dealId: z.string(),
1336
+ organizationId: z.string(),
1337
+ authorUserId: z.string().nullable(),
1338
+ body: z.string(),
1339
+ createdAt: z.string(),
1340
+ updatedAt: z.string()
1213
1341
  })
1214
1342
  ```
1215
1343
 
@@ -1222,24 +1350,24 @@ export const DealNoteListResponseSchema = z.array(DealNoteResponseSchema)
1222
1350
  ### `DealTaskResponseSchema`
1223
1351
 
1224
1352
  ```typescript
1225
- /**
1226
- * Single acq_deal_tasks row (camelCase API representation).
1227
- * Matches AcqDealTask domain type from types.ts.
1228
- */
1229
- export const DealTaskResponseSchema = z.object({
1230
- id: z.string(),
1231
- organizationId: z.string(),
1232
- dealId: z.string(),
1233
- title: z.string(),
1234
- description: z.string().nullable(),
1235
- kind: AcqDealTaskKindSchema,
1236
- dueAt: z.string().nullable(),
1237
- assigneeUserId: z.string().nullable(),
1238
- completedAt: z.string().nullable(),
1239
- completedByUserId: z.string().nullable(),
1240
- createdAt: z.string(),
1241
- updatedAt: z.string(),
1242
- createdByUserId: z.string().nullable()
1353
+ /**
1354
+ * Single acq_deal_tasks row (camelCase API representation).
1355
+ * Matches AcqDealTask domain type from types.ts.
1356
+ */
1357
+ export const DealTaskResponseSchema = z.object({
1358
+ id: z.string(),
1359
+ organizationId: z.string(),
1360
+ dealId: z.string(),
1361
+ title: z.string(),
1362
+ description: z.string().nullable(),
1363
+ kind: AcqDealTaskKindSchema,
1364
+ dueAt: z.string().nullable(),
1365
+ assigneeUserId: z.string().nullable(),
1366
+ completedAt: z.string().nullable(),
1367
+ completedByUserId: z.string().nullable(),
1368
+ createdAt: z.string(),
1369
+ updatedAt: z.string(),
1370
+ createdByUserId: z.string().nullable()
1243
1371
  })
1244
1372
  ```
1245
1373
 
@@ -1252,43 +1380,45 @@ export const DealTaskListResponseSchema = z.array(DealTaskResponseSchema)
1252
1380
  ### `DealSchemas`
1253
1381
 
1254
1382
  ```typescript
1255
- export const DealSchemas = {
1256
- // Params
1257
- DealIdParams: DealIdParamsSchema,
1258
- DealTaskIdParams: DealTaskIdParamsSchema,
1259
-
1260
- // Queries
1261
- ListDealsQuery: ListDealsQuerySchema,
1262
- DealLookupQuery: DealLookupQuerySchema,
1263
- ListDealTasksDueQuery: ListDealTasksDueQuerySchema,
1264
-
1265
- // Request bodies
1266
- CreateDealNoteRequest: CreateDealNoteRequestSchema,
1267
- CreateDealTaskRequest: CreateDealTaskRequestSchema,
1268
- TransitionItemRequest: TransitionItemRequestSchema,
1269
- TransitionDealStateRequest: TransitionDealStateRequestSchema,
1270
- ExecuteActionParams: ExecuteActionParamsSchema,
1271
- ExecuteActionRequest: ExecuteActionRequestSchema,
1272
-
1273
- // Responses
1274
- DealListResponse: DealListResponseSchema,
1275
- DealSummaryResponse: DealSummaryResponseSchema,
1276
- DealLookupResponse: DealLookupResponseSchema,
1277
- DealDetailResponse: DealDetailResponseSchema,
1278
- DealNoteResponse: DealNoteResponseSchema,
1279
- DealNoteListResponse: DealNoteListResponseSchema,
1280
- DealTaskResponse: DealTaskResponseSchema,
1281
- DealTaskListResponse: DealTaskListResponseSchema
1383
+ export const DealSchemas = {
1384
+ // Params
1385
+ DealIdParams: DealIdParamsSchema,
1386
+ DealTaskIdParams: DealTaskIdParamsSchema,
1387
+
1388
+ // Queries
1389
+ ListDealsQuery: ListDealsQuerySchema,
1390
+ DealLookupQuery: DealLookupQuerySchema,
1391
+ ListDealTasksDueQuery: ListDealTasksDueQuerySchema,
1392
+
1393
+ // Request bodies
1394
+ CreateDealNoteRequest: CreateDealNoteRequestSchema,
1395
+ CreateDealTaskRequest: CreateDealTaskRequestSchema,
1396
+ TransitionItemRequest: TransitionItemRequestSchema,
1397
+ TransitionDealStateRequest: TransitionDealStateRequestSchema,
1398
+ ExecuteActionParams: ExecuteActionParamsSchema,
1399
+ ExecuteActionRequest: ExecuteActionRequestSchema,
1400
+
1401
+ // Responses
1402
+ DealPriority: DealPrioritySchema,
1403
+ DealListResponse: DealListResponseSchema,
1404
+ DealSummaryResponse: DealSummaryResponseSchema,
1405
+ DealLookupResponse: DealLookupResponseSchema,
1406
+ ConversationMessage: ConversationMessageSchema,
1407
+ DealDetailResponse: DealDetailResponseSchema,
1408
+ DealNoteResponse: DealNoteResponseSchema,
1409
+ DealNoteListResponse: DealNoteListResponseSchema,
1410
+ DealTaskResponse: DealTaskResponseSchema,
1411
+ DealTaskListResponse: DealTaskListResponseSchema
1282
1412
  }
1283
1413
  ```
1284
1414
 
1285
1415
  ### `Action`
1286
1416
 
1287
1417
  ```typescript
1288
- export interface Action {
1289
- key: string
1290
- label: string
1291
- payloadSchema?: z.ZodTypeAny
1418
+ export interface Action {
1419
+ key: string
1420
+ label: string
1421
+ payloadSchema?: z.ZodTypeAny
1292
1422
  }
1293
1423
  ```
1294
1424
 
@@ -1307,83 +1437,84 @@ export interface ActionDef {
1307
1437
  ### `DEFAULT_CRM_ACTIONS`
1308
1438
 
1309
1439
  ```typescript
1310
- export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
1311
- {
1312
- key: 'move_to_proposal',
1313
- label: 'Move to Proposal',
1314
- isAvailableFor: (deal) => deal.stage_key === 'interested',
1315
- workflowId: 'move_to_proposal-workflow'
1316
- },
1317
- {
1318
- key: 'move_to_closing',
1319
- label: 'Move to Closing',
1320
- isAvailableFor: (deal) => deal.stage_key === 'proposal',
1321
- workflowId: 'move_to_closing-workflow'
1322
- },
1323
- {
1324
- key: 'move_to_closed_won',
1325
- label: 'Close Won',
1326
- isAvailableFor: (deal) => deal.stage_key === 'closing',
1327
- workflowId: 'move_to_closed_won-workflow'
1328
- },
1329
- {
1330
- key: 'move_to_closed_lost',
1331
- label: 'Close Lost',
1332
- isAvailableFor: (deal) =>
1333
- deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
1334
- workflowId: 'move_to_closed_lost-workflow'
1335
- },
1336
- {
1337
- key: 'move_to_nurturing',
1338
- label: 'Move to Nurturing',
1339
- isAvailableFor: (deal) =>
1340
- deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
1341
- workflowId: 'move_to_nurturing-workflow'
1342
- },
1343
- {
1440
+ export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
1441
+ {
1442
+ key: 'move_to_proposal',
1443
+ label: 'Move to Proposal',
1444
+ isAvailableFor: (deal) => deal.stage_key === 'interested',
1445
+ workflowId: 'move_to_proposal-workflow'
1446
+ },
1447
+ {
1448
+ key: 'move_to_closing',
1449
+ label: 'Move to Closing',
1450
+ isAvailableFor: (deal) => deal.stage_key === 'proposal',
1451
+ workflowId: 'move_to_closing-workflow'
1452
+ },
1453
+ {
1454
+ key: 'move_to_closed_won',
1455
+ label: 'Close Won',
1456
+ isAvailableFor: (deal) => deal.stage_key === 'closing',
1457
+ workflowId: 'move_to_closed_won-workflow'
1458
+ },
1459
+ {
1460
+ key: 'move_to_closed_lost',
1461
+ label: 'Close Lost',
1462
+ isAvailableFor: (deal) =>
1463
+ deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
1464
+ workflowId: 'move_to_closed_lost-workflow'
1465
+ },
1466
+ {
1467
+ key: 'move_to_nurturing',
1468
+ label: 'Move to Nurturing',
1469
+ isAvailableFor: (deal) =>
1470
+ deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
1471
+ workflowId: 'move_to_nurturing-workflow'
1472
+ },
1473
+ {
1344
1474
  key: 'send_reply',
1345
1475
  label: 'Send Reply',
1346
1476
  isAvailableFor: (deal) =>
1347
1477
  deal.stage_key === 'interested' &&
1478
+ isOurReplyAction(deal) &&
1348
1479
  (deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey ||
1349
1480
  deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
1350
1481
  deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
1351
- workflowId: 'crm-send-reply-workflow',
1352
- payloadSchema: SendReplyActionPayloadSchema
1353
- },
1354
- {
1355
- key: 'send_link',
1356
- label: 'Send Booking Link',
1357
- isAvailableFor: (deal) =>
1358
- deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey,
1359
- workflowId: 'crm-send-booking-link-workflow'
1360
- },
1361
- {
1362
- key: 'send_nudge',
1363
- label: 'Send Nudge',
1364
- isAvailableFor: (deal) =>
1365
- deal.stage_key === 'interested' &&
1366
- (deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
1367
- deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
1368
- workflowId: 'crm-send-nudge-workflow'
1369
- },
1370
- {
1371
- key: 'mark_no_show',
1372
- label: 'Mark No-Show',
1373
- isAvailableFor: (deal) =>
1374
- deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey,
1375
- // Mirrors the auto-timeout precedent in operations/sales/crm/pipeline/timeout-actions.ts:
1376
- // both manual-click and timeout move the deal to closed_lost. The action_taken activity
1377
- // event captures operator intent and distinguishes the manual variant from the timed one.
1378
- workflowId: 'mark_no_show-workflow'
1379
- },
1380
- {
1381
- key: 'rebook',
1382
- label: 'Rebook',
1383
- isAvailableFor: (deal) =>
1384
- deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_BOOKING_CANCELLED_STATE.stateKey,
1385
- workflowId: 'crm-rebook-workflow'
1386
- }
1482
+ workflowId: 'crm-send-reply-workflow',
1483
+ payloadSchema: SendReplyActionPayloadSchema
1484
+ },
1485
+ {
1486
+ key: 'send_link',
1487
+ label: 'Send Booking Link',
1488
+ isAvailableFor: (deal) =>
1489
+ deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey,
1490
+ workflowId: 'crm-send-booking-link-workflow'
1491
+ },
1492
+ {
1493
+ key: 'send_nudge',
1494
+ label: 'Send Nudge',
1495
+ isAvailableFor: (deal) =>
1496
+ deal.stage_key === 'interested' &&
1497
+ (deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
1498
+ deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
1499
+ workflowId: 'crm-send-nudge-workflow'
1500
+ },
1501
+ {
1502
+ key: 'mark_no_show',
1503
+ label: 'Mark No-Show',
1504
+ isAvailableFor: (deal) =>
1505
+ deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey,
1506
+ // Mirrors the auto-timeout precedent in operations/sales/crm/pipeline/timeout-actions.ts:
1507
+ // both manual-click and timeout move the deal to closed_lost. The action_taken activity
1508
+ // event captures operator intent and distinguishes the manual variant from the timed one.
1509
+ workflowId: 'mark_no_show-workflow'
1510
+ },
1511
+ {
1512
+ key: 'rebook',
1513
+ label: 'Rebook',
1514
+ isAvailableFor: (deal) =>
1515
+ deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_BOOKING_CANCELLED_STATE.stateKey,
1516
+ workflowId: 'crm-rebook-workflow'
1517
+ }
1387
1518
  ]
1388
1519
  ```
1389
1520
 
@@ -1558,7 +1689,7 @@ export interface AcqList {
1558
1689
  scrapingConfig: ScrapingConfig
1559
1690
  icp: IcpRubric
1560
1691
  pipelineConfig: PipelineConfig
1561
- metadata: Record<string, unknown>
1692
+ metadata: AcqListMetadata
1562
1693
  launchedAt: Date | null
1563
1694
  completedAt: Date | null
1564
1695
  createdAt: Date
@@ -1642,10 +1773,10 @@ export interface AcqContact {
1642
1773
 
1643
1774
  ```typescript
1644
1775
  /**
1645
- * Live-scan aggregate telemetry for a single list, computed on demand from
1646
- * the list junction tables and current contact deliverability state.
1647
- * `stageCounts` are attempted counts from list-row processing_state.
1648
- */
1776
+ * Live-scan aggregate telemetry for a single list, computed on demand from
1777
+ * the list junction tables and current contact deliverability state.
1778
+ * `stageCounts` are attempted counts from list-row processing_state.
1779
+ */
1649
1780
  export interface ListTelemetry {
1650
1781
  listId: string
1651
1782
  totalCompanies: number
@@ -1674,87 +1805,101 @@ export interface ListTelemetry {
1674
1805
  ### `ListStageCountsSchema`
1675
1806
 
1676
1807
  ```typescript
1677
- export const ListStageCountsSchema = z.object({
1678
- // Attempted counts by canonical lead-gen stage. The detailed status
1679
- // distribution lives on ListProgress; telemetry keeps the overview payload small.
1680
- stageCounts: z.object({
1681
- populated: z.number().int(),
1682
- extracted: z.number().int(),
1683
- qualified: z.number().int(),
1684
- discovered: z.number().int(),
1685
- verified: z.number().int(),
1686
- personalized: z.number().int(),
1687
- uploaded: z.number().int()
1688
- }),
1689
- deliverability: z.object({
1690
- valid: z.number().int(),
1691
- risky: z.number().int(),
1692
- invalid: z.number().int(),
1693
- unknown: z.number().int(),
1694
- bounced: z.number().int()
1695
- })
1808
+ export const ListStageCountsSchema = z.object({
1809
+ // Attempted counts by canonical lead-gen stage. The detailed status
1810
+ // distribution lives on ListProgress; telemetry keeps the overview payload small.
1811
+ stageCounts: z.object({
1812
+ populated: z.number().int(),
1813
+ extracted: z.number().int(),
1814
+ qualified: z.number().int(),
1815
+ discovered: z.number().int(),
1816
+ verified: z.number().int(),
1817
+ personalized: z.number().int(),
1818
+ uploaded: z.number().int()
1819
+ }),
1820
+ deliverability: z.object({
1821
+ valid: z.number().int(),
1822
+ risky: z.number().int(),
1823
+ invalid: z.number().int(),
1824
+ unknown: z.number().int(),
1825
+ bounced: z.number().int()
1826
+ })
1696
1827
  })
1697
1828
  ```
1698
1829
 
1699
1830
  ### `ListTelemetrySchema`
1700
1831
 
1701
1832
  ```typescript
1702
- export const ListTelemetrySchema = z.object({
1703
- listId: UuidSchema,
1704
- totalCompanies: z.number().int(),
1705
- totalContacts: z.number().int(),
1706
- stageCounts: ListStageCountsSchema.shape.stageCounts,
1707
- deliverability: ListStageCountsSchema.shape.deliverability,
1708
- activeWorkflows: z.array(z.string()).optional()
1833
+ export const ListTelemetrySchema = z.object({
1834
+ listId: UuidSchema,
1835
+ totalCompanies: z.number().int(),
1836
+ totalContacts: z.number().int(),
1837
+ stageCounts: ListStageCountsSchema.shape.stageCounts,
1838
+ deliverability: ListStageCountsSchema.shape.deliverability,
1839
+ activeWorkflows: z.array(z.string()).optional()
1709
1840
  })
1710
1841
  ```
1711
1842
 
1712
1843
  ### `ListIdParamsSchema`
1713
1844
 
1714
1845
  ```typescript
1715
- export const ListIdParamsSchema = z.object({
1716
- listId: UuidSchema
1846
+ export const ListIdParamsSchema = z.object({
1847
+ listId: UuidSchema
1717
1848
  })
1718
1849
  ```
1719
1850
 
1720
1851
  ### `CreateListRequestSchema`
1721
1852
 
1722
1853
  ```typescript
1723
- export const CreateListRequestSchema = z
1724
- .object({
1725
- name: z.string().trim().min(1).max(255),
1726
- description: z.string().trim().nullable().optional(),
1727
- status: ListStatusSchema.optional(),
1728
- scrapingConfig: ScrapingConfigSchema.optional(),
1729
- icp: IcpRubricSchema.optional(),
1730
- pipelineConfig: PipelineConfigSchema.optional()
1731
- })
1854
+ export const CreateListRequestSchema = z
1855
+ .object({
1856
+ name: z.string().trim().min(1).max(255),
1857
+ description: z.string().trim().nullable().optional(),
1858
+ status: ListStatusSchema.optional(),
1859
+ buildTemplateId: ProspectingBuildTemplateIdSchema.optional(),
1860
+ scrapingConfig: ScrapingConfigSchema.optional(),
1861
+ icp: IcpRubricSchema.optional(),
1862
+ pipelineConfig: PipelineConfigSchema.optional()
1863
+ })
1732
1864
  .strict()
1733
1865
  ```
1734
1866
 
1735
1867
  ### `UpdateListRequestSchema`
1736
1868
 
1737
1869
  ```typescript
1738
- export const UpdateListRequestSchema = z
1739
- .object({
1740
- name: z.string().trim().min(1).max(255).optional(),
1741
- description: z.string().trim().nullable().optional(),
1742
- batchIds: z.array(z.string()).optional()
1743
- })
1744
- .strict()
1745
- .refine((data) => data.name !== undefined || data.description !== undefined || data.batchIds !== undefined, {
1746
- message: 'At least one field (name, description, or batchIds) must be provided'
1870
+ export const UpdateListRequestSchema = z
1871
+ .object({
1872
+ name: z.string().trim().min(1).max(255).optional(),
1873
+ description: z.string().trim().nullable().optional(),
1874
+ batchIds: z.array(z.string()).optional(),
1875
+ buildTemplateId: ProspectingBuildTemplateIdSchema.optional(),
1876
+ confirmBuildTemplateChange: z.literal(true).optional()
1877
+ })
1878
+ .strict()
1879
+ .refine(
1880
+ (data) =>
1881
+ data.name !== undefined ||
1882
+ data.description !== undefined ||
1883
+ data.batchIds !== undefined ||
1884
+ data.buildTemplateId !== undefined,
1885
+ {
1886
+ message: 'At least one field (name, description, batchIds, or buildTemplateId) must be provided'
1887
+ }
1888
+ )
1889
+ .refine((data) => data.buildTemplateId === undefined || data.confirmBuildTemplateChange === true, {
1890
+ message: 'confirmBuildTemplateChange must be true when changing buildTemplateId',
1891
+ path: ['confirmBuildTemplateChange']
1747
1892
  })
1748
1893
  ```
1749
1894
 
1750
1895
  ### `UpdateListConfigRequestSchema`
1751
1896
 
1752
1897
  ```typescript
1753
- /**
1754
- * Partial patch for the three jsonb config columns. UI sends only the edited
1755
- * subtree; server writes the field as-is (no deep merge — each column is
1756
- * replaced atomically when present in the patch).
1757
- */
1898
+ /**
1899
+ * Partial patch for the three jsonb config columns. UI sends only the edited
1900
+ * subtree; server writes the field as-is (no deep merge — each column is
1901
+ * replaced atomically when present in the patch).
1902
+ */
1758
1903
  export const UpdateListConfigRequestSchema = z
1759
1904
  .object({
1760
1905
  scrapingConfig: ScrapingConfigSchema.partial().optional(),
@@ -1762,79 +1907,84 @@ export const UpdateListConfigRequestSchema = z
1762
1907
  pipelineConfig: PipelineConfigSchema.partial().optional()
1763
1908
  })
1764
1909
  .strict()
1765
- .refine((data) => data.scrapingConfig !== undefined || data.icp !== undefined || data.pipelineConfig !== undefined, {
1766
- message: 'At least one of scrapingConfig, icp, or pipelineConfig must be provided'
1767
- })
1910
+ .refine(
1911
+ (data) =>
1912
+ data.scrapingConfig !== undefined ||
1913
+ data.icp !== undefined ||
1914
+ data.pipelineConfig !== undefined,
1915
+ {
1916
+ message: 'At least one of scrapingConfig, icp, or pipelineConfig must be provided'
1917
+ }
1918
+ )
1768
1919
  ```
1769
1920
 
1770
1921
  ### `AddCompaniesToListRequestSchema`
1771
1922
 
1772
1923
  ```typescript
1773
- export const AddCompaniesToListRequestSchema = z
1774
- .object({
1775
- companyIds: z.array(UuidSchema).min(1).max(1000)
1776
- })
1924
+ export const AddCompaniesToListRequestSchema = z
1925
+ .object({
1926
+ companyIds: z.array(UuidSchema).min(1).max(1000)
1927
+ })
1777
1928
  .strict()
1778
1929
  ```
1779
1930
 
1780
1931
  ### `RemoveCompaniesFromListRequestSchema`
1781
1932
 
1782
1933
  ```typescript
1783
- export const RemoveCompaniesFromListRequestSchema = z
1784
- .object({
1785
- companyIds: z.array(UuidSchema).min(1).max(1000)
1786
- })
1934
+ export const RemoveCompaniesFromListRequestSchema = z
1935
+ .object({
1936
+ companyIds: z.array(UuidSchema).min(1).max(1000)
1937
+ })
1787
1938
  .strict()
1788
1939
  ```
1789
1940
 
1790
1941
  ### `AddContactsToListRequestSchema`
1791
1942
 
1792
1943
  ```typescript
1793
- export const AddContactsToListRequestSchema = z
1794
- .object({
1795
- contactIds: z.array(UuidSchema).min(1).max(1000)
1796
- })
1944
+ export const AddContactsToListRequestSchema = z
1945
+ .object({
1946
+ contactIds: z.array(UuidSchema).min(1).max(1000)
1947
+ })
1797
1948
  .strict()
1798
1949
  ```
1799
1950
 
1800
1951
  ### `RecordListExecutionRequestSchema`
1801
1952
 
1802
1953
  ```typescript
1803
- export const RecordListExecutionRequestSchema = z
1804
- .object({
1805
- executionId: UuidSchema,
1806
- configSnapshot: z.record(z.string(), z.unknown()).optional()
1807
- })
1954
+ export const RecordListExecutionRequestSchema = z
1955
+ .object({
1956
+ executionId: UuidSchema,
1957
+ configSnapshot: z.record(z.string(), z.unknown()).optional()
1958
+ })
1808
1959
  .strict()
1809
1960
  ```
1810
1961
 
1811
1962
  ### `AcqListResponseSchema`
1812
1963
 
1813
1964
  ```typescript
1814
- /**
1815
- * Single list as returned by /api/acquisition/lists/:id etc.
1816
- * Camel-cased domain shape matching AcqList in types.ts.
1817
- */
1818
- export const AcqListResponseSchema = z.object({
1819
- id: z.string(),
1820
- organizationId: z.string(),
1821
- name: z.string(),
1822
- description: z.string().nullable(),
1823
- type: z.string(),
1824
- batchIds: z.array(z.string()),
1825
- instantlyCampaignId: z.string().nullable(),
1826
- /** Lifecycle status (draft | enriching | launched | closing | archived). */
1827
- status: ListStatusSchema,
1828
- metadata: z.record(z.string(), z.unknown()),
1829
- launchedAt: z.string().nullable(),
1830
- completedAt: z.string().nullable(),
1831
- createdAt: z.string(),
1832
- /** Scraping criteria stored as jsonb on the row. */
1833
- scrapingConfig: ScrapingConfigSchema,
1834
- /** ICP / qualification rubric stored as jsonb on the row. */
1835
- icp: IcpRubricSchema,
1836
- /** Pipeline presentation contract stored as jsonb on the row. */
1837
- pipelineConfig: PipelineConfigSchema
1965
+ /**
1966
+ * Single list as returned by /api/acquisition/lists/:id etc.
1967
+ * Camel-cased domain shape matching AcqList in types.ts.
1968
+ */
1969
+ export const AcqListResponseSchema = z.object({
1970
+ id: z.string(),
1971
+ organizationId: z.string(),
1972
+ name: z.string(),
1973
+ description: z.string().nullable(),
1974
+ batchIds: z.array(z.string()),
1975
+ instantlyCampaignId: z.string().nullable(),
1976
+ /** Lifecycle status (draft | enriching | launched | closing | archived). */
1977
+ status: ListStatusSchema,
1978
+ metadata: AcqListMetadataSchema,
1979
+ launchedAt: z.string().nullable(),
1980
+ completedAt: z.string().nullable(),
1981
+ createdAt: z.string(),
1982
+ /** Scraping criteria stored as jsonb on the row. */
1983
+ scrapingConfig: ScrapingConfigSchema,
1984
+ /** ICP / qualification rubric stored as jsonb on the row. */
1985
+ icp: IcpRubricSchema,
1986
+ /** Pipeline presentation contract stored as jsonb on the row. */
1987
+ pipelineConfig: PipelineConfigSchema
1838
1988
  })
1839
1989
  ```
1840
1990
 
@@ -1859,17 +2009,18 @@ export const ListTelemetryListResponseSchema = z.array(ListTelemetrySchema)
1859
2009
  ### `ListExecutionSummarySchema`
1860
2010
 
1861
2011
  ```typescript
1862
- /**
1863
- * Row from acq_list_executions joined with the execution summary,
1864
- * shaped for the /lists/:id/executions response.
1865
- */
1866
- export const ListExecutionSummarySchema = z.object({
1867
- executionId: z.string(),
1868
- resourceId: z.string(),
2012
+ /**
2013
+ * Row from acq_list_executions joined with the execution summary,
2014
+ * shaped for the /lists/:id/executions response.
2015
+ */
2016
+ export const ListExecutionSummarySchema = z.object({
2017
+ executionId: z.string(),
2018
+ resourceId: z.string(),
1869
2019
  status: z.string(),
1870
2020
  createdAt: z.string(),
1871
2021
  completedAt: z.string().nullable(),
1872
- durationMs: z.number().int().nullable()
2022
+ durationMs: z.number().int().nullable(),
2023
+ input: z.unknown().nullable().optional()
1873
2024
  })
1874
2025
  ```
1875
2026
 
@@ -1900,282 +2051,282 @@ export const AcqEmailValidSchema = z.enum(['VALID', 'INVALID', 'RISKY', 'UNKNOWN
1900
2051
  ### `CompanyIdParamsSchema`
1901
2052
 
1902
2053
  ```typescript
1903
- export const CompanyIdParamsSchema = z.object({
1904
- companyId: UuidSchema
2054
+ export const CompanyIdParamsSchema = z.object({
2055
+ companyId: UuidSchema
1905
2056
  })
1906
2057
  ```
1907
2058
 
1908
2059
  ### `ContactIdParamsSchema`
1909
2060
 
1910
2061
  ```typescript
1911
- export const ContactIdParamsSchema = z.object({
1912
- contactId: UuidSchema
2062
+ export const ContactIdParamsSchema = z.object({
2063
+ contactId: UuidSchema
1913
2064
  })
1914
2065
  ```
1915
2066
 
1916
2067
  ### `ListCompaniesQuerySchema`
1917
2068
 
1918
2069
  ```typescript
1919
- export const ListCompaniesQuerySchema = z
1920
- .object({
1921
- search: z.string().trim().min(1).max(200).optional(),
1922
- listId: UuidSchema.optional(),
1923
- domain: z.string().trim().min(1).max(255).optional(),
1924
- website: z.string().trim().min(1).max(2048).optional(),
1925
- segment: z.string().trim().min(1).max(255).optional(),
1926
- category: z.string().trim().min(1).max(255).optional(),
1927
- batchId: z.string().trim().min(1).max(255).optional(),
1928
- status: AcqCompanyStatusSchema.optional(),
1929
- includeAll: QueryBooleanSchema.optional(),
1930
- limit: z.coerce.number().int().min(1).max(5000).default(50),
1931
- offset: z.coerce.number().int().min(0).default(0)
1932
- })
2070
+ export const ListCompaniesQuerySchema = z
2071
+ .object({
2072
+ search: z.string().trim().min(1).max(200).optional(),
2073
+ listId: UuidSchema.optional(),
2074
+ domain: z.string().trim().min(1).max(255).optional(),
2075
+ website: z.string().trim().min(1).max(2048).optional(),
2076
+ segment: z.string().trim().min(1).max(255).optional(),
2077
+ category: z.string().trim().min(1).max(255).optional(),
2078
+ batchId: z.string().trim().min(1).max(255).optional(),
2079
+ status: AcqCompanyStatusSchema.optional(),
2080
+ includeAll: QueryBooleanSchema.optional(),
2081
+ limit: z.coerce.number().int().min(1).max(5000).default(50),
2082
+ offset: z.coerce.number().int().min(0).default(0)
2083
+ })
1933
2084
  .strict()
1934
2085
  ```
1935
2086
 
1936
2087
  ### `ListContactsQuerySchema`
1937
2088
 
1938
2089
  ```typescript
1939
- export const ListContactsQuerySchema = z
1940
- .object({
1941
- search: z.string().trim().min(1).max(200).optional(),
1942
- listId: UuidSchema.optional(),
1943
- openingLineIsNull: QueryBooleanSchema.optional(),
1944
- batchId: z.string().trim().min(1).max(255).optional(),
1945
- contactStatus: AcqContactStatusSchema.optional(),
1946
- limit: z.coerce.number().int().min(1).max(5000).default(5000),
1947
- offset: z.coerce.number().int().min(0).default(0)
1948
- })
2090
+ export const ListContactsQuerySchema = z
2091
+ .object({
2092
+ search: z.string().trim().min(1).max(200).optional(),
2093
+ listId: UuidSchema.optional(),
2094
+ openingLineIsNull: QueryBooleanSchema.optional(),
2095
+ batchId: z.string().trim().min(1).max(255).optional(),
2096
+ contactStatus: AcqContactStatusSchema.optional(),
2097
+ limit: z.coerce.number().int().min(1).max(5000).default(5000),
2098
+ offset: z.coerce.number().int().min(0).default(0)
2099
+ })
1949
2100
  .strict()
1950
2101
  ```
1951
2102
 
1952
2103
  ### `CreateCompanyRequestSchema`
1953
2104
 
1954
2105
  ```typescript
1955
- export const CreateCompanyRequestSchema = z
1956
- .object({
1957
- name: z.string().trim().min(1).max(255),
1958
- domain: z.string().trim().min(1).max(255).optional(),
1959
- linkedinUrl: z.string().trim().url().optional(),
1960
- website: z.string().trim().url().optional(),
1961
- numEmployees: z.number().int().min(0).optional(),
1962
- foundedYear: z.number().int().optional(),
1963
- locationCity: z.string().trim().min(1).max(255).optional(),
1964
- locationState: z.string().trim().min(1).max(255).optional(),
1965
- category: z.string().trim().min(1).max(255).optional(),
1966
- source: z.string().trim().min(1).max(255).optional(),
1967
- batchId: z.string().trim().min(1).max(255).optional(),
1968
- verticalResearch: z.string().trim().min(1).max(5000).optional()
1969
- })
2106
+ export const CreateCompanyRequestSchema = z
2107
+ .object({
2108
+ name: z.string().trim().min(1).max(255),
2109
+ domain: z.string().trim().min(1).max(255).optional(),
2110
+ linkedinUrl: z.string().trim().url().optional(),
2111
+ website: z.string().trim().url().optional(),
2112
+ numEmployees: z.number().int().min(0).optional(),
2113
+ foundedYear: z.number().int().optional(),
2114
+ locationCity: z.string().trim().min(1).max(255).optional(),
2115
+ locationState: z.string().trim().min(1).max(255).optional(),
2116
+ category: z.string().trim().min(1).max(255).optional(),
2117
+ source: z.string().trim().min(1).max(255).optional(),
2118
+ batchId: z.string().trim().min(1).max(255).optional(),
2119
+ verticalResearch: z.string().trim().min(1).max(5000).optional()
2120
+ })
1970
2121
  .strict()
1971
2122
  ```
1972
2123
 
1973
2124
  ### `UpdateCompanyRequestSchema`
1974
2125
 
1975
2126
  ```typescript
1976
- export const UpdateCompanyRequestSchema = z
1977
- .object({
1978
- name: z.string().trim().min(1).max(255).optional(),
1979
- domain: z.string().trim().min(1).max(255).optional(),
1980
- linkedinUrl: z.string().trim().url().optional(),
1981
- website: z.string().trim().url().optional(),
1982
- numEmployees: z.number().int().min(0).optional(),
1983
- foundedYear: z.number().int().optional(),
1984
- locationCity: z.string().trim().min(1).max(255).optional(),
1985
- locationState: z.string().trim().min(1).max(255).optional(),
1986
- category: z.string().trim().min(1).max(255).optional(),
1987
- segment: z.string().trim().min(1).max(255).optional(),
1988
- pipelineStatus: z.record(z.string(), z.unknown()).optional(),
1989
- enrichmentData: z.record(z.string(), z.unknown()).optional(),
1990
- source: z.string().trim().min(1).max(255).optional(),
1991
- batchId: z.string().trim().min(1).max(255).optional(),
1992
- status: AcqCompanyStatusSchema.optional(),
1993
- verticalResearch: z.string().trim().min(1).max(5000).nullable().optional()
1994
- })
1995
- .strict()
1996
- .refine(
1997
- (data) =>
1998
- data.name !== undefined ||
1999
- data.domain !== undefined ||
2000
- data.linkedinUrl !== undefined ||
2001
- data.website !== undefined ||
2002
- data.numEmployees !== undefined ||
2003
- data.foundedYear !== undefined ||
2004
- data.locationCity !== undefined ||
2005
- data.locationState !== undefined ||
2006
- data.category !== undefined ||
2007
- data.segment !== undefined ||
2008
- data.pipelineStatus !== undefined ||
2009
- data.enrichmentData !== undefined ||
2010
- data.source !== undefined ||
2011
- data.batchId !== undefined ||
2012
- data.status !== undefined ||
2013
- data.verticalResearch !== undefined,
2014
- {
2015
- message: 'At least one field must be provided'
2016
- }
2127
+ export const UpdateCompanyRequestSchema = z
2128
+ .object({
2129
+ name: z.string().trim().min(1).max(255).optional(),
2130
+ domain: z.string().trim().min(1).max(255).optional(),
2131
+ linkedinUrl: z.string().trim().url().optional(),
2132
+ website: z.string().trim().url().optional(),
2133
+ numEmployees: z.number().int().min(0).optional(),
2134
+ foundedYear: z.number().int().optional(),
2135
+ locationCity: z.string().trim().min(1).max(255).optional(),
2136
+ locationState: z.string().trim().min(1).max(255).optional(),
2137
+ category: z.string().trim().min(1).max(255).optional(),
2138
+ segment: z.string().trim().min(1).max(255).optional(),
2139
+ pipelineStatus: z.record(z.string(), z.unknown()).optional(),
2140
+ enrichmentData: z.record(z.string(), z.unknown()).optional(),
2141
+ source: z.string().trim().min(1).max(255).optional(),
2142
+ batchId: z.string().trim().min(1).max(255).optional(),
2143
+ status: AcqCompanyStatusSchema.optional(),
2144
+ verticalResearch: z.string().trim().min(1).max(5000).nullable().optional()
2145
+ })
2146
+ .strict()
2147
+ .refine(
2148
+ (data) =>
2149
+ data.name !== undefined ||
2150
+ data.domain !== undefined ||
2151
+ data.linkedinUrl !== undefined ||
2152
+ data.website !== undefined ||
2153
+ data.numEmployees !== undefined ||
2154
+ data.foundedYear !== undefined ||
2155
+ data.locationCity !== undefined ||
2156
+ data.locationState !== undefined ||
2157
+ data.category !== undefined ||
2158
+ data.segment !== undefined ||
2159
+ data.pipelineStatus !== undefined ||
2160
+ data.enrichmentData !== undefined ||
2161
+ data.source !== undefined ||
2162
+ data.batchId !== undefined ||
2163
+ data.status !== undefined ||
2164
+ data.verticalResearch !== undefined,
2165
+ {
2166
+ message: 'At least one field must be provided'
2167
+ }
2017
2168
  )
2018
2169
  ```
2019
2170
 
2020
2171
  ### `CreateContactRequestSchema`
2021
2172
 
2022
2173
  ```typescript
2023
- export const CreateContactRequestSchema = z
2024
- .object({
2025
- email: z.string().trim().email(),
2026
- companyId: UuidSchema.optional(),
2027
- firstName: z.string().trim().min(1).max(255).optional(),
2028
- lastName: z.string().trim().min(1).max(255).optional(),
2029
- linkedinUrl: z.string().trim().url().optional(),
2030
- title: z.string().trim().min(1).max(255).optional(),
2031
- source: z.string().trim().min(1).max(255).optional(),
2032
- sourceId: z.string().trim().min(1).max(255).optional(),
2033
- batchId: z.string().trim().min(1).max(255).optional()
2034
- })
2174
+ export const CreateContactRequestSchema = z
2175
+ .object({
2176
+ email: z.string().trim().email(),
2177
+ companyId: UuidSchema.optional(),
2178
+ firstName: z.string().trim().min(1).max(255).optional(),
2179
+ lastName: z.string().trim().min(1).max(255).optional(),
2180
+ linkedinUrl: z.string().trim().url().optional(),
2181
+ title: z.string().trim().min(1).max(255).optional(),
2182
+ source: z.string().trim().min(1).max(255).optional(),
2183
+ sourceId: z.string().trim().min(1).max(255).optional(),
2184
+ batchId: z.string().trim().min(1).max(255).optional()
2185
+ })
2035
2186
  .strict()
2036
2187
  ```
2037
2188
 
2038
2189
  ### `UpdateContactRequestSchema`
2039
2190
 
2040
2191
  ```typescript
2041
- export const UpdateContactRequestSchema = z
2042
- .object({
2043
- companyId: UuidSchema.optional(),
2044
- emailValid: AcqEmailValidSchema.optional(),
2045
- firstName: z.string().trim().min(1).max(255).optional(),
2046
- lastName: z.string().trim().min(1).max(255).optional(),
2047
- linkedinUrl: z.string().trim().url().optional(),
2048
- title: z.string().trim().min(1).max(255).optional(),
2049
- headline: z.string().trim().min(1).max(5000).optional(),
2050
- filterReason: z.string().trim().min(1).max(5000).optional(),
2051
- openingLine: z.string().trim().min(1).max(5000).optional(),
2052
- pipelineStatus: z.record(z.string(), z.unknown()).optional(),
2053
- enrichmentData: z.record(z.string(), z.unknown()).optional(),
2054
- status: AcqContactStatusSchema.optional()
2055
- })
2056
- .strict()
2057
- .refine(
2058
- (data) =>
2059
- data.companyId !== undefined ||
2060
- data.emailValid !== undefined ||
2061
- data.firstName !== undefined ||
2062
- data.lastName !== undefined ||
2063
- data.linkedinUrl !== undefined ||
2064
- data.title !== undefined ||
2065
- data.headline !== undefined ||
2066
- data.filterReason !== undefined ||
2067
- data.openingLine !== undefined ||
2068
- data.pipelineStatus !== undefined ||
2069
- data.enrichmentData !== undefined ||
2070
- data.status !== undefined,
2071
- {
2072
- message: 'At least one field must be provided'
2073
- }
2192
+ export const UpdateContactRequestSchema = z
2193
+ .object({
2194
+ companyId: UuidSchema.optional(),
2195
+ emailValid: AcqEmailValidSchema.optional(),
2196
+ firstName: z.string().trim().min(1).max(255).optional(),
2197
+ lastName: z.string().trim().min(1).max(255).optional(),
2198
+ linkedinUrl: z.string().trim().url().optional(),
2199
+ title: z.string().trim().min(1).max(255).optional(),
2200
+ headline: z.string().trim().min(1).max(5000).optional(),
2201
+ filterReason: z.string().trim().min(1).max(5000).optional(),
2202
+ openingLine: z.string().trim().min(1).max(5000).optional(),
2203
+ pipelineStatus: z.record(z.string(), z.unknown()).optional(),
2204
+ enrichmentData: z.record(z.string(), z.unknown()).optional(),
2205
+ status: AcqContactStatusSchema.optional()
2206
+ })
2207
+ .strict()
2208
+ .refine(
2209
+ (data) =>
2210
+ data.companyId !== undefined ||
2211
+ data.emailValid !== undefined ||
2212
+ data.firstName !== undefined ||
2213
+ data.lastName !== undefined ||
2214
+ data.linkedinUrl !== undefined ||
2215
+ data.title !== undefined ||
2216
+ data.headline !== undefined ||
2217
+ data.filterReason !== undefined ||
2218
+ data.openingLine !== undefined ||
2219
+ data.pipelineStatus !== undefined ||
2220
+ data.enrichmentData !== undefined ||
2221
+ data.status !== undefined,
2222
+ {
2223
+ message: 'At least one field must be provided'
2224
+ }
2074
2225
  )
2075
2226
  ```
2076
2227
 
2077
2228
  ### `AcqCompanyResponseSchema`
2078
2229
 
2079
2230
  ```typescript
2080
- export const AcqCompanyResponseSchema = z.object({
2081
- id: z.string(),
2082
- organizationId: z.string(),
2083
- name: z.string(),
2084
- domain: z.string().nullable(),
2085
- linkedinUrl: z.string().nullable(),
2086
- website: z.string().nullable(),
2087
- numEmployees: z.number().nullable(),
2088
- foundedYear: z.number().nullable(),
2089
- locationCity: z.string().nullable(),
2090
- locationState: z.string().nullable(),
2091
- category: z.string().nullable(),
2092
- categoryPain: z.string().nullable(),
2093
- segment: z.string().nullable(),
2094
- pipelineStatus: z.record(z.string(), z.unknown()).nullable(),
2095
- enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2096
- source: z.string().nullable(),
2097
- batchId: z.string().nullable(),
2098
- status: AcqCompanyStatusSchema,
2099
- contactCount: z.number().int().min(0),
2100
- verticalResearch: z.string().nullable(),
2101
- createdAt: z.string(),
2102
- updatedAt: z.string()
2231
+ export const AcqCompanyResponseSchema = z.object({
2232
+ id: z.string(),
2233
+ organizationId: z.string(),
2234
+ name: z.string(),
2235
+ domain: z.string().nullable(),
2236
+ linkedinUrl: z.string().nullable(),
2237
+ website: z.string().nullable(),
2238
+ numEmployees: z.number().nullable(),
2239
+ foundedYear: z.number().nullable(),
2240
+ locationCity: z.string().nullable(),
2241
+ locationState: z.string().nullable(),
2242
+ category: z.string().nullable(),
2243
+ categoryPain: z.string().nullable(),
2244
+ segment: z.string().nullable(),
2245
+ pipelineStatus: z.record(z.string(), z.unknown()).nullable(),
2246
+ enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2247
+ source: z.string().nullable(),
2248
+ batchId: z.string().nullable(),
2249
+ status: AcqCompanyStatusSchema,
2250
+ contactCount: z.number().int().min(0),
2251
+ verticalResearch: z.string().nullable(),
2252
+ createdAt: z.string(),
2253
+ updatedAt: z.string()
2103
2254
  })
2104
2255
  ```
2105
2256
 
2106
2257
  ### `AcqCompanyListResponseSchema`
2107
2258
 
2108
2259
  ```typescript
2109
- export const AcqCompanyListResponseSchema = z.object({
2110
- data: z.array(AcqCompanyResponseSchema),
2111
- total: z.number().int(),
2112
- limit: z.number().int(),
2113
- offset: z.number().int()
2260
+ export const AcqCompanyListResponseSchema = z.object({
2261
+ data: z.array(AcqCompanyResponseSchema),
2262
+ total: z.number().int(),
2263
+ limit: z.number().int(),
2264
+ offset: z.number().int()
2114
2265
  })
2115
2266
  ```
2116
2267
 
2117
2268
  ### `AcqCompanyFacetsResponseSchema`
2118
2269
 
2119
2270
  ```typescript
2120
- export const AcqCompanyFacetsResponseSchema = z.object({
2121
- segments: z.array(z.string()),
2122
- categories: z.array(z.string()),
2123
- statuses: z.array(AcqCompanyStatusSchema)
2271
+ export const AcqCompanyFacetsResponseSchema = z.object({
2272
+ segments: z.array(z.string()),
2273
+ categories: z.array(z.string()),
2274
+ statuses: z.array(AcqCompanyStatusSchema)
2124
2275
  })
2125
2276
  ```
2126
2277
 
2127
2278
  ### `AcqContactCompanySummarySchema`
2128
2279
 
2129
2280
  ```typescript
2130
- export const AcqContactCompanySummarySchema = z.object({
2131
- id: z.string(),
2132
- name: z.string(),
2133
- domain: z.string().nullable(),
2134
- website: z.string().nullable(),
2135
- linkedinUrl: z.string().nullable(),
2136
- segment: z.string().nullable(),
2137
- category: z.string().nullable(),
2138
- status: AcqCompanyStatusSchema
2281
+ export const AcqContactCompanySummarySchema = z.object({
2282
+ id: z.string(),
2283
+ name: z.string(),
2284
+ domain: z.string().nullable(),
2285
+ website: z.string().nullable(),
2286
+ linkedinUrl: z.string().nullable(),
2287
+ segment: z.string().nullable(),
2288
+ category: z.string().nullable(),
2289
+ status: AcqCompanyStatusSchema
2139
2290
  })
2140
2291
  ```
2141
2292
 
2142
2293
  ### `AcqContactResponseSchema`
2143
2294
 
2144
2295
  ```typescript
2145
- export const AcqContactResponseSchema = z.object({
2146
- id: z.string(),
2147
- organizationId: z.string(),
2148
- companyId: z.string().nullable(),
2149
- email: z.string(),
2150
- emailValid: AcqEmailValidSchema.nullable(),
2151
- firstName: z.string().nullable(),
2152
- lastName: z.string().nullable(),
2153
- linkedinUrl: z.string().nullable(),
2154
- title: z.string().nullable(),
2155
- headline: z.string().nullable(),
2156
- filterReason: z.string().nullable(),
2157
- openingLine: z.string().nullable(),
2158
- source: z.string().nullable(),
2159
- sourceId: z.string().nullable(),
2160
- pipelineStatus: z.record(z.string(), z.unknown()).nullable(),
2161
- enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2162
- attioPersonId: z.string().nullable(),
2163
- batchId: z.string().nullable(),
2164
- status: AcqContactStatusSchema,
2165
- company: AcqContactCompanySummarySchema.nullable().optional(),
2166
- createdAt: z.string(),
2167
- updatedAt: z.string()
2296
+ export const AcqContactResponseSchema = z.object({
2297
+ id: z.string(),
2298
+ organizationId: z.string(),
2299
+ companyId: z.string().nullable(),
2300
+ email: z.string(),
2301
+ emailValid: AcqEmailValidSchema.nullable(),
2302
+ firstName: z.string().nullable(),
2303
+ lastName: z.string().nullable(),
2304
+ linkedinUrl: z.string().nullable(),
2305
+ title: z.string().nullable(),
2306
+ headline: z.string().nullable(),
2307
+ filterReason: z.string().nullable(),
2308
+ openingLine: z.string().nullable(),
2309
+ source: z.string().nullable(),
2310
+ sourceId: z.string().nullable(),
2311
+ pipelineStatus: z.record(z.string(), z.unknown()).nullable(),
2312
+ enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2313
+ attioPersonId: z.string().nullable(),
2314
+ batchId: z.string().nullable(),
2315
+ status: AcqContactStatusSchema,
2316
+ company: AcqContactCompanySummarySchema.nullable().optional(),
2317
+ createdAt: z.string(),
2318
+ updatedAt: z.string()
2168
2319
  })
2169
2320
  ```
2170
2321
 
2171
2322
  ### `AcqContactListResponseSchema`
2172
2323
 
2173
2324
  ```typescript
2174
- export const AcqContactListResponseSchema = z.object({
2175
- data: z.array(AcqContactResponseSchema),
2176
- total: z.number().int(),
2177
- limit: z.number().int(),
2178
- offset: z.number().int()
2325
+ export const AcqContactListResponseSchema = z.object({
2326
+ data: z.array(AcqContactResponseSchema),
2327
+ total: z.number().int(),
2328
+ limit: z.number().int(),
2329
+ offset: z.number().int()
2179
2330
  })
2180
2331
  ```
2181
2332
 
@@ -2188,223 +2339,226 @@ export const AcqArtifactOwnerKindSchema = z.enum(['company', 'contact', 'deal',
2188
2339
  ### `ListArtifactsQuerySchema`
2189
2340
 
2190
2341
  ```typescript
2191
- export const ListArtifactsQuerySchema = z
2192
- .object({
2193
- ownerKind: AcqArtifactOwnerKindSchema,
2194
- ownerId: UuidSchema
2195
- })
2342
+ export const ListArtifactsQuerySchema = z
2343
+ .object({
2344
+ ownerKind: AcqArtifactOwnerKindSchema,
2345
+ ownerId: UuidSchema
2346
+ })
2196
2347
  .strict()
2197
2348
  ```
2198
2349
 
2199
2350
  ### `CreateArtifactRequestSchema`
2200
2351
 
2201
2352
  ```typescript
2202
- export const CreateArtifactRequestSchema = z
2203
- .object({
2204
- ownerKind: AcqArtifactOwnerKindSchema,
2205
- ownerId: UuidSchema,
2206
- kind: z.string().trim().min(1).max(255),
2207
- content: z.record(z.string(), z.unknown()),
2208
- sourceExecutionId: UuidSchema.optional()
2209
- })
2353
+ export const CreateArtifactRequestSchema = z
2354
+ .object({
2355
+ ownerKind: AcqArtifactOwnerKindSchema,
2356
+ ownerId: UuidSchema,
2357
+ kind: z.string().trim().min(1).max(255),
2358
+ content: z.record(z.string(), z.unknown()),
2359
+ sourceExecutionId: UuidSchema.optional()
2360
+ })
2210
2361
  .strict()
2211
2362
  ```
2212
2363
 
2213
2364
  ### `AcqArtifactResponseSchema`
2214
2365
 
2215
2366
  ```typescript
2216
- export const AcqArtifactResponseSchema = z.object({
2217
- id: z.string(),
2218
- organizationId: z.string(),
2219
- ownerKind: z.string(),
2220
- ownerId: z.string(),
2221
- kind: z.string(),
2222
- content: z.record(z.string(), z.unknown()),
2223
- sourceExecutionId: z.string().nullable(),
2224
- createdBy: z.string().nullable(),
2225
- createdAt: z.string(),
2226
- version: z.number().int()
2367
+ export const AcqArtifactResponseSchema = z.object({
2368
+ id: z.string(),
2369
+ organizationId: z.string(),
2370
+ ownerKind: z.string(),
2371
+ ownerId: z.string(),
2372
+ kind: z.string(),
2373
+ content: z.record(z.string(), z.unknown()),
2374
+ sourceExecutionId: z.string().nullable(),
2375
+ createdBy: z.string().nullable(),
2376
+ createdAt: z.string(),
2377
+ version: z.number().int()
2227
2378
  })
2228
2379
  ```
2229
2380
 
2230
2381
  ### `AcqArtifactListResponseSchema`
2231
2382
 
2232
2383
  ```typescript
2233
- export const AcqArtifactListResponseSchema = z.object({
2234
- artifacts: z.array(AcqArtifactResponseSchema)
2384
+ export const AcqArtifactListResponseSchema = z.object({
2385
+ artifacts: z.array(AcqArtifactResponseSchema)
2235
2386
  })
2236
2387
  ```
2237
2388
 
2238
2389
  ### `ListMembersQuerySchema`
2239
2390
 
2240
2391
  ```typescript
2241
- export const ListMembersQuerySchema = z
2242
- .object({
2243
- limit: z.coerce.number().int().min(1).max(500).default(50),
2244
- offset: z.coerce.number().int().min(0).default(0)
2245
- })
2392
+ export const ListMembersQuerySchema = z
2393
+ .object({
2394
+ limit: z.coerce.number().int().min(1).max(500).default(50),
2395
+ offset: z.coerce.number().int().min(0).default(0)
2396
+ })
2246
2397
  .strict()
2247
2398
  ```
2248
2399
 
2249
2400
  ### `MemberIdParamsSchema`
2250
2401
 
2251
2402
  ```typescript
2252
- export const MemberIdParamsSchema = z.object({
2253
- memberId: UuidSchema
2403
+ export const MemberIdParamsSchema = z.object({
2404
+ memberId: UuidSchema
2254
2405
  })
2255
2406
  ```
2256
2407
 
2257
2408
  ### `AcqListMemberContactSummarySchema`
2258
2409
 
2259
2410
  ```typescript
2260
- export const AcqListMemberContactSummarySchema = z.object({
2261
- id: z.string(),
2262
- email: z.string(),
2263
- firstName: z.string().nullable(),
2264
- lastName: z.string().nullable(),
2265
- title: z.string().nullable(),
2266
- linkedinUrl: z.string().nullable(),
2267
- companyId: z.string().nullable()
2411
+ export const AcqListMemberContactSummarySchema = z.object({
2412
+ id: z.string(),
2413
+ email: z.string(),
2414
+ firstName: z.string().nullable(),
2415
+ lastName: z.string().nullable(),
2416
+ title: z.string().nullable(),
2417
+ linkedinUrl: z.string().nullable(),
2418
+ companyId: z.string().nullable()
2268
2419
  })
2269
2420
  ```
2270
2421
 
2271
2422
  ### `AcqListMemberResponseSchema`
2272
2423
 
2273
2424
  ```typescript
2274
- export const AcqListMemberResponseSchema = z.object({
2275
- id: z.string(),
2276
- listId: z.string(),
2277
- contactId: z.string(),
2278
- pipelineKey: z.string(),
2279
- stageKey: z.string(),
2280
- stateKey: z.string(),
2281
- activityLog: z.unknown(),
2282
- addedAt: z.string(),
2283
- addedBy: z.string().nullable(),
2284
- sourceExecutionId: z.string().nullable(),
2285
- contact: AcqListMemberContactSummarySchema.nullable()
2425
+ export const AcqListMemberResponseSchema = z.object({
2426
+ id: z.string(),
2427
+ listId: z.string(),
2428
+ contactId: z.string(),
2429
+ pipelineKey: z.string(),
2430
+ stageKey: z.string(),
2431
+ stateKey: z.string(),
2432
+ activityLog: z.unknown(),
2433
+ addedAt: z.string(),
2434
+ addedBy: z.string().nullable(),
2435
+ sourceExecutionId: z.string().nullable(),
2436
+ contact: AcqListMemberContactSummarySchema.nullable()
2286
2437
  })
2287
2438
  ```
2288
2439
 
2289
2440
  ### `AcqListMembersResponseSchema`
2290
2441
 
2291
2442
  ```typescript
2292
- export const AcqListMembersResponseSchema = z.object({
2293
- members: z.array(AcqListMemberResponseSchema)
2443
+ export const AcqListMembersResponseSchema = z.object({
2444
+ members: z.array(AcqListMemberResponseSchema)
2294
2445
  })
2295
2446
  ```
2296
2447
 
2297
2448
  ### `ListCompanyIdParamsSchema`
2298
2449
 
2299
2450
  ```typescript
2300
- export const ListCompanyIdParamsSchema = z.object({
2301
- listCompanyId: UuidSchema
2451
+ export const ListCompanyIdParamsSchema = z.object({
2452
+ listCompanyId: UuidSchema
2302
2453
  })
2303
2454
  ```
2304
2455
 
2305
2456
  ### `AcqListCompanyResponseSchema`
2306
2457
 
2307
2458
  ```typescript
2308
- export const AcqListCompanyResponseSchema = z.object({
2309
- id: z.string(),
2310
- listId: z.string(),
2311
- companyId: z.string(),
2312
- pipelineKey: z.string(),
2313
- stageKey: z.string(),
2314
- stateKey: z.string(),
2315
- activityLog: z.unknown(),
2316
- addedAt: z.string(),
2317
- addedBy: z.string().nullable(),
2318
- sourceExecutionId: z.string().nullable()
2459
+ export const AcqListCompanyResponseSchema = z.object({
2460
+ id: z.string(),
2461
+ listId: z.string(),
2462
+ companyId: z.string(),
2463
+ pipelineKey: z.string(),
2464
+ stageKey: z.string(),
2465
+ stateKey: z.string(),
2466
+ activityLog: z.unknown(),
2467
+ addedAt: z.string(),
2468
+ addedBy: z.string().nullable(),
2469
+ sourceExecutionId: z.string().nullable()
2319
2470
  })
2320
2471
  ```
2321
2472
 
2322
2473
  ### `AcqCompanySchemas`
2323
2474
 
2324
2475
  ```typescript
2325
- export const AcqCompanySchemas = {
2326
- CompanyIdParams: CompanyIdParamsSchema,
2327
- ListCompaniesQuery: ListCompaniesQuerySchema,
2328
- CreateCompanyRequest: CreateCompanyRequestSchema,
2329
- UpdateCompanyRequest: UpdateCompanyRequestSchema,
2330
- AcqCompanyResponse: AcqCompanyResponseSchema,
2331
- AcqCompanyListResponse: AcqCompanyListResponseSchema,
2332
- AcqCompanyFacetsResponse: AcqCompanyFacetsResponseSchema
2476
+ export const AcqCompanySchemas = {
2477
+ CompanyIdParams: CompanyIdParamsSchema,
2478
+ ListCompaniesQuery: ListCompaniesQuerySchema,
2479
+ CreateCompanyRequest: CreateCompanyRequestSchema,
2480
+ UpdateCompanyRequest: UpdateCompanyRequestSchema,
2481
+ AcqCompanyResponse: AcqCompanyResponseSchema,
2482
+ AcqCompanyListResponse: AcqCompanyListResponseSchema,
2483
+ AcqCompanyFacetsResponse: AcqCompanyFacetsResponseSchema
2333
2484
  }
2334
2485
  ```
2335
2486
 
2336
2487
  ### `AcqContactSchemas`
2337
2488
 
2338
2489
  ```typescript
2339
- export const AcqContactSchemas = {
2340
- ContactIdParams: ContactIdParamsSchema,
2341
- ListContactsQuery: ListContactsQuerySchema,
2342
- CreateContactRequest: CreateContactRequestSchema,
2343
- UpdateContactRequest: UpdateContactRequestSchema,
2344
- AcqContactResponse: AcqContactResponseSchema,
2345
- AcqContactListResponse: AcqContactListResponseSchema
2490
+ export const AcqContactSchemas = {
2491
+ ContactIdParams: ContactIdParamsSchema,
2492
+ ListContactsQuery: ListContactsQuerySchema,
2493
+ CreateContactRequest: CreateContactRequestSchema,
2494
+ UpdateContactRequest: UpdateContactRequestSchema,
2495
+ AcqContactResponse: AcqContactResponseSchema,
2496
+ AcqContactListResponse: AcqContactListResponseSchema
2346
2497
  }
2347
2498
  ```
2348
2499
 
2349
2500
  ### `AcqListSchemas`
2350
2501
 
2351
2502
  ```typescript
2352
- export const AcqListSchemas = {
2353
- // Params
2354
- ListIdParams: ListIdParamsSchema,
2355
-
2356
- // Primitives (for UI / tests)
2357
- ListStatus: ListStatusSchema,
2358
- ScrapingConfig: ScrapingConfigSchema,
2359
- IcpRubric: IcpRubricSchema,
2360
- PipelineConfig: PipelineConfigSchema,
2361
- PipelineStage: PipelineStageSchema,
2362
- ProcessingStageStatus: ProcessingStageStatusSchema,
2363
- ListStageCounts: ListStageCountsSchema,
2364
- ListTelemetry: ListTelemetrySchema,
2365
-
2366
- // Requests
2367
- CreateListRequest: CreateListRequestSchema,
2368
- UpdateListRequest: UpdateListRequestSchema,
2369
- UpdateListStatusRequest: UpdateListStatusRequestSchema,
2370
- UpdateListConfigRequest: UpdateListConfigRequestSchema,
2371
- AddCompaniesToListRequest: AddCompaniesToListRequestSchema,
2372
- RemoveCompaniesFromListRequest: RemoveCompaniesFromListRequestSchema,
2373
- AddContactsToListRequest: AddContactsToListRequestSchema,
2374
- RecordListExecutionRequest: RecordListExecutionRequestSchema,
2375
-
2376
- // Responses
2377
- AcqListResponse: AcqListResponseSchema,
2378
- AcqListListResponse: AcqListListResponseSchema,
2379
- ListTelemetryResponse: ListTelemetryResponseSchema,
2380
- ListTelemetryListResponse: ListTelemetryListResponseSchema,
2381
- ListExecutionsResponse: ListExecutionsResponseSchema,
2382
- ListProgressResponse: ListProgressResponseSchema
2503
+ export const AcqListSchemas = {
2504
+ // Params
2505
+ ListIdParams: ListIdParamsSchema,
2506
+
2507
+ // Primitives (for UI / tests)
2508
+ ListStatus: ListStatusSchema,
2509
+ ScrapingConfig: ScrapingConfigSchema,
2510
+ IcpRubric: IcpRubricSchema,
2511
+ PipelineConfig: PipelineConfigSchema,
2512
+ PipelineStage: PipelineStageSchema,
2513
+ BuildPlanSnapshot: BuildPlanSnapshotSchema,
2514
+ BuildPlanSnapshotStep: BuildPlanSnapshotStepSchema,
2515
+ AcqListMetadata: AcqListMetadataSchema,
2516
+ ProcessingStageStatus: ProcessingStageStatusSchema,
2517
+ ListStageCounts: ListStageCountsSchema,
2518
+ ListTelemetry: ListTelemetrySchema,
2519
+
2520
+ // Requests
2521
+ CreateListRequest: CreateListRequestSchema,
2522
+ UpdateListRequest: UpdateListRequestSchema,
2523
+ UpdateListStatusRequest: UpdateListStatusRequestSchema,
2524
+ UpdateListConfigRequest: UpdateListConfigRequestSchema,
2525
+ AddCompaniesToListRequest: AddCompaniesToListRequestSchema,
2526
+ RemoveCompaniesFromListRequest: RemoveCompaniesFromListRequestSchema,
2527
+ AddContactsToListRequest: AddContactsToListRequestSchema,
2528
+ RecordListExecutionRequest: RecordListExecutionRequestSchema,
2529
+
2530
+ // Responses
2531
+ AcqListResponse: AcqListResponseSchema,
2532
+ AcqListListResponse: AcqListListResponseSchema,
2533
+ ListTelemetryResponse: ListTelemetryResponseSchema,
2534
+ ListTelemetryListResponse: ListTelemetryListResponseSchema,
2535
+ ListExecutionsResponse: ListExecutionsResponseSchema,
2536
+ ListProgressResponse: ListProgressResponseSchema
2383
2537
  }
2384
2538
  ```
2385
2539
 
2386
2540
  ### `AcqSubstrateSchemas`
2387
2541
 
2388
2542
  ```typescript
2389
- export const AcqSubstrateSchemas = {
2390
- // Artifacts
2391
- ListArtifactsQuery: ListArtifactsQuerySchema,
2392
- CreateArtifactRequest: CreateArtifactRequestSchema,
2393
- AcqArtifactResponse: AcqArtifactResponseSchema,
2394
- AcqArtifactListResponse: AcqArtifactListResponseSchema,
2395
-
2396
- // List members
2397
- ListMembersQuery: ListMembersQuerySchema,
2398
- MemberIdParams: MemberIdParamsSchema,
2399
- AcqListMemberResponse: AcqListMemberResponseSchema,
2400
- AcqListMembersResponse: AcqListMembersResponseSchema,
2401
-
2402
- // List companies
2403
- ListCompanyIdParams: ListCompanyIdParamsSchema,
2404
- AcqListCompanyResponse: AcqListCompanyResponseSchema,
2405
-
2406
- // Transition (shared with deals — TransitionItemRequestSchema)
2407
- TransitionItemRequest: TransitionItemRequestSchema
2543
+ export const AcqSubstrateSchemas = {
2544
+ // Artifacts
2545
+ ListArtifactsQuery: ListArtifactsQuerySchema,
2546
+ CreateArtifactRequest: CreateArtifactRequestSchema,
2547
+ AcqArtifactResponse: AcqArtifactResponseSchema,
2548
+ AcqArtifactListResponse: AcqArtifactListResponseSchema,
2549
+
2550
+ // List members
2551
+ ListMembersQuery: ListMembersQuerySchema,
2552
+ MemberIdParams: MemberIdParamsSchema,
2553
+ AcqListMemberResponse: AcqListMemberResponseSchema,
2554
+ AcqListMembersResponse: AcqListMembersResponseSchema,
2555
+
2556
+ // List companies
2557
+ ListCompanyIdParams: ListCompanyIdParamsSchema,
2558
+ AcqListCompanyResponse: AcqListCompanyResponseSchema,
2559
+
2560
+ // Transition (shared with deals — TransitionItemRequestSchema)
2561
+ TransitionItemRequest: TransitionItemRequestSchema
2408
2562
  }
2409
2563
  ```
2410
2564
 
@@ -2589,97 +2743,98 @@ export const LEAD_GEN_PIPELINE_DEFINITIONS: Record<string, StatefulPipelineDefin
2589
2743
  ### `PaginationParams`
2590
2744
 
2591
2745
  ```typescript
2592
- export interface PaginationParams {
2593
- limit: number
2594
- offset: number
2746
+ export interface PaginationParams {
2747
+ limit: number
2748
+ offset: number
2595
2749
  }
2596
2750
  ```
2597
2751
 
2598
2752
  ### `PaginatedResult`
2599
2753
 
2600
2754
  ```typescript
2601
- export interface PaginatedResult<T> {
2602
- data: T[]
2603
- total: number
2604
- limit: number
2605
- offset: number
2755
+ export interface PaginatedResult<T> {
2756
+ data: T[]
2757
+ total: number
2758
+ limit: number
2759
+ offset: number
2606
2760
  }
2607
2761
  ```
2608
2762
 
2609
2763
  ### `CreateListParams`
2610
2764
 
2611
2765
  ```typescript
2612
- export interface CreateListParams {
2613
- organizationId: string
2614
- name: string
2615
- description?: string
2616
- type?: string
2617
- batchIds?: string[]
2618
- instantlyCampaignId?: string
2619
- status?: ListStatus
2620
- metadata?: Record<string, unknown>
2621
- scrapingConfig?: ScrapingConfig
2622
- icp?: IcpRubric
2623
- pipelineConfig?: PipelineConfig
2766
+ export interface CreateListParams {
2767
+ organizationId: string
2768
+ name: string
2769
+ description?: string
2770
+ type?: string
2771
+ batchIds?: string[]
2772
+ instantlyCampaignId?: string
2773
+ status?: ListStatus
2774
+ buildTemplateId?: string
2775
+ metadata?: Record<string, unknown>
2776
+ scrapingConfig?: ScrapingConfig
2777
+ icp?: IcpRubric
2778
+ pipelineConfig?: PipelineConfig
2624
2779
  }
2625
2780
  ```
2626
2781
 
2627
2782
  ### `UpdateListParams`
2628
2783
 
2629
2784
  ```typescript
2630
- export interface UpdateListParams {
2631
- name?: string
2632
- description?: string
2633
- batchIds?: string[]
2785
+ export interface UpdateListParams {
2786
+ name?: string
2787
+ description?: string
2788
+ batchIds?: string[]
2634
2789
  }
2635
2790
  ```
2636
2791
 
2637
2792
  ### `CreateCompanyParams`
2638
2793
 
2639
2794
  ```typescript
2640
- export interface CreateCompanyParams {
2641
- organizationId: string
2642
- name: string
2643
- domain?: string
2644
- linkedinUrl?: string
2645
- website?: string
2646
- numEmployees?: number
2647
- foundedYear?: number
2648
- locationCity?: string
2649
- locationState?: string
2650
- category?: string
2651
- source?: string
2652
- batchId?: string
2653
- verticalResearch?: string
2795
+ export interface CreateCompanyParams {
2796
+ organizationId: string
2797
+ name: string
2798
+ domain?: string
2799
+ linkedinUrl?: string
2800
+ website?: string
2801
+ numEmployees?: number
2802
+ foundedYear?: number
2803
+ locationCity?: string
2804
+ locationState?: string
2805
+ category?: string
2806
+ source?: string
2807
+ batchId?: string
2808
+ verticalResearch?: string
2654
2809
  }
2655
2810
  ```
2656
2811
 
2657
2812
  ### `UpdateCompanyParams`
2658
2813
 
2659
2814
  ```typescript
2660
- export interface UpdateCompanyParams {
2661
- name?: string
2662
- domain?: string
2663
- linkedinUrl?: string
2664
- website?: string
2665
- numEmployees?: number
2666
- foundedYear?: number
2667
- locationCity?: string
2668
- locationState?: string
2669
- category?: string
2670
- segment?: string
2671
- pipelineStatus?: Record<string, unknown>
2672
- enrichmentData?: Record<string, unknown>
2673
- source?: string
2674
- batchId?: string
2675
- status?: 'active' | 'invalid'
2676
- verticalResearch?: string | null
2677
- /** Track A: flat qualification score column (null until a scoring rubric is defined) */
2678
- qualificationScore?: number | null
2679
- /** Track A: flat qualification signals jsonb — mirrors the former pipeline_status.qualification shape */
2680
- qualificationSignals?: Record<string, unknown> | null
2681
- /** Track A: key identifying the rubric used for qualification */
2682
- qualificationRubricKey?: string | null
2815
+ export interface UpdateCompanyParams {
2816
+ name?: string
2817
+ domain?: string
2818
+ linkedinUrl?: string
2819
+ website?: string
2820
+ numEmployees?: number
2821
+ foundedYear?: number
2822
+ locationCity?: string
2823
+ locationState?: string
2824
+ category?: string
2825
+ segment?: string
2826
+ pipelineStatus?: Record<string, unknown>
2827
+ enrichmentData?: Record<string, unknown>
2828
+ source?: string
2829
+ batchId?: string
2830
+ status?: 'active' | 'invalid'
2831
+ verticalResearch?: string | null
2832
+ /** Track A: flat qualification score column (null until a scoring rubric is defined) */
2833
+ qualificationScore?: number | null
2834
+ /** Track A: flat qualification signals jsonb — mirrors the former pipeline_status.qualification shape */
2835
+ qualificationSignals?: Record<string, unknown> | null
2836
+ /** Track A: key identifying the rubric used for qualification */
2837
+ qualificationRubricKey?: string | null
2683
2838
  }
2684
2839
  ```
2685
2840
 
@@ -2692,56 +2847,57 @@ export type UpsertCompanyParams = CreateCompanyParams
2692
2847
  ### `CompanyFilters`
2693
2848
 
2694
2849
  ```typescript
2695
- export interface CompanyFilters {
2696
- listId?: string // Filter to companies in a specific list (via acq_list_companies)
2697
- search?: string
2698
- domain?: string
2699
- website?: string
2700
- segment?: string
2701
- category?: string
2702
- pipelineStatus?: Record<string, unknown>
2703
- /** Exclude companies whose pipeline_status contains this value (PostgREST NOT contains) */
2704
- pipelineStatusNot?: Record<string, unknown>
2705
- batchId?: string
2706
- status?: 'active' | 'invalid'
2707
- includeAll?: boolean
2708
- excludeColumns?: Array<'enrichmentData' | 'pipelineStatus'>
2850
+ export interface CompanyFilters {
2851
+ listId?: string // Filter to companies in a specific list (via acq_list_companies)
2852
+ search?: string
2853
+ domain?: string
2854
+ website?: string
2855
+ segment?: string
2856
+ category?: string
2857
+ pipelineStatus?: Record<string, unknown>
2858
+ /** Exclude companies whose pipeline_status contains this value (PostgREST NOT contains) */
2859
+ pipelineStatusNot?: Record<string, unknown>
2860
+ batchId?: string
2861
+ status?: 'active' | 'invalid'
2862
+ includeAll?: boolean
2863
+ excludeColumns?: Array<'enrichmentData' | 'pipelineStatus'>
2864
+ limit?: number
2709
2865
  }
2710
2866
  ```
2711
2867
 
2712
2868
  ### `CreateContactParams`
2713
2869
 
2714
2870
  ```typescript
2715
- export interface CreateContactParams {
2716
- organizationId: string
2717
- email: string
2718
- companyId?: string
2719
- firstName?: string
2720
- lastName?: string
2721
- linkedinUrl?: string
2722
- title?: string
2723
- source?: string
2724
- sourceId?: string
2725
- batchId?: string
2871
+ export interface CreateContactParams {
2872
+ organizationId: string
2873
+ email: string
2874
+ companyId?: string
2875
+ firstName?: string
2876
+ lastName?: string
2877
+ linkedinUrl?: string
2878
+ title?: string
2879
+ source?: string
2880
+ sourceId?: string
2881
+ batchId?: string
2726
2882
  }
2727
2883
  ```
2728
2884
 
2729
2885
  ### `UpdateContactParams`
2730
2886
 
2731
2887
  ```typescript
2732
- export interface UpdateContactParams {
2733
- companyId?: string
2734
- emailValid?: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN'
2735
- firstName?: string
2736
- lastName?: string
2737
- linkedinUrl?: string
2738
- title?: string
2739
- headline?: string
2740
- filterReason?: string
2741
- openingLine?: string
2742
- pipelineStatus?: Record<string, unknown>
2743
- enrichmentData?: Record<string, unknown>
2744
- status?: 'active' | 'invalid'
2888
+ export interface UpdateContactParams {
2889
+ companyId?: string
2890
+ emailValid?: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN'
2891
+ firstName?: string
2892
+ lastName?: string
2893
+ linkedinUrl?: string
2894
+ title?: string
2895
+ headline?: string
2896
+ filterReason?: string
2897
+ openingLine?: string
2898
+ pipelineStatus?: Record<string, unknown>
2899
+ enrichmentData?: Record<string, unknown>
2900
+ status?: 'active' | 'invalid'
2745
2901
  }
2746
2902
  ```
2747
2903
 
@@ -2754,87 +2910,87 @@ export type UpsertContactParams = CreateContactParams
2754
2910
  ### `ContactFilters`
2755
2911
 
2756
2912
  ```typescript
2757
- export interface ContactFilters {
2758
- listId?: string // Filter to contacts in a specific list (via acq_list_members)
2759
- search?: string
2760
- openingLineIsNull?: boolean // Filter to contacts without personalization
2761
- pipelineStatus?: Record<string, unknown>
2762
- batchId?: string
2763
- contactStatus?: 'active' | 'invalid' // Filter by contact status (soft-delete flag)
2913
+ export interface ContactFilters {
2914
+ listId?: string // Filter to contacts in a specific list (via acq_list_members)
2915
+ search?: string
2916
+ openingLineIsNull?: boolean // Filter to contacts without personalization
2917
+ pipelineStatus?: Record<string, unknown>
2918
+ batchId?: string
2919
+ contactStatus?: 'active' | 'invalid' // Filter by contact status (soft-delete flag)
2764
2920
  }
2765
2921
  ```
2766
2922
 
2767
2923
  ### `UpsertSocialPostParams`
2768
2924
 
2769
2925
  ```typescript
2770
- export interface UpsertSocialPostParams {
2771
- organizationId: string
2772
- platform: string
2773
- platformPostId: string
2774
- authorName: string
2775
- authorUrl?: string | null
2776
- postTitle: string
2777
- postText: string
2778
- postUrl: string
2779
- engagementCount?: number
2780
- commentsCount?: number
2781
- postedAt: string
2782
- metadata?: Record<string, unknown>
2783
- relevanceScore?: number
2784
- matchedKeywords?: string[]
2785
- matchedQuery?: string | null
2786
- initialDraft?: string | null
2787
- finalResponse?: string | null
2788
- sourceCategory?: string | null
2926
+ export interface UpsertSocialPostParams {
2927
+ organizationId: string
2928
+ platform: string
2929
+ platformPostId: string
2930
+ authorName: string
2931
+ authorUrl?: string | null
2932
+ postTitle: string
2933
+ postText: string
2934
+ postUrl: string
2935
+ engagementCount?: number
2936
+ commentsCount?: number
2937
+ postedAt: string
2938
+ metadata?: Record<string, unknown>
2939
+ relevanceScore?: number
2940
+ matchedKeywords?: string[]
2941
+ matchedQuery?: string | null
2942
+ initialDraft?: string | null
2943
+ finalResponse?: string | null
2944
+ sourceCategory?: string | null
2789
2945
  }
2790
2946
  ```
2791
2947
 
2792
2948
  ### `UpsertSocialPostsParams`
2793
2949
 
2794
2950
  ```typescript
2795
- export interface UpsertSocialPostsParams {
2796
- organizationId: string
2797
- posts: Omit<UpsertSocialPostParams, 'organizationId'>[]
2951
+ export interface UpsertSocialPostsParams {
2952
+ organizationId: string
2953
+ posts: Omit<UpsertSocialPostParams, 'organizationId'>[]
2798
2954
  }
2799
2955
  ```
2800
2956
 
2801
2957
  ### `UpsertSocialPostsResult`
2802
2958
 
2803
2959
  ```typescript
2804
- export interface UpsertSocialPostsResult {
2805
- inserted: number
2806
- duplicatesSkipped: number
2960
+ export interface UpsertSocialPostsResult {
2961
+ inserted: number
2962
+ duplicatesSkipped: number
2807
2963
  }
2808
2964
  ```
2809
2965
 
2810
2966
  ### `AddContactsToListParams`
2811
2967
 
2812
2968
  ```typescript
2813
- export interface AddContactsToListParams {
2814
- organizationId: string
2815
- listId: string
2816
- contactIds: string[]
2969
+ export interface AddContactsToListParams {
2970
+ organizationId: string
2971
+ listId: string
2972
+ contactIds: string[]
2817
2973
  }
2818
2974
  ```
2819
2975
 
2820
2976
  ### `AddContactsToListResult`
2821
2977
 
2822
2978
  ```typescript
2823
- export interface AddContactsToListResult {
2824
- added: number
2825
- alreadyExisted: number
2979
+ export interface AddContactsToListResult {
2980
+ added: number
2981
+ alreadyExisted: number
2826
2982
  }
2827
2983
  ```
2828
2984
 
2829
2985
  ### `UpdateListConfigParams`
2830
2986
 
2831
2987
  ```typescript
2832
- export interface UpdateListConfigParams {
2833
- organizationId: string
2834
- listId: string
2835
- scrapingConfig?: ScrapingConfig
2836
- icp?: IcpRubric
2837
- pipelineConfig?: PipelineConfig
2988
+ export interface UpdateListConfigParams {
2989
+ organizationId: string
2990
+ listId: string
2991
+ scrapingConfig?: ScrapingConfig
2992
+ icp?: IcpRubric
2993
+ pipelineConfig?: PipelineConfig
2838
2994
  }
2839
2995
  ```
2840
2996
 
@@ -2867,117 +3023,117 @@ export interface UpdateContactStageParams {
2867
3023
  ### `AddCompaniesToListParams`
2868
3024
 
2869
3025
  ```typescript
2870
- export interface AddCompaniesToListParams {
2871
- organizationId: string
2872
- listId: string
2873
- companyIds: string[]
3026
+ export interface AddCompaniesToListParams {
3027
+ organizationId: string
3028
+ listId: string
3029
+ companyIds: string[]
2874
3030
  }
2875
3031
  ```
2876
3032
 
2877
3033
  ### `AddCompaniesToListResult`
2878
3034
 
2879
3035
  ```typescript
2880
- export interface AddCompaniesToListResult {
2881
- added: number
2882
- alreadyExisted: number
3036
+ export interface AddCompaniesToListResult {
3037
+ added: number
3038
+ alreadyExisted: number
2883
3039
  }
2884
3040
  ```
2885
3041
 
2886
3042
  ### `RemoveCompaniesFromListParams`
2887
3043
 
2888
3044
  ```typescript
2889
- export interface RemoveCompaniesFromListParams {
2890
- organizationId: string
2891
- listId: string
2892
- companyIds: string[]
3045
+ export interface RemoveCompaniesFromListParams {
3046
+ organizationId: string
3047
+ listId: string
3048
+ companyIds: string[]
2893
3049
  }
2894
3050
  ```
2895
3051
 
2896
3052
  ### `RemoveCompaniesFromListResult`
2897
3053
 
2898
3054
  ```typescript
2899
- export interface RemoveCompaniesFromListResult {
2900
- removed: number
3055
+ export interface RemoveCompaniesFromListResult {
3056
+ removed: number
2901
3057
  }
2902
3058
  ```
2903
3059
 
2904
3060
  ### `RecordListExecutionParams`
2905
3061
 
2906
3062
  ```typescript
2907
- export interface RecordListExecutionParams {
2908
- organizationId: string
2909
- listId: string
2910
- executionId: string
2911
- configSnapshot?: Record<string, unknown>
3063
+ export interface RecordListExecutionParams {
3064
+ organizationId: string
3065
+ listId: string
3066
+ executionId: string
3067
+ configSnapshot?: Record<string, unknown>
2912
3068
  }
2913
3069
  ```
2914
3070
 
2915
3071
  ### `ListExecutionSummary`
2916
3072
 
2917
3073
  ```typescript
2918
- export interface ListExecutionSummary {
2919
- executionId: string
2920
- resourceId: string
2921
- status: string
2922
- createdAt: string
2923
- completedAt: string | null
2924
- durationMs: number | null
3074
+ export interface ListExecutionSummary {
3075
+ executionId: string
3076
+ resourceId: string
3077
+ status: string
3078
+ createdAt: string
3079
+ completedAt: string | null
3080
+ durationMs: number | null
2925
3081
  }
2926
3082
  ```
2927
3083
 
2928
3084
  ### `BulkImportParams`
2929
3085
 
2930
3086
  ```typescript
2931
- export interface BulkImportParams {
2932
- organizationId: string
2933
- contacts: CreateContactParams[]
2934
- listId?: string
3087
+ export interface BulkImportParams {
3088
+ organizationId: string
3089
+ contacts: CreateContactParams[]
3090
+ listId?: string
2935
3091
  }
2936
3092
  ```
2937
3093
 
2938
3094
  ### `BulkImportResult`
2939
3095
 
2940
3096
  ```typescript
2941
- export interface BulkImportResult {
2942
- created: number
2943
- updated: number
2944
- errors: Array<{ email: string; error: string }>
3097
+ export interface BulkImportResult {
3098
+ created: number
3099
+ updated: number
3100
+ errors: Array<{ email: string; error: string }>
2945
3101
  }
2946
3102
  ```
2947
3103
 
2948
3104
  ### `BulkImportCompanyEntry`
2949
3105
 
2950
3106
  ```typescript
2951
- export interface BulkImportCompanyEntry {
2952
- name: string
2953
- domain: string
2954
- website?: string
2955
- locationCity?: string
2956
- locationState?: string
2957
- category?: string
2958
- source?: string
2959
- enrichmentData?: Record<string, unknown>
2960
- pipelineStatus?: Record<string, unknown>
3107
+ export interface BulkImportCompanyEntry {
3108
+ name: string
3109
+ domain: string
3110
+ website?: string
3111
+ locationCity?: string
3112
+ locationState?: string
3113
+ category?: string
3114
+ source?: string
3115
+ enrichmentData?: Record<string, unknown>
3116
+ pipelineStatus?: Record<string, unknown>
2961
3117
  }
2962
3118
  ```
2963
3119
 
2964
3120
  ### `BulkImportCompaniesParams`
2965
3121
 
2966
3122
  ```typescript
2967
- export interface BulkImportCompaniesParams {
2968
- organizationId: string
2969
- batchId: string
2970
- companies: BulkImportCompanyEntry[]
3123
+ export interface BulkImportCompaniesParams {
3124
+ organizationId: string
3125
+ batchId: string
3126
+ companies: BulkImportCompanyEntry[]
2971
3127
  }
2972
3128
  ```
2973
3129
 
2974
3130
  ### `BulkImportCompaniesResult`
2975
3131
 
2976
3132
  ```typescript
2977
- export interface BulkImportCompaniesResult {
2978
- created: number
2979
- skipped: number
2980
- errors: Array<{ companyName: string; error: string }>
3133
+ export interface BulkImportCompaniesResult {
3134
+ created: number
3135
+ skipped: number
3136
+ errors: Array<{ companyName: string; error: string }>
2981
3137
  }
2982
3138
  ```
2983
3139
 
@@ -3042,6 +3198,7 @@ export type LeadToolMap = {
3042
3198
  markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
3043
3199
  updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
3044
3200
  updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
3201
+ cacheInstantlyThreadIds: { params: Omit<CacheInstantlyThreadIdsParams, 'organizationId'>; result: void }
3045
3202
  transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
3046
3203
  setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
3047
3204
  cancelSchedulesAndHitlByEmail: {
@@ -3139,3 +3296,73 @@ export type ListToolMap = {
3139
3296
  }
3140
3297
  }
3141
3298
  ```
3299
+
3300
+ ## Knowledge Platform Primitives
3301
+
3302
+ ### `KnowledgeLinkSchema`
3303
+
3304
+ ```typescript
3305
+ export const KnowledgeLinkSchema = z.object({
3306
+ nodeId: NodeIdStringSchema
3307
+ })
3308
+ ```
3309
+
3310
+ ### `OrgKnowledgeKindSchema`
3311
+
3312
+ ```typescript
3313
+ export const OrgKnowledgeKindSchema = z.enum(['playbook', 'strategy', 'reference'])
3314
+ ```
3315
+
3316
+ ### `OrgKnowledgeNodeSchema`
3317
+
3318
+ ```typescript
3319
+ export const OrgKnowledgeNodeSchema = z.object({
3320
+ id: ModelIdSchema,
3321
+ kind: OrgKnowledgeKindSchema,
3322
+ title: z.string().trim().min(1).max(200),
3323
+ summary: z.string().trim().min(1).max(1000),
3324
+ /** Raw MDX string. Phase 2 will introduce a structured block format. */
3325
+ body: z.string().trim().min(1),
3326
+ /**
3327
+ * Graph links to other OM nodes this knowledge node governs.
3328
+ * Each link emits a `governs` edge: knowledge-node -> target node.
3329
+ */
3330
+ links: z.array(KnowledgeLinkSchema).default([]),
3331
+ /** Identifiers of the roles or members who own this knowledge node. */
3332
+ ownerIds: z.array(ModelIdSchema).default([]),
3333
+ /** ISO date string (YYYY-MM-DD or full ISO 8601) of last meaningful update. */
3334
+ updatedAt: z.string().trim().min(1).max(50)
3335
+ })
3336
+ ```
3337
+
3338
+ ### `KnowledgeDomainSchema`
3339
+
3340
+ ```typescript
3341
+ export const KnowledgeDomainSchema = z.object({
3342
+ nodes: z.array(OrgKnowledgeNodeSchema).default([])
3343
+ })
3344
+ ```
3345
+
3346
+ ### `OrgKnowledgeNode`
3347
+
3348
+ ```typescript
3349
+ export type OrgKnowledgeNode = z.infer<typeof OrgKnowledgeNodeSchema>
3350
+ ```
3351
+
3352
+ ### `OrgKnowledgeKind`
3353
+
3354
+ ```typescript
3355
+ export type OrgKnowledgeKind = z.infer<typeof OrgKnowledgeKindSchema>
3356
+ ```
3357
+
3358
+ ### `KnowledgeLink`
3359
+
3360
+ ```typescript
3361
+ export type KnowledgeLink = z.infer<typeof KnowledgeLinkSchema>
3362
+ ```
3363
+
3364
+ ### `KnowledgeDomain`
3365
+
3366
+ ```typescript
3367
+ export type KnowledgeDomain = z.infer<typeof KnowledgeDomainSchema>
3368
+ ```