@elevasis/core 0.15.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/index.d.ts +60 -0
  2. package/dist/index.js +198 -1
  3. package/dist/organization-model/index.d.ts +60 -0
  4. package/dist/organization-model/index.js +198 -1
  5. package/dist/test-utils/index.d.ts +399 -363
  6. package/dist/test-utils/index.js +198 -1
  7. package/package.json +3 -3
  8. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +826 -703
  9. package/src/business/acquisition/activity-events.ts +12 -3
  10. package/src/business/acquisition/api-schemas.test.ts +315 -4
  11. package/src/business/acquisition/api-schemas.ts +1192 -1097
  12. package/src/business/acquisition/build-templates.ts +44 -0
  13. package/src/business/acquisition/crm-next-action.test.ts +262 -0
  14. package/src/business/acquisition/crm-next-action.ts +220 -0
  15. package/src/business/acquisition/crm-priority.test.ts +216 -0
  16. package/src/business/acquisition/crm-priority.ts +349 -0
  17. package/src/business/acquisition/crm-state-actions.test.ts +12 -21
  18. package/src/business/acquisition/deal-ownership.test.ts +351 -0
  19. package/src/business/acquisition/deal-ownership.ts +120 -0
  20. package/src/business/acquisition/derive-actions.test.ts +101 -37
  21. package/src/business/acquisition/derive-actions.ts +102 -87
  22. package/src/business/acquisition/index.ts +10 -0
  23. package/src/business/acquisition/types.ts +51 -8
  24. package/src/execution/engine/index.ts +4 -3
  25. package/src/execution/engine/tools/lead-service-types.ts +44 -30
  26. package/src/execution/engine/tools/platform/acquisition/list-tools.ts +6 -5
  27. package/src/execution/engine/tools/platform/acquisition/types.ts +3 -1
  28. package/src/execution/engine/tools/registry.ts +4 -3
  29. package/src/execution/engine/tools/tool-maps.ts +3 -1
  30. package/src/organization-model/domains/prospecting.ts +204 -1
  31. package/src/organization-model/domains/sales.test.ts +29 -0
  32. package/src/organization-model/domains/sales.ts +102 -0
  33. package/src/organization-model/types.ts +2 -2
  34. package/src/platform/constants/versions.ts +1 -1
  35. package/src/reference/_generated/contracts.md +826 -703
  36. package/src/supabase/database.types.ts +2978 -2958
@@ -885,6 +885,26 @@ export interface AcqContact {
885
885
  export type DealStage = 'interested' | 'proposal' | 'closing' | 'closed_won' | 'closed_lost' | 'nurturing'
886
886
  ```
887
887
 
888
+ ### `DealPriorityBucketKey`
889
+
890
+ ```typescript
891
+ export type DealPriorityBucketKey = 'needs_response' | 'follow_up_due' | 'waiting' | 'stale' | 'closed_low'
892
+ ```
893
+
894
+ ### `DealPriority`
895
+
896
+ ```typescript
897
+ export interface DealPriority {
898
+ bucketKey: DealPriorityBucketKey
899
+ rank: number
900
+ label: string
901
+ color: string
902
+ reason: string
903
+ latestActivityAt: string | null
904
+ nextActionAt: string | null
905
+ }
906
+ ```
907
+
888
908
  ### `KanbanStageConfig`
889
909
 
890
910
  ```typescript
@@ -941,8 +961,11 @@ export interface DealFilters {
941
961
 
942
962
  ```typescript
943
963
  /** Deal list item with joined contact and company data */
944
- export interface DealListItem extends AcqDealRow {
945
- contact: DealContact | null
964
+ export interface DealListItem extends AcqDealRow {
965
+ priority: DealPriority
966
+ ownership: 'us' | 'them' | null
967
+ nextAction: string | null
968
+ contact: DealContact | null
946
969
  }
947
970
  ```
948
971
 
@@ -983,6 +1006,66 @@ export interface AcqDealTask {
983
1006
  }
984
1007
  ```
985
1008
 
1009
+ ### `CrmPriorityBucketKey`
1010
+
1011
+ ```typescript
1012
+ export type CrmPriorityBucketKey = 'needs_response' | 'follow_up_due' | 'waiting' | 'stale' | 'closed_low'
1013
+ ```
1014
+
1015
+ ### `CrmPriorityBucketDefinition`
1016
+
1017
+ ```typescript
1018
+ export interface CrmPriorityBucketDefinition {
1019
+ bucketKey: CrmPriorityBucketKey
1020
+ label: string
1021
+ /** Lower ranks sort first in deal lists and pipeline columns. */
1022
+ rank: number
1023
+ /** UI color token. Consumers may map this to their design system. */
1024
+ color: string
1025
+ }
1026
+ ```
1027
+
1028
+ ### `CrmPriorityRuleConfig`
1029
+
1030
+ ```typescript
1031
+ export interface CrmPriorityRuleConfig {
1032
+ buckets: CrmPriorityBucketDefinition[]
1033
+ closedStageKeys: string[]
1034
+ followUpAfterDaysByStateKey: Record<string, number>
1035
+ staleAfterDays: number
1036
+ }
1037
+ ```
1038
+
1039
+ ### `CRM_PRIORITY_BUCKETS`
1040
+
1041
+ ```typescript
1042
+ export const CRM_PRIORITY_BUCKETS: CrmPriorityBucketDefinition[] = [
1043
+ { bucketKey: 'needs_response', label: 'Needs Response', rank: 10, color: 'red' },
1044
+ { bucketKey: 'follow_up_due', label: 'Follow-up Due', rank: 20, color: 'orange' },
1045
+ { bucketKey: 'waiting', label: 'Waiting', rank: 30, color: 'blue' },
1046
+ { bucketKey: 'stale', label: 'Stale', rank: 40, color: 'gray' },
1047
+ { bucketKey: 'closed_low', label: 'Closed', rank: 50, color: 'dark' }
1048
+ ]
1049
+ ```
1050
+
1051
+ ### `DEFAULT_CRM_PRIORITY_RULE_CONFIG`
1052
+
1053
+ ```typescript
1054
+ export const DEFAULT_CRM_PRIORITY_RULE_CONFIG: CrmPriorityRuleConfig = {
1055
+ buckets: CRM_PRIORITY_BUCKETS,
1056
+ closedStageKeys: ['closed_won', 'closed_lost'],
1057
+ followUpAfterDaysByStateKey: {
1058
+ discovery_link_sent: 3,
1059
+ discovery_nudging: 2,
1060
+ reply_sent: 3,
1061
+ followup_1_sent: 3,
1062
+ followup_2_sent: 5,
1063
+ followup_3_sent: 7
1064
+ },
1065
+ staleAfterDays: 14
1066
+ }
1067
+ ```
1068
+
986
1069
  ### `DealStageSchema`
987
1070
 
988
1071
  ```typescript
@@ -998,178 +1081,195 @@ export const AcqDealTaskKindSchema = z.enum(['call', 'email', 'meeting', 'other'
998
1081
  ### `DealIdParamsSchema`
999
1082
 
1000
1083
  ```typescript
1001
- export const DealIdParamsSchema = z.object({
1002
- dealId: UuidSchema
1084
+ export const DealIdParamsSchema = z.object({
1085
+ dealId: UuidSchema
1003
1086
  })
1004
1087
  ```
1005
1088
 
1006
1089
  ### `DealTaskIdParamsSchema`
1007
1090
 
1008
1091
  ```typescript
1009
- export const DealTaskIdParamsSchema = z.object({
1010
- dealId: UuidSchema,
1011
- taskId: UuidSchema
1092
+ export const DealTaskIdParamsSchema = z.object({
1093
+ dealId: UuidSchema,
1094
+ taskId: UuidSchema
1012
1095
  })
1013
1096
  ```
1014
1097
 
1015
1098
  ### `ListDealsQuerySchema`
1016
1099
 
1017
1100
  ```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
- })
1101
+ export const ListDealsQuerySchema = z
1102
+ .object({
1103
+ stage: DealStageSchema.optional(),
1104
+ search: z.string().optional(),
1105
+ limit: z.coerce.number().int().positive().default(50),
1106
+ offset: z.coerce.number().int().min(0).default(0)
1107
+ })
1025
1108
  .strict()
1026
1109
  ```
1027
1110
 
1028
1111
  ### `DealLookupQuerySchema`
1029
1112
 
1030
1113
  ```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
- })
1114
+ export const DealLookupQuerySchema = z
1115
+ .object({
1116
+ search: z.string().trim().min(1).max(200).optional(),
1117
+ limit: z.coerce.number().int().min(1).max(25).default(10)
1118
+ })
1036
1119
  .strict()
1037
1120
  ```
1038
1121
 
1039
1122
  ### `ListDealTasksDueQuerySchema`
1040
1123
 
1041
1124
  ```typescript
1042
- export const ListDealTasksDueQuerySchema = z
1043
- .object({
1044
- window: z.enum(['overdue', 'today', 'today_and_overdue', 'upcoming']).optional(),
1045
- assigneeUserId: UuidSchema.optional()
1046
- })
1125
+ export const ListDealTasksDueQuerySchema = z
1126
+ .object({
1127
+ window: z.enum(['overdue', 'today', 'today_and_overdue', 'upcoming']).optional(),
1128
+ assigneeUserId: UuidSchema.optional()
1129
+ })
1047
1130
  .strict()
1048
1131
  ```
1049
1132
 
1050
1133
  ### `CreateDealNoteRequestSchema`
1051
1134
 
1052
1135
  ```typescript
1053
- export const CreateDealNoteRequestSchema = z
1054
- .object({
1055
- body: z.string().trim().min(1).max(10000)
1056
- })
1136
+ export const CreateDealNoteRequestSchema = z
1137
+ .object({
1138
+ body: z.string().trim().min(1).max(10000)
1139
+ })
1057
1140
  .strict()
1058
1141
  ```
1059
1142
 
1060
1143
  ### `CreateDealTaskRequestSchema`
1061
1144
 
1062
1145
  ```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
- })
1146
+ export const CreateDealTaskRequestSchema = z
1147
+ .object({
1148
+ title: z.string().trim().min(1).max(255),
1149
+ description: z.string().nullable().optional(),
1150
+ kind: AcqDealTaskKindSchema.optional(),
1151
+ dueAt: z.string().datetime().nullable().optional(),
1152
+ assigneeUserId: UuidSchema.nullable().optional()
1153
+ })
1071
1154
  .strict()
1072
1155
  ```
1073
1156
 
1074
1157
  ### `TransitionItemRequestSchema`
1075
1158
 
1076
1159
  ```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
- })
1160
+ export const TransitionItemRequestSchema = z
1161
+ .object({
1162
+ pipelineKey: z.string().min(1),
1163
+ stageKey: z.string().min(1),
1164
+ stateKey: z.string().nullable().optional(),
1165
+ reason: z.string().optional(),
1166
+ expectedUpdatedAt: z.string().datetime().optional()
1167
+ })
1085
1168
  .strict()
1086
1169
  ```
1087
1170
 
1088
1171
  ### `ExecuteActionParamsSchema`
1089
1172
 
1090
1173
  ```typescript
1091
- export const ExecuteActionParamsSchema = z
1092
- .object({
1093
- dealId: UuidSchema,
1094
- actionKey: NonEmptyStringSchema
1095
- })
1174
+ export const ExecuteActionParamsSchema = z
1175
+ .object({
1176
+ dealId: UuidSchema,
1177
+ actionKey: NonEmptyStringSchema
1178
+ })
1096
1179
  .strict()
1097
1180
  ```
1098
1181
 
1099
1182
  ### `ExecuteActionRequestSchema`
1100
1183
 
1101
1184
  ```typescript
1102
- export const ExecuteActionRequestSchema = z
1103
- .object({
1104
- payload: z.record(z.string(), z.unknown()).optional()
1105
- })
1185
+ export const ExecuteActionRequestSchema = z
1186
+ .object({
1187
+ payload: z.record(z.string(), z.unknown()).optional()
1188
+ })
1106
1189
  .strict()
1107
1190
  ```
1108
1191
 
1109
1192
  ### `DealContactSummarySchema`
1110
1193
 
1111
1194
  ```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()
1195
+ /**
1196
+ * Contact summary nested inside DealListItem / DealDetailResponse.
1197
+ * Matches the joined shape returned by useDeals / useDealDetail Supabase queries.
1198
+ */
1199
+ export const DealContactSummarySchema = z.object({
1200
+ id: z.string(),
1201
+ first_name: z.string().nullable(),
1202
+ last_name: z.string().nullable(),
1203
+ email: z.string(),
1204
+ title: z.string().nullable(),
1205
+ headline: z.string().nullable(),
1206
+ linkedin_url: z.string().nullable(),
1207
+ pipeline_status: z.record(z.string(), z.unknown()).nullable(),
1208
+ enrichment_data: z.record(z.string(), z.unknown()).nullable(),
1209
+ company: z
1210
+ .object({
1211
+ id: z.string(),
1212
+ name: z.string(),
1213
+ domain: z.string().nullable(),
1214
+ website: z.string().nullable(),
1215
+ linkedin_url: z.string().nullable(),
1216
+ segment: z.string().nullable(),
1217
+ category: z.string().nullable(),
1218
+ num_employees: z.number().nullable()
1219
+ })
1220
+ .nullable()
1221
+ })
1222
+ ```
1223
+
1224
+ ### `DealPrioritySchema`
1225
+
1226
+ ```typescript
1227
+ export const DealPrioritySchema = z.object({
1228
+ bucketKey: z.enum(['needs_response', 'follow_up_due', 'waiting', 'stale', 'closed_low']),
1229
+ rank: z.number().int(),
1230
+ label: z.string(),
1231
+ color: z.string(),
1232
+ reason: z.string(),
1233
+ latestActivityAt: z.string().nullable(),
1234
+ nextActionAt: z.string().nullable()
1138
1235
  })
1139
1236
  ```
1140
1237
 
1141
1238
  ### `DealListItemSchema`
1142
1239
 
1143
1240
  ```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(),
1241
+ /**
1242
+ * Deal list item with joined contact (and company via contact).
1243
+ * Matches DealListItem from @repo/core types.
1244
+ */
1245
+ export const DealListItemSchema = z.object({
1246
+ // acq_deals columns
1247
+ id: z.string(),
1248
+ organization_id: z.string(),
1249
+ contact_id: z.string().nullable(),
1250
+ contact_email: z.string(),
1251
+ pipeline_key: z.string(),
1252
+ stage_key: z.string().nullable(),
1253
+ state_key: z.string().nullable(),
1254
+ activity_log: z.unknown(),
1255
+ discovery_data: z.unknown().nullable(),
1256
+ discovery_submitted_at: z.string().nullable(),
1257
+ discovery_submitted_by: z.string().nullable(),
1258
+ proposal_data: z.unknown().nullable(),
1259
+ proposal_sent_at: z.string().nullable(),
1260
+ proposal_pdf_url: z.string().nullable(),
1261
+ signature_envelope_id: z.string().nullable(),
1262
+ source_list_id: z.string().nullable(),
1263
+ source_type: z.string().nullable(),
1264
+ initial_fee: z.number().nullable(),
1265
+ monthly_fee: z.number().nullable(),
1266
+ closed_lost_at: z.string().nullable(),
1267
+ closed_lost_reason: z.string().nullable(),
1171
1268
  created_at: z.string(),
1172
1269
  updated_at: z.string(),
1270
+ priority: DealPrioritySchema,
1271
+ ownership: z.enum(['us', 'them']).nullable(),
1272
+ nextAction: z.string().nullable(),
1173
1273
  // joined relation
1174
1274
  contact: DealContactSummarySchema.nullable()
1175
1275
  })
@@ -1178,38 +1278,40 @@ export const DealListItemSchema = z.object({
1178
1278
  ### `DealListResponseSchema`
1179
1279
 
1180
1280
  ```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()
1281
+ export const DealListResponseSchema = z.object({
1282
+ data: z.array(DealListItemSchema),
1283
+ total: z.number().int(),
1284
+ limit: z.number().int(),
1285
+ offset: z.number().int()
1186
1286
  })
1187
1287
  ```
1188
1288
 
1189
1289
  ### `DealDetailResponseSchema`
1190
1290
 
1191
1291
  ```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
1292
+ /**
1293
+ * Deal detail shape — currently the same as a list item (full joined record).
1294
+ * Additive fields keep existing DealListItem callers compatible.
1295
+ */
1296
+ export const DealDetailResponseSchema = DealListItemSchema.extend({
1297
+ conversation: DealConversationSchema
1298
+ })
1197
1299
  ```
1198
1300
 
1199
1301
  ### `DealNoteResponseSchema`
1200
1302
 
1201
1303
  ```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()
1304
+ /**
1305
+ * Single acq_deal_notes row (camelCase API representation).
1306
+ */
1307
+ export const DealNoteResponseSchema = z.object({
1308
+ id: z.string(),
1309
+ dealId: z.string(),
1310
+ organizationId: z.string(),
1311
+ authorUserId: z.string().nullable(),
1312
+ body: z.string(),
1313
+ createdAt: z.string(),
1314
+ updatedAt: z.string()
1213
1315
  })
1214
1316
  ```
1215
1317
 
@@ -1222,24 +1324,24 @@ export const DealNoteListResponseSchema = z.array(DealNoteResponseSchema)
1222
1324
  ### `DealTaskResponseSchema`
1223
1325
 
1224
1326
  ```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()
1327
+ /**
1328
+ * Single acq_deal_tasks row (camelCase API representation).
1329
+ * Matches AcqDealTask domain type from types.ts.
1330
+ */
1331
+ export const DealTaskResponseSchema = z.object({
1332
+ id: z.string(),
1333
+ organizationId: z.string(),
1334
+ dealId: z.string(),
1335
+ title: z.string(),
1336
+ description: z.string().nullable(),
1337
+ kind: AcqDealTaskKindSchema,
1338
+ dueAt: z.string().nullable(),
1339
+ assigneeUserId: z.string().nullable(),
1340
+ completedAt: z.string().nullable(),
1341
+ completedByUserId: z.string().nullable(),
1342
+ createdAt: z.string(),
1343
+ updatedAt: z.string(),
1344
+ createdByUserId: z.string().nullable()
1243
1345
  })
1244
1346
  ```
1245
1347
 
@@ -1252,43 +1354,45 @@ export const DealTaskListResponseSchema = z.array(DealTaskResponseSchema)
1252
1354
  ### `DealSchemas`
1253
1355
 
1254
1356
  ```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
1357
+ export const DealSchemas = {
1358
+ // Params
1359
+ DealIdParams: DealIdParamsSchema,
1360
+ DealTaskIdParams: DealTaskIdParamsSchema,
1361
+
1362
+ // Queries
1363
+ ListDealsQuery: ListDealsQuerySchema,
1364
+ DealLookupQuery: DealLookupQuerySchema,
1365
+ ListDealTasksDueQuery: ListDealTasksDueQuerySchema,
1366
+
1367
+ // Request bodies
1368
+ CreateDealNoteRequest: CreateDealNoteRequestSchema,
1369
+ CreateDealTaskRequest: CreateDealTaskRequestSchema,
1370
+ TransitionItemRequest: TransitionItemRequestSchema,
1371
+ TransitionDealStateRequest: TransitionDealStateRequestSchema,
1372
+ ExecuteActionParams: ExecuteActionParamsSchema,
1373
+ ExecuteActionRequest: ExecuteActionRequestSchema,
1374
+
1375
+ // Responses
1376
+ DealPriority: DealPrioritySchema,
1377
+ DealListResponse: DealListResponseSchema,
1378
+ DealSummaryResponse: DealSummaryResponseSchema,
1379
+ DealLookupResponse: DealLookupResponseSchema,
1380
+ ConversationMessage: ConversationMessageSchema,
1381
+ DealDetailResponse: DealDetailResponseSchema,
1382
+ DealNoteResponse: DealNoteResponseSchema,
1383
+ DealNoteListResponse: DealNoteListResponseSchema,
1384
+ DealTaskResponse: DealTaskResponseSchema,
1385
+ DealTaskListResponse: DealTaskListResponseSchema
1282
1386
  }
1283
1387
  ```
1284
1388
 
1285
1389
  ### `Action`
1286
1390
 
1287
1391
  ```typescript
1288
- export interface Action {
1289
- key: string
1290
- label: string
1291
- payloadSchema?: z.ZodTypeAny
1392
+ export interface Action {
1393
+ key: string
1394
+ label: string
1395
+ payloadSchema?: z.ZodTypeAny
1292
1396
  }
1293
1397
  ```
1294
1398
 
@@ -1307,83 +1411,84 @@ export interface ActionDef {
1307
1411
  ### `DEFAULT_CRM_ACTIONS`
1308
1412
 
1309
1413
  ```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
- {
1414
+ export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
1415
+ {
1416
+ key: 'move_to_proposal',
1417
+ label: 'Move to Proposal',
1418
+ isAvailableFor: (deal) => deal.stage_key === 'interested',
1419
+ workflowId: 'move_to_proposal-workflow'
1420
+ },
1421
+ {
1422
+ key: 'move_to_closing',
1423
+ label: 'Move to Closing',
1424
+ isAvailableFor: (deal) => deal.stage_key === 'proposal',
1425
+ workflowId: 'move_to_closing-workflow'
1426
+ },
1427
+ {
1428
+ key: 'move_to_closed_won',
1429
+ label: 'Close Won',
1430
+ isAvailableFor: (deal) => deal.stage_key === 'closing',
1431
+ workflowId: 'move_to_closed_won-workflow'
1432
+ },
1433
+ {
1434
+ key: 'move_to_closed_lost',
1435
+ label: 'Close Lost',
1436
+ isAvailableFor: (deal) =>
1437
+ deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
1438
+ workflowId: 'move_to_closed_lost-workflow'
1439
+ },
1440
+ {
1441
+ key: 'move_to_nurturing',
1442
+ label: 'Move to Nurturing',
1443
+ isAvailableFor: (deal) =>
1444
+ deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
1445
+ workflowId: 'move_to_nurturing-workflow'
1446
+ },
1447
+ {
1344
1448
  key: 'send_reply',
1345
1449
  label: 'Send Reply',
1346
1450
  isAvailableFor: (deal) =>
1347
1451
  deal.stage_key === 'interested' &&
1452
+ isOurReplyAction(deal) &&
1348
1453
  (deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey ||
1349
1454
  deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
1350
1455
  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
- }
1456
+ workflowId: 'crm-send-reply-workflow',
1457
+ payloadSchema: SendReplyActionPayloadSchema
1458
+ },
1459
+ {
1460
+ key: 'send_link',
1461
+ label: 'Send Booking Link',
1462
+ isAvailableFor: (deal) =>
1463
+ deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey,
1464
+ workflowId: 'crm-send-booking-link-workflow'
1465
+ },
1466
+ {
1467
+ key: 'send_nudge',
1468
+ label: 'Send Nudge',
1469
+ isAvailableFor: (deal) =>
1470
+ deal.stage_key === 'interested' &&
1471
+ (deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
1472
+ deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
1473
+ workflowId: 'crm-send-nudge-workflow'
1474
+ },
1475
+ {
1476
+ key: 'mark_no_show',
1477
+ label: 'Mark No-Show',
1478
+ isAvailableFor: (deal) =>
1479
+ deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey,
1480
+ // Mirrors the auto-timeout precedent in operations/sales/crm/pipeline/timeout-actions.ts:
1481
+ // both manual-click and timeout move the deal to closed_lost. The action_taken activity
1482
+ // event captures operator intent and distinguishes the manual variant from the timed one.
1483
+ workflowId: 'mark_no_show-workflow'
1484
+ },
1485
+ {
1486
+ key: 'rebook',
1487
+ label: 'Rebook',
1488
+ isAvailableFor: (deal) =>
1489
+ deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_BOOKING_CANCELLED_STATE.stateKey,
1490
+ workflowId: 'crm-rebook-workflow'
1491
+ }
1387
1492
  ]
1388
1493
  ```
1389
1494
 
@@ -1558,7 +1663,7 @@ export interface AcqList {
1558
1663
  scrapingConfig: ScrapingConfig
1559
1664
  icp: IcpRubric
1560
1665
  pipelineConfig: PipelineConfig
1561
- metadata: Record<string, unknown>
1666
+ metadata: AcqListMetadata
1562
1667
  launchedAt: Date | null
1563
1668
  completedAt: Date | null
1564
1669
  createdAt: Date
@@ -1642,10 +1747,10 @@ export interface AcqContact {
1642
1747
 
1643
1748
  ```typescript
1644
1749
  /**
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
- */
1750
+ * Live-scan aggregate telemetry for a single list, computed on demand from
1751
+ * the list junction tables and current contact deliverability state.
1752
+ * `stageCounts` are attempted counts from list-row processing_state.
1753
+ */
1649
1754
  export interface ListTelemetry {
1650
1755
  listId: string
1651
1756
  totalCompanies: number
@@ -1674,167 +1779,180 @@ export interface ListTelemetry {
1674
1779
  ### `ListStageCountsSchema`
1675
1780
 
1676
1781
  ```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
- })
1782
+ export const ListStageCountsSchema = z.object({
1783
+ // Attempted counts by canonical lead-gen stage. The detailed status
1784
+ // distribution lives on ListProgress; telemetry keeps the overview payload small.
1785
+ stageCounts: z.object({
1786
+ populated: z.number().int(),
1787
+ extracted: z.number().int(),
1788
+ qualified: z.number().int(),
1789
+ discovered: z.number().int(),
1790
+ verified: z.number().int(),
1791
+ personalized: z.number().int(),
1792
+ uploaded: z.number().int()
1793
+ }),
1794
+ deliverability: z.object({
1795
+ valid: z.number().int(),
1796
+ risky: z.number().int(),
1797
+ invalid: z.number().int(),
1798
+ unknown: z.number().int(),
1799
+ bounced: z.number().int()
1800
+ })
1696
1801
  })
1697
1802
  ```
1698
1803
 
1699
1804
  ### `ListTelemetrySchema`
1700
1805
 
1701
1806
  ```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()
1807
+ export const ListTelemetrySchema = z.object({
1808
+ listId: UuidSchema,
1809
+ totalCompanies: z.number().int(),
1810
+ totalContacts: z.number().int(),
1811
+ stageCounts: ListStageCountsSchema.shape.stageCounts,
1812
+ deliverability: ListStageCountsSchema.shape.deliverability,
1813
+ activeWorkflows: z.array(z.string()).optional()
1709
1814
  })
1710
1815
  ```
1711
1816
 
1712
1817
  ### `ListIdParamsSchema`
1713
1818
 
1714
1819
  ```typescript
1715
- export const ListIdParamsSchema = z.object({
1716
- listId: UuidSchema
1820
+ export const ListIdParamsSchema = z.object({
1821
+ listId: UuidSchema
1717
1822
  })
1718
1823
  ```
1719
1824
 
1720
1825
  ### `CreateListRequestSchema`
1721
1826
 
1722
1827
  ```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
- })
1828
+ export const CreateListRequestSchema = z
1829
+ .object({
1830
+ name: z.string().trim().min(1).max(255),
1831
+ description: z.string().trim().nullable().optional(),
1832
+ status: ListStatusSchema.optional(),
1833
+ buildTemplateId: ProspectingBuildTemplateIdSchema.optional(),
1834
+ scrapingConfig: ScrapingConfigSchema.optional(),
1835
+ icp: IcpRubricSchema.optional(),
1836
+ pipelineConfig: PipelineConfigSchema.optional()
1837
+ })
1732
1838
  .strict()
1733
1839
  ```
1734
1840
 
1735
1841
  ### `UpdateListRequestSchema`
1736
1842
 
1737
1843
  ```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'
1844
+ export const UpdateListRequestSchema = z
1845
+ .object({
1846
+ name: z.string().trim().min(1).max(255).optional(),
1847
+ description: z.string().trim().nullable().optional(),
1848
+ batchIds: z.array(z.string()).optional(),
1849
+ buildTemplateId: ProspectingBuildTemplateIdSchema.optional(),
1850
+ confirmBuildTemplateChange: z.literal(true).optional()
1851
+ })
1852
+ .strict()
1853
+ .refine(
1854
+ (data) =>
1855
+ data.name !== undefined ||
1856
+ data.description !== undefined ||
1857
+ data.batchIds !== undefined ||
1858
+ data.buildTemplateId !== undefined,
1859
+ {
1860
+ message: 'At least one field (name, description, batchIds, or buildTemplateId) must be provided'
1861
+ }
1862
+ )
1863
+ .refine((data) => data.buildTemplateId === undefined || data.confirmBuildTemplateChange === true, {
1864
+ message: 'confirmBuildTemplateChange must be true when changing buildTemplateId',
1865
+ path: ['confirmBuildTemplateChange']
1747
1866
  })
1748
1867
  ```
1749
1868
 
1750
1869
  ### `UpdateListConfigRequestSchema`
1751
1870
 
1752
1871
  ```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
- */
1758
- export const UpdateListConfigRequestSchema = z
1759
- .object({
1760
- scrapingConfig: ScrapingConfigSchema.partial().optional(),
1761
- icp: IcpRubricSchema.partial().optional(),
1762
- pipelineConfig: PipelineConfigSchema.partial().optional()
1763
- })
1764
- .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'
1872
+ /**
1873
+ * Partial patch for the three jsonb config columns. UI sends only the edited
1874
+ * subtree; server writes the field as-is (no deep merge — each column is
1875
+ * replaced atomically when present in the patch).
1876
+ */
1877
+ export const UpdateListConfigRequestSchema = z
1878
+ .object({
1879
+ scrapingConfig: ScrapingConfigSchema.partial().optional(),
1880
+ icp: IcpRubricSchema.partial().optional(),
1881
+ pipelineConfig: PipelineConfigSchema.partial().optional()
1882
+ })
1883
+ .strict()
1884
+ .refine((data) => data.scrapingConfig !== undefined || data.icp !== undefined || data.pipelineConfig !== undefined, {
1885
+ message: 'At least one of scrapingConfig, icp, or pipelineConfig must be provided'
1767
1886
  })
1768
1887
  ```
1769
1888
 
1770
1889
  ### `AddCompaniesToListRequestSchema`
1771
1890
 
1772
1891
  ```typescript
1773
- export const AddCompaniesToListRequestSchema = z
1774
- .object({
1775
- companyIds: z.array(UuidSchema).min(1).max(1000)
1776
- })
1892
+ export const AddCompaniesToListRequestSchema = z
1893
+ .object({
1894
+ companyIds: z.array(UuidSchema).min(1).max(1000)
1895
+ })
1777
1896
  .strict()
1778
1897
  ```
1779
1898
 
1780
1899
  ### `RemoveCompaniesFromListRequestSchema`
1781
1900
 
1782
1901
  ```typescript
1783
- export const RemoveCompaniesFromListRequestSchema = z
1784
- .object({
1785
- companyIds: z.array(UuidSchema).min(1).max(1000)
1786
- })
1902
+ export const RemoveCompaniesFromListRequestSchema = z
1903
+ .object({
1904
+ companyIds: z.array(UuidSchema).min(1).max(1000)
1905
+ })
1787
1906
  .strict()
1788
1907
  ```
1789
1908
 
1790
1909
  ### `AddContactsToListRequestSchema`
1791
1910
 
1792
1911
  ```typescript
1793
- export const AddContactsToListRequestSchema = z
1794
- .object({
1795
- contactIds: z.array(UuidSchema).min(1).max(1000)
1796
- })
1912
+ export const AddContactsToListRequestSchema = z
1913
+ .object({
1914
+ contactIds: z.array(UuidSchema).min(1).max(1000)
1915
+ })
1797
1916
  .strict()
1798
1917
  ```
1799
1918
 
1800
1919
  ### `RecordListExecutionRequestSchema`
1801
1920
 
1802
1921
  ```typescript
1803
- export const RecordListExecutionRequestSchema = z
1804
- .object({
1805
- executionId: UuidSchema,
1806
- configSnapshot: z.record(z.string(), z.unknown()).optional()
1807
- })
1922
+ export const RecordListExecutionRequestSchema = z
1923
+ .object({
1924
+ executionId: UuidSchema,
1925
+ configSnapshot: z.record(z.string(), z.unknown()).optional()
1926
+ })
1808
1927
  .strict()
1809
1928
  ```
1810
1929
 
1811
1930
  ### `AcqListResponseSchema`
1812
1931
 
1813
1932
  ```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
1933
+ /**
1934
+ * Single list as returned by /api/acquisition/lists/:id etc.
1935
+ * Camel-cased domain shape matching AcqList in types.ts.
1936
+ */
1937
+ export const AcqListResponseSchema = z.object({
1938
+ id: z.string(),
1939
+ organizationId: z.string(),
1940
+ name: z.string(),
1941
+ description: z.string().nullable(),
1942
+ batchIds: z.array(z.string()),
1943
+ instantlyCampaignId: z.string().nullable(),
1944
+ /** Lifecycle status (draft | enriching | launched | closing | archived). */
1945
+ status: ListStatusSchema,
1946
+ metadata: AcqListMetadataSchema,
1947
+ launchedAt: z.string().nullable(),
1948
+ completedAt: z.string().nullable(),
1949
+ createdAt: z.string(),
1950
+ /** Scraping criteria stored as jsonb on the row. */
1951
+ scrapingConfig: ScrapingConfigSchema,
1952
+ /** ICP / qualification rubric stored as jsonb on the row. */
1953
+ icp: IcpRubricSchema,
1954
+ /** Pipeline presentation contract stored as jsonb on the row. */
1955
+ pipelineConfig: PipelineConfigSchema
1838
1956
  })
1839
1957
  ```
1840
1958
 
@@ -1859,17 +1977,17 @@ export const ListTelemetryListResponseSchema = z.array(ListTelemetrySchema)
1859
1977
  ### `ListExecutionSummarySchema`
1860
1978
 
1861
1979
  ```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(),
1869
- status: z.string(),
1870
- createdAt: z.string(),
1871
- completedAt: z.string().nullable(),
1872
- durationMs: z.number().int().nullable()
1980
+ /**
1981
+ * Row from acq_list_executions joined with the execution summary,
1982
+ * shaped for the /lists/:id/executions response.
1983
+ */
1984
+ export const ListExecutionSummarySchema = z.object({
1985
+ executionId: z.string(),
1986
+ resourceId: z.string(),
1987
+ status: z.string(),
1988
+ createdAt: z.string(),
1989
+ completedAt: z.string().nullable(),
1990
+ durationMs: z.number().int().nullable()
1873
1991
  })
1874
1992
  ```
1875
1993
 
@@ -1900,282 +2018,282 @@ export const AcqEmailValidSchema = z.enum(['VALID', 'INVALID', 'RISKY', 'UNKNOWN
1900
2018
  ### `CompanyIdParamsSchema`
1901
2019
 
1902
2020
  ```typescript
1903
- export const CompanyIdParamsSchema = z.object({
1904
- companyId: UuidSchema
2021
+ export const CompanyIdParamsSchema = z.object({
2022
+ companyId: UuidSchema
1905
2023
  })
1906
2024
  ```
1907
2025
 
1908
2026
  ### `ContactIdParamsSchema`
1909
2027
 
1910
2028
  ```typescript
1911
- export const ContactIdParamsSchema = z.object({
1912
- contactId: UuidSchema
2029
+ export const ContactIdParamsSchema = z.object({
2030
+ contactId: UuidSchema
1913
2031
  })
1914
2032
  ```
1915
2033
 
1916
2034
  ### `ListCompaniesQuerySchema`
1917
2035
 
1918
2036
  ```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
- })
2037
+ export const ListCompaniesQuerySchema = z
2038
+ .object({
2039
+ search: z.string().trim().min(1).max(200).optional(),
2040
+ listId: UuidSchema.optional(),
2041
+ domain: z.string().trim().min(1).max(255).optional(),
2042
+ website: z.string().trim().min(1).max(2048).optional(),
2043
+ segment: z.string().trim().min(1).max(255).optional(),
2044
+ category: z.string().trim().min(1).max(255).optional(),
2045
+ batchId: z.string().trim().min(1).max(255).optional(),
2046
+ status: AcqCompanyStatusSchema.optional(),
2047
+ includeAll: QueryBooleanSchema.optional(),
2048
+ limit: z.coerce.number().int().min(1).max(5000).default(50),
2049
+ offset: z.coerce.number().int().min(0).default(0)
2050
+ })
1933
2051
  .strict()
1934
2052
  ```
1935
2053
 
1936
2054
  ### `ListContactsQuerySchema`
1937
2055
 
1938
2056
  ```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
- })
2057
+ export const ListContactsQuerySchema = z
2058
+ .object({
2059
+ search: z.string().trim().min(1).max(200).optional(),
2060
+ listId: UuidSchema.optional(),
2061
+ openingLineIsNull: QueryBooleanSchema.optional(),
2062
+ batchId: z.string().trim().min(1).max(255).optional(),
2063
+ contactStatus: AcqContactStatusSchema.optional(),
2064
+ limit: z.coerce.number().int().min(1).max(5000).default(5000),
2065
+ offset: z.coerce.number().int().min(0).default(0)
2066
+ })
1949
2067
  .strict()
1950
2068
  ```
1951
2069
 
1952
2070
  ### `CreateCompanyRequestSchema`
1953
2071
 
1954
2072
  ```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
- })
2073
+ export const CreateCompanyRequestSchema = z
2074
+ .object({
2075
+ name: z.string().trim().min(1).max(255),
2076
+ domain: z.string().trim().min(1).max(255).optional(),
2077
+ linkedinUrl: z.string().trim().url().optional(),
2078
+ website: z.string().trim().url().optional(),
2079
+ numEmployees: z.number().int().min(0).optional(),
2080
+ foundedYear: z.number().int().optional(),
2081
+ locationCity: z.string().trim().min(1).max(255).optional(),
2082
+ locationState: z.string().trim().min(1).max(255).optional(),
2083
+ category: z.string().trim().min(1).max(255).optional(),
2084
+ source: z.string().trim().min(1).max(255).optional(),
2085
+ batchId: z.string().trim().min(1).max(255).optional(),
2086
+ verticalResearch: z.string().trim().min(1).max(5000).optional()
2087
+ })
1970
2088
  .strict()
1971
2089
  ```
1972
2090
 
1973
2091
  ### `UpdateCompanyRequestSchema`
1974
2092
 
1975
2093
  ```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
- }
2094
+ export const UpdateCompanyRequestSchema = z
2095
+ .object({
2096
+ name: z.string().trim().min(1).max(255).optional(),
2097
+ domain: z.string().trim().min(1).max(255).optional(),
2098
+ linkedinUrl: z.string().trim().url().optional(),
2099
+ website: z.string().trim().url().optional(),
2100
+ numEmployees: z.number().int().min(0).optional(),
2101
+ foundedYear: z.number().int().optional(),
2102
+ locationCity: z.string().trim().min(1).max(255).optional(),
2103
+ locationState: z.string().trim().min(1).max(255).optional(),
2104
+ category: z.string().trim().min(1).max(255).optional(),
2105
+ segment: z.string().trim().min(1).max(255).optional(),
2106
+ pipelineStatus: z.record(z.string(), z.unknown()).optional(),
2107
+ enrichmentData: z.record(z.string(), z.unknown()).optional(),
2108
+ source: z.string().trim().min(1).max(255).optional(),
2109
+ batchId: z.string().trim().min(1).max(255).optional(),
2110
+ status: AcqCompanyStatusSchema.optional(),
2111
+ verticalResearch: z.string().trim().min(1).max(5000).nullable().optional()
2112
+ })
2113
+ .strict()
2114
+ .refine(
2115
+ (data) =>
2116
+ data.name !== undefined ||
2117
+ data.domain !== undefined ||
2118
+ data.linkedinUrl !== undefined ||
2119
+ data.website !== undefined ||
2120
+ data.numEmployees !== undefined ||
2121
+ data.foundedYear !== undefined ||
2122
+ data.locationCity !== undefined ||
2123
+ data.locationState !== undefined ||
2124
+ data.category !== undefined ||
2125
+ data.segment !== undefined ||
2126
+ data.pipelineStatus !== undefined ||
2127
+ data.enrichmentData !== undefined ||
2128
+ data.source !== undefined ||
2129
+ data.batchId !== undefined ||
2130
+ data.status !== undefined ||
2131
+ data.verticalResearch !== undefined,
2132
+ {
2133
+ message: 'At least one field must be provided'
2134
+ }
2017
2135
  )
2018
2136
  ```
2019
2137
 
2020
2138
  ### `CreateContactRequestSchema`
2021
2139
 
2022
2140
  ```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
- })
2141
+ export const CreateContactRequestSchema = z
2142
+ .object({
2143
+ email: z.string().trim().email(),
2144
+ companyId: UuidSchema.optional(),
2145
+ firstName: z.string().trim().min(1).max(255).optional(),
2146
+ lastName: z.string().trim().min(1).max(255).optional(),
2147
+ linkedinUrl: z.string().trim().url().optional(),
2148
+ title: z.string().trim().min(1).max(255).optional(),
2149
+ source: z.string().trim().min(1).max(255).optional(),
2150
+ sourceId: z.string().trim().min(1).max(255).optional(),
2151
+ batchId: z.string().trim().min(1).max(255).optional()
2152
+ })
2035
2153
  .strict()
2036
2154
  ```
2037
2155
 
2038
2156
  ### `UpdateContactRequestSchema`
2039
2157
 
2040
2158
  ```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
- }
2159
+ export const UpdateContactRequestSchema = z
2160
+ .object({
2161
+ companyId: UuidSchema.optional(),
2162
+ emailValid: AcqEmailValidSchema.optional(),
2163
+ firstName: z.string().trim().min(1).max(255).optional(),
2164
+ lastName: z.string().trim().min(1).max(255).optional(),
2165
+ linkedinUrl: z.string().trim().url().optional(),
2166
+ title: z.string().trim().min(1).max(255).optional(),
2167
+ headline: z.string().trim().min(1).max(5000).optional(),
2168
+ filterReason: z.string().trim().min(1).max(5000).optional(),
2169
+ openingLine: z.string().trim().min(1).max(5000).optional(),
2170
+ pipelineStatus: z.record(z.string(), z.unknown()).optional(),
2171
+ enrichmentData: z.record(z.string(), z.unknown()).optional(),
2172
+ status: AcqContactStatusSchema.optional()
2173
+ })
2174
+ .strict()
2175
+ .refine(
2176
+ (data) =>
2177
+ data.companyId !== undefined ||
2178
+ data.emailValid !== undefined ||
2179
+ data.firstName !== undefined ||
2180
+ data.lastName !== undefined ||
2181
+ data.linkedinUrl !== undefined ||
2182
+ data.title !== undefined ||
2183
+ data.headline !== undefined ||
2184
+ data.filterReason !== undefined ||
2185
+ data.openingLine !== undefined ||
2186
+ data.pipelineStatus !== undefined ||
2187
+ data.enrichmentData !== undefined ||
2188
+ data.status !== undefined,
2189
+ {
2190
+ message: 'At least one field must be provided'
2191
+ }
2074
2192
  )
2075
2193
  ```
2076
2194
 
2077
2195
  ### `AcqCompanyResponseSchema`
2078
2196
 
2079
2197
  ```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()
2198
+ export const AcqCompanyResponseSchema = z.object({
2199
+ id: z.string(),
2200
+ organizationId: z.string(),
2201
+ name: z.string(),
2202
+ domain: z.string().nullable(),
2203
+ linkedinUrl: z.string().nullable(),
2204
+ website: z.string().nullable(),
2205
+ numEmployees: z.number().nullable(),
2206
+ foundedYear: z.number().nullable(),
2207
+ locationCity: z.string().nullable(),
2208
+ locationState: z.string().nullable(),
2209
+ category: z.string().nullable(),
2210
+ categoryPain: z.string().nullable(),
2211
+ segment: z.string().nullable(),
2212
+ pipelineStatus: z.record(z.string(), z.unknown()).nullable(),
2213
+ enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2214
+ source: z.string().nullable(),
2215
+ batchId: z.string().nullable(),
2216
+ status: AcqCompanyStatusSchema,
2217
+ contactCount: z.number().int().min(0),
2218
+ verticalResearch: z.string().nullable(),
2219
+ createdAt: z.string(),
2220
+ updatedAt: z.string()
2103
2221
  })
2104
2222
  ```
2105
2223
 
2106
2224
  ### `AcqCompanyListResponseSchema`
2107
2225
 
2108
2226
  ```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()
2227
+ export const AcqCompanyListResponseSchema = z.object({
2228
+ data: z.array(AcqCompanyResponseSchema),
2229
+ total: z.number().int(),
2230
+ limit: z.number().int(),
2231
+ offset: z.number().int()
2114
2232
  })
2115
2233
  ```
2116
2234
 
2117
2235
  ### `AcqCompanyFacetsResponseSchema`
2118
2236
 
2119
2237
  ```typescript
2120
- export const AcqCompanyFacetsResponseSchema = z.object({
2121
- segments: z.array(z.string()),
2122
- categories: z.array(z.string()),
2123
- statuses: z.array(AcqCompanyStatusSchema)
2238
+ export const AcqCompanyFacetsResponseSchema = z.object({
2239
+ segments: z.array(z.string()),
2240
+ categories: z.array(z.string()),
2241
+ statuses: z.array(AcqCompanyStatusSchema)
2124
2242
  })
2125
2243
  ```
2126
2244
 
2127
2245
  ### `AcqContactCompanySummarySchema`
2128
2246
 
2129
2247
  ```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
2248
+ export const AcqContactCompanySummarySchema = z.object({
2249
+ id: z.string(),
2250
+ name: z.string(),
2251
+ domain: z.string().nullable(),
2252
+ website: z.string().nullable(),
2253
+ linkedinUrl: z.string().nullable(),
2254
+ segment: z.string().nullable(),
2255
+ category: z.string().nullable(),
2256
+ status: AcqCompanyStatusSchema
2139
2257
  })
2140
2258
  ```
2141
2259
 
2142
2260
  ### `AcqContactResponseSchema`
2143
2261
 
2144
2262
  ```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()
2263
+ export const AcqContactResponseSchema = z.object({
2264
+ id: z.string(),
2265
+ organizationId: z.string(),
2266
+ companyId: z.string().nullable(),
2267
+ email: z.string(),
2268
+ emailValid: AcqEmailValidSchema.nullable(),
2269
+ firstName: z.string().nullable(),
2270
+ lastName: z.string().nullable(),
2271
+ linkedinUrl: z.string().nullable(),
2272
+ title: z.string().nullable(),
2273
+ headline: z.string().nullable(),
2274
+ filterReason: z.string().nullable(),
2275
+ openingLine: z.string().nullable(),
2276
+ source: z.string().nullable(),
2277
+ sourceId: z.string().nullable(),
2278
+ pipelineStatus: z.record(z.string(), z.unknown()).nullable(),
2279
+ enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2280
+ attioPersonId: z.string().nullable(),
2281
+ batchId: z.string().nullable(),
2282
+ status: AcqContactStatusSchema,
2283
+ company: AcqContactCompanySummarySchema.nullable().optional(),
2284
+ createdAt: z.string(),
2285
+ updatedAt: z.string()
2168
2286
  })
2169
2287
  ```
2170
2288
 
2171
2289
  ### `AcqContactListResponseSchema`
2172
2290
 
2173
2291
  ```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()
2292
+ export const AcqContactListResponseSchema = z.object({
2293
+ data: z.array(AcqContactResponseSchema),
2294
+ total: z.number().int(),
2295
+ limit: z.number().int(),
2296
+ offset: z.number().int()
2179
2297
  })
2180
2298
  ```
2181
2299
 
@@ -2188,223 +2306,226 @@ export const AcqArtifactOwnerKindSchema = z.enum(['company', 'contact', 'deal',
2188
2306
  ### `ListArtifactsQuerySchema`
2189
2307
 
2190
2308
  ```typescript
2191
- export const ListArtifactsQuerySchema = z
2192
- .object({
2193
- ownerKind: AcqArtifactOwnerKindSchema,
2194
- ownerId: UuidSchema
2195
- })
2309
+ export const ListArtifactsQuerySchema = z
2310
+ .object({
2311
+ ownerKind: AcqArtifactOwnerKindSchema,
2312
+ ownerId: UuidSchema
2313
+ })
2196
2314
  .strict()
2197
2315
  ```
2198
2316
 
2199
2317
  ### `CreateArtifactRequestSchema`
2200
2318
 
2201
2319
  ```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
- })
2320
+ export const CreateArtifactRequestSchema = z
2321
+ .object({
2322
+ ownerKind: AcqArtifactOwnerKindSchema,
2323
+ ownerId: UuidSchema,
2324
+ kind: z.string().trim().min(1).max(255),
2325
+ content: z.record(z.string(), z.unknown()),
2326
+ sourceExecutionId: UuidSchema.optional()
2327
+ })
2210
2328
  .strict()
2211
2329
  ```
2212
2330
 
2213
2331
  ### `AcqArtifactResponseSchema`
2214
2332
 
2215
2333
  ```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()
2334
+ export const AcqArtifactResponseSchema = z.object({
2335
+ id: z.string(),
2336
+ organizationId: z.string(),
2337
+ ownerKind: z.string(),
2338
+ ownerId: z.string(),
2339
+ kind: z.string(),
2340
+ content: z.record(z.string(), z.unknown()),
2341
+ sourceExecutionId: z.string().nullable(),
2342
+ createdBy: z.string().nullable(),
2343
+ createdAt: z.string(),
2344
+ version: z.number().int()
2227
2345
  })
2228
2346
  ```
2229
2347
 
2230
2348
  ### `AcqArtifactListResponseSchema`
2231
2349
 
2232
2350
  ```typescript
2233
- export const AcqArtifactListResponseSchema = z.object({
2234
- artifacts: z.array(AcqArtifactResponseSchema)
2351
+ export const AcqArtifactListResponseSchema = z.object({
2352
+ artifacts: z.array(AcqArtifactResponseSchema)
2235
2353
  })
2236
2354
  ```
2237
2355
 
2238
2356
  ### `ListMembersQuerySchema`
2239
2357
 
2240
2358
  ```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
- })
2359
+ export const ListMembersQuerySchema = z
2360
+ .object({
2361
+ limit: z.coerce.number().int().min(1).max(500).default(50),
2362
+ offset: z.coerce.number().int().min(0).default(0)
2363
+ })
2246
2364
  .strict()
2247
2365
  ```
2248
2366
 
2249
2367
  ### `MemberIdParamsSchema`
2250
2368
 
2251
2369
  ```typescript
2252
- export const MemberIdParamsSchema = z.object({
2253
- memberId: UuidSchema
2370
+ export const MemberIdParamsSchema = z.object({
2371
+ memberId: UuidSchema
2254
2372
  })
2255
2373
  ```
2256
2374
 
2257
2375
  ### `AcqListMemberContactSummarySchema`
2258
2376
 
2259
2377
  ```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()
2378
+ export const AcqListMemberContactSummarySchema = z.object({
2379
+ id: z.string(),
2380
+ email: z.string(),
2381
+ firstName: z.string().nullable(),
2382
+ lastName: z.string().nullable(),
2383
+ title: z.string().nullable(),
2384
+ linkedinUrl: z.string().nullable(),
2385
+ companyId: z.string().nullable()
2268
2386
  })
2269
2387
  ```
2270
2388
 
2271
2389
  ### `AcqListMemberResponseSchema`
2272
2390
 
2273
2391
  ```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()
2392
+ export const AcqListMemberResponseSchema = z.object({
2393
+ id: z.string(),
2394
+ listId: z.string(),
2395
+ contactId: z.string(),
2396
+ pipelineKey: z.string(),
2397
+ stageKey: z.string(),
2398
+ stateKey: z.string(),
2399
+ activityLog: z.unknown(),
2400
+ addedAt: z.string(),
2401
+ addedBy: z.string().nullable(),
2402
+ sourceExecutionId: z.string().nullable(),
2403
+ contact: AcqListMemberContactSummarySchema.nullable()
2286
2404
  })
2287
2405
  ```
2288
2406
 
2289
2407
  ### `AcqListMembersResponseSchema`
2290
2408
 
2291
2409
  ```typescript
2292
- export const AcqListMembersResponseSchema = z.object({
2293
- members: z.array(AcqListMemberResponseSchema)
2410
+ export const AcqListMembersResponseSchema = z.object({
2411
+ members: z.array(AcqListMemberResponseSchema)
2294
2412
  })
2295
2413
  ```
2296
2414
 
2297
2415
  ### `ListCompanyIdParamsSchema`
2298
2416
 
2299
2417
  ```typescript
2300
- export const ListCompanyIdParamsSchema = z.object({
2301
- listCompanyId: UuidSchema
2418
+ export const ListCompanyIdParamsSchema = z.object({
2419
+ listCompanyId: UuidSchema
2302
2420
  })
2303
2421
  ```
2304
2422
 
2305
2423
  ### `AcqListCompanyResponseSchema`
2306
2424
 
2307
2425
  ```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()
2426
+ export const AcqListCompanyResponseSchema = z.object({
2427
+ id: z.string(),
2428
+ listId: z.string(),
2429
+ companyId: z.string(),
2430
+ pipelineKey: z.string(),
2431
+ stageKey: z.string(),
2432
+ stateKey: z.string(),
2433
+ activityLog: z.unknown(),
2434
+ addedAt: z.string(),
2435
+ addedBy: z.string().nullable(),
2436
+ sourceExecutionId: z.string().nullable()
2319
2437
  })
2320
2438
  ```
2321
2439
 
2322
2440
  ### `AcqCompanySchemas`
2323
2441
 
2324
2442
  ```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
2443
+ export const AcqCompanySchemas = {
2444
+ CompanyIdParams: CompanyIdParamsSchema,
2445
+ ListCompaniesQuery: ListCompaniesQuerySchema,
2446
+ CreateCompanyRequest: CreateCompanyRequestSchema,
2447
+ UpdateCompanyRequest: UpdateCompanyRequestSchema,
2448
+ AcqCompanyResponse: AcqCompanyResponseSchema,
2449
+ AcqCompanyListResponse: AcqCompanyListResponseSchema,
2450
+ AcqCompanyFacetsResponse: AcqCompanyFacetsResponseSchema
2333
2451
  }
2334
2452
  ```
2335
2453
 
2336
2454
  ### `AcqContactSchemas`
2337
2455
 
2338
2456
  ```typescript
2339
- export const AcqContactSchemas = {
2340
- ContactIdParams: ContactIdParamsSchema,
2341
- ListContactsQuery: ListContactsQuerySchema,
2342
- CreateContactRequest: CreateContactRequestSchema,
2343
- UpdateContactRequest: UpdateContactRequestSchema,
2344
- AcqContactResponse: AcqContactResponseSchema,
2345
- AcqContactListResponse: AcqContactListResponseSchema
2457
+ export const AcqContactSchemas = {
2458
+ ContactIdParams: ContactIdParamsSchema,
2459
+ ListContactsQuery: ListContactsQuerySchema,
2460
+ CreateContactRequest: CreateContactRequestSchema,
2461
+ UpdateContactRequest: UpdateContactRequestSchema,
2462
+ AcqContactResponse: AcqContactResponseSchema,
2463
+ AcqContactListResponse: AcqContactListResponseSchema
2346
2464
  }
2347
2465
  ```
2348
2466
 
2349
2467
  ### `AcqListSchemas`
2350
2468
 
2351
2469
  ```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
2470
+ export const AcqListSchemas = {
2471
+ // Params
2472
+ ListIdParams: ListIdParamsSchema,
2473
+
2474
+ // Primitives (for UI / tests)
2475
+ ListStatus: ListStatusSchema,
2476
+ ScrapingConfig: ScrapingConfigSchema,
2477
+ IcpRubric: IcpRubricSchema,
2478
+ PipelineConfig: PipelineConfigSchema,
2479
+ PipelineStage: PipelineStageSchema,
2480
+ BuildPlanSnapshot: BuildPlanSnapshotSchema,
2481
+ BuildPlanSnapshotStep: BuildPlanSnapshotStepSchema,
2482
+ AcqListMetadata: AcqListMetadataSchema,
2483
+ ProcessingStageStatus: ProcessingStageStatusSchema,
2484
+ ListStageCounts: ListStageCountsSchema,
2485
+ ListTelemetry: ListTelemetrySchema,
2486
+
2487
+ // Requests
2488
+ CreateListRequest: CreateListRequestSchema,
2489
+ UpdateListRequest: UpdateListRequestSchema,
2490
+ UpdateListStatusRequest: UpdateListStatusRequestSchema,
2491
+ UpdateListConfigRequest: UpdateListConfigRequestSchema,
2492
+ AddCompaniesToListRequest: AddCompaniesToListRequestSchema,
2493
+ RemoveCompaniesFromListRequest: RemoveCompaniesFromListRequestSchema,
2494
+ AddContactsToListRequest: AddContactsToListRequestSchema,
2495
+ RecordListExecutionRequest: RecordListExecutionRequestSchema,
2496
+
2497
+ // Responses
2498
+ AcqListResponse: AcqListResponseSchema,
2499
+ AcqListListResponse: AcqListListResponseSchema,
2500
+ ListTelemetryResponse: ListTelemetryResponseSchema,
2501
+ ListTelemetryListResponse: ListTelemetryListResponseSchema,
2502
+ ListExecutionsResponse: ListExecutionsResponseSchema,
2503
+ ListProgressResponse: ListProgressResponseSchema
2383
2504
  }
2384
2505
  ```
2385
2506
 
2386
2507
  ### `AcqSubstrateSchemas`
2387
2508
 
2388
2509
  ```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
2510
+ export const AcqSubstrateSchemas = {
2511
+ // Artifacts
2512
+ ListArtifactsQuery: ListArtifactsQuerySchema,
2513
+ CreateArtifactRequest: CreateArtifactRequestSchema,
2514
+ AcqArtifactResponse: AcqArtifactResponseSchema,
2515
+ AcqArtifactListResponse: AcqArtifactListResponseSchema,
2516
+
2517
+ // List members
2518
+ ListMembersQuery: ListMembersQuerySchema,
2519
+ MemberIdParams: MemberIdParamsSchema,
2520
+ AcqListMemberResponse: AcqListMemberResponseSchema,
2521
+ AcqListMembersResponse: AcqListMembersResponseSchema,
2522
+
2523
+ // List companies
2524
+ ListCompanyIdParams: ListCompanyIdParamsSchema,
2525
+ AcqListCompanyResponse: AcqListCompanyResponseSchema,
2526
+
2527
+ // Transition (shared with deals — TransitionItemRequestSchema)
2528
+ TransitionItemRequest: TransitionItemRequestSchema
2408
2529
  }
2409
2530
  ```
2410
2531
 
@@ -2615,11 +2736,12 @@ export interface CreateListParams {
2615
2736
  description?: string
2616
2737
  type?: string
2617
2738
  batchIds?: string[]
2618
- instantlyCampaignId?: string
2619
- status?: ListStatus
2620
- metadata?: Record<string, unknown>
2621
- scrapingConfig?: ScrapingConfig
2622
- icp?: IcpRubric
2739
+ instantlyCampaignId?: string
2740
+ status?: ListStatus
2741
+ buildTemplateId?: string
2742
+ metadata?: Record<string, unknown>
2743
+ scrapingConfig?: ScrapingConfig
2744
+ icp?: IcpRubric
2623
2745
  pipelineConfig?: PipelineConfig
2624
2746
  }
2625
2747
  ```
@@ -2627,10 +2749,10 @@ export interface CreateListParams {
2627
2749
  ### `UpdateListParams`
2628
2750
 
2629
2751
  ```typescript
2630
- export interface UpdateListParams {
2631
- name?: string
2632
- description?: string
2633
- batchIds?: string[]
2752
+ export interface UpdateListParams {
2753
+ name?: string
2754
+ description?: string
2755
+ batchIds?: string[]
2634
2756
  }
2635
2757
  ```
2636
2758
 
@@ -3042,6 +3164,7 @@ export type LeadToolMap = {
3042
3164
  markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
3043
3165
  updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
3044
3166
  updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
3167
+ cacheInstantlyThreadIds: { params: Omit<CacheInstantlyThreadIdsParams, 'organizationId'>; result: void }
3045
3168
  transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
3046
3169
  setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
3047
3170
  cancelSchedulesAndHitlByEmail: {