@elevasis/core 0.14.0 → 0.15.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.
@@ -998,218 +998,218 @@ export const AcqDealTaskKindSchema = z.enum(['call', 'email', 'meeting', 'other'
998
998
  ### `DealIdParamsSchema`
999
999
 
1000
1000
  ```typescript
1001
- export const DealIdParamsSchema = z.object({
1002
- dealId: UuidSchema
1001
+ export const DealIdParamsSchema = z.object({
1002
+ dealId: UuidSchema
1003
1003
  })
1004
1004
  ```
1005
1005
 
1006
1006
  ### `DealTaskIdParamsSchema`
1007
1007
 
1008
1008
  ```typescript
1009
- export const DealTaskIdParamsSchema = z.object({
1010
- dealId: UuidSchema,
1011
- taskId: UuidSchema
1009
+ export const DealTaskIdParamsSchema = z.object({
1010
+ dealId: UuidSchema,
1011
+ taskId: UuidSchema
1012
1012
  })
1013
1013
  ```
1014
1014
 
1015
1015
  ### `ListDealsQuerySchema`
1016
1016
 
1017
1017
  ```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
- })
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
+ })
1025
1025
  .strict()
1026
1026
  ```
1027
1027
 
1028
1028
  ### `DealLookupQuerySchema`
1029
1029
 
1030
1030
  ```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
- })
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
+ })
1036
1036
  .strict()
1037
1037
  ```
1038
1038
 
1039
1039
  ### `ListDealTasksDueQuerySchema`
1040
1040
 
1041
1041
  ```typescript
1042
- export const ListDealTasksDueQuerySchema = z
1043
- .object({
1044
- window: z.enum(['overdue', 'today', 'today_and_overdue', 'upcoming']).optional(),
1045
- assigneeUserId: UuidSchema.optional()
1046
- })
1042
+ export const ListDealTasksDueQuerySchema = z
1043
+ .object({
1044
+ window: z.enum(['overdue', 'today', 'today_and_overdue', 'upcoming']).optional(),
1045
+ assigneeUserId: UuidSchema.optional()
1046
+ })
1047
1047
  .strict()
1048
1048
  ```
1049
1049
 
1050
1050
  ### `CreateDealNoteRequestSchema`
1051
1051
 
1052
1052
  ```typescript
1053
- export const CreateDealNoteRequestSchema = z
1054
- .object({
1055
- body: z.string().trim().min(1).max(10000)
1056
- })
1053
+ export const CreateDealNoteRequestSchema = z
1054
+ .object({
1055
+ body: z.string().trim().min(1).max(10000)
1056
+ })
1057
1057
  .strict()
1058
1058
  ```
1059
1059
 
1060
1060
  ### `CreateDealTaskRequestSchema`
1061
1061
 
1062
1062
  ```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
- })
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
+ })
1071
1071
  .strict()
1072
1072
  ```
1073
1073
 
1074
1074
  ### `TransitionItemRequestSchema`
1075
1075
 
1076
1076
  ```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
- })
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
+ })
1085
1085
  .strict()
1086
1086
  ```
1087
1087
 
1088
1088
  ### `ExecuteActionParamsSchema`
1089
1089
 
1090
1090
  ```typescript
1091
- export const ExecuteActionParamsSchema = z
1092
- .object({
1093
- dealId: UuidSchema,
1094
- actionKey: NonEmptyStringSchema
1095
- })
1091
+ export const ExecuteActionParamsSchema = z
1092
+ .object({
1093
+ dealId: UuidSchema,
1094
+ actionKey: NonEmptyStringSchema
1095
+ })
1096
1096
  .strict()
1097
1097
  ```
1098
1098
 
1099
1099
  ### `ExecuteActionRequestSchema`
1100
1100
 
1101
1101
  ```typescript
1102
- export const ExecuteActionRequestSchema = z
1103
- .object({
1104
- payload: z.record(z.string(), z.unknown()).optional()
1105
- })
1102
+ export const ExecuteActionRequestSchema = z
1103
+ .object({
1104
+ payload: z.record(z.string(), z.unknown()).optional()
1105
+ })
1106
1106
  .strict()
1107
1107
  ```
1108
1108
 
1109
1109
  ### `DealContactSummarySchema`
1110
1110
 
1111
1111
  ```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()
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()
1138
1138
  })
1139
1139
  ```
1140
1140
 
1141
1141
  ### `DealListItemSchema`
1142
1142
 
1143
1143
  ```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(),
1171
- created_at: z.string(),
1172
- updated_at: z.string(),
1173
- // joined relation
1174
- contact: DealContactSummarySchema.nullable()
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(),
1171
+ created_at: z.string(),
1172
+ updated_at: z.string(),
1173
+ // joined relation
1174
+ contact: DealContactSummarySchema.nullable()
1175
1175
  })
1176
1176
  ```
1177
1177
 
1178
1178
  ### `DealListResponseSchema`
1179
1179
 
1180
1180
  ```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()
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()
1186
1186
  })
1187
1187
  ```
1188
1188
 
1189
1189
  ### `DealDetailResponseSchema`
1190
1190
 
1191
1191
  ```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
- */
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
1196
  export const DealDetailResponseSchema = DealListItemSchema
1197
1197
  ```
1198
1198
 
1199
1199
  ### `DealNoteResponseSchema`
1200
1200
 
1201
1201
  ```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()
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()
1213
1213
  })
1214
1214
  ```
1215
1215
 
@@ -1222,24 +1222,24 @@ export const DealNoteListResponseSchema = z.array(DealNoteResponseSchema)
1222
1222
  ### `DealTaskResponseSchema`
1223
1223
 
1224
1224
  ```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()
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()
1243
1243
  })
1244
1244
  ```
1245
1245
 
@@ -1252,152 +1252,157 @@ export const DealTaskListResponseSchema = z.array(DealTaskResponseSchema)
1252
1252
  ### `DealSchemas`
1253
1253
 
1254
1254
  ```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
- ExecuteActionParams: ExecuteActionParamsSchema,
1270
- ExecuteActionRequest: ExecuteActionRequestSchema,
1271
-
1272
- // Responses
1273
- DealListResponse: DealListResponseSchema,
1274
- DealSummaryResponse: DealSummaryResponseSchema,
1275
- DealLookupResponse: DealLookupResponseSchema,
1276
- DealDetailResponse: DealDetailResponseSchema,
1277
- DealNoteResponse: DealNoteResponseSchema,
1278
- DealNoteListResponse: DealNoteListResponseSchema,
1279
- DealTaskResponse: DealTaskResponseSchema,
1280
- DealTaskListResponse: DealTaskListResponseSchema
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
1281
1282
  }
1282
1283
  ```
1283
1284
 
1284
1285
  ### `Action`
1285
1286
 
1286
1287
  ```typescript
1287
- export interface Action {
1288
- key: string
1289
- label: string
1290
- payloadSchema?: z.ZodTypeAny
1288
+ export interface Action {
1289
+ key: string
1290
+ label: string
1291
+ payloadSchema?: z.ZodTypeAny
1291
1292
  }
1292
1293
  ```
1293
1294
 
1294
1295
  ### `ActionDef`
1295
1296
 
1296
1297
  ```typescript
1297
- export interface ActionDef {
1298
- key: string
1299
- label: string
1300
- isAvailableFor: (deal: AcqDealRow) => boolean
1301
- workflowId: string
1302
- payloadSchema?: z.ZodTypeAny
1298
+ export interface ActionDef {
1299
+ key: string
1300
+ label: string
1301
+ isAvailableFor: (deal: AcqDealRow) => boolean
1302
+ workflowId: string
1303
+ payloadSchema?: z.ZodTypeAny
1303
1304
  }
1304
1305
  ```
1305
1306
 
1306
1307
  ### `DEFAULT_CRM_ACTIONS`
1307
1308
 
1308
1309
  ```typescript
1309
- export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
1310
- {
1311
- key: 'move_to_proposal',
1312
- label: 'Move to Proposal',
1313
- isAvailableFor: (deal) => deal.stage_key === 'interested',
1314
- workflowId: 'move_to_proposal-workflow'
1315
- },
1316
- {
1317
- key: 'move_to_closing',
1318
- label: 'Move to Closing',
1319
- isAvailableFor: (deal) => deal.stage_key === 'proposal',
1320
- workflowId: 'move_to_closing-workflow'
1321
- },
1322
- {
1323
- key: 'move_to_closed_won',
1324
- label: 'Close Won',
1325
- isAvailableFor: (deal) => deal.stage_key === 'closing',
1326
- workflowId: 'move_to_closed_won-workflow'
1327
- },
1328
- {
1329
- key: 'move_to_closed_lost',
1330
- label: 'Close Lost',
1331
- isAvailableFor: (deal) =>
1332
- deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
1333
- workflowId: 'move_to_closed_lost-workflow'
1334
- },
1335
- {
1336
- key: 'move_to_nurturing',
1337
- label: 'Move to Nurturing',
1338
- isAvailableFor: (deal) =>
1339
- deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
1340
- workflowId: 'move_to_nurturing-workflow'
1341
- },
1342
- {
1343
- key: 'send_reply',
1344
- label: 'Send Reply',
1345
- isAvailableFor: (deal) =>
1346
- deal.stage_key === 'interested' &&
1347
- (deal.state_key === 'discovery_replied' ||
1348
- deal.state_key === 'discovery_link_sent' ||
1349
- deal.state_key === 'discovery_nudging'),
1350
- workflowId: 'crm-send-reply-workflow',
1351
- payloadSchema: SendReplyActionPayloadSchema
1352
- },
1353
- {
1354
- key: 'send_link',
1355
- label: 'Send Booking Link',
1356
- isAvailableFor: (deal) => deal.stage_key === 'interested' && deal.state_key === 'discovery_replied',
1357
- workflowId: 'crm-send-booking-link-workflow'
1358
- },
1359
- {
1360
- key: 'send_nudge',
1361
- label: 'Send Nudge',
1362
- isAvailableFor: (deal) =>
1363
- deal.stage_key === 'interested' &&
1364
- (deal.state_key === 'discovery_link_sent' || deal.state_key === 'discovery_nudging'),
1365
- workflowId: 'crm-send-nudge-workflow'
1366
- },
1367
- {
1368
- key: 'mark_no_show',
1369
- label: 'Mark No-Show',
1370
- isAvailableFor: (deal) => deal.stage_key === 'interested' && deal.state_key === 'discovery_nudging',
1371
- // Mirrors the auto-timeout precedent in operations/sales/crm/pipeline/timeout-actions.ts:
1372
- // both manual-click and timeout move the deal to closed_lost. The action_taken activity
1373
- // event captures operator intent and distinguishes the manual variant from the timed one.
1374
- workflowId: 'mark_no_show-workflow'
1375
- },
1376
- {
1377
- key: 'rebook',
1378
- label: 'Rebook',
1379
- isAvailableFor: (deal) => deal.stage_key === 'interested' && deal.state_key === 'discovery_booking_cancelled',
1380
- workflowId: 'crm-rebook-workflow'
1381
- }
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
+ {
1344
+ key: 'send_reply',
1345
+ label: 'Send Reply',
1346
+ isAvailableFor: (deal) =>
1347
+ deal.stage_key === 'interested' &&
1348
+ (deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey ||
1349
+ deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
1350
+ 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
+ }
1382
1387
  ]
1383
1388
  ```
1384
1389
 
1385
1390
  ### `CrmToolMap`
1386
1391
 
1387
1392
  ```typescript
1388
- export type CrmToolMap = {
1389
- getRecentActivity: { params: CrmRecentActivityParams; result: RecentActivityEntry[] }
1390
- listDeals: { params: CrmListDealsParams; result: DealListItem[] }
1391
- getDeal: { params: CrmGetDealParams; result: DealDetail | null }
1392
- getDealByEmail: { params: CrmGetDealByEmailParams; result: DealDetail | null }
1393
- createDealNote: { params: CrmDealNoteParams; result: AcqDealNote }
1394
- listDealNotes: { params: Omit<ListDealNotesParams, 'organizationId'>; result: AcqDealNote[] }
1395
- createDealTask: { params: CrmDealTaskParams; result: AcqDealTask }
1396
- listDealTasks: { params: Omit<ListDealTasksParams, 'organizationId'>; result: AcqDealTask[] }
1397
- listDealTasksDue: { params: CrmTaskDueParams; result: AcqDealTask[] }
1398
- completeDealTask: { params: Omit<CompleteDealTaskParams, 'organizationId'>; result: AcqDealTask }
1399
- recordActivity: { params: CrmRecordActivityParams; result: void }
1400
- deleteDeal: { params: CrmDeleteDealParams; result: void }
1393
+ export type CrmToolMap = {
1394
+ getRecentActivity: { params: CrmRecentActivityParams; result: RecentActivityEntry[] }
1395
+ listDeals: { params: CrmListDealsParams; result: DealListItem[] }
1396
+ getDeal: { params: CrmGetDealParams; result: DealDetail | null }
1397
+ getDealByEmail: { params: CrmGetDealByEmailParams; result: DealDetail | null }
1398
+ createDealNote: { params: CrmDealNoteParams; result: AcqDealNote }
1399
+ listDealNotes: { params: Omit<ListDealNotesParams, 'organizationId'>; result: AcqDealNote[] }
1400
+ createDealTask: { params: CrmDealTaskParams; result: AcqDealTask }
1401
+ listDealTasks: { params: Omit<ListDealTasksParams, 'organizationId'>; result: AcqDealTask[] }
1402
+ listDealTasksDue: { params: CrmTaskDueParams; result: AcqDealTask[] }
1403
+ completeDealTask: { params: Omit<CompleteDealTaskParams, 'organizationId'>; result: AcqDealTask }
1404
+ recordActivity: { params: CrmRecordActivityParams; result: void }
1405
+ deleteDeal: { params: CrmDeleteDealParams; result: void }
1401
1406
  }
1402
1407
  ```
1403
1408
 
@@ -1637,9 +1642,10 @@ export interface AcqContact {
1637
1642
 
1638
1643
  ```typescript
1639
1644
  /**
1640
- * Live-scan aggregate telemetry for a single list, computed on demand from
1641
- * the list junction tables and current contact deliverability state.
1642
- */
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
+ */
1643
1649
  export interface ListTelemetry {
1644
1650
  listId: string
1645
1651
  totalCompanies: number
@@ -1668,165 +1674,167 @@ export interface ListTelemetry {
1668
1674
  ### `ListStageCountsSchema`
1669
1675
 
1670
1676
  ```typescript
1671
- export const ListStageCountsSchema = z.object({
1672
- stageCounts: z.object({
1673
- populated: z.number().int(),
1674
- extracted: z.number().int(),
1675
- qualified: z.number().int(),
1676
- discovered: z.number().int(),
1677
- verified: z.number().int(),
1678
- personalized: z.number().int(),
1679
- uploaded: z.number().int()
1680
- }),
1681
- deliverability: z.object({
1682
- valid: z.number().int(),
1683
- risky: z.number().int(),
1684
- invalid: z.number().int(),
1685
- unknown: z.number().int(),
1686
- bounced: z.number().int()
1687
- })
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
+ })
1688
1696
  })
1689
1697
  ```
1690
1698
 
1691
1699
  ### `ListTelemetrySchema`
1692
1700
 
1693
1701
  ```typescript
1694
- export const ListTelemetrySchema = z.object({
1695
- listId: UuidSchema,
1696
- totalCompanies: z.number().int(),
1697
- totalContacts: z.number().int(),
1698
- stageCounts: ListStageCountsSchema.shape.stageCounts,
1699
- deliverability: ListStageCountsSchema.shape.deliverability,
1700
- activeWorkflows: z.array(z.string()).optional()
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()
1701
1709
  })
1702
1710
  ```
1703
1711
 
1704
1712
  ### `ListIdParamsSchema`
1705
1713
 
1706
1714
  ```typescript
1707
- export const ListIdParamsSchema = z.object({
1708
- listId: UuidSchema
1715
+ export const ListIdParamsSchema = z.object({
1716
+ listId: UuidSchema
1709
1717
  })
1710
1718
  ```
1711
1719
 
1712
1720
  ### `CreateListRequestSchema`
1713
1721
 
1714
1722
  ```typescript
1715
- export const CreateListRequestSchema = z
1716
- .object({
1717
- name: z.string().trim().min(1).max(255),
1718
- description: z.string().trim().nullable().optional(),
1719
- status: ListStatusSchema.optional(),
1720
- scrapingConfig: ScrapingConfigSchema.optional(),
1721
- icp: IcpRubricSchema.optional(),
1722
- pipelineConfig: PipelineConfigSchema.optional()
1723
- })
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
+ })
1724
1732
  .strict()
1725
1733
  ```
1726
1734
 
1727
1735
  ### `UpdateListRequestSchema`
1728
1736
 
1729
1737
  ```typescript
1730
- export const UpdateListRequestSchema = z
1731
- .object({
1732
- name: z.string().trim().min(1).max(255).optional(),
1733
- description: z.string().trim().nullable().optional(),
1734
- batchIds: z.array(z.string()).optional()
1735
- })
1736
- .strict()
1737
- .refine((data) => data.name !== undefined || data.description !== undefined || data.batchIds !== undefined, {
1738
- message: 'At least one field (name, description, or batchIds) must be provided'
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'
1739
1747
  })
1740
1748
  ```
1741
1749
 
1742
1750
  ### `UpdateListConfigRequestSchema`
1743
1751
 
1744
1752
  ```typescript
1745
- /**
1746
- * Partial patch for the three jsonb config columns. UI sends only the edited
1747
- * subtree; server writes the field as-is (no deep merge — each column is
1748
- * replaced atomically when present in the patch).
1749
- */
1750
- export const UpdateListConfigRequestSchema = z
1751
- .object({
1752
- scrapingConfig: ScrapingConfigSchema.partial().optional(),
1753
- icp: IcpRubricSchema.partial().optional(),
1754
- pipelineConfig: PipelineConfigSchema.partial().optional()
1755
- })
1756
- .strict()
1757
- .refine((data) => data.scrapingConfig !== undefined || data.icp !== undefined || data.pipelineConfig !== undefined, {
1758
- message: 'At least one of scrapingConfig, icp, or pipelineConfig must be provided'
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'
1759
1767
  })
1760
1768
  ```
1761
1769
 
1762
1770
  ### `AddCompaniesToListRequestSchema`
1763
1771
 
1764
1772
  ```typescript
1765
- export const AddCompaniesToListRequestSchema = z
1766
- .object({
1767
- companyIds: z.array(UuidSchema).min(1).max(1000)
1768
- })
1773
+ export const AddCompaniesToListRequestSchema = z
1774
+ .object({
1775
+ companyIds: z.array(UuidSchema).min(1).max(1000)
1776
+ })
1769
1777
  .strict()
1770
1778
  ```
1771
1779
 
1772
1780
  ### `RemoveCompaniesFromListRequestSchema`
1773
1781
 
1774
1782
  ```typescript
1775
- export const RemoveCompaniesFromListRequestSchema = z
1776
- .object({
1777
- companyIds: z.array(UuidSchema).min(1).max(1000)
1778
- })
1783
+ export const RemoveCompaniesFromListRequestSchema = z
1784
+ .object({
1785
+ companyIds: z.array(UuidSchema).min(1).max(1000)
1786
+ })
1779
1787
  .strict()
1780
1788
  ```
1781
1789
 
1782
1790
  ### `AddContactsToListRequestSchema`
1783
1791
 
1784
1792
  ```typescript
1785
- export const AddContactsToListRequestSchema = z
1786
- .object({
1787
- contactIds: z.array(UuidSchema).min(1).max(1000)
1788
- })
1793
+ export const AddContactsToListRequestSchema = z
1794
+ .object({
1795
+ contactIds: z.array(UuidSchema).min(1).max(1000)
1796
+ })
1789
1797
  .strict()
1790
1798
  ```
1791
1799
 
1792
1800
  ### `RecordListExecutionRequestSchema`
1793
1801
 
1794
1802
  ```typescript
1795
- export const RecordListExecutionRequestSchema = z
1796
- .object({
1797
- executionId: UuidSchema,
1798
- configSnapshot: z.record(z.string(), z.unknown()).optional()
1799
- })
1803
+ export const RecordListExecutionRequestSchema = z
1804
+ .object({
1805
+ executionId: UuidSchema,
1806
+ configSnapshot: z.record(z.string(), z.unknown()).optional()
1807
+ })
1800
1808
  .strict()
1801
1809
  ```
1802
1810
 
1803
1811
  ### `AcqListResponseSchema`
1804
1812
 
1805
1813
  ```typescript
1806
- /**
1807
- * Single list as returned by /api/acquisition/lists/:id etc.
1808
- * Camel-cased domain shape matching AcqList in types.ts.
1809
- */
1810
- export const AcqListResponseSchema = z.object({
1811
- id: z.string(),
1812
- organizationId: z.string(),
1813
- name: z.string(),
1814
- description: z.string().nullable(),
1815
- type: z.string(),
1816
- batchIds: z.array(z.string()),
1817
- instantlyCampaignId: z.string().nullable(),
1818
- /** Lifecycle status (draft | enriching | launched | closing | archived). */
1819
- status: ListStatusSchema,
1820
- metadata: z.record(z.string(), z.unknown()),
1821
- launchedAt: z.string().nullable(),
1822
- completedAt: z.string().nullable(),
1823
- createdAt: z.string(),
1824
- /** Scraping criteria stored as jsonb on the row. */
1825
- scrapingConfig: ScrapingConfigSchema,
1826
- /** ICP / qualification rubric stored as jsonb on the row. */
1827
- icp: IcpRubricSchema,
1828
- /** Pipeline presentation contract stored as jsonb on the row. */
1829
- pipelineConfig: PipelineConfigSchema
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
1830
1838
  })
1831
1839
  ```
1832
1840
 
@@ -1851,17 +1859,17 @@ export const ListTelemetryListResponseSchema = z.array(ListTelemetrySchema)
1851
1859
  ### `ListExecutionSummarySchema`
1852
1860
 
1853
1861
  ```typescript
1854
- /**
1855
- * Row from acq_list_executions joined with the execution summary,
1856
- * shaped for the /lists/:id/executions response.
1857
- */
1858
- export const ListExecutionSummarySchema = z.object({
1859
- executionId: z.string(),
1860
- resourceId: z.string(),
1861
- status: z.string(),
1862
- createdAt: z.string(),
1863
- completedAt: z.string().nullable(),
1864
- durationMs: z.number().int().nullable()
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()
1865
1873
  })
1866
1874
  ```
1867
1875
 
@@ -1892,282 +1900,282 @@ export const AcqEmailValidSchema = z.enum(['VALID', 'INVALID', 'RISKY', 'UNKNOWN
1892
1900
  ### `CompanyIdParamsSchema`
1893
1901
 
1894
1902
  ```typescript
1895
- export const CompanyIdParamsSchema = z.object({
1896
- companyId: UuidSchema
1903
+ export const CompanyIdParamsSchema = z.object({
1904
+ companyId: UuidSchema
1897
1905
  })
1898
1906
  ```
1899
1907
 
1900
1908
  ### `ContactIdParamsSchema`
1901
1909
 
1902
1910
  ```typescript
1903
- export const ContactIdParamsSchema = z.object({
1904
- contactId: UuidSchema
1911
+ export const ContactIdParamsSchema = z.object({
1912
+ contactId: UuidSchema
1905
1913
  })
1906
1914
  ```
1907
1915
 
1908
1916
  ### `ListCompaniesQuerySchema`
1909
1917
 
1910
1918
  ```typescript
1911
- export const ListCompaniesQuerySchema = z
1912
- .object({
1913
- search: z.string().trim().min(1).max(200).optional(),
1914
- listId: UuidSchema.optional(),
1915
- domain: z.string().trim().min(1).max(255).optional(),
1916
- website: z.string().trim().min(1).max(2048).optional(),
1917
- segment: z.string().trim().min(1).max(255).optional(),
1918
- category: z.string().trim().min(1).max(255).optional(),
1919
- batchId: z.string().trim().min(1).max(255).optional(),
1920
- status: AcqCompanyStatusSchema.optional(),
1921
- includeAll: QueryBooleanSchema.optional(),
1922
- limit: z.coerce.number().int().min(1).max(5000).default(50),
1923
- offset: z.coerce.number().int().min(0).default(0)
1924
- })
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
+ })
1925
1933
  .strict()
1926
1934
  ```
1927
1935
 
1928
1936
  ### `ListContactsQuerySchema`
1929
1937
 
1930
1938
  ```typescript
1931
- export const ListContactsQuerySchema = z
1932
- .object({
1933
- search: z.string().trim().min(1).max(200).optional(),
1934
- listId: UuidSchema.optional(),
1935
- openingLineIsNull: QueryBooleanSchema.optional(),
1936
- batchId: z.string().trim().min(1).max(255).optional(),
1937
- contactStatus: AcqContactStatusSchema.optional(),
1938
- limit: z.coerce.number().int().min(1).max(5000).default(5000),
1939
- offset: z.coerce.number().int().min(0).default(0)
1940
- })
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
+ })
1941
1949
  .strict()
1942
1950
  ```
1943
1951
 
1944
1952
  ### `CreateCompanyRequestSchema`
1945
1953
 
1946
1954
  ```typescript
1947
- export const CreateCompanyRequestSchema = z
1948
- .object({
1949
- name: z.string().trim().min(1).max(255),
1950
- domain: z.string().trim().min(1).max(255).optional(),
1951
- linkedinUrl: z.string().trim().url().optional(),
1952
- website: z.string().trim().url().optional(),
1953
- numEmployees: z.number().int().min(0).optional(),
1954
- foundedYear: z.number().int().optional(),
1955
- locationCity: z.string().trim().min(1).max(255).optional(),
1956
- locationState: z.string().trim().min(1).max(255).optional(),
1957
- category: z.string().trim().min(1).max(255).optional(),
1958
- source: z.string().trim().min(1).max(255).optional(),
1959
- batchId: z.string().trim().min(1).max(255).optional(),
1960
- verticalResearch: z.string().trim().min(1).max(5000).optional()
1961
- })
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
+ })
1962
1970
  .strict()
1963
1971
  ```
1964
1972
 
1965
1973
  ### `UpdateCompanyRequestSchema`
1966
1974
 
1967
1975
  ```typescript
1968
- export const UpdateCompanyRequestSchema = z
1969
- .object({
1970
- name: z.string().trim().min(1).max(255).optional(),
1971
- domain: z.string().trim().min(1).max(255).optional(),
1972
- linkedinUrl: z.string().trim().url().optional(),
1973
- website: z.string().trim().url().optional(),
1974
- numEmployees: z.number().int().min(0).optional(),
1975
- foundedYear: z.number().int().optional(),
1976
- locationCity: z.string().trim().min(1).max(255).optional(),
1977
- locationState: z.string().trim().min(1).max(255).optional(),
1978
- category: z.string().trim().min(1).max(255).optional(),
1979
- segment: z.string().trim().min(1).max(255).optional(),
1980
- pipelineStatus: z.record(z.string(), z.unknown()).optional(),
1981
- enrichmentData: z.record(z.string(), z.unknown()).optional(),
1982
- source: z.string().trim().min(1).max(255).optional(),
1983
- batchId: z.string().trim().min(1).max(255).optional(),
1984
- status: AcqCompanyStatusSchema.optional(),
1985
- verticalResearch: z.string().trim().min(1).max(5000).nullable().optional()
1986
- })
1987
- .strict()
1988
- .refine(
1989
- (data) =>
1990
- data.name !== undefined ||
1991
- data.domain !== undefined ||
1992
- data.linkedinUrl !== undefined ||
1993
- data.website !== undefined ||
1994
- data.numEmployees !== undefined ||
1995
- data.foundedYear !== undefined ||
1996
- data.locationCity !== undefined ||
1997
- data.locationState !== undefined ||
1998
- data.category !== undefined ||
1999
- data.segment !== undefined ||
2000
- data.pipelineStatus !== undefined ||
2001
- data.enrichmentData !== undefined ||
2002
- data.source !== undefined ||
2003
- data.batchId !== undefined ||
2004
- data.status !== undefined ||
2005
- data.verticalResearch !== undefined,
2006
- {
2007
- message: 'At least one field must be provided'
2008
- }
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
+ }
2009
2017
  )
2010
2018
  ```
2011
2019
 
2012
2020
  ### `CreateContactRequestSchema`
2013
2021
 
2014
2022
  ```typescript
2015
- export const CreateContactRequestSchema = z
2016
- .object({
2017
- email: z.string().trim().email(),
2018
- companyId: UuidSchema.optional(),
2019
- firstName: z.string().trim().min(1).max(255).optional(),
2020
- lastName: z.string().trim().min(1).max(255).optional(),
2021
- linkedinUrl: z.string().trim().url().optional(),
2022
- title: z.string().trim().min(1).max(255).optional(),
2023
- source: z.string().trim().min(1).max(255).optional(),
2024
- sourceId: z.string().trim().min(1).max(255).optional(),
2025
- batchId: z.string().trim().min(1).max(255).optional()
2026
- })
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
+ })
2027
2035
  .strict()
2028
2036
  ```
2029
2037
 
2030
2038
  ### `UpdateContactRequestSchema`
2031
2039
 
2032
2040
  ```typescript
2033
- export const UpdateContactRequestSchema = z
2034
- .object({
2035
- companyId: UuidSchema.optional(),
2036
- emailValid: AcqEmailValidSchema.optional(),
2037
- firstName: z.string().trim().min(1).max(255).optional(),
2038
- lastName: z.string().trim().min(1).max(255).optional(),
2039
- linkedinUrl: z.string().trim().url().optional(),
2040
- title: z.string().trim().min(1).max(255).optional(),
2041
- headline: z.string().trim().min(1).max(5000).optional(),
2042
- filterReason: z.string().trim().min(1).max(5000).optional(),
2043
- openingLine: z.string().trim().min(1).max(5000).optional(),
2044
- pipelineStatus: z.record(z.string(), z.unknown()).optional(),
2045
- enrichmentData: z.record(z.string(), z.unknown()).optional(),
2046
- status: AcqContactStatusSchema.optional()
2047
- })
2048
- .strict()
2049
- .refine(
2050
- (data) =>
2051
- data.companyId !== undefined ||
2052
- data.emailValid !== undefined ||
2053
- data.firstName !== undefined ||
2054
- data.lastName !== undefined ||
2055
- data.linkedinUrl !== undefined ||
2056
- data.title !== undefined ||
2057
- data.headline !== undefined ||
2058
- data.filterReason !== undefined ||
2059
- data.openingLine !== undefined ||
2060
- data.pipelineStatus !== undefined ||
2061
- data.enrichmentData !== undefined ||
2062
- data.status !== undefined,
2063
- {
2064
- message: 'At least one field must be provided'
2065
- }
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
+ }
2066
2074
  )
2067
2075
  ```
2068
2076
 
2069
2077
  ### `AcqCompanyResponseSchema`
2070
2078
 
2071
2079
  ```typescript
2072
- export const AcqCompanyResponseSchema = z.object({
2073
- id: z.string(),
2074
- organizationId: z.string(),
2075
- name: z.string(),
2076
- domain: z.string().nullable(),
2077
- linkedinUrl: z.string().nullable(),
2078
- website: z.string().nullable(),
2079
- numEmployees: z.number().nullable(),
2080
- foundedYear: z.number().nullable(),
2081
- locationCity: z.string().nullable(),
2082
- locationState: z.string().nullable(),
2083
- category: z.string().nullable(),
2084
- categoryPain: z.string().nullable(),
2085
- segment: z.string().nullable(),
2086
- pipelineStatus: z.record(z.string(), z.unknown()).nullable(),
2087
- enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2088
- source: z.string().nullable(),
2089
- batchId: z.string().nullable(),
2090
- status: AcqCompanyStatusSchema,
2091
- contactCount: z.number().int().min(0),
2092
- verticalResearch: z.string().nullable(),
2093
- createdAt: z.string(),
2094
- updatedAt: z.string()
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()
2095
2103
  })
2096
2104
  ```
2097
2105
 
2098
2106
  ### `AcqCompanyListResponseSchema`
2099
2107
 
2100
2108
  ```typescript
2101
- export const AcqCompanyListResponseSchema = z.object({
2102
- data: z.array(AcqCompanyResponseSchema),
2103
- total: z.number().int(),
2104
- limit: z.number().int(),
2105
- offset: z.number().int()
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()
2106
2114
  })
2107
2115
  ```
2108
2116
 
2109
2117
  ### `AcqCompanyFacetsResponseSchema`
2110
2118
 
2111
2119
  ```typescript
2112
- export const AcqCompanyFacetsResponseSchema = z.object({
2113
- segments: z.array(z.string()),
2114
- categories: z.array(z.string()),
2115
- statuses: z.array(AcqCompanyStatusSchema)
2120
+ export const AcqCompanyFacetsResponseSchema = z.object({
2121
+ segments: z.array(z.string()),
2122
+ categories: z.array(z.string()),
2123
+ statuses: z.array(AcqCompanyStatusSchema)
2116
2124
  })
2117
2125
  ```
2118
2126
 
2119
2127
  ### `AcqContactCompanySummarySchema`
2120
2128
 
2121
2129
  ```typescript
2122
- export const AcqContactCompanySummarySchema = z.object({
2123
- id: z.string(),
2124
- name: z.string(),
2125
- domain: z.string().nullable(),
2126
- website: z.string().nullable(),
2127
- linkedinUrl: z.string().nullable(),
2128
- segment: z.string().nullable(),
2129
- category: z.string().nullable(),
2130
- status: AcqCompanyStatusSchema
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
2131
2139
  })
2132
2140
  ```
2133
2141
 
2134
2142
  ### `AcqContactResponseSchema`
2135
2143
 
2136
2144
  ```typescript
2137
- export const AcqContactResponseSchema = z.object({
2138
- id: z.string(),
2139
- organizationId: z.string(),
2140
- companyId: z.string().nullable(),
2141
- email: z.string(),
2142
- emailValid: AcqEmailValidSchema.nullable(),
2143
- firstName: z.string().nullable(),
2144
- lastName: z.string().nullable(),
2145
- linkedinUrl: z.string().nullable(),
2146
- title: z.string().nullable(),
2147
- headline: z.string().nullable(),
2148
- filterReason: z.string().nullable(),
2149
- openingLine: z.string().nullable(),
2150
- source: z.string().nullable(),
2151
- sourceId: z.string().nullable(),
2152
- pipelineStatus: z.record(z.string(), z.unknown()).nullable(),
2153
- enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2154
- attioPersonId: z.string().nullable(),
2155
- batchId: z.string().nullable(),
2156
- status: AcqContactStatusSchema,
2157
- company: AcqContactCompanySummarySchema.nullable().optional(),
2158
- createdAt: z.string(),
2159
- updatedAt: z.string()
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()
2160
2168
  })
2161
2169
  ```
2162
2170
 
2163
2171
  ### `AcqContactListResponseSchema`
2164
2172
 
2165
2173
  ```typescript
2166
- export const AcqContactListResponseSchema = z.object({
2167
- data: z.array(AcqContactResponseSchema),
2168
- total: z.number().int(),
2169
- limit: z.number().int(),
2170
- offset: z.number().int()
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()
2171
2179
  })
2172
2180
  ```
2173
2181
 
@@ -2180,222 +2188,223 @@ export const AcqArtifactOwnerKindSchema = z.enum(['company', 'contact', 'deal',
2180
2188
  ### `ListArtifactsQuerySchema`
2181
2189
 
2182
2190
  ```typescript
2183
- export const ListArtifactsQuerySchema = z
2184
- .object({
2185
- ownerKind: AcqArtifactOwnerKindSchema,
2186
- ownerId: UuidSchema
2187
- })
2191
+ export const ListArtifactsQuerySchema = z
2192
+ .object({
2193
+ ownerKind: AcqArtifactOwnerKindSchema,
2194
+ ownerId: UuidSchema
2195
+ })
2188
2196
  .strict()
2189
2197
  ```
2190
2198
 
2191
2199
  ### `CreateArtifactRequestSchema`
2192
2200
 
2193
2201
  ```typescript
2194
- export const CreateArtifactRequestSchema = z
2195
- .object({
2196
- ownerKind: AcqArtifactOwnerKindSchema,
2197
- ownerId: UuidSchema,
2198
- kind: z.string().trim().min(1).max(255),
2199
- content: z.record(z.string(), z.unknown()),
2200
- sourceExecutionId: UuidSchema.optional()
2201
- })
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
+ })
2202
2210
  .strict()
2203
2211
  ```
2204
2212
 
2205
2213
  ### `AcqArtifactResponseSchema`
2206
2214
 
2207
2215
  ```typescript
2208
- export const AcqArtifactResponseSchema = z.object({
2209
- id: z.string(),
2210
- organizationId: z.string(),
2211
- ownerKind: z.string(),
2212
- ownerId: z.string(),
2213
- kind: z.string(),
2214
- content: z.record(z.string(), z.unknown()),
2215
- sourceExecutionId: z.string().nullable(),
2216
- createdBy: z.string().nullable(),
2217
- createdAt: z.string(),
2218
- version: z.number().int()
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()
2219
2227
  })
2220
2228
  ```
2221
2229
 
2222
2230
  ### `AcqArtifactListResponseSchema`
2223
2231
 
2224
2232
  ```typescript
2225
- export const AcqArtifactListResponseSchema = z.object({
2226
- artifacts: z.array(AcqArtifactResponseSchema)
2233
+ export const AcqArtifactListResponseSchema = z.object({
2234
+ artifacts: z.array(AcqArtifactResponseSchema)
2227
2235
  })
2228
2236
  ```
2229
2237
 
2230
2238
  ### `ListMembersQuerySchema`
2231
2239
 
2232
2240
  ```typescript
2233
- export const ListMembersQuerySchema = z
2234
- .object({
2235
- limit: z.coerce.number().int().min(1).max(500).default(50),
2236
- offset: z.coerce.number().int().min(0).default(0)
2237
- })
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
+ })
2238
2246
  .strict()
2239
2247
  ```
2240
2248
 
2241
2249
  ### `MemberIdParamsSchema`
2242
2250
 
2243
2251
  ```typescript
2244
- export const MemberIdParamsSchema = z.object({
2245
- memberId: UuidSchema
2252
+ export const MemberIdParamsSchema = z.object({
2253
+ memberId: UuidSchema
2246
2254
  })
2247
2255
  ```
2248
2256
 
2249
2257
  ### `AcqListMemberContactSummarySchema`
2250
2258
 
2251
2259
  ```typescript
2252
- export const AcqListMemberContactSummarySchema = z.object({
2253
- id: z.string(),
2254
- email: z.string(),
2255
- firstName: z.string().nullable(),
2256
- lastName: z.string().nullable(),
2257
- title: z.string().nullable(),
2258
- linkedinUrl: z.string().nullable(),
2259
- companyId: z.string().nullable()
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()
2260
2268
  })
2261
2269
  ```
2262
2270
 
2263
2271
  ### `AcqListMemberResponseSchema`
2264
2272
 
2265
2273
  ```typescript
2266
- export const AcqListMemberResponseSchema = z.object({
2267
- id: z.string(),
2268
- listId: z.string(),
2269
- contactId: z.string(),
2270
- pipelineKey: z.string(),
2271
- stageKey: z.string(),
2272
- stateKey: z.string(),
2273
- activityLog: z.unknown(),
2274
- addedAt: z.string(),
2275
- addedBy: z.string().nullable(),
2276
- sourceExecutionId: z.string().nullable(),
2277
- contact: AcqListMemberContactSummarySchema.nullable()
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()
2278
2286
  })
2279
2287
  ```
2280
2288
 
2281
2289
  ### `AcqListMembersResponseSchema`
2282
2290
 
2283
2291
  ```typescript
2284
- export const AcqListMembersResponseSchema = z.object({
2285
- members: z.array(AcqListMemberResponseSchema)
2292
+ export const AcqListMembersResponseSchema = z.object({
2293
+ members: z.array(AcqListMemberResponseSchema)
2286
2294
  })
2287
2295
  ```
2288
2296
 
2289
2297
  ### `ListCompanyIdParamsSchema`
2290
2298
 
2291
2299
  ```typescript
2292
- export const ListCompanyIdParamsSchema = z.object({
2293
- listCompanyId: UuidSchema
2300
+ export const ListCompanyIdParamsSchema = z.object({
2301
+ listCompanyId: UuidSchema
2294
2302
  })
2295
2303
  ```
2296
2304
 
2297
2305
  ### `AcqListCompanyResponseSchema`
2298
2306
 
2299
2307
  ```typescript
2300
- export const AcqListCompanyResponseSchema = z.object({
2301
- id: z.string(),
2302
- listId: z.string(),
2303
- companyId: z.string(),
2304
- pipelineKey: z.string(),
2305
- stageKey: z.string(),
2306
- stateKey: z.string(),
2307
- activityLog: z.unknown(),
2308
- addedAt: z.string(),
2309
- addedBy: z.string().nullable(),
2310
- sourceExecutionId: z.string().nullable()
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()
2311
2319
  })
2312
2320
  ```
2313
2321
 
2314
2322
  ### `AcqCompanySchemas`
2315
2323
 
2316
2324
  ```typescript
2317
- export const AcqCompanySchemas = {
2318
- CompanyIdParams: CompanyIdParamsSchema,
2319
- ListCompaniesQuery: ListCompaniesQuerySchema,
2320
- CreateCompanyRequest: CreateCompanyRequestSchema,
2321
- UpdateCompanyRequest: UpdateCompanyRequestSchema,
2322
- AcqCompanyResponse: AcqCompanyResponseSchema,
2323
- AcqCompanyListResponse: AcqCompanyListResponseSchema,
2324
- AcqCompanyFacetsResponse: AcqCompanyFacetsResponseSchema
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
2325
2333
  }
2326
2334
  ```
2327
2335
 
2328
2336
  ### `AcqContactSchemas`
2329
2337
 
2330
2338
  ```typescript
2331
- export const AcqContactSchemas = {
2332
- ContactIdParams: ContactIdParamsSchema,
2333
- ListContactsQuery: ListContactsQuerySchema,
2334
- CreateContactRequest: CreateContactRequestSchema,
2335
- UpdateContactRequest: UpdateContactRequestSchema,
2336
- AcqContactResponse: AcqContactResponseSchema,
2337
- AcqContactListResponse: AcqContactListResponseSchema
2339
+ export const AcqContactSchemas = {
2340
+ ContactIdParams: ContactIdParamsSchema,
2341
+ ListContactsQuery: ListContactsQuerySchema,
2342
+ CreateContactRequest: CreateContactRequestSchema,
2343
+ UpdateContactRequest: UpdateContactRequestSchema,
2344
+ AcqContactResponse: AcqContactResponseSchema,
2345
+ AcqContactListResponse: AcqContactListResponseSchema
2338
2346
  }
2339
2347
  ```
2340
2348
 
2341
2349
  ### `AcqListSchemas`
2342
2350
 
2343
2351
  ```typescript
2344
- export const AcqListSchemas = {
2345
- // Params
2346
- ListIdParams: ListIdParamsSchema,
2347
-
2348
- // Primitives (for UI / tests)
2349
- ListStatus: ListStatusSchema,
2350
- ScrapingConfig: ScrapingConfigSchema,
2351
- IcpRubric: IcpRubricSchema,
2352
- PipelineConfig: PipelineConfigSchema,
2353
- PipelineStage: PipelineStageSchema,
2354
- ListStageCounts: ListStageCountsSchema,
2355
- ListTelemetry: ListTelemetrySchema,
2356
-
2357
- // Requests
2358
- CreateListRequest: CreateListRequestSchema,
2359
- UpdateListRequest: UpdateListRequestSchema,
2360
- UpdateListStatusRequest: UpdateListStatusRequestSchema,
2361
- UpdateListConfigRequest: UpdateListConfigRequestSchema,
2362
- AddCompaniesToListRequest: AddCompaniesToListRequestSchema,
2363
- RemoveCompaniesFromListRequest: RemoveCompaniesFromListRequestSchema,
2364
- AddContactsToListRequest: AddContactsToListRequestSchema,
2365
- RecordListExecutionRequest: RecordListExecutionRequestSchema,
2366
-
2367
- // Responses
2368
- AcqListResponse: AcqListResponseSchema,
2369
- AcqListListResponse: AcqListListResponseSchema,
2370
- ListTelemetryResponse: ListTelemetryResponseSchema,
2371
- ListTelemetryListResponse: ListTelemetryListResponseSchema,
2372
- ListExecutionsResponse: ListExecutionsResponseSchema,
2373
- ListProgressResponse: ListProgressResponseSchema
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
2374
2383
  }
2375
2384
  ```
2376
2385
 
2377
2386
  ### `AcqSubstrateSchemas`
2378
2387
 
2379
2388
  ```typescript
2380
- export const AcqSubstrateSchemas = {
2381
- // Artifacts
2382
- ListArtifactsQuery: ListArtifactsQuerySchema,
2383
- CreateArtifactRequest: CreateArtifactRequestSchema,
2384
- AcqArtifactResponse: AcqArtifactResponseSchema,
2385
- AcqArtifactListResponse: AcqArtifactListResponseSchema,
2386
-
2387
- // List members
2388
- ListMembersQuery: ListMembersQuerySchema,
2389
- MemberIdParams: MemberIdParamsSchema,
2390
- AcqListMemberResponse: AcqListMemberResponseSchema,
2391
- AcqListMembersResponse: AcqListMembersResponseSchema,
2392
-
2393
- // List companies
2394
- ListCompanyIdParams: ListCompanyIdParamsSchema,
2395
- AcqListCompanyResponse: AcqListCompanyResponseSchema,
2396
-
2397
- // Transition (shared with deals — TransitionItemRequestSchema)
2398
- TransitionItemRequest: TransitionItemRequestSchema
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
2399
2408
  }
2400
2409
  ```
2401
2410
 
@@ -2446,134 +2455,134 @@ export const StatefulSchema = z.object({
2446
2455
  ### `StatefulStateDefinition`
2447
2456
 
2448
2457
  ```typescript
2449
- /** One state within a stage — minimal shape: key + display label. */
2450
- export interface StatefulStateDefinition {
2451
- /** Matches state_key values written by workflow steps. */
2452
- stateKey: string
2453
- label: string
2458
+ /** One state within a stage — minimal shape: key + display label. */
2459
+ export interface StatefulStateDefinition {
2460
+ /** Matches state_key values written by workflow steps. */
2461
+ stateKey: string
2462
+ label: string
2454
2463
  }
2455
2464
  ```
2456
2465
 
2457
2466
  ### `StatefulStageDefinition`
2458
2467
 
2459
2468
  ```typescript
2460
- /** One stage within a pipeline — has a stage_key and an ordered list of valid states. */
2461
- export interface StatefulStageDefinition {
2462
- /** Matches stage_key values written by workflow steps. */
2463
- stageKey: string
2464
- label: string
2465
- states: StatefulStateDefinition[]
2469
+ /** One stage within a pipeline — has a stage_key and an ordered list of valid states. */
2470
+ export interface StatefulStageDefinition {
2471
+ /** Matches stage_key values written by workflow steps. */
2472
+ stageKey: string
2473
+ label: string
2474
+ states: StatefulStateDefinition[]
2466
2475
  }
2467
2476
  ```
2468
2477
 
2469
2478
  ### `StatefulPipelineDefinition`
2470
2479
 
2471
2480
  ```typescript
2472
- /**
2473
- * Pipeline definition for a single entity participating in the Stateful trait.
2474
- * Parallel to acq_deals' pipeline_key concept but structured for lead-gen entities.
2475
- */
2476
- export interface StatefulPipelineDefinition {
2477
- /** Matches pipeline_key values in the database (e.g. 'lead-gen'). */
2478
- pipelineKey: string
2479
- label: string
2480
- /** Entity this pipeline applies to (e.g. 'acq.list', 'acq.list-member', 'acq.list-company'). */
2481
- entityKey: string
2482
- stages: StatefulStageDefinition[]
2481
+ /**
2482
+ * Pipeline definition for a single entity participating in the Stateful trait.
2483
+ * Parallel to acq_deals' pipeline_key concept but structured for lead-gen entities.
2484
+ */
2485
+ export interface StatefulPipelineDefinition {
2486
+ /** Matches pipeline_key values in the database (e.g. 'lead-gen'). */
2487
+ pipelineKey: string
2488
+ label: string
2489
+ /** Entity this pipeline applies to (e.g. 'acq.list', 'acq.list-member', 'acq.list-company'). */
2490
+ entityKey: string
2491
+ stages: StatefulStageDefinition[]
2483
2492
  }
2484
2493
  ```
2485
2494
 
2486
2495
  ### `ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE`
2487
2496
 
2488
2497
  ```typescript
2489
- /**
2490
- * Lead-gen pipeline definition for acq_list_members (contacts).
2491
- * Three stages matching the post-restructure sales subdomain tree.
2492
- *
2493
- * Note: members visit outreach and prospecting states depending on which
2494
- * workflow last processed them. stage_key is set per-transition by the workflow.
2495
- */
2496
- export const ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
2497
- pipelineKey: 'lead-gen',
2498
- label: 'Lead Generation',
2499
- entityKey: 'acq.list-member',
2500
- stages: [
2501
- {
2502
- stageKey: 'outreach',
2503
- label: 'Outreach',
2504
- states: [
2505
- PENDING_STATE,
2506
- { stateKey: 'personalized', label: 'Personalized' },
2507
- { stateKey: 'uploaded', label: 'Uploaded' },
2508
- { stateKey: 'interested', label: 'Interested' }
2509
- ]
2510
- },
2511
- {
2512
- stageKey: 'prospecting',
2513
- label: 'Prospecting',
2514
- states: [
2515
- PENDING_STATE,
2516
- { stateKey: 'discovered', label: 'Discovered' },
2517
- { stateKey: 'verified', label: 'Verified' }
2518
- ]
2519
- },
2520
- {
2521
- stageKey: 'qualification',
2522
- label: 'Qualification',
2523
- states: [PENDING_STATE]
2524
- }
2525
- ]
2498
+ /**
2499
+ * Lead-gen pipeline definition for acq_list_members (contacts).
2500
+ * Three stages matching the post-restructure sales subdomain tree.
2501
+ *
2502
+ * Note: members visit outreach and prospecting states depending on which
2503
+ * workflow last processed them. stage_key is set per-transition by the workflow.
2504
+ */
2505
+ export const ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
2506
+ pipelineKey: 'lead-gen',
2507
+ label: 'Lead Generation',
2508
+ entityKey: 'acq.list-member',
2509
+ stages: [
2510
+ {
2511
+ stageKey: 'outreach',
2512
+ label: 'Outreach',
2513
+ states: [
2514
+ PENDING_STATE,
2515
+ { stateKey: 'personalized', label: 'Personalized' },
2516
+ { stateKey: 'uploaded', label: 'Uploaded' },
2517
+ { stateKey: 'interested', label: 'Interested' }
2518
+ ]
2519
+ },
2520
+ {
2521
+ stageKey: 'prospecting',
2522
+ label: 'Prospecting',
2523
+ states: [
2524
+ PENDING_STATE,
2525
+ { stateKey: 'discovered', label: 'Discovered' },
2526
+ { stateKey: 'verified', label: 'Verified' }
2527
+ ]
2528
+ },
2529
+ {
2530
+ stageKey: 'qualification',
2531
+ label: 'Qualification',
2532
+ states: [PENDING_STATE]
2533
+ }
2534
+ ]
2526
2535
  }
2527
2536
  ```
2528
2537
 
2529
2538
  ### `ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE`
2530
2539
 
2531
2540
  ```typescript
2532
- /**
2533
- * Lead-gen pipeline definition for acq_list_companies.
2534
- * Three stages matching the post-restructure sales subdomain tree.
2535
- *
2536
- * Note: companies visit prospecting and qualification states depending on which
2537
- * workflow last processed them. stage_key is set per-transition by the workflow.
2538
- */
2539
- export const ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
2540
- pipelineKey: 'lead-gen',
2541
- label: 'Lead Generation',
2542
- entityKey: 'acq.list-company',
2543
- stages: [
2544
- {
2545
- stageKey: 'outreach',
2546
- label: 'Outreach',
2547
- states: [PENDING_STATE]
2548
- },
2549
- {
2550
- stageKey: 'prospecting',
2551
- label: 'Prospecting',
2552
- states: [
2553
- PENDING_STATE,
2554
- { stateKey: 'populated', label: 'Populated' },
2555
- { stateKey: 'extracted', label: 'Extracted' }
2556
- ]
2557
- },
2558
- {
2559
- stageKey: 'qualification',
2560
- label: 'Qualification',
2561
- states: [PENDING_STATE, { stateKey: 'qualified', label: 'Qualified' }]
2562
- }
2563
- ]
2541
+ /**
2542
+ * Lead-gen pipeline definition for acq_list_companies.
2543
+ * Three stages matching the post-restructure sales subdomain tree.
2544
+ *
2545
+ * Note: companies visit prospecting and qualification states depending on which
2546
+ * workflow last processed them. stage_key is set per-transition by the workflow.
2547
+ */
2548
+ export const ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
2549
+ pipelineKey: 'lead-gen',
2550
+ label: 'Lead Generation',
2551
+ entityKey: 'acq.list-company',
2552
+ stages: [
2553
+ {
2554
+ stageKey: 'outreach',
2555
+ label: 'Outreach',
2556
+ states: [PENDING_STATE]
2557
+ },
2558
+ {
2559
+ stageKey: 'prospecting',
2560
+ label: 'Prospecting',
2561
+ states: [
2562
+ PENDING_STATE,
2563
+ { stateKey: 'populated', label: 'Populated' },
2564
+ { stateKey: 'extracted', label: 'Extracted' }
2565
+ ]
2566
+ },
2567
+ {
2568
+ stageKey: 'qualification',
2569
+ label: 'Qualification',
2570
+ states: [PENDING_STATE, { stateKey: 'qualified', label: 'Qualified' }]
2571
+ }
2572
+ ]
2564
2573
  }
2565
2574
  ```
2566
2575
 
2567
2576
  ### `LEAD_GEN_PIPELINE_DEFINITIONS`
2568
2577
 
2569
2578
  ```typescript
2570
- /**
2571
- * All lead-gen pipeline definitions indexed by entity key.
2572
- * Use findPipeline() to locate a definition by pipeline_key within any of these arrays.
2573
- */
2574
- export const LEAD_GEN_PIPELINE_DEFINITIONS: Record<string, StatefulPipelineDefinition[]> = {
2575
- 'acq.list-member': [ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE],
2576
- 'acq.list-company': [ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE]
2579
+ /**
2580
+ * All lead-gen pipeline definitions indexed by entity key.
2581
+ * Use findPipeline() to locate a definition by pipeline_key within any of these arrays.
2582
+ */
2583
+ export const LEAD_GEN_PIPELINE_DEFINITIONS: Record<string, StatefulPipelineDefinition[]> = {
2584
+ 'acq.list-member': [ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE],
2585
+ 'acq.list-company': [ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE]
2577
2586
  }
2578
2587
  ```
2579
2588
 
@@ -2832,24 +2841,26 @@ export interface UpdateListConfigParams {
2832
2841
  ### `UpdateCompanyStageParams`
2833
2842
 
2834
2843
  ```typescript
2835
- export interface UpdateCompanyStageParams {
2836
- organizationId: string
2837
- listId: string
2838
- companyId: string
2839
- stage: string
2840
- executionId?: string
2844
+ export interface UpdateCompanyStageParams {
2845
+ organizationId: string
2846
+ listId: string
2847
+ companyId: string
2848
+ stage: string
2849
+ status?: ProcessingStageStatus
2850
+ executionId?: string
2841
2851
  }
2842
2852
  ```
2843
2853
 
2844
2854
  ### `UpdateContactStageParams`
2845
2855
 
2846
2856
  ```typescript
2847
- export interface UpdateContactStageParams {
2848
- organizationId: string
2849
- listId: string
2850
- contactId: string
2851
- stage: string
2852
- executionId?: string
2857
+ export interface UpdateContactStageParams {
2858
+ organizationId: string
2859
+ listId: string
2860
+ contactId: string
2861
+ stage: string
2862
+ status?: ProcessingStageStatus
2863
+ executionId?: string
2853
2864
  }
2854
2865
  ```
2855
2866
 
@@ -2973,157 +2984,158 @@ export interface BulkImportCompaniesResult {
2973
2984
  ### `LeadToolMap`
2974
2985
 
2975
2986
  ```typescript
2976
- export type LeadToolMap = {
2977
- // List operations
2978
- listLists: { params: Record<string, never>; result: AcqList[] }
2979
- createList: { params: Omit<CreateListParams, 'organizationId'>; result: AcqList }
2980
- updateList: { params: { id: string } & UpdateListParams; result: AcqList }
2981
- deleteList: { params: { id: string }; result: void }
2982
- addContactsToList: { params: Omit<AddContactsToListParams, 'organizationId'>; result: AddContactsToListResult }
2983
- updateCompanyStage: {
2984
- params: Omit<UpdateCompanyStageParams, 'organizationId'>
2985
- result: void
2986
- }
2987
- updateContactStage: {
2988
- params: Omit<UpdateContactStageParams, 'organizationId'>
2989
- result: void
2990
- }
2991
- // Company operations
2992
- createCompany: { params: Omit<CreateCompanyParams, 'organizationId'>; result: AcqCompany }
2993
- upsertCompany: { params: Omit<UpsertCompanyParams, 'organizationId'>; result: AcqCompany }
2994
- updateCompany: { params: { id: string } & UpdateCompanyParams; result: AcqCompany }
2995
- getCompany: { params: { id: string }; result: AcqCompany | null }
2996
- listCompanies: { params: CompanyFilters; result: AcqCompany[] }
2997
- deleteCompany: { params: { id: string }; result: void }
2998
- // Contact operations
2999
- createContact: { params: Omit<CreateContactParams, 'organizationId'>; result: AcqContact }
3000
- upsertContact: { params: Omit<UpsertContactParams, 'organizationId'>; result: AcqContact }
3001
- updateContact: { params: { id: string } & UpdateContactParams; result: AcqContact }
3002
- getContact: { params: { id: string }; result: AcqContact | null }
3003
- getContactByEmail: { params: { email: string }; result: AcqContact | null }
3004
- listContacts: {
3005
- params: ContactFilters & { limit?: number; offset?: number }
3006
- result: PaginatedResult<AcqContact>
3007
- }
3008
- deleteContact: { params: { id: string }; result: void }
3009
- bulkImportContacts: { params: Omit<BulkImportParams, 'organizationId'>; result: BulkImportResult }
3010
- bulkImportCompanies: {
3011
- params: Omit<BulkImportCompaniesParams, 'organizationId'>
3012
- result: BulkImportCompaniesResult
3013
- }
3014
- deactivateContactsByCompany: {
3015
- params: { companyId: string }
3016
- result: { deactivated: number }
3017
- }
3018
- // Deal operations
3019
- upsertDeal: { params: Omit<UpsertDealParams, 'organizationId'>; result: AcqDeal }
3020
- getDealByEmail: { params: { email: string }; result: AcqDeal | null }
3021
- getDealByEnvelopeId: { params: { envelopeId: string }; result: AcqDeal | null }
3022
- updateDealEnvelopeId: { params: { dealId: string; envelopeId: string }; result: AcqDeal | null }
3023
- getDealById: { params: Omit<GetDealByIdParams, 'organizationId'>; result: AcqDeal | null }
3024
- getContactById: { params: Omit<GetContactByIdParams, 'organizationId'>; result: AcqContact | null }
3025
- getCompanyById: { params: Omit<GetCompanyByIdParams, 'organizationId'>; result: AcqCompany | null }
3026
- // Deal-sync operations
3027
- updateDiscoveryData: { params: Omit<UpdateDiscoveryDataParams, 'organizationId'>; result: void }
3028
- updateProposalData: { params: Omit<UpdateProposalDataParams, 'organizationId'>; result: void }
3029
- markProposalSent: { params: Omit<MarkProposalSentParams, 'organizationId'>; result: void }
3030
- markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
3031
- updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
3032
- updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
3033
- transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
3034
- setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
3035
- cancelSchedulesAndHitlByEmail: {
3036
- params: Omit<CancelSchedulesAndHitlByEmailParams, 'organizationId'>
3037
- result: { schedulesCancelled: number; hitlDeleted: number }
3038
- }
3039
- cancelHitlByDealId: { params: Omit<CancelHitlByDealIdParams, 'organizationId'>; result: { hitlDeleted: number } }
3040
- clearDealFields: { params: Omit<ClearDealFieldsParams, 'organizationId'>; result: void }
3041
- deleteDeal: { params: Omit<DeleteDealParams, 'organizationId'>; result: void }
3042
- recordDealActivity: {
3043
- params: Omit<RecordDealActivityParams, 'organizationId'>
3044
- result: void
3045
- }
3046
- // Deal note operations
3047
- createDealNote: {
3048
- params: Omit<CreateDealNoteParams, 'organizationId'>
3049
- result: AcqDealNote
3050
- }
3051
- listDealNotes: {
3052
- params: Omit<ListDealNotesParams, 'organizationId'>
3053
- result: AcqDealNote[]
3054
- }
3055
- // Deal task operations
3056
- createDealTask: {
3057
- params: Omit<CreateDealTaskParams, 'organizationId'>
3058
- result: AcqDealTask
3059
- }
3060
- listDealTasks: {
3061
- params: Omit<ListDealTasksParams, 'organizationId'>
3062
- result: AcqDealTask[]
3063
- }
3064
- listDealTasksDue: {
3065
- params: Omit<ListDealTasksDueParams, 'organizationId'>
3066
- result: AcqDealTask[]
3067
- }
3068
- completeDealTask: {
3069
- params: Omit<CompleteDealTaskParams, 'organizationId'>
3070
- result: AcqDealTask
3071
- }
3072
- // Deal query & analytics operations
3073
- listDeals: { params: DealFilters; result: AcqDeal[] }
3074
- getDealPipelineAnalytics: { params: { recentLimit?: number }; result: DealPipelineAnalytics }
3075
- // Enrichment data operations
3076
- mergeEnrichmentData: {
3077
- params: { id: string; table: 'acq_companies' | 'acq_contacts'; data: Record<string, unknown> }
3078
- result: void
3079
- }
3080
- // Social monitoring operations
3081
- upsertSocialPosts: {
3082
- params: { posts: Omit<UpsertSocialPostParams, 'organizationId'>[] }
3083
- result: UpsertSocialPostsResult
3084
- }
3085
- setDealStateKey: {
3086
- params: {
3087
- dealId: string
3088
- stateKey: string
3089
- }
3090
- result: { ok: true }
3091
- }
3092
- // CRM workflow helpers
3093
- transitionDeal: {
3094
- params: {
3095
- dealId: string
3096
- toStage: string
3097
- toState?: string
3098
- }
3099
- result: { deal: AcqDeal }
3100
- }
3101
- loadDeal: {
3102
- params: { dealId: string }
3103
- result: DealDetail | null
3104
- }
2987
+ export type LeadToolMap = {
2988
+ // List operations
2989
+ listLists: { params: Record<string, never>; result: AcqList[] }
2990
+ createList: { params: Omit<CreateListParams, 'organizationId'>; result: AcqList }
2991
+ updateList: { params: { id: string } & UpdateListParams; result: AcqList }
2992
+ deleteList: { params: { id: string }; result: void }
2993
+ addContactsToList: { params: Omit<AddContactsToListParams, 'organizationId'>; result: AddContactsToListResult }
2994
+ addCompaniesToList: { params: Omit<AddCompaniesToListParams, 'organizationId'>; result: AddCompaniesToListResult }
2995
+ updateCompanyStage: {
2996
+ params: Omit<UpdateCompanyStageParams, 'organizationId'>
2997
+ result: void
2998
+ }
2999
+ updateContactStage: {
3000
+ params: Omit<UpdateContactStageParams, 'organizationId'>
3001
+ result: void
3002
+ }
3003
+ // Company operations
3004
+ createCompany: { params: Omit<CreateCompanyParams, 'organizationId'>; result: AcqCompany }
3005
+ upsertCompany: { params: Omit<UpsertCompanyParams, 'organizationId'>; result: AcqCompany }
3006
+ updateCompany: { params: { id: string } & UpdateCompanyParams; result: AcqCompany }
3007
+ getCompany: { params: { id: string }; result: AcqCompany | null }
3008
+ listCompanies: { params: CompanyFilters; result: AcqCompany[] }
3009
+ deleteCompany: { params: { id: string }; result: void }
3010
+ // Contact operations
3011
+ createContact: { params: Omit<CreateContactParams, 'organizationId'>; result: AcqContact }
3012
+ upsertContact: { params: Omit<UpsertContactParams, 'organizationId'>; result: AcqContact }
3013
+ updateContact: { params: { id: string } & UpdateContactParams; result: AcqContact }
3014
+ getContact: { params: { id: string }; result: AcqContact | null }
3015
+ getContactByEmail: { params: { email: string }; result: AcqContact | null }
3016
+ listContacts: {
3017
+ params: ContactFilters & { limit?: number; offset?: number }
3018
+ result: PaginatedResult<AcqContact>
3019
+ }
3020
+ deleteContact: { params: { id: string }; result: void }
3021
+ bulkImportContacts: { params: Omit<BulkImportParams, 'organizationId'>; result: BulkImportResult }
3022
+ bulkImportCompanies: {
3023
+ params: Omit<BulkImportCompaniesParams, 'organizationId'>
3024
+ result: BulkImportCompaniesResult
3025
+ }
3026
+ deactivateContactsByCompany: {
3027
+ params: { companyId: string }
3028
+ result: { deactivated: number }
3029
+ }
3030
+ // Deal operations
3031
+ upsertDeal: { params: Omit<UpsertDealParams, 'organizationId'>; result: AcqDeal }
3032
+ getDealByEmail: { params: { email: string }; result: AcqDeal | null }
3033
+ getDealByEnvelopeId: { params: { envelopeId: string }; result: AcqDeal | null }
3034
+ updateDealEnvelopeId: { params: { dealId: string; envelopeId: string }; result: AcqDeal | null }
3035
+ getDealById: { params: Omit<GetDealByIdParams, 'organizationId'>; result: AcqDeal | null }
3036
+ getContactById: { params: Omit<GetContactByIdParams, 'organizationId'>; result: AcqContact | null }
3037
+ getCompanyById: { params: Omit<GetCompanyByIdParams, 'organizationId'>; result: AcqCompany | null }
3038
+ // Deal-sync operations
3039
+ updateDiscoveryData: { params: Omit<UpdateDiscoveryDataParams, 'organizationId'>; result: void }
3040
+ updateProposalData: { params: Omit<UpdateProposalDataParams, 'organizationId'>; result: void }
3041
+ markProposalSent: { params: Omit<MarkProposalSentParams, 'organizationId'>; result: void }
3042
+ markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
3043
+ updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
3044
+ updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
3045
+ transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
3046
+ setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
3047
+ cancelSchedulesAndHitlByEmail: {
3048
+ params: Omit<CancelSchedulesAndHitlByEmailParams, 'organizationId'>
3049
+ result: { schedulesCancelled: number; hitlDeleted: number }
3050
+ }
3051
+ cancelHitlByDealId: { params: Omit<CancelHitlByDealIdParams, 'organizationId'>; result: { hitlDeleted: number } }
3052
+ clearDealFields: { params: Omit<ClearDealFieldsParams, 'organizationId'>; result: void }
3053
+ deleteDeal: { params: Omit<DeleteDealParams, 'organizationId'>; result: void }
3054
+ recordDealActivity: {
3055
+ params: Omit<RecordDealActivityParams, 'organizationId'>
3056
+ result: void
3057
+ }
3058
+ // Deal note operations
3059
+ createDealNote: {
3060
+ params: Omit<CreateDealNoteParams, 'organizationId'>
3061
+ result: AcqDealNote
3062
+ }
3063
+ listDealNotes: {
3064
+ params: Omit<ListDealNotesParams, 'organizationId'>
3065
+ result: AcqDealNote[]
3066
+ }
3067
+ // Deal task operations
3068
+ createDealTask: {
3069
+ params: Omit<CreateDealTaskParams, 'organizationId'>
3070
+ result: AcqDealTask
3071
+ }
3072
+ listDealTasks: {
3073
+ params: Omit<ListDealTasksParams, 'organizationId'>
3074
+ result: AcqDealTask[]
3075
+ }
3076
+ listDealTasksDue: {
3077
+ params: Omit<ListDealTasksDueParams, 'organizationId'>
3078
+ result: AcqDealTask[]
3079
+ }
3080
+ completeDealTask: {
3081
+ params: Omit<CompleteDealTaskParams, 'organizationId'>
3082
+ result: AcqDealTask
3083
+ }
3084
+ // Deal query & analytics operations
3085
+ listDeals: { params: DealFilters; result: AcqDeal[] }
3086
+ getDealPipelineAnalytics: { params: { recentLimit?: number }; result: DealPipelineAnalytics }
3087
+ // Enrichment data operations
3088
+ mergeEnrichmentData: {
3089
+ params: { id: string; table: 'acq_companies' | 'acq_contacts'; data: Record<string, unknown> }
3090
+ result: void
3091
+ }
3092
+ // Social monitoring operations
3093
+ upsertSocialPosts: {
3094
+ params: { posts: Omit<UpsertSocialPostParams, 'organizationId'>[] }
3095
+ result: UpsertSocialPostsResult
3096
+ }
3097
+ setDealStateKey: {
3098
+ params: {
3099
+ dealId: string
3100
+ stateKey: string
3101
+ }
3102
+ result: { ok: true }
3103
+ }
3104
+ // CRM workflow helpers
3105
+ transitionDeal: {
3106
+ params: {
3107
+ dealId: string
3108
+ toStage: string
3109
+ toState?: string
3110
+ }
3111
+ result: { deal: AcqDeal }
3112
+ }
3113
+ loadDeal: {
3114
+ params: { dealId: string }
3115
+ result: DealDetail | null
3116
+ }
3105
3117
  }
3106
3118
  ```
3107
3119
 
3108
3120
  ### `ListToolMap`
3109
3121
 
3110
3122
  ```typescript
3111
- export type ListToolMap = {
3112
- getConfig: {
3113
- params: { listId: string }
3114
- result: { scrapingConfig: ScrapingConfig; icp: IcpRubric; pipelineConfig: PipelineConfig }
3115
- }
3116
- recordExecution: {
3117
- params: Omit<RecordListExecutionParams, 'organizationId'>
3118
- result: void
3119
- }
3120
- updateCompanyStage: {
3121
- params: Omit<UpdateCompanyStageParams, 'organizationId'>
3122
- result: void
3123
- }
3124
- updateContactStage: {
3125
- params: Omit<UpdateContactStageParams, 'organizationId'>
3126
- result: void
3127
- }
3123
+ export type ListToolMap = {
3124
+ getConfig: {
3125
+ params: { listId: string }
3126
+ result: { scrapingConfig: ScrapingConfig; icp: IcpRubric; pipelineConfig: PipelineConfig }
3127
+ }
3128
+ recordExecution: {
3129
+ params: Omit<RecordListExecutionParams, 'organizationId'>
3130
+ result: void
3131
+ }
3132
+ updateCompanyStage: {
3133
+ params: Omit<UpdateCompanyStageParams, 'organizationId'>
3134
+ result: void
3135
+ }
3136
+ updateContactStage: {
3137
+ params: Omit<UpdateContactStageParams, 'organizationId'>
3138
+ result: void
3139
+ }
3128
3140
  }
3129
3141
  ```