@elevasis/sdk 1.13.1 → 1.14.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.
@@ -812,73 +812,73 @@ export interface DeploymentSpec {
812
812
  ### `AcqCompany`
813
813
 
814
814
  ```typescript
815
- /**
816
- * Company record in the acquisition database.
817
- * Contains enriched company data from various sources.
818
- * Transformed from AcqCompanyRow with camelCase properties.
819
- */
820
- export interface AcqCompany {
821
- id: string
822
- organizationId: string
823
- name: string
824
- domain: string | null
825
- linkedinUrl: string | null
826
- website: string | null
827
- numEmployees: number | null
828
- foundedYear: number | null
829
- locationCity: string | null
830
- locationState: string | null
831
- category: string | null
832
- categoryPain: string | null
833
- segment: string | null
834
- pipelineStatus: CompanyPipelineStatus | null
835
- enrichmentData: CompanyEnrichmentData | null
836
- source: string | null
837
- batchId: string | null
838
- status: 'active' | 'invalid'
839
- verticalResearch: string | null
840
- /** Track A: flat qualification score (null until a scoring rubric is defined). Added by W1 migration. */
841
- qualificationScore: number | null
842
- /** Track A: flat qualification signals jsonb preserving the result payload shape. Added by W1 migration. */
843
- qualificationSignals: Record<string, unknown> | null
844
- /** Track A: key identifying the rubric used for qualification. Added by W1 migration. */
845
- qualificationRubricKey: string | null
846
- createdAt: Date
847
- updatedAt: Date
815
+ /**
816
+ * Company record in the acquisition database.
817
+ * Contains enriched company data from various sources.
818
+ * Transformed from AcqCompanyRow with camelCase properties.
819
+ */
820
+ export interface AcqCompany {
821
+ id: string
822
+ organizationId: string
823
+ name: string
824
+ domain: string | null
825
+ linkedinUrl: string | null
826
+ website: string | null
827
+ numEmployees: number | null
828
+ foundedYear: number | null
829
+ locationCity: string | null
830
+ locationState: string | null
831
+ category: string | null
832
+ categoryPain: string | null
833
+ segment: string | null
834
+ pipelineStatus: CompanyPipelineStatus | null
835
+ enrichmentData: CompanyEnrichmentData | null
836
+ source: string | null
837
+ batchId: string | null
838
+ status: 'active' | 'invalid'
839
+ verticalResearch: string | null
840
+ /** Track A: flat qualification score (null until a scoring rubric is defined). Added by W1 migration. */
841
+ qualificationScore: number | null
842
+ /** Track A: flat qualification signals jsonb preserving the result payload shape. Added by W1 migration. */
843
+ qualificationSignals: Record<string, unknown> | null
844
+ /** Track A: key identifying the rubric used for qualification. Added by W1 migration. */
845
+ qualificationRubricKey: string | null
846
+ createdAt: Date
847
+ updatedAt: Date
848
848
  }
849
849
  ```
850
850
 
851
851
  ### `AcqContact`
852
852
 
853
853
  ```typescript
854
- /**
855
- * Contact record in the acquisition database.
856
- * Contains enriched contact data and personalization content.
857
- * Transformed from AcqContactRow with camelCase properties.
858
- */
859
- export interface AcqContact {
860
- id: string
861
- organizationId: string
862
- companyId: string | null
863
- email: string
864
- emailValid: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN' | null
865
- firstName: string | null
866
- lastName: string | null
867
- linkedinUrl: string | null
868
- title: string | null
869
- headline: string | null
870
- filterReason: string | null
871
- openingLine: string | null
872
- source: string | null
873
- sourceId: string | null
874
- pipelineStatus: ContactPipelineStatus | null
875
- enrichmentData: ContactEnrichmentData | null
876
- /** Attio Person record ID - set when contact responds and is added to CRM */
877
- attioPersonId: string | null
878
- batchId: string | null
879
- status: 'active' | 'invalid'
880
- createdAt: Date
881
- updatedAt: Date
854
+ /**
855
+ * Contact record in the acquisition database.
856
+ * Contains enriched contact data and personalization content.
857
+ * Transformed from AcqContactRow with camelCase properties.
858
+ */
859
+ export interface AcqContact {
860
+ id: string
861
+ organizationId: string
862
+ companyId: string | null
863
+ email: string
864
+ emailValid: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN' | null
865
+ firstName: string | null
866
+ lastName: string | null
867
+ linkedinUrl: string | null
868
+ title: string | null
869
+ headline: string | null
870
+ filterReason: string | null
871
+ openingLine: string | null
872
+ source: string | null
873
+ sourceId: string | null
874
+ pipelineStatus: ContactPipelineStatus | null
875
+ enrichmentData: ContactEnrichmentData | null
876
+ /** Attio Person record ID - set when contact responds and is added to CRM */
877
+ attioPersonId: string | null
878
+ batchId: string | null
879
+ status: 'active' | 'invalid'
880
+ createdAt: Date
881
+ updatedAt: Date
882
882
  }
883
883
  ```
884
884
 
@@ -891,9 +891,9 @@ export type DealStage = 'interested' | 'proposal' | 'closing' | 'closed_won' | '
891
891
  ### `KanbanStageConfig`
892
892
 
893
893
  ```typescript
894
- export interface KanbanStageConfig {
895
- color: string // Mantine color token (e.g. 'blue', 'teal')
896
- label?: string // Optional display label override
894
+ export interface KanbanStageConfig {
895
+ color: string // Mantine color token (e.g. 'blue', 'teal')
896
+ label?: string // Optional display label override
897
897
  }
898
898
  ```
899
899
 
@@ -906,46 +906,46 @@ export type KanbanBoardConfig = Partial<Record<DealStage, KanbanStageConfig>>
906
906
  ### `DealContact`
907
907
 
908
908
  ```typescript
909
- export interface DealContact {
910
- id: string
911
- first_name: string | null
912
- last_name: string | null
913
- email: string
914
- title: string | null
915
- headline: string | null
916
- linkedin_url: string | null
917
- pipeline_status: Record<string, unknown> | null
918
- enrichment_data: Record<string, unknown> | null
919
- company: {
920
- id: string
921
- name: string
922
- domain: string | null
923
- website: string | null
924
- linkedin_url: string | null
925
- segment: string | null
926
- category: string | null
927
- num_employees: number | null
928
- } | null
909
+ export interface DealContact {
910
+ id: string
911
+ first_name: string | null
912
+ last_name: string | null
913
+ email: string
914
+ title: string | null
915
+ headline: string | null
916
+ linkedin_url: string | null
917
+ pipeline_status: Record<string, unknown> | null
918
+ enrichment_data: Record<string, unknown> | null
919
+ company: {
920
+ id: string
921
+ name: string
922
+ domain: string | null
923
+ website: string | null
924
+ linkedin_url: string | null
925
+ segment: string | null
926
+ category: string | null
927
+ num_employees: number | null
928
+ } | null
929
929
  }
930
930
  ```
931
931
 
932
932
  ### `DealFilters`
933
933
 
934
934
  ```typescript
935
- export interface DealFilters {
936
- stage?: DealStage
937
- search?: string
938
- limit?: number
939
- offset?: number
935
+ export interface DealFilters {
936
+ stage?: DealStage
937
+ search?: string
938
+ limit?: number
939
+ offset?: number
940
940
  }
941
941
  ```
942
942
 
943
943
  ### `DealListItem`
944
944
 
945
945
  ```typescript
946
- /** Deal list item with joined contact and company data */
947
- export interface DealListItem extends AcqDealRow {
948
- contact: DealContact | null
946
+ /** Deal list item with joined contact and company data */
947
+ export interface DealListItem extends AcqDealRow {
948
+ contact: DealContact | null
949
949
  }
950
950
  ```
951
951
 
@@ -958,31 +958,31 @@ export type DealDetail = DealListItem
958
958
  ### `AcqDealTaskKind`
959
959
 
960
960
  ```typescript
961
- /** Task kind options for a deal task (human follow-up action type) */
961
+ /** Task kind options for a deal task (human follow-up action type) */
962
962
  export type AcqDealTaskKind = 'call' | 'email' | 'meeting' | 'other'
963
963
  ```
964
964
 
965
965
  ### `AcqDealTask`
966
966
 
967
967
  ```typescript
968
- /**
969
- * A CRM to-do item attached to a deal representing a human follow-up action.
970
- * Transformed from AcqDealTaskRow with camelCase properties.
971
- */
972
- export interface AcqDealTask {
973
- id: string
974
- organizationId: string
975
- dealId: string
976
- title: string
977
- description: string | null
978
- kind: AcqDealTaskKind
979
- dueAt: string | null
980
- assigneeUserId: string | null
981
- completedAt: string | null
982
- completedByUserId: string | null
983
- createdAt: string
984
- updatedAt: string
985
- createdByUserId: string | null
968
+ /**
969
+ * A CRM to-do item attached to a deal representing a human follow-up action.
970
+ * Transformed from AcqDealTaskRow with camelCase properties.
971
+ */
972
+ export interface AcqDealTask {
973
+ id: string
974
+ organizationId: string
975
+ dealId: string
976
+ title: string
977
+ description: string | null
978
+ kind: AcqDealTaskKind
979
+ dueAt: string | null
980
+ assigneeUserId: string | null
981
+ completedAt: string | null
982
+ completedByUserId: string | null
983
+ createdAt: string
984
+ updatedAt: string
985
+ createdByUserId: string | null
986
986
  }
987
987
  ```
988
988
 
@@ -1001,218 +1001,218 @@ export const AcqDealTaskKindSchema = z.enum(['call', 'email', 'meeting', 'other'
1001
1001
  ### `DealIdParamsSchema`
1002
1002
 
1003
1003
  ```typescript
1004
- export const DealIdParamsSchema = z.object({
1005
- dealId: UuidSchema
1004
+ export const DealIdParamsSchema = z.object({
1005
+ dealId: UuidSchema
1006
1006
  })
1007
1007
  ```
1008
1008
 
1009
1009
  ### `DealTaskIdParamsSchema`
1010
1010
 
1011
1011
  ```typescript
1012
- export const DealTaskIdParamsSchema = z.object({
1013
- dealId: UuidSchema,
1014
- taskId: UuidSchema
1012
+ export const DealTaskIdParamsSchema = z.object({
1013
+ dealId: UuidSchema,
1014
+ taskId: UuidSchema
1015
1015
  })
1016
1016
  ```
1017
1017
 
1018
1018
  ### `ListDealsQuerySchema`
1019
1019
 
1020
1020
  ```typescript
1021
- export const ListDealsQuerySchema = z
1022
- .object({
1023
- stage: DealStageSchema.optional(),
1024
- search: z.string().optional(),
1025
- limit: z.coerce.number().int().positive().default(50),
1026
- offset: z.coerce.number().int().min(0).default(0)
1027
- })
1021
+ export const ListDealsQuerySchema = z
1022
+ .object({
1023
+ stage: DealStageSchema.optional(),
1024
+ search: z.string().optional(),
1025
+ limit: z.coerce.number().int().positive().default(50),
1026
+ offset: z.coerce.number().int().min(0).default(0)
1027
+ })
1028
1028
  .strict()
1029
1029
  ```
1030
1030
 
1031
1031
  ### `DealLookupQuerySchema`
1032
1032
 
1033
1033
  ```typescript
1034
- export const DealLookupQuerySchema = z
1035
- .object({
1036
- search: z.string().trim().min(1).max(200).optional(),
1037
- limit: z.coerce.number().int().min(1).max(25).default(10)
1038
- })
1034
+ export const DealLookupQuerySchema = z
1035
+ .object({
1036
+ search: z.string().trim().min(1).max(200).optional(),
1037
+ limit: z.coerce.number().int().min(1).max(25).default(10)
1038
+ })
1039
1039
  .strict()
1040
1040
  ```
1041
1041
 
1042
1042
  ### `ListDealTasksDueQuerySchema`
1043
1043
 
1044
1044
  ```typescript
1045
- export const ListDealTasksDueQuerySchema = z
1046
- .object({
1047
- window: z.enum(['overdue', 'today', 'today_and_overdue', 'upcoming']).optional(),
1048
- assigneeUserId: UuidSchema.optional()
1049
- })
1045
+ export const ListDealTasksDueQuerySchema = z
1046
+ .object({
1047
+ window: z.enum(['overdue', 'today', 'today_and_overdue', 'upcoming']).optional(),
1048
+ assigneeUserId: UuidSchema.optional()
1049
+ })
1050
1050
  .strict()
1051
1051
  ```
1052
1052
 
1053
1053
  ### `CreateDealNoteRequestSchema`
1054
1054
 
1055
1055
  ```typescript
1056
- export const CreateDealNoteRequestSchema = z
1057
- .object({
1058
- body: z.string().trim().min(1).max(10000)
1059
- })
1056
+ export const CreateDealNoteRequestSchema = z
1057
+ .object({
1058
+ body: z.string().trim().min(1).max(10000)
1059
+ })
1060
1060
  .strict()
1061
1061
  ```
1062
1062
 
1063
1063
  ### `CreateDealTaskRequestSchema`
1064
1064
 
1065
1065
  ```typescript
1066
- export const CreateDealTaskRequestSchema = z
1067
- .object({
1068
- title: z.string().trim().min(1).max(255),
1069
- description: z.string().nullable().optional(),
1070
- kind: AcqDealTaskKindSchema.optional(),
1071
- dueAt: z.string().datetime().nullable().optional(),
1072
- assigneeUserId: UuidSchema.nullable().optional()
1073
- })
1066
+ export const CreateDealTaskRequestSchema = z
1067
+ .object({
1068
+ title: z.string().trim().min(1).max(255),
1069
+ description: z.string().nullable().optional(),
1070
+ kind: AcqDealTaskKindSchema.optional(),
1071
+ dueAt: z.string().datetime().nullable().optional(),
1072
+ assigneeUserId: UuidSchema.nullable().optional()
1073
+ })
1074
1074
  .strict()
1075
1075
  ```
1076
1076
 
1077
1077
  ### `TransitionItemRequestSchema`
1078
1078
 
1079
1079
  ```typescript
1080
- export const TransitionItemRequestSchema = z
1081
- .object({
1082
- pipelineKey: z.string().min(1),
1083
- stageKey: z.string().min(1),
1084
- stateKey: z.string().nullable().optional(),
1085
- reason: z.string().optional(),
1086
- expectedUpdatedAt: z.string().datetime().optional()
1087
- })
1080
+ export const TransitionItemRequestSchema = z
1081
+ .object({
1082
+ pipelineKey: z.string().min(1),
1083
+ stageKey: z.string().min(1),
1084
+ stateKey: z.string().nullable().optional(),
1085
+ reason: z.string().optional(),
1086
+ expectedUpdatedAt: z.string().datetime().optional()
1087
+ })
1088
1088
  .strict()
1089
1089
  ```
1090
1090
 
1091
1091
  ### `ExecuteActionParamsSchema`
1092
1092
 
1093
1093
  ```typescript
1094
- export const ExecuteActionParamsSchema = z
1095
- .object({
1096
- dealId: UuidSchema,
1097
- actionKey: NonEmptyStringSchema
1098
- })
1094
+ export const ExecuteActionParamsSchema = z
1095
+ .object({
1096
+ dealId: UuidSchema,
1097
+ actionKey: NonEmptyStringSchema
1098
+ })
1099
1099
  .strict()
1100
1100
  ```
1101
1101
 
1102
1102
  ### `ExecuteActionRequestSchema`
1103
1103
 
1104
1104
  ```typescript
1105
- export const ExecuteActionRequestSchema = z
1106
- .object({
1107
- payload: z.record(z.string(), z.unknown()).optional()
1108
- })
1105
+ export const ExecuteActionRequestSchema = z
1106
+ .object({
1107
+ payload: z.record(z.string(), z.unknown()).optional()
1108
+ })
1109
1109
  .strict()
1110
1110
  ```
1111
1111
 
1112
1112
  ### `DealContactSummarySchema`
1113
1113
 
1114
1114
  ```typescript
1115
- /**
1116
- * Contact summary nested inside DealListItem / DealDetailResponse.
1117
- * Matches the joined shape returned by useDeals / useDealDetail Supabase queries.
1118
- */
1119
- export const DealContactSummarySchema = z.object({
1120
- id: z.string(),
1121
- first_name: z.string().nullable(),
1122
- last_name: z.string().nullable(),
1123
- email: z.string(),
1124
- title: z.string().nullable(),
1125
- headline: z.string().nullable(),
1126
- linkedin_url: z.string().nullable(),
1127
- pipeline_status: z.record(z.string(), z.unknown()).nullable(),
1128
- enrichment_data: z.record(z.string(), z.unknown()).nullable(),
1129
- company: z
1130
- .object({
1131
- id: z.string(),
1132
- name: z.string(),
1133
- domain: z.string().nullable(),
1134
- website: z.string().nullable(),
1135
- linkedin_url: z.string().nullable(),
1136
- segment: z.string().nullable(),
1137
- category: z.string().nullable(),
1138
- num_employees: z.number().nullable()
1139
- })
1140
- .nullable()
1115
+ /**
1116
+ * Contact summary nested inside DealListItem / DealDetailResponse.
1117
+ * Matches the joined shape returned by useDeals / useDealDetail Supabase queries.
1118
+ */
1119
+ export const DealContactSummarySchema = z.object({
1120
+ id: z.string(),
1121
+ first_name: z.string().nullable(),
1122
+ last_name: z.string().nullable(),
1123
+ email: z.string(),
1124
+ title: z.string().nullable(),
1125
+ headline: z.string().nullable(),
1126
+ linkedin_url: z.string().nullable(),
1127
+ pipeline_status: z.record(z.string(), z.unknown()).nullable(),
1128
+ enrichment_data: z.record(z.string(), z.unknown()).nullable(),
1129
+ company: z
1130
+ .object({
1131
+ id: z.string(),
1132
+ name: z.string(),
1133
+ domain: z.string().nullable(),
1134
+ website: z.string().nullable(),
1135
+ linkedin_url: z.string().nullable(),
1136
+ segment: z.string().nullable(),
1137
+ category: z.string().nullable(),
1138
+ num_employees: z.number().nullable()
1139
+ })
1140
+ .nullable()
1141
1141
  })
1142
1142
  ```
1143
1143
 
1144
1144
  ### `DealListItemSchema`
1145
1145
 
1146
1146
  ```typescript
1147
- /**
1148
- * Deal list item with joined contact (and company via contact).
1149
- * Matches DealListItem from @repo/core types.
1150
- */
1151
- export const DealListItemSchema = z.object({
1152
- // acq_deals columns
1153
- id: z.string(),
1154
- organization_id: z.string(),
1155
- contact_id: z.string().nullable(),
1156
- contact_email: z.string(),
1157
- pipeline_key: z.string(),
1158
- stage_key: z.string().nullable(),
1159
- state_key: z.string().nullable(),
1160
- activity_log: z.unknown(),
1161
- discovery_data: z.unknown().nullable(),
1162
- discovery_submitted_at: z.string().nullable(),
1163
- discovery_submitted_by: z.string().nullable(),
1164
- proposal_data: z.unknown().nullable(),
1165
- proposal_sent_at: z.string().nullable(),
1166
- proposal_pdf_url: z.string().nullable(),
1167
- signature_envelope_id: z.string().nullable(),
1168
- source_list_id: z.string().nullable(),
1169
- source_type: z.string().nullable(),
1170
- initial_fee: z.number().nullable(),
1171
- monthly_fee: z.number().nullable(),
1172
- closed_lost_at: z.string().nullable(),
1173
- closed_lost_reason: z.string().nullable(),
1174
- created_at: z.string(),
1175
- updated_at: z.string(),
1176
- // joined relation
1177
- contact: DealContactSummarySchema.nullable()
1147
+ /**
1148
+ * Deal list item with joined contact (and company via contact).
1149
+ * Matches DealListItem from @repo/core types.
1150
+ */
1151
+ export const DealListItemSchema = z.object({
1152
+ // acq_deals columns
1153
+ id: z.string(),
1154
+ organization_id: z.string(),
1155
+ contact_id: z.string().nullable(),
1156
+ contact_email: z.string(),
1157
+ pipeline_key: z.string(),
1158
+ stage_key: z.string().nullable(),
1159
+ state_key: z.string().nullable(),
1160
+ activity_log: z.unknown(),
1161
+ discovery_data: z.unknown().nullable(),
1162
+ discovery_submitted_at: z.string().nullable(),
1163
+ discovery_submitted_by: z.string().nullable(),
1164
+ proposal_data: z.unknown().nullable(),
1165
+ proposal_sent_at: z.string().nullable(),
1166
+ proposal_pdf_url: z.string().nullable(),
1167
+ signature_envelope_id: z.string().nullable(),
1168
+ source_list_id: z.string().nullable(),
1169
+ source_type: z.string().nullable(),
1170
+ initial_fee: z.number().nullable(),
1171
+ monthly_fee: z.number().nullable(),
1172
+ closed_lost_at: z.string().nullable(),
1173
+ closed_lost_reason: z.string().nullable(),
1174
+ created_at: z.string(),
1175
+ updated_at: z.string(),
1176
+ // joined relation
1177
+ contact: DealContactSummarySchema.nullable()
1178
1178
  })
1179
1179
  ```
1180
1180
 
1181
1181
  ### `DealListResponseSchema`
1182
1182
 
1183
1183
  ```typescript
1184
- export const DealListResponseSchema = z.object({
1185
- data: z.array(DealListItemSchema),
1186
- total: z.number().int(),
1187
- limit: z.number().int(),
1188
- offset: z.number().int()
1184
+ export const DealListResponseSchema = z.object({
1185
+ data: z.array(DealListItemSchema),
1186
+ total: z.number().int(),
1187
+ limit: z.number().int(),
1188
+ offset: z.number().int()
1189
1189
  })
1190
1190
  ```
1191
1191
 
1192
1192
  ### `DealDetailResponseSchema`
1193
1193
 
1194
1194
  ```typescript
1195
- /**
1196
- * Deal detail shape — currently the same as a list item (full joined record).
1197
- * useDealDetail returns DealDetail which is typed as DealListItem.
1198
- */
1195
+ /**
1196
+ * Deal detail shape — currently the same as a list item (full joined record).
1197
+ * useDealDetail returns DealDetail which is typed as DealListItem.
1198
+ */
1199
1199
  export const DealDetailResponseSchema = DealListItemSchema
1200
1200
  ```
1201
1201
 
1202
1202
  ### `DealNoteResponseSchema`
1203
1203
 
1204
1204
  ```typescript
1205
- /**
1206
- * Single acq_deal_notes row (camelCase API representation).
1207
- */
1208
- export const DealNoteResponseSchema = z.object({
1209
- id: z.string(),
1210
- dealId: z.string(),
1211
- organizationId: z.string(),
1212
- authorUserId: z.string().nullable(),
1213
- body: z.string(),
1214
- createdAt: z.string(),
1215
- updatedAt: z.string()
1205
+ /**
1206
+ * Single acq_deal_notes row (camelCase API representation).
1207
+ */
1208
+ export const DealNoteResponseSchema = z.object({
1209
+ id: z.string(),
1210
+ dealId: z.string(),
1211
+ organizationId: z.string(),
1212
+ authorUserId: z.string().nullable(),
1213
+ body: z.string(),
1214
+ createdAt: z.string(),
1215
+ updatedAt: z.string()
1216
1216
  })
1217
1217
  ```
1218
1218
 
@@ -1225,24 +1225,24 @@ export const DealNoteListResponseSchema = z.array(DealNoteResponseSchema)
1225
1225
  ### `DealTaskResponseSchema`
1226
1226
 
1227
1227
  ```typescript
1228
- /**
1229
- * Single acq_deal_tasks row (camelCase API representation).
1230
- * Matches AcqDealTask domain type from types.ts.
1231
- */
1232
- export const DealTaskResponseSchema = z.object({
1233
- id: z.string(),
1234
- organizationId: z.string(),
1235
- dealId: z.string(),
1236
- title: z.string(),
1237
- description: z.string().nullable(),
1238
- kind: AcqDealTaskKindSchema,
1239
- dueAt: z.string().nullable(),
1240
- assigneeUserId: z.string().nullable(),
1241
- completedAt: z.string().nullable(),
1242
- completedByUserId: z.string().nullable(),
1243
- createdAt: z.string(),
1244
- updatedAt: z.string(),
1245
- createdByUserId: z.string().nullable()
1228
+ /**
1229
+ * Single acq_deal_tasks row (camelCase API representation).
1230
+ * Matches AcqDealTask domain type from types.ts.
1231
+ */
1232
+ export const DealTaskResponseSchema = z.object({
1233
+ id: z.string(),
1234
+ organizationId: z.string(),
1235
+ dealId: z.string(),
1236
+ title: z.string(),
1237
+ description: z.string().nullable(),
1238
+ kind: AcqDealTaskKindSchema,
1239
+ dueAt: z.string().nullable(),
1240
+ assigneeUserId: z.string().nullable(),
1241
+ completedAt: z.string().nullable(),
1242
+ completedByUserId: z.string().nullable(),
1243
+ createdAt: z.string(),
1244
+ updatedAt: z.string(),
1245
+ createdByUserId: z.string().nullable()
1246
1246
  })
1247
1247
  ```
1248
1248
 
@@ -1255,141 +1255,152 @@ export const DealTaskListResponseSchema = z.array(DealTaskResponseSchema)
1255
1255
  ### `DealSchemas`
1256
1256
 
1257
1257
  ```typescript
1258
- export const DealSchemas = {
1259
- // Params
1260
- DealIdParams: DealIdParamsSchema,
1261
- DealTaskIdParams: DealTaskIdParamsSchema,
1262
-
1263
- // Queries
1264
- ListDealsQuery: ListDealsQuerySchema,
1265
- DealLookupQuery: DealLookupQuerySchema,
1266
- ListDealTasksDueQuery: ListDealTasksDueQuerySchema,
1267
-
1268
- // Request bodies
1269
- CreateDealNoteRequest: CreateDealNoteRequestSchema,
1270
- CreateDealTaskRequest: CreateDealTaskRequestSchema,
1271
- TransitionItemRequest: TransitionItemRequestSchema,
1272
- ExecuteActionParams: ExecuteActionParamsSchema,
1273
- ExecuteActionRequest: ExecuteActionRequestSchema,
1274
-
1275
- // Responses
1276
- DealListResponse: DealListResponseSchema,
1277
- DealSummaryResponse: DealSummaryResponseSchema,
1278
- DealLookupResponse: DealLookupResponseSchema,
1279
- DealDetailResponse: DealDetailResponseSchema,
1280
- DealNoteResponse: DealNoteResponseSchema,
1281
- DealNoteListResponse: DealNoteListResponseSchema,
1282
- DealTaskResponse: DealTaskResponseSchema,
1283
- DealTaskListResponse: DealTaskListResponseSchema
1258
+ export const DealSchemas = {
1259
+ // Params
1260
+ DealIdParams: DealIdParamsSchema,
1261
+ DealTaskIdParams: DealTaskIdParamsSchema,
1262
+
1263
+ // Queries
1264
+ ListDealsQuery: ListDealsQuerySchema,
1265
+ DealLookupQuery: DealLookupQuerySchema,
1266
+ ListDealTasksDueQuery: ListDealTasksDueQuerySchema,
1267
+
1268
+ // Request bodies
1269
+ CreateDealNoteRequest: CreateDealNoteRequestSchema,
1270
+ CreateDealTaskRequest: CreateDealTaskRequestSchema,
1271
+ TransitionItemRequest: TransitionItemRequestSchema,
1272
+ ExecuteActionParams: ExecuteActionParamsSchema,
1273
+ ExecuteActionRequest: ExecuteActionRequestSchema,
1274
+
1275
+ // Responses
1276
+ DealListResponse: DealListResponseSchema,
1277
+ DealSummaryResponse: DealSummaryResponseSchema,
1278
+ DealLookupResponse: DealLookupResponseSchema,
1279
+ DealDetailResponse: DealDetailResponseSchema,
1280
+ DealNoteResponse: DealNoteResponseSchema,
1281
+ DealNoteListResponse: DealNoteListResponseSchema,
1282
+ DealTaskResponse: DealTaskResponseSchema,
1283
+ DealTaskListResponse: DealTaskListResponseSchema
1284
1284
  }
1285
1285
  ```
1286
1286
 
1287
1287
  ### `Action`
1288
1288
 
1289
1289
  ```typescript
1290
- export interface Action {
1291
- key: string
1292
- label: string
1293
- payloadSchema?: z.ZodTypeAny
1290
+ export interface Action {
1291
+ key: string
1292
+ label: string
1293
+ payloadSchema?: z.ZodTypeAny
1294
1294
  }
1295
1295
  ```
1296
1296
 
1297
1297
  ### `ActionDef`
1298
1298
 
1299
1299
  ```typescript
1300
- export interface ActionDef {
1301
- key: string
1302
- label: string
1303
- isAvailableFor: (deal: AcqDealRow) => boolean
1304
- workflowId: string
1305
- payloadSchema?: z.ZodTypeAny
1300
+ export interface ActionDef {
1301
+ key: string
1302
+ label: string
1303
+ isAvailableFor: (deal: AcqDealRow) => boolean
1304
+ workflowId: string
1305
+ payloadSchema?: z.ZodTypeAny
1306
1306
  }
1307
1307
  ```
1308
1308
 
1309
1309
  ### `DEFAULT_CRM_ACTIONS`
1310
1310
 
1311
1311
  ```typescript
1312
- export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
1313
- {
1314
- key: 'move_to_proposal',
1315
- label: 'Move to Proposal',
1316
- isAvailableFor: (deal) => deal.stage_key === 'interested',
1317
- workflowId: 'move_to_proposal-workflow'
1318
- },
1319
- {
1320
- key: 'move_to_closing',
1321
- label: 'Move to Closing',
1322
- isAvailableFor: (deal) => deal.stage_key === 'proposal',
1323
- workflowId: 'move_to_closing-workflow'
1324
- },
1325
- {
1326
- key: 'move_to_closed_won',
1327
- label: 'Close Won',
1328
- isAvailableFor: (deal) => deal.stage_key === 'closing',
1329
- workflowId: 'move_to_closed_won-workflow'
1330
- },
1331
- {
1332
- key: 'move_to_closed_lost',
1333
- label: 'Close Lost',
1334
- isAvailableFor: (deal) =>
1335
- deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
1336
- workflowId: 'move_to_closed_lost-workflow'
1337
- },
1338
- {
1339
- key: 'move_to_nurturing',
1340
- label: 'Move to Nurturing',
1341
- isAvailableFor: (deal) =>
1342
- deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
1343
- workflowId: 'move_to_nurturing-workflow'
1344
- },
1345
- {
1346
- key: 'send_link',
1347
- label: 'Send Booking Link',
1348
- isAvailableFor: (deal) => deal.stage_key === 'interested' && deal.state_key === 'discovery_replied',
1349
- workflowId: 'crm-send-booking-link-workflow'
1350
- },
1351
- {
1352
- key: 'send_nudge',
1353
- label: 'Send Nudge',
1354
- isAvailableFor: (deal) =>
1355
- deal.stage_key === 'interested' &&
1356
- (deal.state_key === 'discovery_link_sent' || deal.state_key === 'discovery_nudging'),
1357
- workflowId: 'crm-send-nudge-workflow'
1358
- },
1359
- {
1360
- key: 'mark_no_show',
1361
- label: 'Mark No-Show',
1362
- isAvailableFor: (deal) => deal.stage_key === 'interested' && deal.state_key === 'discovery_nudging',
1363
- // Mirrors the auto-timeout precedent in operations/sales/crm/pipeline/timeout-actions.ts:
1364
- // both manual-click and timeout move the deal to closed_lost. The action_taken activity
1365
- // event captures operator intent and distinguishes the manual variant from the timed one.
1366
- workflowId: 'mark_no_show-workflow'
1367
- },
1368
- {
1369
- key: 'rebook',
1370
- label: 'Rebook',
1371
- isAvailableFor: (deal) => deal.stage_key === 'interested' && deal.state_key === 'discovery_booking_cancelled',
1372
- workflowId: 'crm-rebook-workflow'
1373
- }
1312
+ export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
1313
+ {
1314
+ key: 'move_to_proposal',
1315
+ label: 'Move to Proposal',
1316
+ isAvailableFor: (deal) => deal.stage_key === 'interested',
1317
+ workflowId: 'move_to_proposal-workflow'
1318
+ },
1319
+ {
1320
+ key: 'move_to_closing',
1321
+ label: 'Move to Closing',
1322
+ isAvailableFor: (deal) => deal.stage_key === 'proposal',
1323
+ workflowId: 'move_to_closing-workflow'
1324
+ },
1325
+ {
1326
+ key: 'move_to_closed_won',
1327
+ label: 'Close Won',
1328
+ isAvailableFor: (deal) => deal.stage_key === 'closing',
1329
+ workflowId: 'move_to_closed_won-workflow'
1330
+ },
1331
+ {
1332
+ key: 'move_to_closed_lost',
1333
+ label: 'Close Lost',
1334
+ isAvailableFor: (deal) =>
1335
+ deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
1336
+ workflowId: 'move_to_closed_lost-workflow'
1337
+ },
1338
+ {
1339
+ key: 'move_to_nurturing',
1340
+ label: 'Move to Nurturing',
1341
+ isAvailableFor: (deal) =>
1342
+ deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
1343
+ workflowId: 'move_to_nurturing-workflow'
1344
+ },
1345
+ {
1346
+ key: 'send_reply',
1347
+ label: 'Send Reply',
1348
+ isAvailableFor: (deal) =>
1349
+ deal.stage_key === 'interested' &&
1350
+ (deal.state_key === 'discovery_replied' ||
1351
+ deal.state_key === 'discovery_link_sent' ||
1352
+ deal.state_key === 'discovery_nudging'),
1353
+ workflowId: 'crm-send-reply-workflow',
1354
+ payloadSchema: SendReplyActionPayloadSchema
1355
+ },
1356
+ {
1357
+ key: 'send_link',
1358
+ label: 'Send Booking Link',
1359
+ isAvailableFor: (deal) => deal.stage_key === 'interested' && deal.state_key === 'discovery_replied',
1360
+ workflowId: 'crm-send-booking-link-workflow'
1361
+ },
1362
+ {
1363
+ key: 'send_nudge',
1364
+ label: 'Send Nudge',
1365
+ isAvailableFor: (deal) =>
1366
+ deal.stage_key === 'interested' &&
1367
+ (deal.state_key === 'discovery_link_sent' || deal.state_key === 'discovery_nudging'),
1368
+ workflowId: 'crm-send-nudge-workflow'
1369
+ },
1370
+ {
1371
+ key: 'mark_no_show',
1372
+ label: 'Mark No-Show',
1373
+ isAvailableFor: (deal) => deal.stage_key === 'interested' && deal.state_key === 'discovery_nudging',
1374
+ // Mirrors the auto-timeout precedent in operations/sales/crm/pipeline/timeout-actions.ts:
1375
+ // both manual-click and timeout move the deal to closed_lost. The action_taken activity
1376
+ // event captures operator intent and distinguishes the manual variant from the timed one.
1377
+ workflowId: 'mark_no_show-workflow'
1378
+ },
1379
+ {
1380
+ key: 'rebook',
1381
+ label: 'Rebook',
1382
+ isAvailableFor: (deal) => deal.stage_key === 'interested' && deal.state_key === 'discovery_booking_cancelled',
1383
+ workflowId: 'crm-rebook-workflow'
1384
+ }
1374
1385
  ]
1375
1386
  ```
1376
1387
 
1377
1388
  ### `CrmToolMap`
1378
1389
 
1379
1390
  ```typescript
1380
- export type CrmToolMap = {
1381
- getRecentActivity: { params: CrmRecentActivityParams; result: RecentActivityEntry[] }
1382
- listDeals: { params: CrmListDealsParams; result: DealListItem[] }
1383
- getDeal: { params: CrmGetDealParams; result: DealDetail | null }
1384
- getDealByEmail: { params: CrmGetDealByEmailParams; result: DealDetail | null }
1385
- createDealNote: { params: CrmDealNoteParams; result: AcqDealNote }
1386
- listDealNotes: { params: Omit<ListDealNotesParams, 'organizationId'>; result: AcqDealNote[] }
1387
- createDealTask: { params: CrmDealTaskParams; result: AcqDealTask }
1388
- listDealTasks: { params: Omit<ListDealTasksParams, 'organizationId'>; result: AcqDealTask[] }
1389
- listDealTasksDue: { params: CrmTaskDueParams; result: AcqDealTask[] }
1390
- completeDealTask: { params: Omit<CompleteDealTaskParams, 'organizationId'>; result: AcqDealTask }
1391
- recordActivity: { params: CrmRecordActivityParams; result: void }
1392
- deleteDeal: { params: CrmDeleteDealParams; result: void }
1391
+ export type CrmToolMap = {
1392
+ getRecentActivity: { params: CrmRecentActivityParams; result: RecentActivityEntry[] }
1393
+ listDeals: { params: CrmListDealsParams; result: DealListItem[] }
1394
+ getDeal: { params: CrmGetDealParams; result: DealDetail | null }
1395
+ getDealByEmail: { params: CrmGetDealByEmailParams; result: DealDetail | null }
1396
+ createDealNote: { params: CrmDealNoteParams; result: AcqDealNote }
1397
+ listDealNotes: { params: Omit<ListDealNotesParams, 'organizationId'>; result: AcqDealNote[] }
1398
+ createDealTask: { params: CrmDealTaskParams; result: AcqDealTask }
1399
+ listDealTasks: { params: Omit<ListDealTasksParams, 'organizationId'>; result: AcqDealTask[] }
1400
+ listDealTasksDue: { params: CrmTaskDueParams; result: AcqDealTask[] }
1401
+ completeDealTask: { params: Omit<CompleteDealTaskParams, 'organizationId'>; result: AcqDealTask }
1402
+ recordActivity: { params: CrmRecordActivityParams; result: void }
1403
+ deleteDeal: { params: CrmDeleteDealParams; result: void }
1393
1404
  }
1394
1405
  ```
1395
1406
 
@@ -1398,622 +1409,427 @@ export type CrmToolMap = {
1398
1409
  ### `WebPost`
1399
1410
 
1400
1411
  ```typescript
1401
- /**
1402
- * Represents a web post from company website scraping.
1403
- * Used for recent blog posts, news, or announcements.
1404
- */
1405
- export interface WebPost {
1406
- /** ISO date string of when the post was published */
1407
- date: string
1408
- /** Title of the web post */
1409
- title: string
1410
- /** Brief summary of the post content */
1411
- summary: string
1412
- /** AI-generated insight about the post's relevance */
1413
- aiInsight?: string
1412
+ /**
1413
+ * Represents a web post from company website scraping.
1414
+ * Used for recent blog posts, news, or announcements.
1415
+ */
1416
+ export interface WebPost {
1417
+ /** ISO date string of when the post was published */
1418
+ date: string
1419
+ /** Title of the web post */
1420
+ title: string
1421
+ /** Brief summary of the post content */
1422
+ summary: string
1423
+ /** AI-generated insight about the post's relevance */
1424
+ aiInsight?: string
1414
1425
  }
1415
1426
  ```
1416
1427
 
1417
1428
  ### `CompanyPipelineStatus`
1418
1429
 
1419
1430
  ```typescript
1420
- /**
1421
- * Tracks pipeline status for a company across all processing stages.
1422
- */
1423
- export interface CompanyPipelineStatus {
1424
- acquired: boolean
1425
- enrichment: {
1426
- [source: string]: {
1427
- status: 'pending' | 'complete' | 'failed' | 'skipped'
1428
- completedAt?: string
1429
- error?: string
1430
- }
1431
- }
1431
+ /**
1432
+ * Tracks pipeline status for a company across all processing stages.
1433
+ */
1434
+ export interface CompanyPipelineStatus {
1435
+ acquired: boolean
1436
+ enrichment: {
1437
+ [source: string]: {
1438
+ status: 'pending' | 'complete' | 'failed' | 'skipped'
1439
+ completedAt?: string
1440
+ error?: string
1441
+ }
1442
+ }
1432
1443
  }
1433
1444
  ```
1434
1445
 
1435
1446
  ### `ContactPipelineStatus`
1436
1447
 
1437
1448
  ```typescript
1438
- /**
1439
- * Tracks pipeline status for a contact across all processing stages.
1440
- */
1441
- export interface ContactPipelineStatus {
1442
- enrichment: {
1443
- [source: string]: {
1444
- status: 'pending' | 'complete' | 'failed' | 'skipped'
1445
- completedAt?: string
1446
- error?: string
1447
- }
1448
- }
1449
- personalization: {
1450
- status: 'pending' | 'complete' | 'failed' | 'skipped'
1451
- completedAt?: string
1452
- }
1453
- outreach: {
1454
- status: 'pending' | 'sent' | 'replied' | 'bounced' | 'opted-out'
1455
- sentAt?: string
1456
- channel?: string
1457
- campaignId?: string
1458
- }
1449
+ /**
1450
+ * Tracks pipeline status for a contact across all processing stages.
1451
+ */
1452
+ export interface ContactPipelineStatus {
1453
+ enrichment: {
1454
+ [source: string]: {
1455
+ status: 'pending' | 'complete' | 'failed' | 'skipped'
1456
+ completedAt?: string
1457
+ error?: string
1458
+ }
1459
+ }
1460
+ personalization: {
1461
+ status: 'pending' | 'complete' | 'failed' | 'skipped'
1462
+ completedAt?: string
1463
+ }
1464
+ outreach: {
1465
+ status: 'pending' | 'sent' | 'replied' | 'bounced' | 'opted-out'
1466
+ sentAt?: string
1467
+ channel?: string
1468
+ campaignId?: string
1469
+ }
1459
1470
  }
1460
1471
  ```
1461
1472
 
1462
1473
  ### `CompanyEnrichmentData`
1463
1474
 
1464
1475
  ```typescript
1465
- /**
1466
- * Enrichment data collected for a company from various sources.
1467
- */
1468
- export interface CompanyEnrichmentData {
1469
- googleMaps?: {
1470
- placeId?: string
1471
- totalScore?: number
1472
- reviewsCount?: number
1473
- address?: string
1474
- phone?: string
1475
- categoryName?: string
1476
- googleMapsUrl?: string
1477
- scrapedAt?: string
1478
- }
1479
- websiteCrawl?: {
1480
- companyDescription?: string
1481
- services?: string[]
1482
- specialties?: string[]
1483
- staff?: Array<{ name: string; title?: string; email?: string }>
1484
- automationGaps?: string[]
1485
- targetAudience?: string
1486
- category?: string
1487
- segment?: string
1488
- recentWin?: string
1489
- emailCount?: number
1490
- pageCount?: number
1491
- totalChars?: number
1492
- crawledAt?: string
1493
- extractedAt?: string
1494
- }
1495
- website?: {
1496
- missionVision?: string
1497
- uniqueAttributes?: string
1498
- coreOfferings?: string
1499
- targetAudience?: string
1500
- companyValues?: string
1501
- businessDescription?: string
1502
- recentPosts?: Array<{ date?: string; title?: string; summary?: string; aiInsight?: string }>
1503
- }
1504
- tomba?: {
1505
- waterfallEmail?: {
1506
- email: string
1507
- name?: string
1508
- title?: string
1509
- department?: string
1510
- } | null
1511
- genericEmail?: string | null
1512
- totalFound?: number
1513
- searchedAt?: string
1514
- }
1476
+ /**
1477
+ * Enrichment data collected for a company from various sources.
1478
+ */
1479
+ export interface CompanyEnrichmentData {
1480
+ googleMaps?: {
1481
+ placeId?: string
1482
+ totalScore?: number
1483
+ reviewsCount?: number
1484
+ address?: string
1485
+ phone?: string
1486
+ categoryName?: string
1487
+ googleMapsUrl?: string
1488
+ scrapedAt?: string
1489
+ }
1490
+ websiteCrawl?: {
1491
+ companyDescription?: string
1492
+ services?: string[]
1493
+ specialties?: string[]
1494
+ staff?: Array<{ name: string; title?: string; email?: string }>
1495
+ automationGaps?: string[]
1496
+ targetAudience?: string
1497
+ category?: string
1498
+ segment?: string
1499
+ recentWin?: string
1500
+ emailCount?: number
1501
+ pageCount?: number
1502
+ totalChars?: number
1503
+ crawledAt?: string
1504
+ extractedAt?: string
1505
+ }
1506
+ website?: {
1507
+ missionVision?: string
1508
+ uniqueAttributes?: string
1509
+ coreOfferings?: string
1510
+ targetAudience?: string
1511
+ companyValues?: string
1512
+ businessDescription?: string
1513
+ recentPosts?: Array<{ date?: string; title?: string; summary?: string; aiInsight?: string }>
1514
+ }
1515
+ tomba?: {
1516
+ waterfallEmail?: {
1517
+ email: string
1518
+ name?: string
1519
+ title?: string
1520
+ department?: string
1521
+ } | null
1522
+ genericEmail?: string | null
1523
+ totalFound?: number
1524
+ searchedAt?: string
1525
+ }
1515
1526
  }
1516
1527
  ```
1517
1528
 
1518
1529
  ### `ContactEnrichmentData`
1519
1530
 
1520
1531
  ```typescript
1521
- /**
1522
- * Enrichment data collected for a contact from various sources.
1523
- */
1524
- export interface ContactEnrichmentData {
1525
- linkedin?: {
1526
- summary?: string
1527
- pastExperience?: string
1528
- education?: string
1529
- activity?: Array<{ date?: string; content?: string }>
1530
- }
1532
+ /**
1533
+ * Enrichment data collected for a contact from various sources.
1534
+ */
1535
+ export interface ContactEnrichmentData {
1536
+ linkedin?: {
1537
+ summary?: string
1538
+ pastExperience?: string
1539
+ education?: string
1540
+ activity?: Array<{ date?: string; content?: string }>
1541
+ }
1531
1542
  }
1532
1543
  ```
1533
1544
 
1534
1545
  ### `AcqList`
1535
1546
 
1536
1547
  ```typescript
1537
- /**
1538
- * Acquisition list for organizing contacts and companies.
1539
- * Transformed from AcqListRow with camelCase properties.
1540
- *
1541
- * Track B: acq_lists adopts the Stateful trait (pipeline_key / stage_key / state_key / activity_log).
1542
- * `status` is preserved as a convenience alias for `state_key` so existing consumers continue to
1543
- * compile until they are migrated to read the trait fields directly.
1544
- */
1545
- export interface AcqList {
1546
- id: string
1547
- organizationId: string
1548
- name: string
1549
- description: string | null
1550
- type: string
1551
- batchIds: string[]
1552
- instantlyCampaignId: string | null
1553
- /** @deprecated Use state_key. Retained as alias mapped from state_key for backward-compatibility. */
1554
- status: string
1555
- /** Stateful trait: pipeline identifier (always 'lead-gen' for acq_lists). Added by W2 migration. */
1556
- pipelineKey: string
1557
- /** Stateful trait: stage within the pipeline (always 'lifecycle' for acq_lists). Added by W2 migration. */
1558
- stageKey: string
1559
- /** Stateful trait: lifecycle state (draft | enriching | launched | closing | archived). Added by W2 migration. */
1560
- stateKey: string
1561
- metadata: Record<string, unknown>
1562
- launchedAt: Date | null
1563
- completedAt: Date | null
1564
- createdAt: Date
1565
- config: ListConfig
1548
+ export interface AcqList {
1549
+ id: string
1550
+ organizationId: string
1551
+ name: string
1552
+ description: string | null
1553
+ batchIds: string[]
1554
+ instantlyCampaignId: string | null
1555
+ status: ListStatus
1556
+ scrapingConfig: ScrapingConfig
1557
+ icp: IcpRubric
1558
+ pipelineConfig: PipelineConfig
1559
+ metadata: Record<string, unknown>
1560
+ launchedAt: Date | null
1561
+ completedAt: Date | null
1562
+ createdAt: Date
1566
1563
  }
1567
1564
  ```
1568
1565
 
1569
1566
  ### `AcqCompany`
1570
1567
 
1571
1568
  ```typescript
1572
- /**
1573
- * Company record in the acquisition database.
1574
- * Contains enriched company data from various sources.
1575
- * Transformed from AcqCompanyRow with camelCase properties.
1576
- */
1577
- export interface AcqCompany {
1578
- id: string
1579
- organizationId: string
1580
- name: string
1581
- domain: string | null
1582
- linkedinUrl: string | null
1583
- website: string | null
1584
- numEmployees: number | null
1585
- foundedYear: number | null
1586
- locationCity: string | null
1587
- locationState: string | null
1588
- category: string | null
1589
- categoryPain: string | null
1590
- segment: string | null
1591
- pipelineStatus: CompanyPipelineStatus | null
1592
- enrichmentData: CompanyEnrichmentData | null
1593
- source: string | null
1594
- batchId: string | null
1595
- status: 'active' | 'invalid'
1596
- verticalResearch: string | null
1597
- /** Track A: flat qualification score (null until a scoring rubric is defined). Added by W1 migration. */
1598
- qualificationScore: number | null
1599
- /** Track A: flat qualification signals jsonb preserving the result payload shape. Added by W1 migration. */
1600
- qualificationSignals: Record<string, unknown> | null
1601
- /** Track A: key identifying the rubric used for qualification. Added by W1 migration. */
1602
- qualificationRubricKey: string | null
1603
- createdAt: Date
1604
- updatedAt: Date
1569
+ /**
1570
+ * Company record in the acquisition database.
1571
+ * Contains enriched company data from various sources.
1572
+ * Transformed from AcqCompanyRow with camelCase properties.
1573
+ */
1574
+ export interface AcqCompany {
1575
+ id: string
1576
+ organizationId: string
1577
+ name: string
1578
+ domain: string | null
1579
+ linkedinUrl: string | null
1580
+ website: string | null
1581
+ numEmployees: number | null
1582
+ foundedYear: number | null
1583
+ locationCity: string | null
1584
+ locationState: string | null
1585
+ category: string | null
1586
+ categoryPain: string | null
1587
+ segment: string | null
1588
+ pipelineStatus: CompanyPipelineStatus | null
1589
+ enrichmentData: CompanyEnrichmentData | null
1590
+ source: string | null
1591
+ batchId: string | null
1592
+ status: 'active' | 'invalid'
1593
+ verticalResearch: string | null
1594
+ /** Track A: flat qualification score (null until a scoring rubric is defined). Added by W1 migration. */
1595
+ qualificationScore: number | null
1596
+ /** Track A: flat qualification signals jsonb preserving the result payload shape. Added by W1 migration. */
1597
+ qualificationSignals: Record<string, unknown> | null
1598
+ /** Track A: key identifying the rubric used for qualification. Added by W1 migration. */
1599
+ qualificationRubricKey: string | null
1600
+ createdAt: Date
1601
+ updatedAt: Date
1605
1602
  }
1606
1603
  ```
1607
1604
 
1608
1605
  ### `AcqContact`
1609
1606
 
1610
1607
  ```typescript
1611
- /**
1612
- * Contact record in the acquisition database.
1613
- * Contains enriched contact data and personalization content.
1614
- * Transformed from AcqContactRow with camelCase properties.
1615
- */
1616
- export interface AcqContact {
1617
- id: string
1618
- organizationId: string
1619
- companyId: string | null
1620
- email: string
1621
- emailValid: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN' | null
1622
- firstName: string | null
1623
- lastName: string | null
1624
- linkedinUrl: string | null
1625
- title: string | null
1626
- headline: string | null
1627
- filterReason: string | null
1628
- openingLine: string | null
1629
- source: string | null
1630
- sourceId: string | null
1631
- pipelineStatus: ContactPipelineStatus | null
1632
- enrichmentData: ContactEnrichmentData | null
1633
- /** Attio Person record ID - set when contact responds and is added to CRM */
1634
- attioPersonId: string | null
1635
- batchId: string | null
1636
- status: 'active' | 'invalid'
1637
- createdAt: Date
1638
- updatedAt: Date
1639
- }
1640
- ```
1641
-
1642
- ### `PipelineStep`
1643
-
1644
- ```typescript
1645
- /**
1646
- * One ordered step in a list's pipeline. Maps to a deployed workflow
1647
- * (e.g. 'lgn-03-company-qualification-workflow'). The `inputTemplate`
1648
- * is merged with `{ listId }` at run time to form the workflow input.
1649
- */
1650
- export interface PipelineStep {
1651
- /** Stable key, e.g. 'scrape' | 'extract' | 'qualify' | 'discover' | 'verify' | 'personalize'. */
1652
- key: string
1653
- /** Human label rendered in the UI stepper. */
1654
- label: string
1655
- /** Deployed workflow resourceId (e.g. 'lgn-03-company-qualification-workflow'). */
1656
- resourceId: string
1657
- /** Input defaults merged with `{ listId }` at dispatch. */
1658
- inputTemplate: Record<string, unknown>
1659
- /** Whether the UI shows the Run button. */
1660
- enabled: boolean
1661
- /** Display order (ascending). */
1662
- order: number
1663
- }
1664
- ```
1665
-
1666
- ### `CompanyListStage`
1667
-
1668
- ```typescript
1669
- export type CompanyListStage = 'populated' | 'extracted' | 'qualified'
1670
- ```
1671
-
1672
- ### `ContactListStage`
1673
-
1674
- ```typescript
1675
- export type ContactListStage = 'discovered' | 'verified' | 'personalized' | 'uploaded'
1676
- ```
1677
-
1678
- ### `ListConfig`
1679
-
1680
- ```typescript
1681
- /**
1682
- * Per-list pipeline configuration stored as jsonb in `acq_lists.config`.
1683
- *
1684
- * `qualification` is the only required subtree. Every other subtree is optional
1685
- * and inherits global defaults when omitted: workflows resolve values as
1686
- * `list.config.foo ?? globalDefaults.foo`. Seeded rows from
1687
- * `20260413000100_backfill_list_configs.sql` only populate `qualification`
1688
- * and `scraping`; the rest was intentionally omitted.
1689
- */
1690
- export interface ListConfig {
1691
- qualification: {
1692
- /** One-line description of the target vertical/segment. */
1693
- targetDescription: string
1694
- /** Minimum Google review count to qualify. */
1695
- minReviewCount: number
1696
- /** Minimum Google star rating to qualify (e.g. 3.0). */
1697
- minRating: number
1698
- /** Whether to exclude franchises/chains during qualification. */
1699
- excludeFranchises: boolean
1700
- /** Free-form LLM rules layered on top of the structured criteria. */
1701
- customRules: string
1702
- /**
1703
- * Free-form text key identifying the ICP qualification rubric applied to this list.
1704
- * Decision C4: stays as free-form text until an Org OS rubric registry lands.
1705
- */
1706
- qualificationRubricKey?: string | null
1707
- }
1708
- enrichment?: {
1709
- emailDiscovery?: {
1710
- primary: 'tomba' | 'anymailfinder'
1711
- credentialName?: string
1712
- }
1713
- emailVerification?: {
1714
- provider: 'millionverifier'
1715
- threshold?: 'ok' | 'ok+catch_all'
1716
- }
1717
- }
1718
- personalization?: {
1719
- industryContext?: string
1720
- /** Email body template with tags like {{opening_line}} / {{category_pain}}. */
1721
- emailBody?: string
1722
- creativeDirection?: string
1723
- /** Contradiction-prevention rules layered into the personalization prompt. */
1724
- exclusionRules?: string[]
1725
- }
1726
- pipeline?: {
1727
- steps: PipelineStep[]
1728
- }
1608
+ /**
1609
+ * Contact record in the acquisition database.
1610
+ * Contains enriched contact data and personalization content.
1611
+ * Transformed from AcqContactRow with camelCase properties.
1612
+ */
1613
+ export interface AcqContact {
1614
+ id: string
1615
+ organizationId: string
1616
+ companyId: string | null
1617
+ email: string
1618
+ emailValid: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN' | null
1619
+ firstName: string | null
1620
+ lastName: string | null
1621
+ linkedinUrl: string | null
1622
+ title: string | null
1623
+ headline: string | null
1624
+ filterReason: string | null
1625
+ openingLine: string | null
1626
+ source: string | null
1627
+ sourceId: string | null
1628
+ pipelineStatus: ContactPipelineStatus | null
1629
+ enrichmentData: ContactEnrichmentData | null
1630
+ /** Attio Person record ID - set when contact responds and is added to CRM */
1631
+ attioPersonId: string | null
1632
+ batchId: string | null
1633
+ status: 'active' | 'invalid'
1634
+ createdAt: Date
1635
+ updatedAt: Date
1729
1636
  }
1730
1637
  ```
1731
1638
 
1732
1639
  ### `ListTelemetry`
1733
1640
 
1734
1641
  ```typescript
1735
- /**
1736
- * Live-scan aggregate telemetry for a single list, computed on demand from
1737
- * the list junction tables and current contact deliverability state.
1738
- */
1739
- export interface ListTelemetry {
1740
- listId: string
1741
- totalCompanies: number
1742
- totalContacts: number
1743
- stageCounts: {
1744
- populated: number
1745
- extracted: number
1746
- qualified: number
1747
- discovered: number
1748
- verified: number
1749
- personalized: number
1750
- uploaded: number
1751
- }
1752
- deliverability: {
1753
- valid: number
1754
- risky: number
1755
- invalid: number
1756
- unknown: number
1757
- bounced: number
1758
- }
1759
- /** Reserved -- active workflow IDs associated with this list. */
1760
- activeWorkflows?: string[]
1761
- }
1762
- ```
1763
-
1764
- ### `ListQualificationSchema`
1765
-
1766
- ```typescript
1767
- export const ListQualificationSchema = z.object({
1768
- targetDescription: z.string(),
1769
- minReviewCount: z.number().int().min(0),
1770
- minRating: z.number().min(0).max(5),
1771
- excludeFranchises: z.boolean(),
1772
- customRules: z.string(),
1773
- /**
1774
- * Free-form text key identifying the ICP rubric applied to this list.
1775
- * Decision C4: stays free-form until an Org OS rubric registry lands.
1776
- */
1777
- qualificationRubricKey: z.string().trim().max(255).nullish()
1778
- })
1779
- ```
1780
-
1781
- ### `ListEnrichmentSchema`
1782
-
1783
- ```typescript
1784
- export const ListEnrichmentSchema = z.object({
1785
- emailDiscovery: z
1786
- .object({
1787
- primary: z.enum(['tomba', 'anymailfinder']),
1788
- credentialName: z.string().optional()
1789
- })
1790
- .optional(),
1791
- emailVerification: z
1792
- .object({
1793
- provider: z.literal('millionverifier'),
1794
- threshold: z.enum(['ok', 'ok+catch_all']).optional()
1795
- })
1796
- .optional()
1797
- })
1798
- ```
1799
-
1800
- ### `ListPersonalizationSchema`
1801
-
1802
- ```typescript
1803
- export const ListPersonalizationSchema = z.object({
1804
- industryContext: z.string().optional(),
1805
- emailBody: z.string().optional(),
1806
- creativeDirection: z.string().optional(),
1807
- exclusionRules: z.array(z.string()).optional()
1808
- })
1809
- ```
1810
-
1811
- ### `PipelineStepSchema`
1812
-
1813
- ```typescript
1814
- export const PipelineStepSchema = z.object({
1815
- key: z.string(),
1816
- label: z.string(),
1817
- resourceId: z.string(),
1818
- inputTemplate: z.record(z.string(), z.unknown()),
1819
- enabled: z.boolean(),
1820
- order: z.number().int()
1821
- })
1822
- ```
1823
-
1824
- ### `ListPipelineSchema`
1825
-
1826
- ```typescript
1827
- export const ListPipelineSchema = z.object({
1828
- steps: z.array(PipelineStepSchema)
1829
- })
1830
- ```
1831
-
1832
- ### `ListConfigSchema`
1833
-
1834
- ```typescript
1835
- /**
1836
- * Full ListConfig shape. `qualification` is required; everything else optional.
1837
- * Matches `acq_lists.config` jsonb and ListConfig type in types.ts.
1838
- */
1839
- export const ListConfigSchema = z.object({
1840
- qualification: ListQualificationSchema,
1841
- enrichment: ListEnrichmentSchema.optional(),
1842
- personalization: ListPersonalizationSchema.optional(),
1843
- pipeline: ListPipelineSchema.optional()
1844
- })
1642
+ /**
1643
+ * Live-scan aggregate telemetry for a single list, computed on demand from
1644
+ * the list junction tables and current contact deliverability state.
1645
+ */
1646
+ export interface ListTelemetry {
1647
+ listId: string
1648
+ totalCompanies: number
1649
+ totalContacts: number
1650
+ stageCounts: {
1651
+ populated: number
1652
+ extracted: number
1653
+ qualified: number
1654
+ discovered: number
1655
+ verified: number
1656
+ personalized: number
1657
+ uploaded: number
1658
+ }
1659
+ deliverability: {
1660
+ valid: number
1661
+ risky: number
1662
+ invalid: number
1663
+ unknown: number
1664
+ bounced: number
1665
+ }
1666
+ /** Reserved -- active workflow IDs associated with this list. */
1667
+ activeWorkflows?: string[]
1668
+ }
1845
1669
  ```
1846
1670
 
1847
1671
  ### `ListStageCountsSchema`
1848
1672
 
1849
1673
  ```typescript
1850
- export const ListStageCountsSchema = z.object({
1851
- stageCounts: z.object({
1852
- populated: z.number().int(),
1853
- extracted: z.number().int(),
1854
- qualified: z.number().int(),
1855
- discovered: z.number().int(),
1856
- verified: z.number().int(),
1857
- personalized: z.number().int(),
1858
- uploaded: z.number().int()
1859
- }),
1860
- deliverability: z.object({
1861
- valid: z.number().int(),
1862
- risky: z.number().int(),
1863
- invalid: z.number().int(),
1864
- unknown: z.number().int(),
1865
- bounced: z.number().int()
1866
- })
1674
+ export const ListStageCountsSchema = z.object({
1675
+ stageCounts: z.object({
1676
+ populated: z.number().int(),
1677
+ extracted: z.number().int(),
1678
+ qualified: z.number().int(),
1679
+ discovered: z.number().int(),
1680
+ verified: z.number().int(),
1681
+ personalized: z.number().int(),
1682
+ uploaded: z.number().int()
1683
+ }),
1684
+ deliverability: z.object({
1685
+ valid: z.number().int(),
1686
+ risky: z.number().int(),
1687
+ invalid: z.number().int(),
1688
+ unknown: z.number().int(),
1689
+ bounced: z.number().int()
1690
+ })
1867
1691
  })
1868
1692
  ```
1869
1693
 
1870
1694
  ### `ListTelemetrySchema`
1871
1695
 
1872
1696
  ```typescript
1873
- export const ListTelemetrySchema = z.object({
1874
- listId: UuidSchema,
1875
- totalCompanies: z.number().int(),
1876
- totalContacts: z.number().int(),
1877
- stageCounts: ListStageCountsSchema.shape.stageCounts,
1878
- deliverability: ListStageCountsSchema.shape.deliverability,
1879
- activeWorkflows: z.array(z.string()).optional()
1697
+ export const ListTelemetrySchema = z.object({
1698
+ listId: UuidSchema,
1699
+ totalCompanies: z.number().int(),
1700
+ totalContacts: z.number().int(),
1701
+ stageCounts: ListStageCountsSchema.shape.stageCounts,
1702
+ deliverability: ListStageCountsSchema.shape.deliverability,
1703
+ activeWorkflows: z.array(z.string()).optional()
1880
1704
  })
1881
1705
  ```
1882
1706
 
1883
1707
  ### `ListIdParamsSchema`
1884
1708
 
1885
1709
  ```typescript
1886
- export const ListIdParamsSchema = z.object({
1887
- listId: UuidSchema
1710
+ export const ListIdParamsSchema = z.object({
1711
+ listId: UuidSchema
1888
1712
  })
1889
1713
  ```
1890
1714
 
1891
1715
  ### `CreateListRequestSchema`
1892
1716
 
1893
1717
  ```typescript
1894
- export const CreateListRequestSchema = z
1895
- .object({
1896
- name: z.string().trim().min(1).max(255),
1897
- description: z.string().trim().nullable().optional(),
1898
- type: z.string().default('manual'),
1899
- /** Stateful trait pipeline key. Defaults to 'lead-gen'. */
1900
- pipelineKey: z.string().trim().min(1).max(100).optional(),
1901
- config: ListConfigSchema.optional()
1902
- })
1718
+ export const CreateListRequestSchema = z
1719
+ .object({
1720
+ name: z.string().trim().min(1).max(255),
1721
+ description: z.string().trim().nullable().optional(),
1722
+ status: ListStatusSchema.optional(),
1723
+ scrapingConfig: ScrapingConfigSchema.optional(),
1724
+ icp: IcpRubricSchema.optional(),
1725
+ pipelineConfig: PipelineConfigSchema.optional()
1726
+ })
1903
1727
  .strict()
1904
1728
  ```
1905
1729
 
1906
1730
  ### `UpdateListRequestSchema`
1907
1731
 
1908
1732
  ```typescript
1909
- export const UpdateListRequestSchema = z
1910
- .object({
1911
- name: z.string().trim().min(1).max(255).optional(),
1912
- description: z.string().trim().nullable().optional(),
1913
- status: z.string().optional(),
1914
- batchIds: z.array(z.string()).optional()
1733
+ export const UpdateListRequestSchema = z
1734
+ .object({
1735
+ name: z.string().trim().min(1).max(255).optional(),
1736
+ description: z.string().trim().nullable().optional(),
1737
+ batchIds: z.array(z.string()).optional()
1738
+ })
1739
+ .strict()
1740
+ .refine((data) => data.name !== undefined || data.description !== undefined || data.batchIds !== undefined, {
1741
+ message: 'At least one field (name, description, or batchIds) must be provided'
1915
1742
  })
1916
- .strict()
1917
- .refine(
1918
- (data) =>
1919
- data.name !== undefined ||
1920
- data.description !== undefined ||
1921
- data.status !== undefined ||
1922
- data.batchIds !== undefined,
1923
- {
1924
- message: 'At least one field (name, description, status, or batchIds) must be provided'
1925
- }
1926
- )
1927
1743
  ```
1928
1744
 
1929
1745
  ### `UpdateListConfigRequestSchema`
1930
1746
 
1931
1747
  ```typescript
1932
- /**
1933
- * Partial patch for list.config UI sends only the edited tab's subtree.
1934
- * Zod v4: use .partial() on each subtree and remake the root schema.
1935
- * Since the root ListConfigSchema marks `qualification` as required, we must
1936
- * produce a manually-built deep-partial that makes qualification optional too.
1937
- */
1938
- export const UpdateListConfigRequestSchema = z
1939
- .object({
1940
- qualification: ListQualificationSchema.partial().optional(),
1941
- enrichment: ListEnrichmentSchema.partial().optional(),
1942
- personalization: ListPersonalizationSchema.partial().optional(),
1943
- pipeline: ListPipelineSchema.partial().optional()
1748
+ /**
1749
+ * Partial patch for the three jsonb config columns. UI sends only the edited
1750
+ * subtree; server writes the field as-is (no deep merge each column is
1751
+ * replaced atomically when present in the patch).
1752
+ */
1753
+ export const UpdateListConfigRequestSchema = z
1754
+ .object({
1755
+ scrapingConfig: ScrapingConfigSchema.partial().optional(),
1756
+ icp: IcpRubricSchema.partial().optional(),
1757
+ pipelineConfig: PipelineConfigSchema.partial().optional()
1758
+ })
1759
+ .strict()
1760
+ .refine((data) => data.scrapingConfig !== undefined || data.icp !== undefined || data.pipelineConfig !== undefined, {
1761
+ message: 'At least one of scrapingConfig, icp, or pipelineConfig must be provided'
1944
1762
  })
1945
- .strict()
1946
1763
  ```
1947
1764
 
1948
1765
  ### `AddCompaniesToListRequestSchema`
1949
1766
 
1950
1767
  ```typescript
1951
- export const AddCompaniesToListRequestSchema = z
1952
- .object({
1953
- companyIds: z.array(UuidSchema).min(1).max(1000)
1954
- })
1768
+ export const AddCompaniesToListRequestSchema = z
1769
+ .object({
1770
+ companyIds: z.array(UuidSchema).min(1).max(1000)
1771
+ })
1955
1772
  .strict()
1956
1773
  ```
1957
1774
 
1958
1775
  ### `RemoveCompaniesFromListRequestSchema`
1959
1776
 
1960
1777
  ```typescript
1961
- export const RemoveCompaniesFromListRequestSchema = z
1962
- .object({
1963
- companyIds: z.array(UuidSchema).min(1).max(1000)
1964
- })
1778
+ export const RemoveCompaniesFromListRequestSchema = z
1779
+ .object({
1780
+ companyIds: z.array(UuidSchema).min(1).max(1000)
1781
+ })
1965
1782
  .strict()
1966
1783
  ```
1967
1784
 
1968
1785
  ### `AddContactsToListRequestSchema`
1969
1786
 
1970
1787
  ```typescript
1971
- export const AddContactsToListRequestSchema = z
1972
- .object({
1973
- contactIds: z.array(UuidSchema).min(1).max(1000)
1974
- })
1788
+ export const AddContactsToListRequestSchema = z
1789
+ .object({
1790
+ contactIds: z.array(UuidSchema).min(1).max(1000)
1791
+ })
1975
1792
  .strict()
1976
1793
  ```
1977
1794
 
1978
1795
  ### `RecordListExecutionRequestSchema`
1979
1796
 
1980
1797
  ```typescript
1981
- export const RecordListExecutionRequestSchema = z
1982
- .object({
1983
- executionId: UuidSchema,
1984
- configSnapshot: z.record(z.string(), z.unknown()).optional()
1985
- })
1798
+ export const RecordListExecutionRequestSchema = z
1799
+ .object({
1800
+ executionId: UuidSchema,
1801
+ configSnapshot: z.record(z.string(), z.unknown()).optional()
1802
+ })
1986
1803
  .strict()
1987
1804
  ```
1988
1805
 
1989
1806
  ### `AcqListResponseSchema`
1990
1807
 
1991
1808
  ```typescript
1992
- /**
1993
- * Single list as returned by /api/acquisition/lists/:id etc.
1994
- * Camel-cased domain shape matching AcqList in types.ts.
1995
- */
1996
- export const AcqListResponseSchema = z.object({
1997
- id: z.string(),
1998
- organizationId: z.string(),
1999
- name: z.string(),
2000
- description: z.string().nullable(),
2001
- type: z.string(),
2002
- batchIds: z.array(z.string()),
2003
- instantlyCampaignId: z.string().nullable(),
2004
- /** @deprecated Alias for stateKey retained for backward compatibility. */
2005
- status: z.string(),
2006
- /** Stateful trait: pipeline identifier (always 'lead-gen'). Added by W2 migration. */
2007
- pipelineKey: z.string(),
2008
- /** Stateful trait: stage within the pipeline (always 'lifecycle'). Added by W2 migration. */
2009
- stageKey: z.string(),
2010
- /** Stateful trait: lifecycle state (draft | enriching | launched | closing | archived). */
2011
- stateKey: z.string(),
2012
- metadata: z.record(z.string(), z.unknown()),
2013
- launchedAt: z.string().nullable(),
2014
- completedAt: z.string().nullable(),
2015
- createdAt: z.string(),
2016
- config: ListConfigSchema
1809
+ /**
1810
+ * Single list as returned by /api/acquisition/lists/:id etc.
1811
+ * Camel-cased domain shape matching AcqList in types.ts.
1812
+ */
1813
+ export const AcqListResponseSchema = z.object({
1814
+ id: z.string(),
1815
+ organizationId: z.string(),
1816
+ name: z.string(),
1817
+ description: z.string().nullable(),
1818
+ type: z.string(),
1819
+ batchIds: z.array(z.string()),
1820
+ instantlyCampaignId: z.string().nullable(),
1821
+ /** Lifecycle status (draft | enriching | launched | closing | archived). */
1822
+ status: ListStatusSchema,
1823
+ metadata: z.record(z.string(), z.unknown()),
1824
+ launchedAt: z.string().nullable(),
1825
+ completedAt: z.string().nullable(),
1826
+ createdAt: z.string(),
1827
+ /** Scraping criteria stored as jsonb on the row. */
1828
+ scrapingConfig: ScrapingConfigSchema,
1829
+ /** ICP / qualification rubric stored as jsonb on the row. */
1830
+ icp: IcpRubricSchema,
1831
+ /** Pipeline presentation contract stored as jsonb on the row. */
1832
+ pipelineConfig: PipelineConfigSchema
2017
1833
  })
2018
1834
  ```
2019
1835
 
@@ -2038,17 +1854,17 @@ export const ListTelemetryListResponseSchema = z.array(ListTelemetrySchema)
2038
1854
  ### `ListExecutionSummarySchema`
2039
1855
 
2040
1856
  ```typescript
2041
- /**
2042
- * Row from acq_list_executions joined with the execution summary,
2043
- * shaped for the /lists/:id/executions response.
2044
- */
2045
- export const ListExecutionSummarySchema = z.object({
2046
- executionId: z.string(),
2047
- resourceId: z.string(),
2048
- status: z.string(),
2049
- createdAt: z.string(),
2050
- completedAt: z.string().nullable(),
2051
- durationMs: z.number().int().nullable()
1857
+ /**
1858
+ * Row from acq_list_executions joined with the execution summary,
1859
+ * shaped for the /lists/:id/executions response.
1860
+ */
1861
+ export const ListExecutionSummarySchema = z.object({
1862
+ executionId: z.string(),
1863
+ resourceId: z.string(),
1864
+ status: z.string(),
1865
+ createdAt: z.string(),
1866
+ completedAt: z.string().nullable(),
1867
+ durationMs: z.number().int().nullable()
2052
1868
  })
2053
1869
  ```
2054
1870
 
@@ -2079,282 +1895,282 @@ export const AcqEmailValidSchema = z.enum(['VALID', 'INVALID', 'RISKY', 'UNKNOWN
2079
1895
  ### `CompanyIdParamsSchema`
2080
1896
 
2081
1897
  ```typescript
2082
- export const CompanyIdParamsSchema = z.object({
2083
- companyId: UuidSchema
1898
+ export const CompanyIdParamsSchema = z.object({
1899
+ companyId: UuidSchema
2084
1900
  })
2085
1901
  ```
2086
1902
 
2087
1903
  ### `ContactIdParamsSchema`
2088
1904
 
2089
1905
  ```typescript
2090
- export const ContactIdParamsSchema = z.object({
2091
- contactId: UuidSchema
1906
+ export const ContactIdParamsSchema = z.object({
1907
+ contactId: UuidSchema
2092
1908
  })
2093
1909
  ```
2094
1910
 
2095
1911
  ### `ListCompaniesQuerySchema`
2096
1912
 
2097
1913
  ```typescript
2098
- export const ListCompaniesQuerySchema = z
2099
- .object({
2100
- search: z.string().trim().min(1).max(200).optional(),
2101
- listId: UuidSchema.optional(),
2102
- domain: z.string().trim().min(1).max(255).optional(),
2103
- website: z.string().trim().min(1).max(2048).optional(),
2104
- segment: z.string().trim().min(1).max(255).optional(),
2105
- category: z.string().trim().min(1).max(255).optional(),
2106
- batchId: z.string().trim().min(1).max(255).optional(),
2107
- status: AcqCompanyStatusSchema.optional(),
2108
- includeAll: QueryBooleanSchema.optional(),
2109
- limit: z.coerce.number().int().min(1).max(5000).default(50),
2110
- offset: z.coerce.number().int().min(0).default(0)
2111
- })
1914
+ export const ListCompaniesQuerySchema = z
1915
+ .object({
1916
+ search: z.string().trim().min(1).max(200).optional(),
1917
+ listId: UuidSchema.optional(),
1918
+ domain: z.string().trim().min(1).max(255).optional(),
1919
+ website: z.string().trim().min(1).max(2048).optional(),
1920
+ segment: z.string().trim().min(1).max(255).optional(),
1921
+ category: z.string().trim().min(1).max(255).optional(),
1922
+ batchId: z.string().trim().min(1).max(255).optional(),
1923
+ status: AcqCompanyStatusSchema.optional(),
1924
+ includeAll: QueryBooleanSchema.optional(),
1925
+ limit: z.coerce.number().int().min(1).max(5000).default(50),
1926
+ offset: z.coerce.number().int().min(0).default(0)
1927
+ })
2112
1928
  .strict()
2113
1929
  ```
2114
1930
 
2115
1931
  ### `ListContactsQuerySchema`
2116
1932
 
2117
1933
  ```typescript
2118
- export const ListContactsQuerySchema = z
2119
- .object({
2120
- search: z.string().trim().min(1).max(200).optional(),
2121
- listId: UuidSchema.optional(),
2122
- openingLineIsNull: QueryBooleanSchema.optional(),
2123
- batchId: z.string().trim().min(1).max(255).optional(),
2124
- contactStatus: AcqContactStatusSchema.optional(),
2125
- limit: z.coerce.number().int().min(1).max(5000).default(5000),
2126
- offset: z.coerce.number().int().min(0).default(0)
2127
- })
1934
+ export const ListContactsQuerySchema = z
1935
+ .object({
1936
+ search: z.string().trim().min(1).max(200).optional(),
1937
+ listId: UuidSchema.optional(),
1938
+ openingLineIsNull: QueryBooleanSchema.optional(),
1939
+ batchId: z.string().trim().min(1).max(255).optional(),
1940
+ contactStatus: AcqContactStatusSchema.optional(),
1941
+ limit: z.coerce.number().int().min(1).max(5000).default(5000),
1942
+ offset: z.coerce.number().int().min(0).default(0)
1943
+ })
2128
1944
  .strict()
2129
1945
  ```
2130
1946
 
2131
1947
  ### `CreateCompanyRequestSchema`
2132
1948
 
2133
1949
  ```typescript
2134
- export const CreateCompanyRequestSchema = z
2135
- .object({
2136
- name: z.string().trim().min(1).max(255),
2137
- domain: z.string().trim().min(1).max(255).optional(),
2138
- linkedinUrl: z.string().trim().url().optional(),
2139
- website: z.string().trim().url().optional(),
2140
- numEmployees: z.number().int().min(0).optional(),
2141
- foundedYear: z.number().int().optional(),
2142
- locationCity: z.string().trim().min(1).max(255).optional(),
2143
- locationState: z.string().trim().min(1).max(255).optional(),
2144
- category: z.string().trim().min(1).max(255).optional(),
2145
- source: z.string().trim().min(1).max(255).optional(),
2146
- batchId: z.string().trim().min(1).max(255).optional(),
2147
- verticalResearch: z.string().trim().min(1).max(5000).optional()
2148
- })
1950
+ export const CreateCompanyRequestSchema = z
1951
+ .object({
1952
+ name: z.string().trim().min(1).max(255),
1953
+ domain: z.string().trim().min(1).max(255).optional(),
1954
+ linkedinUrl: z.string().trim().url().optional(),
1955
+ website: z.string().trim().url().optional(),
1956
+ numEmployees: z.number().int().min(0).optional(),
1957
+ foundedYear: z.number().int().optional(),
1958
+ locationCity: z.string().trim().min(1).max(255).optional(),
1959
+ locationState: z.string().trim().min(1).max(255).optional(),
1960
+ category: z.string().trim().min(1).max(255).optional(),
1961
+ source: z.string().trim().min(1).max(255).optional(),
1962
+ batchId: z.string().trim().min(1).max(255).optional(),
1963
+ verticalResearch: z.string().trim().min(1).max(5000).optional()
1964
+ })
2149
1965
  .strict()
2150
1966
  ```
2151
1967
 
2152
1968
  ### `UpdateCompanyRequestSchema`
2153
1969
 
2154
1970
  ```typescript
2155
- export const UpdateCompanyRequestSchema = z
2156
- .object({
2157
- name: z.string().trim().min(1).max(255).optional(),
2158
- domain: z.string().trim().min(1).max(255).optional(),
2159
- linkedinUrl: z.string().trim().url().optional(),
2160
- website: z.string().trim().url().optional(),
2161
- numEmployees: z.number().int().min(0).optional(),
2162
- foundedYear: z.number().int().optional(),
2163
- locationCity: z.string().trim().min(1).max(255).optional(),
2164
- locationState: z.string().trim().min(1).max(255).optional(),
2165
- category: z.string().trim().min(1).max(255).optional(),
2166
- segment: z.string().trim().min(1).max(255).optional(),
2167
- pipelineStatus: z.record(z.string(), z.unknown()).optional(),
2168
- enrichmentData: z.record(z.string(), z.unknown()).optional(),
2169
- source: z.string().trim().min(1).max(255).optional(),
2170
- batchId: z.string().trim().min(1).max(255).optional(),
2171
- status: AcqCompanyStatusSchema.optional(),
2172
- verticalResearch: z.string().trim().min(1).max(5000).nullable().optional()
2173
- })
2174
- .strict()
2175
- .refine(
2176
- (data) =>
2177
- data.name !== undefined ||
2178
- data.domain !== undefined ||
2179
- data.linkedinUrl !== undefined ||
2180
- data.website !== undefined ||
2181
- data.numEmployees !== undefined ||
2182
- data.foundedYear !== undefined ||
2183
- data.locationCity !== undefined ||
2184
- data.locationState !== undefined ||
2185
- data.category !== undefined ||
2186
- data.segment !== undefined ||
2187
- data.pipelineStatus !== undefined ||
2188
- data.enrichmentData !== undefined ||
2189
- data.source !== undefined ||
2190
- data.batchId !== undefined ||
2191
- data.status !== undefined ||
2192
- data.verticalResearch !== undefined,
2193
- {
2194
- message: 'At least one field must be provided'
2195
- }
1971
+ export const UpdateCompanyRequestSchema = z
1972
+ .object({
1973
+ name: z.string().trim().min(1).max(255).optional(),
1974
+ domain: z.string().trim().min(1).max(255).optional(),
1975
+ linkedinUrl: z.string().trim().url().optional(),
1976
+ website: z.string().trim().url().optional(),
1977
+ numEmployees: z.number().int().min(0).optional(),
1978
+ foundedYear: z.number().int().optional(),
1979
+ locationCity: z.string().trim().min(1).max(255).optional(),
1980
+ locationState: z.string().trim().min(1).max(255).optional(),
1981
+ category: z.string().trim().min(1).max(255).optional(),
1982
+ segment: z.string().trim().min(1).max(255).optional(),
1983
+ pipelineStatus: z.record(z.string(), z.unknown()).optional(),
1984
+ enrichmentData: z.record(z.string(), z.unknown()).optional(),
1985
+ source: z.string().trim().min(1).max(255).optional(),
1986
+ batchId: z.string().trim().min(1).max(255).optional(),
1987
+ status: AcqCompanyStatusSchema.optional(),
1988
+ verticalResearch: z.string().trim().min(1).max(5000).nullable().optional()
1989
+ })
1990
+ .strict()
1991
+ .refine(
1992
+ (data) =>
1993
+ data.name !== undefined ||
1994
+ data.domain !== undefined ||
1995
+ data.linkedinUrl !== undefined ||
1996
+ data.website !== undefined ||
1997
+ data.numEmployees !== undefined ||
1998
+ data.foundedYear !== undefined ||
1999
+ data.locationCity !== undefined ||
2000
+ data.locationState !== undefined ||
2001
+ data.category !== undefined ||
2002
+ data.segment !== undefined ||
2003
+ data.pipelineStatus !== undefined ||
2004
+ data.enrichmentData !== undefined ||
2005
+ data.source !== undefined ||
2006
+ data.batchId !== undefined ||
2007
+ data.status !== undefined ||
2008
+ data.verticalResearch !== undefined,
2009
+ {
2010
+ message: 'At least one field must be provided'
2011
+ }
2196
2012
  )
2197
2013
  ```
2198
2014
 
2199
2015
  ### `CreateContactRequestSchema`
2200
2016
 
2201
2017
  ```typescript
2202
- export const CreateContactRequestSchema = z
2203
- .object({
2204
- email: z.string().trim().email(),
2205
- companyId: UuidSchema.optional(),
2206
- firstName: z.string().trim().min(1).max(255).optional(),
2207
- lastName: z.string().trim().min(1).max(255).optional(),
2208
- linkedinUrl: z.string().trim().url().optional(),
2209
- title: z.string().trim().min(1).max(255).optional(),
2210
- source: z.string().trim().min(1).max(255).optional(),
2211
- sourceId: z.string().trim().min(1).max(255).optional(),
2212
- batchId: z.string().trim().min(1).max(255).optional()
2213
- })
2018
+ export const CreateContactRequestSchema = z
2019
+ .object({
2020
+ email: z.string().trim().email(),
2021
+ companyId: UuidSchema.optional(),
2022
+ firstName: z.string().trim().min(1).max(255).optional(),
2023
+ lastName: z.string().trim().min(1).max(255).optional(),
2024
+ linkedinUrl: z.string().trim().url().optional(),
2025
+ title: z.string().trim().min(1).max(255).optional(),
2026
+ source: z.string().trim().min(1).max(255).optional(),
2027
+ sourceId: z.string().trim().min(1).max(255).optional(),
2028
+ batchId: z.string().trim().min(1).max(255).optional()
2029
+ })
2214
2030
  .strict()
2215
2031
  ```
2216
2032
 
2217
2033
  ### `UpdateContactRequestSchema`
2218
2034
 
2219
2035
  ```typescript
2220
- export const UpdateContactRequestSchema = z
2221
- .object({
2222
- companyId: UuidSchema.optional(),
2223
- emailValid: AcqEmailValidSchema.optional(),
2224
- firstName: z.string().trim().min(1).max(255).optional(),
2225
- lastName: z.string().trim().min(1).max(255).optional(),
2226
- linkedinUrl: z.string().trim().url().optional(),
2227
- title: z.string().trim().min(1).max(255).optional(),
2228
- headline: z.string().trim().min(1).max(5000).optional(),
2229
- filterReason: z.string().trim().min(1).max(5000).optional(),
2230
- openingLine: z.string().trim().min(1).max(5000).optional(),
2231
- pipelineStatus: z.record(z.string(), z.unknown()).optional(),
2232
- enrichmentData: z.record(z.string(), z.unknown()).optional(),
2233
- status: AcqContactStatusSchema.optional()
2234
- })
2235
- .strict()
2236
- .refine(
2237
- (data) =>
2238
- data.companyId !== undefined ||
2239
- data.emailValid !== undefined ||
2240
- data.firstName !== undefined ||
2241
- data.lastName !== undefined ||
2242
- data.linkedinUrl !== undefined ||
2243
- data.title !== undefined ||
2244
- data.headline !== undefined ||
2245
- data.filterReason !== undefined ||
2246
- data.openingLine !== undefined ||
2247
- data.pipelineStatus !== undefined ||
2248
- data.enrichmentData !== undefined ||
2249
- data.status !== undefined,
2250
- {
2251
- message: 'At least one field must be provided'
2252
- }
2036
+ export const UpdateContactRequestSchema = z
2037
+ .object({
2038
+ companyId: UuidSchema.optional(),
2039
+ emailValid: AcqEmailValidSchema.optional(),
2040
+ firstName: z.string().trim().min(1).max(255).optional(),
2041
+ lastName: z.string().trim().min(1).max(255).optional(),
2042
+ linkedinUrl: z.string().trim().url().optional(),
2043
+ title: z.string().trim().min(1).max(255).optional(),
2044
+ headline: z.string().trim().min(1).max(5000).optional(),
2045
+ filterReason: z.string().trim().min(1).max(5000).optional(),
2046
+ openingLine: z.string().trim().min(1).max(5000).optional(),
2047
+ pipelineStatus: z.record(z.string(), z.unknown()).optional(),
2048
+ enrichmentData: z.record(z.string(), z.unknown()).optional(),
2049
+ status: AcqContactStatusSchema.optional()
2050
+ })
2051
+ .strict()
2052
+ .refine(
2053
+ (data) =>
2054
+ data.companyId !== undefined ||
2055
+ data.emailValid !== undefined ||
2056
+ data.firstName !== undefined ||
2057
+ data.lastName !== undefined ||
2058
+ data.linkedinUrl !== undefined ||
2059
+ data.title !== undefined ||
2060
+ data.headline !== undefined ||
2061
+ data.filterReason !== undefined ||
2062
+ data.openingLine !== undefined ||
2063
+ data.pipelineStatus !== undefined ||
2064
+ data.enrichmentData !== undefined ||
2065
+ data.status !== undefined,
2066
+ {
2067
+ message: 'At least one field must be provided'
2068
+ }
2253
2069
  )
2254
2070
  ```
2255
2071
 
2256
2072
  ### `AcqCompanyResponseSchema`
2257
2073
 
2258
2074
  ```typescript
2259
- export const AcqCompanyResponseSchema = z.object({
2260
- id: z.string(),
2261
- organizationId: z.string(),
2262
- name: z.string(),
2263
- domain: z.string().nullable(),
2264
- linkedinUrl: z.string().nullable(),
2265
- website: z.string().nullable(),
2266
- numEmployees: z.number().nullable(),
2267
- foundedYear: z.number().nullable(),
2268
- locationCity: z.string().nullable(),
2269
- locationState: z.string().nullable(),
2270
- category: z.string().nullable(),
2271
- categoryPain: z.string().nullable(),
2272
- segment: z.string().nullable(),
2273
- pipelineStatus: z.record(z.string(), z.unknown()).nullable(),
2274
- enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2275
- source: z.string().nullable(),
2276
- batchId: z.string().nullable(),
2277
- status: AcqCompanyStatusSchema,
2278
- contactCount: z.number().int().min(0),
2279
- verticalResearch: z.string().nullable(),
2280
- createdAt: z.string(),
2281
- updatedAt: z.string()
2075
+ export const AcqCompanyResponseSchema = z.object({
2076
+ id: z.string(),
2077
+ organizationId: z.string(),
2078
+ name: z.string(),
2079
+ domain: z.string().nullable(),
2080
+ linkedinUrl: z.string().nullable(),
2081
+ website: z.string().nullable(),
2082
+ numEmployees: z.number().nullable(),
2083
+ foundedYear: z.number().nullable(),
2084
+ locationCity: z.string().nullable(),
2085
+ locationState: z.string().nullable(),
2086
+ category: z.string().nullable(),
2087
+ categoryPain: z.string().nullable(),
2088
+ segment: z.string().nullable(),
2089
+ pipelineStatus: z.record(z.string(), z.unknown()).nullable(),
2090
+ enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2091
+ source: z.string().nullable(),
2092
+ batchId: z.string().nullable(),
2093
+ status: AcqCompanyStatusSchema,
2094
+ contactCount: z.number().int().min(0),
2095
+ verticalResearch: z.string().nullable(),
2096
+ createdAt: z.string(),
2097
+ updatedAt: z.string()
2282
2098
  })
2283
2099
  ```
2284
2100
 
2285
2101
  ### `AcqCompanyListResponseSchema`
2286
2102
 
2287
2103
  ```typescript
2288
- export const AcqCompanyListResponseSchema = z.object({
2289
- data: z.array(AcqCompanyResponseSchema),
2290
- total: z.number().int(),
2291
- limit: z.number().int(),
2292
- offset: z.number().int()
2104
+ export const AcqCompanyListResponseSchema = z.object({
2105
+ data: z.array(AcqCompanyResponseSchema),
2106
+ total: z.number().int(),
2107
+ limit: z.number().int(),
2108
+ offset: z.number().int()
2293
2109
  })
2294
2110
  ```
2295
2111
 
2296
2112
  ### `AcqCompanyFacetsResponseSchema`
2297
2113
 
2298
2114
  ```typescript
2299
- export const AcqCompanyFacetsResponseSchema = z.object({
2300
- segments: z.array(z.string()),
2301
- categories: z.array(z.string()),
2302
- statuses: z.array(AcqCompanyStatusSchema)
2115
+ export const AcqCompanyFacetsResponseSchema = z.object({
2116
+ segments: z.array(z.string()),
2117
+ categories: z.array(z.string()),
2118
+ statuses: z.array(AcqCompanyStatusSchema)
2303
2119
  })
2304
2120
  ```
2305
2121
 
2306
2122
  ### `AcqContactCompanySummarySchema`
2307
2123
 
2308
2124
  ```typescript
2309
- export const AcqContactCompanySummarySchema = z.object({
2310
- id: z.string(),
2311
- name: z.string(),
2312
- domain: z.string().nullable(),
2313
- website: z.string().nullable(),
2314
- linkedinUrl: z.string().nullable(),
2315
- segment: z.string().nullable(),
2316
- category: z.string().nullable(),
2317
- status: AcqCompanyStatusSchema
2125
+ export const AcqContactCompanySummarySchema = z.object({
2126
+ id: z.string(),
2127
+ name: z.string(),
2128
+ domain: z.string().nullable(),
2129
+ website: z.string().nullable(),
2130
+ linkedinUrl: z.string().nullable(),
2131
+ segment: z.string().nullable(),
2132
+ category: z.string().nullable(),
2133
+ status: AcqCompanyStatusSchema
2318
2134
  })
2319
2135
  ```
2320
2136
 
2321
2137
  ### `AcqContactResponseSchema`
2322
2138
 
2323
2139
  ```typescript
2324
- export const AcqContactResponseSchema = z.object({
2325
- id: z.string(),
2326
- organizationId: z.string(),
2327
- companyId: z.string().nullable(),
2328
- email: z.string(),
2329
- emailValid: AcqEmailValidSchema.nullable(),
2330
- firstName: z.string().nullable(),
2331
- lastName: z.string().nullable(),
2332
- linkedinUrl: z.string().nullable(),
2333
- title: z.string().nullable(),
2334
- headline: z.string().nullable(),
2335
- filterReason: z.string().nullable(),
2336
- openingLine: z.string().nullable(),
2337
- source: z.string().nullable(),
2338
- sourceId: z.string().nullable(),
2339
- pipelineStatus: z.record(z.string(), z.unknown()).nullable(),
2340
- enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2341
- attioPersonId: z.string().nullable(),
2342
- batchId: z.string().nullable(),
2343
- status: AcqContactStatusSchema,
2344
- company: AcqContactCompanySummarySchema.nullable().optional(),
2345
- createdAt: z.string(),
2346
- updatedAt: z.string()
2140
+ export const AcqContactResponseSchema = z.object({
2141
+ id: z.string(),
2142
+ organizationId: z.string(),
2143
+ companyId: z.string().nullable(),
2144
+ email: z.string(),
2145
+ emailValid: AcqEmailValidSchema.nullable(),
2146
+ firstName: z.string().nullable(),
2147
+ lastName: z.string().nullable(),
2148
+ linkedinUrl: z.string().nullable(),
2149
+ title: z.string().nullable(),
2150
+ headline: z.string().nullable(),
2151
+ filterReason: z.string().nullable(),
2152
+ openingLine: z.string().nullable(),
2153
+ source: z.string().nullable(),
2154
+ sourceId: z.string().nullable(),
2155
+ pipelineStatus: z.record(z.string(), z.unknown()).nullable(),
2156
+ enrichmentData: z.record(z.string(), z.unknown()).nullable(),
2157
+ attioPersonId: z.string().nullable(),
2158
+ batchId: z.string().nullable(),
2159
+ status: AcqContactStatusSchema,
2160
+ company: AcqContactCompanySummarySchema.nullable().optional(),
2161
+ createdAt: z.string(),
2162
+ updatedAt: z.string()
2347
2163
  })
2348
2164
  ```
2349
2165
 
2350
2166
  ### `AcqContactListResponseSchema`
2351
2167
 
2352
2168
  ```typescript
2353
- export const AcqContactListResponseSchema = z.object({
2354
- data: z.array(AcqContactResponseSchema),
2355
- total: z.number().int(),
2356
- limit: z.number().int(),
2357
- offset: z.number().int()
2169
+ export const AcqContactListResponseSchema = z.object({
2170
+ data: z.array(AcqContactResponseSchema),
2171
+ total: z.number().int(),
2172
+ limit: z.number().int(),
2173
+ offset: z.number().int()
2358
2174
  })
2359
2175
  ```
2360
2176
 
@@ -2367,265 +2183,222 @@ export const AcqArtifactOwnerKindSchema = z.enum(['company', 'contact', 'deal',
2367
2183
  ### `ListArtifactsQuerySchema`
2368
2184
 
2369
2185
  ```typescript
2370
- export const ListArtifactsQuerySchema = z
2371
- .object({
2372
- ownerKind: AcqArtifactOwnerKindSchema,
2373
- ownerId: UuidSchema
2374
- })
2186
+ export const ListArtifactsQuerySchema = z
2187
+ .object({
2188
+ ownerKind: AcqArtifactOwnerKindSchema,
2189
+ ownerId: UuidSchema
2190
+ })
2375
2191
  .strict()
2376
2192
  ```
2377
2193
 
2378
2194
  ### `CreateArtifactRequestSchema`
2379
2195
 
2380
2196
  ```typescript
2381
- export const CreateArtifactRequestSchema = z
2382
- .object({
2383
- ownerKind: AcqArtifactOwnerKindSchema,
2384
- ownerId: UuidSchema,
2385
- kind: z.string().trim().min(1).max(255),
2386
- content: z.record(z.string(), z.unknown()),
2387
- sourceExecutionId: UuidSchema.optional()
2388
- })
2197
+ export const CreateArtifactRequestSchema = z
2198
+ .object({
2199
+ ownerKind: AcqArtifactOwnerKindSchema,
2200
+ ownerId: UuidSchema,
2201
+ kind: z.string().trim().min(1).max(255),
2202
+ content: z.record(z.string(), z.unknown()),
2203
+ sourceExecutionId: UuidSchema.optional()
2204
+ })
2389
2205
  .strict()
2390
2206
  ```
2391
2207
 
2392
2208
  ### `AcqArtifactResponseSchema`
2393
2209
 
2394
2210
  ```typescript
2395
- export const AcqArtifactResponseSchema = z.object({
2396
- id: z.string(),
2397
- organizationId: z.string(),
2398
- ownerKind: z.string(),
2399
- ownerId: z.string(),
2400
- kind: z.string(),
2401
- content: z.record(z.string(), z.unknown()),
2402
- sourceExecutionId: z.string().nullable(),
2403
- createdBy: z.string().nullable(),
2404
- createdAt: z.string(),
2405
- version: z.number().int()
2211
+ export const AcqArtifactResponseSchema = z.object({
2212
+ id: z.string(),
2213
+ organizationId: z.string(),
2214
+ ownerKind: z.string(),
2215
+ ownerId: z.string(),
2216
+ kind: z.string(),
2217
+ content: z.record(z.string(), z.unknown()),
2218
+ sourceExecutionId: z.string().nullable(),
2219
+ createdBy: z.string().nullable(),
2220
+ createdAt: z.string(),
2221
+ version: z.number().int()
2406
2222
  })
2407
2223
  ```
2408
2224
 
2409
2225
  ### `AcqArtifactListResponseSchema`
2410
2226
 
2411
2227
  ```typescript
2412
- export const AcqArtifactListResponseSchema = z.object({
2413
- artifacts: z.array(AcqArtifactResponseSchema)
2414
- })
2415
- ```
2416
-
2417
- ### `ListTouchpointsQuerySchema`
2418
-
2419
- ```typescript
2420
- export const ListTouchpointsQuerySchema = z
2421
- .object({
2422
- listId: UuidSchema.optional(),
2423
- listMemberId: UuidSchema.optional(),
2424
- contactId: UuidSchema.optional()
2425
- })
2426
- .strict()
2427
- .refine((data) => data.listId !== undefined || data.listMemberId !== undefined || data.contactId !== undefined, {
2428
- message: 'At least one filter (listId, listMemberId, or contactId) must be provided'
2429
- })
2430
- ```
2431
-
2432
- ### `AcqTouchpointResponseSchema`
2433
-
2434
- ```typescript
2435
- export const AcqTouchpointResponseSchema = z.object({
2436
- id: z.string(),
2437
- organizationId: z.string(),
2438
- listId: z.string().nullable(),
2439
- listMemberId: z.string().nullable(),
2440
- contactId: z.string().nullable(),
2441
- artifactId: z.string().nullable(),
2442
- channel: z.string(),
2443
- kind: z.string(),
2444
- direction: z.string(),
2445
- occurredAt: z.string(),
2446
- payload: z.record(z.string(), z.unknown()).nullable(),
2447
- sourceExecutionId: z.string().nullable(),
2448
- createdAt: z.string()
2449
- })
2450
- ```
2451
-
2452
- ### `AcqTouchpointListResponseSchema`
2453
-
2454
- ```typescript
2455
- export const AcqTouchpointListResponseSchema = z.object({
2456
- touchpoints: z.array(AcqTouchpointResponseSchema)
2228
+ export const AcqArtifactListResponseSchema = z.object({
2229
+ artifacts: z.array(AcqArtifactResponseSchema)
2457
2230
  })
2458
2231
  ```
2459
2232
 
2460
2233
  ### `ListMembersQuerySchema`
2461
2234
 
2462
2235
  ```typescript
2463
- export const ListMembersQuerySchema = z
2464
- .object({
2465
- limit: z.coerce.number().int().min(1).max(500).default(50),
2466
- offset: z.coerce.number().int().min(0).default(0)
2467
- })
2236
+ export const ListMembersQuerySchema = z
2237
+ .object({
2238
+ limit: z.coerce.number().int().min(1).max(500).default(50),
2239
+ offset: z.coerce.number().int().min(0).default(0)
2240
+ })
2468
2241
  .strict()
2469
2242
  ```
2470
2243
 
2471
2244
  ### `MemberIdParamsSchema`
2472
2245
 
2473
2246
  ```typescript
2474
- export const MemberIdParamsSchema = z.object({
2475
- memberId: UuidSchema
2247
+ export const MemberIdParamsSchema = z.object({
2248
+ memberId: UuidSchema
2476
2249
  })
2477
2250
  ```
2478
2251
 
2479
2252
  ### `AcqListMemberContactSummarySchema`
2480
2253
 
2481
2254
  ```typescript
2482
- export const AcqListMemberContactSummarySchema = z.object({
2483
- id: z.string(),
2484
- email: z.string(),
2485
- firstName: z.string().nullable(),
2486
- lastName: z.string().nullable(),
2487
- title: z.string().nullable(),
2488
- linkedinUrl: z.string().nullable(),
2489
- companyId: z.string().nullable()
2255
+ export const AcqListMemberContactSummarySchema = z.object({
2256
+ id: z.string(),
2257
+ email: z.string(),
2258
+ firstName: z.string().nullable(),
2259
+ lastName: z.string().nullable(),
2260
+ title: z.string().nullable(),
2261
+ linkedinUrl: z.string().nullable(),
2262
+ companyId: z.string().nullable()
2490
2263
  })
2491
2264
  ```
2492
2265
 
2493
2266
  ### `AcqListMemberResponseSchema`
2494
2267
 
2495
2268
  ```typescript
2496
- export const AcqListMemberResponseSchema = z.object({
2497
- id: z.string(),
2498
- listId: z.string(),
2499
- contactId: z.string(),
2500
- pipelineKey: z.string(),
2501
- stageKey: z.string(),
2502
- stateKey: z.string(),
2503
- activityLog: z.unknown(),
2504
- addedAt: z.string(),
2505
- addedBy: z.string().nullable(),
2506
- sourceExecutionId: z.string().nullable(),
2507
- contact: AcqListMemberContactSummarySchema.nullable()
2269
+ export const AcqListMemberResponseSchema = z.object({
2270
+ id: z.string(),
2271
+ listId: z.string(),
2272
+ contactId: z.string(),
2273
+ pipelineKey: z.string(),
2274
+ stageKey: z.string(),
2275
+ stateKey: z.string(),
2276
+ activityLog: z.unknown(),
2277
+ addedAt: z.string(),
2278
+ addedBy: z.string().nullable(),
2279
+ sourceExecutionId: z.string().nullable(),
2280
+ contact: AcqListMemberContactSummarySchema.nullable()
2508
2281
  })
2509
2282
  ```
2510
2283
 
2511
2284
  ### `AcqListMembersResponseSchema`
2512
2285
 
2513
2286
  ```typescript
2514
- export const AcqListMembersResponseSchema = z.object({
2515
- members: z.array(AcqListMemberResponseSchema)
2287
+ export const AcqListMembersResponseSchema = z.object({
2288
+ members: z.array(AcqListMemberResponseSchema)
2516
2289
  })
2517
2290
  ```
2518
2291
 
2519
2292
  ### `ListCompanyIdParamsSchema`
2520
2293
 
2521
2294
  ```typescript
2522
- export const ListCompanyIdParamsSchema = z.object({
2523
- listCompanyId: UuidSchema
2295
+ export const ListCompanyIdParamsSchema = z.object({
2296
+ listCompanyId: UuidSchema
2524
2297
  })
2525
2298
  ```
2526
2299
 
2527
2300
  ### `AcqListCompanyResponseSchema`
2528
2301
 
2529
2302
  ```typescript
2530
- export const AcqListCompanyResponseSchema = z.object({
2531
- id: z.string(),
2532
- listId: z.string(),
2533
- companyId: z.string(),
2534
- pipelineKey: z.string(),
2535
- stageKey: z.string(),
2536
- stateKey: z.string(),
2537
- activityLog: z.unknown(),
2538
- addedAt: z.string(),
2539
- addedBy: z.string().nullable(),
2540
- sourceExecutionId: z.string().nullable()
2303
+ export const AcqListCompanyResponseSchema = z.object({
2304
+ id: z.string(),
2305
+ listId: z.string(),
2306
+ companyId: z.string(),
2307
+ pipelineKey: z.string(),
2308
+ stageKey: z.string(),
2309
+ stateKey: z.string(),
2310
+ activityLog: z.unknown(),
2311
+ addedAt: z.string(),
2312
+ addedBy: z.string().nullable(),
2313
+ sourceExecutionId: z.string().nullable()
2541
2314
  })
2542
2315
  ```
2543
2316
 
2544
2317
  ### `AcqCompanySchemas`
2545
2318
 
2546
2319
  ```typescript
2547
- export const AcqCompanySchemas = {
2548
- CompanyIdParams: CompanyIdParamsSchema,
2549
- ListCompaniesQuery: ListCompaniesQuerySchema,
2550
- CreateCompanyRequest: CreateCompanyRequestSchema,
2551
- UpdateCompanyRequest: UpdateCompanyRequestSchema,
2552
- AcqCompanyResponse: AcqCompanyResponseSchema,
2553
- AcqCompanyListResponse: AcqCompanyListResponseSchema,
2554
- AcqCompanyFacetsResponse: AcqCompanyFacetsResponseSchema
2320
+ export const AcqCompanySchemas = {
2321
+ CompanyIdParams: CompanyIdParamsSchema,
2322
+ ListCompaniesQuery: ListCompaniesQuerySchema,
2323
+ CreateCompanyRequest: CreateCompanyRequestSchema,
2324
+ UpdateCompanyRequest: UpdateCompanyRequestSchema,
2325
+ AcqCompanyResponse: AcqCompanyResponseSchema,
2326
+ AcqCompanyListResponse: AcqCompanyListResponseSchema,
2327
+ AcqCompanyFacetsResponse: AcqCompanyFacetsResponseSchema
2555
2328
  }
2556
2329
  ```
2557
2330
 
2558
2331
  ### `AcqContactSchemas`
2559
2332
 
2560
2333
  ```typescript
2561
- export const AcqContactSchemas = {
2562
- ContactIdParams: ContactIdParamsSchema,
2563
- ListContactsQuery: ListContactsQuerySchema,
2564
- CreateContactRequest: CreateContactRequestSchema,
2565
- UpdateContactRequest: UpdateContactRequestSchema,
2566
- AcqContactResponse: AcqContactResponseSchema,
2567
- AcqContactListResponse: AcqContactListResponseSchema
2334
+ export const AcqContactSchemas = {
2335
+ ContactIdParams: ContactIdParamsSchema,
2336
+ ListContactsQuery: ListContactsQuerySchema,
2337
+ CreateContactRequest: CreateContactRequestSchema,
2338
+ UpdateContactRequest: UpdateContactRequestSchema,
2339
+ AcqContactResponse: AcqContactResponseSchema,
2340
+ AcqContactListResponse: AcqContactListResponseSchema
2568
2341
  }
2569
2342
  ```
2570
2343
 
2571
2344
  ### `AcqListSchemas`
2572
2345
 
2573
2346
  ```typescript
2574
- export const AcqListSchemas = {
2575
- // Params
2576
- ListIdParams: ListIdParamsSchema,
2577
-
2578
- // Primitives (for UI / tests)
2579
- ListConfig: ListConfigSchema,
2580
- ListStageCounts: ListStageCountsSchema,
2581
- ListTelemetry: ListTelemetrySchema,
2582
- PipelineStep: PipelineStepSchema,
2583
-
2584
- // Requests
2585
- CreateListRequest: CreateListRequestSchema,
2586
- UpdateListRequest: UpdateListRequestSchema,
2587
- UpdateListConfigRequest: UpdateListConfigRequestSchema,
2588
- AddCompaniesToListRequest: AddCompaniesToListRequestSchema,
2589
- RemoveCompaniesFromListRequest: RemoveCompaniesFromListRequestSchema,
2590
- AddContactsToListRequest: AddContactsToListRequestSchema,
2591
- RecordListExecutionRequest: RecordListExecutionRequestSchema,
2592
-
2593
- // Responses
2594
- AcqListResponse: AcqListResponseSchema,
2595
- AcqListListResponse: AcqListListResponseSchema,
2596
- ListTelemetryResponse: ListTelemetryResponseSchema,
2597
- ListTelemetryListResponse: ListTelemetryListResponseSchema,
2598
- ListExecutionsResponse: ListExecutionsResponseSchema
2347
+ export const AcqListSchemas = {
2348
+ // Params
2349
+ ListIdParams: ListIdParamsSchema,
2350
+
2351
+ // Primitives (for UI / tests)
2352
+ ListStatus: ListStatusSchema,
2353
+ ScrapingConfig: ScrapingConfigSchema,
2354
+ IcpRubric: IcpRubricSchema,
2355
+ PipelineConfig: PipelineConfigSchema,
2356
+ PipelineStage: PipelineStageSchema,
2357
+ ListStageCounts: ListStageCountsSchema,
2358
+ ListTelemetry: ListTelemetrySchema,
2359
+
2360
+ // Requests
2361
+ CreateListRequest: CreateListRequestSchema,
2362
+ UpdateListRequest: UpdateListRequestSchema,
2363
+ UpdateListStatusRequest: UpdateListStatusRequestSchema,
2364
+ UpdateListConfigRequest: UpdateListConfigRequestSchema,
2365
+ AddCompaniesToListRequest: AddCompaniesToListRequestSchema,
2366
+ RemoveCompaniesFromListRequest: RemoveCompaniesFromListRequestSchema,
2367
+ AddContactsToListRequest: AddContactsToListRequestSchema,
2368
+ RecordListExecutionRequest: RecordListExecutionRequestSchema,
2369
+
2370
+ // Responses
2371
+ AcqListResponse: AcqListResponseSchema,
2372
+ AcqListListResponse: AcqListListResponseSchema,
2373
+ ListTelemetryResponse: ListTelemetryResponseSchema,
2374
+ ListTelemetryListResponse: ListTelemetryListResponseSchema,
2375
+ ListExecutionsResponse: ListExecutionsResponseSchema,
2376
+ ListProgressResponse: ListProgressResponseSchema
2599
2377
  }
2600
2378
  ```
2601
2379
 
2602
2380
  ### `AcqSubstrateSchemas`
2603
2381
 
2604
2382
  ```typescript
2605
- export const AcqSubstrateSchemas = {
2606
- // Artifacts
2607
- ListArtifactsQuery: ListArtifactsQuerySchema,
2608
- CreateArtifactRequest: CreateArtifactRequestSchema,
2609
- AcqArtifactResponse: AcqArtifactResponseSchema,
2610
- AcqArtifactListResponse: AcqArtifactListResponseSchema,
2611
-
2612
- // Touchpoints
2613
- ListTouchpointsQuery: ListTouchpointsQuerySchema,
2614
- AcqTouchpointResponse: AcqTouchpointResponseSchema,
2615
- AcqTouchpointListResponse: AcqTouchpointListResponseSchema,
2616
-
2617
- // List members
2618
- ListMembersQuery: ListMembersQuerySchema,
2619
- MemberIdParams: MemberIdParamsSchema,
2620
- AcqListMemberResponse: AcqListMemberResponseSchema,
2621
- AcqListMembersResponse: AcqListMembersResponseSchema,
2622
-
2623
- // List companies
2624
- ListCompanyIdParams: ListCompanyIdParamsSchema,
2625
- AcqListCompanyResponse: AcqListCompanyResponseSchema,
2626
-
2627
- // Transition (shared with deals — TransitionItemRequestSchema)
2628
- TransitionItemRequest: TransitionItemRequestSchema
2383
+ export const AcqSubstrateSchemas = {
2384
+ // Artifacts
2385
+ ListArtifactsQuery: ListArtifactsQuerySchema,
2386
+ CreateArtifactRequest: CreateArtifactRequestSchema,
2387
+ AcqArtifactResponse: AcqArtifactResponseSchema,
2388
+ AcqArtifactListResponse: AcqArtifactListResponseSchema,
2389
+
2390
+ // List members
2391
+ ListMembersQuery: ListMembersQuerySchema,
2392
+ MemberIdParams: MemberIdParamsSchema,
2393
+ AcqListMemberResponse: AcqListMemberResponseSchema,
2394
+ AcqListMembersResponse: AcqListMembersResponseSchema,
2395
+
2396
+ // List companies
2397
+ ListCompanyIdParams: ListCompanyIdParamsSchema,
2398
+ AcqListCompanyResponse: AcqListCompanyResponseSchema,
2399
+
2400
+ // Transition (shared with deals — TransitionItemRequestSchema)
2401
+ TransitionItemRequest: TransitionItemRequestSchema
2629
2402
  }
2630
2403
  ```
2631
2404
 
@@ -2676,258 +2449,231 @@ export const StatefulSchema = z.object({
2676
2449
  ### `StatefulStateDefinition`
2677
2450
 
2678
2451
  ```typescript
2679
- /** One state within a stage — minimal shape: key + display label. */
2680
- export interface StatefulStateDefinition {
2681
- /** Matches state_key values written by workflow steps. */
2682
- stateKey: string
2683
- label: string
2452
+ /** One state within a stage — minimal shape: key + display label. */
2453
+ export interface StatefulStateDefinition {
2454
+ /** Matches state_key values written by workflow steps. */
2455
+ stateKey: string
2456
+ label: string
2684
2457
  }
2685
2458
  ```
2686
2459
 
2687
2460
  ### `StatefulStageDefinition`
2688
2461
 
2689
2462
  ```typescript
2690
- /** One stage within a pipeline — has a stage_key and an ordered list of valid states. */
2691
- export interface StatefulStageDefinition {
2692
- /** Matches stage_key values written by workflow steps. */
2693
- stageKey: string
2694
- label: string
2695
- states: StatefulStateDefinition[]
2463
+ /** One stage within a pipeline — has a stage_key and an ordered list of valid states. */
2464
+ export interface StatefulStageDefinition {
2465
+ /** Matches stage_key values written by workflow steps. */
2466
+ stageKey: string
2467
+ label: string
2468
+ states: StatefulStateDefinition[]
2696
2469
  }
2697
2470
  ```
2698
2471
 
2699
2472
  ### `StatefulPipelineDefinition`
2700
2473
 
2701
2474
  ```typescript
2702
- /**
2703
- * Pipeline definition for a single entity participating in the Stateful trait.
2704
- * Parallel to acq_deals' pipeline_key concept but structured for lead-gen entities.
2705
- */
2706
- export interface StatefulPipelineDefinition {
2707
- /** Matches pipeline_key values in the database (e.g. 'lead-gen'). */
2708
- pipelineKey: string
2709
- label: string
2710
- /** Entity this pipeline applies to (e.g. 'acq.list', 'acq.list-member', 'acq.list-company'). */
2711
- entityKey: string
2712
- stages: StatefulStageDefinition[]
2713
- }
2714
- ```
2715
-
2716
- ### `ACQ_LISTS_LEAD_GEN_PIPELINE`
2717
-
2718
- ```typescript
2719
- /**
2720
- * Lead-gen pipeline definition for acq_lists.
2721
- * Single stage: 'lifecycle' with five ordered states (Decision B9).
2722
- */
2723
- export const ACQ_LISTS_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
2724
- pipelineKey: 'lead-gen',
2725
- label: 'Lead Generation',
2726
- entityKey: 'acq.list',
2727
- stages: [
2728
- {
2729
- stageKey: 'lifecycle',
2730
- label: 'Lifecycle',
2731
- states: [
2732
- { stateKey: 'draft', label: 'Draft' },
2733
- { stateKey: 'enriching', label: 'Enriching' },
2734
- { stateKey: 'launched', label: 'Launched' },
2735
- { stateKey: 'closing', label: 'Closing' },
2736
- { stateKey: 'archived', label: 'Archived' }
2737
- ]
2738
- }
2739
- ]
2475
+ /**
2476
+ * Pipeline definition for a single entity participating in the Stateful trait.
2477
+ * Parallel to acq_deals' pipeline_key concept but structured for lead-gen entities.
2478
+ */
2479
+ export interface StatefulPipelineDefinition {
2480
+ /** Matches pipeline_key values in the database (e.g. 'lead-gen'). */
2481
+ pipelineKey: string
2482
+ label: string
2483
+ /** Entity this pipeline applies to (e.g. 'acq.list', 'acq.list-member', 'acq.list-company'). */
2484
+ entityKey: string
2485
+ stages: StatefulStageDefinition[]
2740
2486
  }
2741
2487
  ```
2742
2488
 
2743
2489
  ### `ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE`
2744
2490
 
2745
2491
  ```typescript
2746
- /**
2747
- * Lead-gen pipeline definition for acq_list_members (contacts).
2748
- * Three stages matching the post-restructure sales subdomain tree.
2749
- *
2750
- * Note: members visit outreach and prospecting states depending on which
2751
- * workflow last processed them. stage_key is set per-transition by the workflow.
2752
- */
2753
- export const ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
2754
- pipelineKey: 'lead-gen',
2755
- label: 'Lead Generation',
2756
- entityKey: 'acq.list-member',
2757
- stages: [
2758
- {
2759
- stageKey: 'outreach',
2760
- label: 'Outreach',
2761
- states: [
2762
- PENDING_STATE,
2763
- { stateKey: 'personalized', label: 'Personalized' },
2764
- { stateKey: 'uploaded', label: 'Uploaded' },
2765
- { stateKey: 'interested', label: 'Interested' }
2766
- ]
2767
- },
2768
- {
2769
- stageKey: 'prospecting',
2770
- label: 'Prospecting',
2771
- states: [
2772
- PENDING_STATE,
2773
- { stateKey: 'discovered', label: 'Discovered' },
2774
- { stateKey: 'verified', label: 'Verified' }
2775
- ]
2776
- },
2777
- {
2778
- stageKey: 'qualification',
2779
- label: 'Qualification',
2780
- states: [PENDING_STATE]
2781
- }
2782
- ]
2492
+ /**
2493
+ * Lead-gen pipeline definition for acq_list_members (contacts).
2494
+ * Three stages matching the post-restructure sales subdomain tree.
2495
+ *
2496
+ * Note: members visit outreach and prospecting states depending on which
2497
+ * workflow last processed them. stage_key is set per-transition by the workflow.
2498
+ */
2499
+ export const ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
2500
+ pipelineKey: 'lead-gen',
2501
+ label: 'Lead Generation',
2502
+ entityKey: 'acq.list-member',
2503
+ stages: [
2504
+ {
2505
+ stageKey: 'outreach',
2506
+ label: 'Outreach',
2507
+ states: [
2508
+ PENDING_STATE,
2509
+ { stateKey: 'personalized', label: 'Personalized' },
2510
+ { stateKey: 'uploaded', label: 'Uploaded' },
2511
+ { stateKey: 'interested', label: 'Interested' }
2512
+ ]
2513
+ },
2514
+ {
2515
+ stageKey: 'prospecting',
2516
+ label: 'Prospecting',
2517
+ states: [
2518
+ PENDING_STATE,
2519
+ { stateKey: 'discovered', label: 'Discovered' },
2520
+ { stateKey: 'verified', label: 'Verified' }
2521
+ ]
2522
+ },
2523
+ {
2524
+ stageKey: 'qualification',
2525
+ label: 'Qualification',
2526
+ states: [PENDING_STATE]
2527
+ }
2528
+ ]
2783
2529
  }
2784
2530
  ```
2785
2531
 
2786
2532
  ### `ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE`
2787
2533
 
2788
2534
  ```typescript
2789
- /**
2790
- * Lead-gen pipeline definition for acq_list_companies.
2791
- * Three stages matching the post-restructure sales subdomain tree.
2792
- *
2793
- * Note: companies visit prospecting and qualification states depending on which
2794
- * workflow last processed them. stage_key is set per-transition by the workflow.
2795
- */
2796
- export const ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
2797
- pipelineKey: 'lead-gen',
2798
- label: 'Lead Generation',
2799
- entityKey: 'acq.list-company',
2800
- stages: [
2801
- {
2802
- stageKey: 'outreach',
2803
- label: 'Outreach',
2804
- states: [PENDING_STATE]
2805
- },
2806
- {
2807
- stageKey: 'prospecting',
2808
- label: 'Prospecting',
2809
- states: [
2810
- PENDING_STATE,
2811
- { stateKey: 'populated', label: 'Populated' },
2812
- { stateKey: 'extracted', label: 'Extracted' }
2813
- ]
2814
- },
2815
- {
2816
- stageKey: 'qualification',
2817
- label: 'Qualification',
2818
- states: [PENDING_STATE, { stateKey: 'qualified', label: 'Qualified' }]
2819
- }
2820
- ]
2535
+ /**
2536
+ * Lead-gen pipeline definition for acq_list_companies.
2537
+ * Three stages matching the post-restructure sales subdomain tree.
2538
+ *
2539
+ * Note: companies visit prospecting and qualification states depending on which
2540
+ * workflow last processed them. stage_key is set per-transition by the workflow.
2541
+ */
2542
+ export const ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
2543
+ pipelineKey: 'lead-gen',
2544
+ label: 'Lead Generation',
2545
+ entityKey: 'acq.list-company',
2546
+ stages: [
2547
+ {
2548
+ stageKey: 'outreach',
2549
+ label: 'Outreach',
2550
+ states: [PENDING_STATE]
2551
+ },
2552
+ {
2553
+ stageKey: 'prospecting',
2554
+ label: 'Prospecting',
2555
+ states: [
2556
+ PENDING_STATE,
2557
+ { stateKey: 'populated', label: 'Populated' },
2558
+ { stateKey: 'extracted', label: 'Extracted' }
2559
+ ]
2560
+ },
2561
+ {
2562
+ stageKey: 'qualification',
2563
+ label: 'Qualification',
2564
+ states: [PENDING_STATE, { stateKey: 'qualified', label: 'Qualified' }]
2565
+ }
2566
+ ]
2821
2567
  }
2822
2568
  ```
2823
2569
 
2824
2570
  ### `LEAD_GEN_PIPELINE_DEFINITIONS`
2825
2571
 
2826
2572
  ```typescript
2827
- /**
2828
- * All lead-gen pipeline definitions indexed by entity key.
2829
- * Use findPipeline() to locate a definition by pipeline_key within any of these arrays.
2830
- */
2831
- export const LEAD_GEN_PIPELINE_DEFINITIONS: Record<string, StatefulPipelineDefinition[]> = {
2832
- 'acq.list': [ACQ_LISTS_LEAD_GEN_PIPELINE],
2833
- 'acq.list-member': [ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE],
2834
- 'acq.list-company': [ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE]
2573
+ /**
2574
+ * All lead-gen pipeline definitions indexed by entity key.
2575
+ * Use findPipeline() to locate a definition by pipeline_key within any of these arrays.
2576
+ */
2577
+ export const LEAD_GEN_PIPELINE_DEFINITIONS: Record<string, StatefulPipelineDefinition[]> = {
2578
+ 'acq.list-member': [ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE],
2579
+ 'acq.list-company': [ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE]
2835
2580
  }
2836
2581
  ```
2837
2582
 
2838
2583
  ### `PaginationParams`
2839
2584
 
2840
2585
  ```typescript
2841
- export interface PaginationParams {
2842
- limit: number
2843
- offset: number
2586
+ export interface PaginationParams {
2587
+ limit: number
2588
+ offset: number
2844
2589
  }
2845
2590
  ```
2846
2591
 
2847
2592
  ### `PaginatedResult`
2848
2593
 
2849
2594
  ```typescript
2850
- export interface PaginatedResult<T> {
2851
- data: T[]
2852
- total: number
2853
- limit: number
2854
- offset: number
2595
+ export interface PaginatedResult<T> {
2596
+ data: T[]
2597
+ total: number
2598
+ limit: number
2599
+ offset: number
2855
2600
  }
2856
2601
  ```
2857
2602
 
2858
2603
  ### `CreateListParams`
2859
2604
 
2860
2605
  ```typescript
2861
- export interface CreateListParams {
2862
- organizationId: string
2863
- name: string
2864
- description?: string
2865
- type?: string
2866
- batchIds?: string[]
2867
- instantlyCampaignId?: string
2868
- status?: string
2869
- metadata?: Record<string, unknown>
2870
- config?: ListConfig
2606
+ export interface CreateListParams {
2607
+ organizationId: string
2608
+ name: string
2609
+ description?: string
2610
+ type?: string
2611
+ batchIds?: string[]
2612
+ instantlyCampaignId?: string
2613
+ status?: ListStatus
2614
+ metadata?: Record<string, unknown>
2615
+ scrapingConfig?: ScrapingConfig
2616
+ icp?: IcpRubric
2617
+ pipelineConfig?: PipelineConfig
2871
2618
  }
2872
2619
  ```
2873
2620
 
2874
2621
  ### `UpdateListParams`
2875
2622
 
2876
2623
  ```typescript
2877
- export interface UpdateListParams {
2878
- name?: string
2879
- description?: string
2880
- status?: string
2881
- batchIds?: string[]
2624
+ export interface UpdateListParams {
2625
+ name?: string
2626
+ description?: string
2627
+ batchIds?: string[]
2882
2628
  }
2883
2629
  ```
2884
2630
 
2885
2631
  ### `CreateCompanyParams`
2886
2632
 
2887
2633
  ```typescript
2888
- export interface CreateCompanyParams {
2889
- organizationId: string
2890
- name: string
2891
- domain?: string
2892
- linkedinUrl?: string
2893
- website?: string
2894
- numEmployees?: number
2895
- foundedYear?: number
2896
- locationCity?: string
2897
- locationState?: string
2898
- category?: string
2899
- source?: string
2900
- batchId?: string
2901
- verticalResearch?: string
2634
+ export interface CreateCompanyParams {
2635
+ organizationId: string
2636
+ name: string
2637
+ domain?: string
2638
+ linkedinUrl?: string
2639
+ website?: string
2640
+ numEmployees?: number
2641
+ foundedYear?: number
2642
+ locationCity?: string
2643
+ locationState?: string
2644
+ category?: string
2645
+ source?: string
2646
+ batchId?: string
2647
+ verticalResearch?: string
2902
2648
  }
2903
2649
  ```
2904
2650
 
2905
2651
  ### `UpdateCompanyParams`
2906
2652
 
2907
2653
  ```typescript
2908
- export interface UpdateCompanyParams {
2909
- name?: string
2910
- domain?: string
2911
- linkedinUrl?: string
2912
- website?: string
2913
- numEmployees?: number
2914
- foundedYear?: number
2915
- locationCity?: string
2916
- locationState?: string
2917
- category?: string
2918
- segment?: string
2919
- pipelineStatus?: Record<string, unknown>
2920
- enrichmentData?: Record<string, unknown>
2921
- source?: string
2922
- batchId?: string
2923
- status?: 'active' | 'invalid'
2924
- verticalResearch?: string | null
2925
- /** Track A: flat qualification score column (null until a scoring rubric is defined) */
2926
- qualificationScore?: number | null
2927
- /** Track A: flat qualification signals jsonb — mirrors the former pipeline_status.qualification shape */
2928
- qualificationSignals?: Record<string, unknown> | null
2929
- /** Track A: key identifying the rubric used for qualification */
2930
- qualificationRubricKey?: string | null
2654
+ export interface UpdateCompanyParams {
2655
+ name?: string
2656
+ domain?: string
2657
+ linkedinUrl?: string
2658
+ website?: string
2659
+ numEmployees?: number
2660
+ foundedYear?: number
2661
+ locationCity?: string
2662
+ locationState?: string
2663
+ category?: string
2664
+ segment?: string
2665
+ pipelineStatus?: Record<string, unknown>
2666
+ enrichmentData?: Record<string, unknown>
2667
+ source?: string
2668
+ batchId?: string
2669
+ status?: 'active' | 'invalid'
2670
+ verticalResearch?: string | null
2671
+ /** Track A: flat qualification score column (null until a scoring rubric is defined) */
2672
+ qualificationScore?: number | null
2673
+ /** Track A: flat qualification signals jsonb — mirrors the former pipeline_status.qualification shape */
2674
+ qualificationSignals?: Record<string, unknown> | null
2675
+ /** Track A: key identifying the rubric used for qualification */
2676
+ qualificationRubricKey?: string | null
2931
2677
  }
2932
2678
  ```
2933
2679
 
@@ -2940,56 +2686,56 @@ export type UpsertCompanyParams = CreateCompanyParams
2940
2686
  ### `CompanyFilters`
2941
2687
 
2942
2688
  ```typescript
2943
- export interface CompanyFilters {
2944
- listId?: string // Filter to companies in a specific list (via acq_list_companies)
2945
- search?: string
2946
- domain?: string
2947
- website?: string
2948
- segment?: string
2949
- category?: string
2950
- pipelineStatus?: Record<string, unknown>
2951
- /** Exclude companies whose pipeline_status contains this value (PostgREST NOT contains) */
2952
- pipelineStatusNot?: Record<string, unknown>
2953
- batchId?: string
2954
- status?: 'active' | 'invalid'
2955
- includeAll?: boolean
2956
- excludeColumns?: Array<'enrichmentData' | 'pipelineStatus'>
2689
+ export interface CompanyFilters {
2690
+ listId?: string // Filter to companies in a specific list (via acq_list_companies)
2691
+ search?: string
2692
+ domain?: string
2693
+ website?: string
2694
+ segment?: string
2695
+ category?: string
2696
+ pipelineStatus?: Record<string, unknown>
2697
+ /** Exclude companies whose pipeline_status contains this value (PostgREST NOT contains) */
2698
+ pipelineStatusNot?: Record<string, unknown>
2699
+ batchId?: string
2700
+ status?: 'active' | 'invalid'
2701
+ includeAll?: boolean
2702
+ excludeColumns?: Array<'enrichmentData' | 'pipelineStatus'>
2957
2703
  }
2958
2704
  ```
2959
2705
 
2960
2706
  ### `CreateContactParams`
2961
2707
 
2962
2708
  ```typescript
2963
- export interface CreateContactParams {
2964
- organizationId: string
2965
- email: string
2966
- companyId?: string
2967
- firstName?: string
2968
- lastName?: string
2969
- linkedinUrl?: string
2970
- title?: string
2971
- source?: string
2972
- sourceId?: string
2973
- batchId?: string
2709
+ export interface CreateContactParams {
2710
+ organizationId: string
2711
+ email: string
2712
+ companyId?: string
2713
+ firstName?: string
2714
+ lastName?: string
2715
+ linkedinUrl?: string
2716
+ title?: string
2717
+ source?: string
2718
+ sourceId?: string
2719
+ batchId?: string
2974
2720
  }
2975
2721
  ```
2976
2722
 
2977
2723
  ### `UpdateContactParams`
2978
2724
 
2979
2725
  ```typescript
2980
- export interface UpdateContactParams {
2981
- companyId?: string
2982
- emailValid?: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN'
2983
- firstName?: string
2984
- lastName?: string
2985
- linkedinUrl?: string
2986
- title?: string
2987
- headline?: string
2988
- filterReason?: string
2989
- openingLine?: string
2990
- pipelineStatus?: Record<string, unknown>
2991
- enrichmentData?: Record<string, unknown>
2992
- status?: 'active' | 'invalid'
2726
+ export interface UpdateContactParams {
2727
+ companyId?: string
2728
+ emailValid?: 'VALID' | 'INVALID' | 'RISKY' | 'UNKNOWN'
2729
+ firstName?: string
2730
+ lastName?: string
2731
+ linkedinUrl?: string
2732
+ title?: string
2733
+ headline?: string
2734
+ filterReason?: string
2735
+ openingLine?: string
2736
+ pipelineStatus?: Record<string, unknown>
2737
+ enrichmentData?: Record<string, unknown>
2738
+ status?: 'active' | 'invalid'
2993
2739
  }
2994
2740
  ```
2995
2741
 
@@ -3002,419 +2748,385 @@ export type UpsertContactParams = CreateContactParams
3002
2748
  ### `ContactFilters`
3003
2749
 
3004
2750
  ```typescript
3005
- export interface ContactFilters {
3006
- listId?: string // Filter to contacts in a specific list (via acq_list_members)
3007
- search?: string
3008
- openingLineIsNull?: boolean // Filter to contacts without personalization
3009
- pipelineStatus?: Record<string, unknown>
3010
- batchId?: string
3011
- contactStatus?: 'active' | 'invalid' // Filter by contact status (soft-delete flag)
2751
+ export interface ContactFilters {
2752
+ listId?: string // Filter to contacts in a specific list (via acq_list_members)
2753
+ search?: string
2754
+ openingLineIsNull?: boolean // Filter to contacts without personalization
2755
+ pipelineStatus?: Record<string, unknown>
2756
+ batchId?: string
2757
+ contactStatus?: 'active' | 'invalid' // Filter by contact status (soft-delete flag)
3012
2758
  }
3013
2759
  ```
3014
2760
 
3015
2761
  ### `UpsertSocialPostParams`
3016
2762
 
3017
2763
  ```typescript
3018
- export interface UpsertSocialPostParams {
3019
- organizationId: string
3020
- platform: string
3021
- platformPostId: string
3022
- authorName: string
3023
- authorUrl?: string | null
3024
- postTitle: string
3025
- postText: string
3026
- postUrl: string
3027
- engagementCount?: number
3028
- commentsCount?: number
3029
- postedAt: string
3030
- metadata?: Record<string, unknown>
3031
- relevanceScore?: number
3032
- matchedKeywords?: string[]
3033
- matchedQuery?: string | null
3034
- initialDraft?: string | null
3035
- finalResponse?: string | null
3036
- sourceCategory?: string | null
2764
+ export interface UpsertSocialPostParams {
2765
+ organizationId: string
2766
+ platform: string
2767
+ platformPostId: string
2768
+ authorName: string
2769
+ authorUrl?: string | null
2770
+ postTitle: string
2771
+ postText: string
2772
+ postUrl: string
2773
+ engagementCount?: number
2774
+ commentsCount?: number
2775
+ postedAt: string
2776
+ metadata?: Record<string, unknown>
2777
+ relevanceScore?: number
2778
+ matchedKeywords?: string[]
2779
+ matchedQuery?: string | null
2780
+ initialDraft?: string | null
2781
+ finalResponse?: string | null
2782
+ sourceCategory?: string | null
3037
2783
  }
3038
2784
  ```
3039
2785
 
3040
2786
  ### `UpsertSocialPostsParams`
3041
2787
 
3042
2788
  ```typescript
3043
- export interface UpsertSocialPostsParams {
3044
- organizationId: string
3045
- posts: Omit<UpsertSocialPostParams, 'organizationId'>[]
2789
+ export interface UpsertSocialPostsParams {
2790
+ organizationId: string
2791
+ posts: Omit<UpsertSocialPostParams, 'organizationId'>[]
3046
2792
  }
3047
2793
  ```
3048
2794
 
3049
2795
  ### `UpsertSocialPostsResult`
3050
2796
 
3051
2797
  ```typescript
3052
- export interface UpsertSocialPostsResult {
3053
- inserted: number
3054
- duplicatesSkipped: number
2798
+ export interface UpsertSocialPostsResult {
2799
+ inserted: number
2800
+ duplicatesSkipped: number
3055
2801
  }
3056
2802
  ```
3057
2803
 
3058
2804
  ### `AddContactsToListParams`
3059
2805
 
3060
2806
  ```typescript
3061
- export interface AddContactsToListParams {
3062
- organizationId: string
3063
- listId: string
3064
- contactIds: string[]
2807
+ export interface AddContactsToListParams {
2808
+ organizationId: string
2809
+ listId: string
2810
+ contactIds: string[]
3065
2811
  }
3066
2812
  ```
3067
2813
 
3068
2814
  ### `AddContactsToListResult`
3069
2815
 
3070
2816
  ```typescript
3071
- export interface AddContactsToListResult {
3072
- added: number
3073
- alreadyExisted: number
2817
+ export interface AddContactsToListResult {
2818
+ added: number
2819
+ alreadyExisted: number
3074
2820
  }
3075
2821
  ```
3076
2822
 
3077
2823
  ### `UpdateListConfigParams`
3078
2824
 
3079
2825
  ```typescript
3080
- export interface UpdateListConfigParams {
3081
- organizationId: string
3082
- listId: string
3083
- /** Deep-partial patch — any subtree that is present is replaced at that level. */
3084
- configPatch: Record<string, unknown>
2826
+ export interface UpdateListConfigParams {
2827
+ organizationId: string
2828
+ listId: string
2829
+ scrapingConfig?: ScrapingConfig
2830
+ icp?: IcpRubric
2831
+ pipelineConfig?: PipelineConfig
3085
2832
  }
3086
2833
  ```
3087
2834
 
3088
2835
  ### `UpdateCompanyStageParams`
3089
2836
 
3090
2837
  ```typescript
3091
- export interface UpdateCompanyStageParams {
3092
- organizationId: string
3093
- listId: string
3094
- companyId: string
3095
- stage: CompanyListStage
3096
- executionId?: string
2838
+ export interface UpdateCompanyStageParams {
2839
+ organizationId: string
2840
+ listId: string
2841
+ companyId: string
2842
+ stage: string
2843
+ executionId?: string
3097
2844
  }
3098
2845
  ```
3099
2846
 
3100
2847
  ### `UpdateContactStageParams`
3101
2848
 
3102
2849
  ```typescript
3103
- export interface UpdateContactStageParams {
3104
- organizationId: string
3105
- listId: string
3106
- contactId: string
3107
- stage: ContactListStage
3108
- executionId?: string
2850
+ export interface UpdateContactStageParams {
2851
+ organizationId: string
2852
+ listId: string
2853
+ contactId: string
2854
+ stage: string
2855
+ executionId?: string
3109
2856
  }
3110
2857
  ```
3111
2858
 
3112
2859
  ### `AddCompaniesToListParams`
3113
2860
 
3114
2861
  ```typescript
3115
- export interface AddCompaniesToListParams {
3116
- organizationId: string
3117
- listId: string
3118
- companyIds: string[]
2862
+ export interface AddCompaniesToListParams {
2863
+ organizationId: string
2864
+ listId: string
2865
+ companyIds: string[]
3119
2866
  }
3120
2867
  ```
3121
2868
 
3122
2869
  ### `AddCompaniesToListResult`
3123
2870
 
3124
2871
  ```typescript
3125
- export interface AddCompaniesToListResult {
3126
- added: number
3127
- alreadyExisted: number
2872
+ export interface AddCompaniesToListResult {
2873
+ added: number
2874
+ alreadyExisted: number
3128
2875
  }
3129
2876
  ```
3130
2877
 
3131
2878
  ### `RemoveCompaniesFromListParams`
3132
2879
 
3133
2880
  ```typescript
3134
- export interface RemoveCompaniesFromListParams {
3135
- organizationId: string
3136
- listId: string
3137
- companyIds: string[]
2881
+ export interface RemoveCompaniesFromListParams {
2882
+ organizationId: string
2883
+ listId: string
2884
+ companyIds: string[]
3138
2885
  }
3139
2886
  ```
3140
2887
 
3141
2888
  ### `RemoveCompaniesFromListResult`
3142
2889
 
3143
2890
  ```typescript
3144
- export interface RemoveCompaniesFromListResult {
3145
- removed: number
2891
+ export interface RemoveCompaniesFromListResult {
2892
+ removed: number
3146
2893
  }
3147
2894
  ```
3148
2895
 
3149
2896
  ### `RecordListExecutionParams`
3150
2897
 
3151
2898
  ```typescript
3152
- export interface RecordListExecutionParams {
3153
- organizationId: string
3154
- listId: string
3155
- executionId: string
3156
- configSnapshot?: Record<string, unknown>
2899
+ export interface RecordListExecutionParams {
2900
+ organizationId: string
2901
+ listId: string
2902
+ executionId: string
2903
+ configSnapshot?: Record<string, unknown>
3157
2904
  }
3158
2905
  ```
3159
2906
 
3160
2907
  ### `ListExecutionSummary`
3161
2908
 
3162
2909
  ```typescript
3163
- export interface ListExecutionSummary {
3164
- executionId: string
3165
- resourceId: string
3166
- status: string
3167
- createdAt: string
3168
- completedAt: string | null
3169
- durationMs: number | null
2910
+ export interface ListExecutionSummary {
2911
+ executionId: string
2912
+ resourceId: string
2913
+ status: string
2914
+ createdAt: string
2915
+ completedAt: string | null
2916
+ durationMs: number | null
3170
2917
  }
3171
2918
  ```
3172
2919
 
3173
2920
  ### `BulkImportParams`
3174
2921
 
3175
2922
  ```typescript
3176
- export interface BulkImportParams {
3177
- organizationId: string
3178
- contacts: CreateContactParams[]
3179
- listId?: string
2923
+ export interface BulkImportParams {
2924
+ organizationId: string
2925
+ contacts: CreateContactParams[]
2926
+ listId?: string
3180
2927
  }
3181
2928
  ```
3182
2929
 
3183
2930
  ### `BulkImportResult`
3184
2931
 
3185
2932
  ```typescript
3186
- export interface BulkImportResult {
3187
- created: number
3188
- updated: number
3189
- errors: Array<{ email: string; error: string }>
2933
+ export interface BulkImportResult {
2934
+ created: number
2935
+ updated: number
2936
+ errors: Array<{ email: string; error: string }>
3190
2937
  }
3191
2938
  ```
3192
2939
 
3193
2940
  ### `BulkImportCompanyEntry`
3194
2941
 
3195
2942
  ```typescript
3196
- export interface BulkImportCompanyEntry {
3197
- name: string
3198
- domain: string
3199
- website?: string
3200
- locationCity?: string
3201
- locationState?: string
3202
- category?: string
3203
- source?: string
3204
- enrichmentData?: Record<string, unknown>
3205
- pipelineStatus?: Record<string, unknown>
2943
+ export interface BulkImportCompanyEntry {
2944
+ name: string
2945
+ domain: string
2946
+ website?: string
2947
+ locationCity?: string
2948
+ locationState?: string
2949
+ category?: string
2950
+ source?: string
2951
+ enrichmentData?: Record<string, unknown>
2952
+ pipelineStatus?: Record<string, unknown>
3206
2953
  }
3207
2954
  ```
3208
2955
 
3209
2956
  ### `BulkImportCompaniesParams`
3210
2957
 
3211
2958
  ```typescript
3212
- export interface BulkImportCompaniesParams {
3213
- organizationId: string
3214
- batchId: string
3215
- companies: BulkImportCompanyEntry[]
2959
+ export interface BulkImportCompaniesParams {
2960
+ organizationId: string
2961
+ batchId: string
2962
+ companies: BulkImportCompanyEntry[]
3216
2963
  }
3217
2964
  ```
3218
2965
 
3219
2966
  ### `BulkImportCompaniesResult`
3220
2967
 
3221
2968
  ```typescript
3222
- export interface BulkImportCompaniesResult {
3223
- created: number
3224
- skipped: number
3225
- errors: Array<{ companyName: string; error: string }>
2969
+ export interface BulkImportCompaniesResult {
2970
+ created: number
2971
+ skipped: number
2972
+ errors: Array<{ companyName: string; error: string }>
3226
2973
  }
3227
2974
  ```
3228
2975
 
3229
2976
  ### `LeadToolMap`
3230
2977
 
3231
2978
  ```typescript
3232
- export type LeadToolMap = {
3233
- // List operations
3234
- listLists: { params: Record<string, never>; result: AcqList[] }
3235
- createList: { params: Omit<CreateListParams, 'organizationId'>; result: AcqList }
3236
- updateList: { params: { id: string } & UpdateListParams; result: AcqList }
3237
- deleteList: { params: { id: string }; result: void }
3238
- addContactsToList: { params: Omit<AddContactsToListParams, 'organizationId'>; result: AddContactsToListResult }
3239
- updateCompanyStage: {
3240
- params: Omit<UpdateCompanyStageParams, 'organizationId'>
3241
- result: void
3242
- }
3243
- updateContactStage: {
3244
- params: Omit<UpdateContactStageParams, 'organizationId'>
3245
- result: void
3246
- }
3247
- // Company operations
3248
- createCompany: { params: Omit<CreateCompanyParams, 'organizationId'>; result: AcqCompany }
3249
- upsertCompany: { params: Omit<UpsertCompanyParams, 'organizationId'>; result: AcqCompany }
3250
- updateCompany: { params: { id: string } & UpdateCompanyParams; result: AcqCompany }
3251
- getCompany: { params: { id: string }; result: AcqCompany | null }
3252
- listCompanies: { params: CompanyFilters; result: AcqCompany[] }
3253
- deleteCompany: { params: { id: string }; result: void }
3254
- // Contact operations
3255
- createContact: { params: Omit<CreateContactParams, 'organizationId'>; result: AcqContact }
3256
- upsertContact: { params: Omit<UpsertContactParams, 'organizationId'>; result: AcqContact }
3257
- updateContact: { params: { id: string } & UpdateContactParams; result: AcqContact }
3258
- getContact: { params: { id: string }; result: AcqContact | null }
3259
- getContactByEmail: { params: { email: string }; result: AcqContact | null }
3260
- listContacts: {
3261
- params: ContactFilters & { limit?: number; offset?: number }
3262
- result: PaginatedResult<AcqContact>
3263
- }
3264
- deleteContact: { params: { id: string }; result: void }
3265
- bulkImportContacts: { params: Omit<BulkImportParams, 'organizationId'>; result: BulkImportResult }
3266
- bulkImportCompanies: {
3267
- params: Omit<BulkImportCompaniesParams, 'organizationId'>
3268
- result: BulkImportCompaniesResult
3269
- }
3270
- deactivateContactsByCompany: {
3271
- params: { companyId: string }
3272
- result: { deactivated: number }
3273
- }
3274
- // Deal operations
3275
- upsertDeal: { params: Omit<UpsertDealParams, 'organizationId'>; result: AcqDeal }
3276
- getDealByEmail: { params: { email: string }; result: AcqDeal | null }
3277
- getDealByEnvelopeId: { params: { envelopeId: string }; result: AcqDeal | null }
3278
- updateDealEnvelopeId: { params: { dealId: string; envelopeId: string }; result: AcqDeal | null }
3279
- getDealById: { params: Omit<GetDealByIdParams, 'organizationId'>; result: AcqDeal | null }
3280
- getContactById: { params: Omit<GetContactByIdParams, 'organizationId'>; result: AcqContact | null }
3281
- getCompanyById: { params: Omit<GetCompanyByIdParams, 'organizationId'>; result: AcqCompany | null }
3282
- // Deal-sync operations
3283
- updateDiscoveryData: { params: Omit<UpdateDiscoveryDataParams, 'organizationId'>; result: void }
3284
- updateProposalData: { params: Omit<UpdateProposalDataParams, 'organizationId'>; result: void }
3285
- markProposalSent: { params: Omit<MarkProposalSentParams, 'organizationId'>; result: void }
3286
- markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
3287
- updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
3288
- updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
3289
- transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
3290
- setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
3291
- cancelSchedulesAndHitlByEmail: {
3292
- params: Omit<CancelSchedulesAndHitlByEmailParams, 'organizationId'>
3293
- result: { schedulesCancelled: number; hitlDeleted: number }
3294
- }
3295
- cancelHitlByDealId: { params: Omit<CancelHitlByDealIdParams, 'organizationId'>; result: { hitlDeleted: number } }
3296
- clearDealFields: { params: Omit<ClearDealFieldsParams, 'organizationId'>; result: void }
3297
- deleteDeal: { params: Omit<DeleteDealParams, 'organizationId'>; result: void }
3298
- recordDealActivity: {
3299
- params: Omit<RecordDealActivityParams, 'organizationId'>
3300
- result: void
3301
- }
3302
- // Deal note operations
3303
- createDealNote: {
3304
- params: Omit<CreateDealNoteParams, 'organizationId'>
3305
- result: AcqDealNote
3306
- }
3307
- listDealNotes: {
3308
- params: Omit<ListDealNotesParams, 'organizationId'>
3309
- result: AcqDealNote[]
3310
- }
3311
- // Deal task operations
3312
- createDealTask: {
3313
- params: Omit<CreateDealTaskParams, 'organizationId'>
3314
- result: AcqDealTask
3315
- }
3316
- listDealTasks: {
3317
- params: Omit<ListDealTasksParams, 'organizationId'>
3318
- result: AcqDealTask[]
3319
- }
3320
- listDealTasksDue: {
3321
- params: Omit<ListDealTasksDueParams, 'organizationId'>
3322
- result: AcqDealTask[]
3323
- }
3324
- completeDealTask: {
3325
- params: Omit<CompleteDealTaskParams, 'organizationId'>
3326
- result: AcqDealTask
3327
- }
3328
- // Deal query & analytics operations
3329
- listDeals: { params: DealFilters; result: AcqDeal[] }
3330
- getDealPipelineAnalytics: { params: { recentLimit?: number }; result: DealPipelineAnalytics }
3331
- // Enrichment data operations
3332
- mergeEnrichmentData: {
3333
- params: { id: string; table: 'acq_companies' | 'acq_contacts'; data: Record<string, unknown> }
3334
- result: void
3335
- }
3336
- // Social monitoring operations
3337
- upsertSocialPosts: {
3338
- params: { posts: Omit<UpsertSocialPostParams, 'organizationId'>[] }
3339
- result: UpsertSocialPostsResult
3340
- }
3341
- // Touchpoint operations
3342
- recordTouchpoint: {
3343
- params: {
3344
- contactId?: string
3345
- listMemberId?: string
3346
- listId?: string
3347
- direction: 'inbound' | 'outbound'
3348
- channel: string
3349
- kind: TouchpointKind
3350
- payload?: Record<string, unknown>
3351
- artifactId?: string
3352
- sourceExecutionId?: string
3353
- occurredAt?: string
3354
- }
3355
- result: { id: string }
3356
- }
3357
- setDealStateKey: {
3358
- params: {
3359
- dealId: string
3360
- stateKey: string
3361
- }
3362
- result: { ok: true }
3363
- }
3364
- // CRM workflow helpers
3365
- transitionDeal: {
3366
- params: {
3367
- dealId: string
3368
- toStage: string
3369
- toState?: string
3370
- }
3371
- result: { deal: AcqDeal }
3372
- }
3373
- loadDeal: {
3374
- params: { dealId: string }
3375
- result: DealDetail | null
3376
- }
3377
- listDealTouchpoints: {
3378
- params: {
3379
- dealId: string
3380
- kind?: string
3381
- limit?: number
3382
- }
3383
- result: Array<{
3384
- id: string
3385
- organization_id: string
3386
- contact_id: string | null
3387
- list_id: string | null
3388
- list_member_id: string | null
3389
- direction: string
3390
- channel: string
3391
- kind: string
3392
- payload: Record<string, unknown> | null
3393
- artifact_id: string | null
3394
- source_execution_id: string | null
3395
- occurred_at: string
3396
- created_at: string
3397
- }>
3398
- }
2979
+ export type LeadToolMap = {
2980
+ // List operations
2981
+ listLists: { params: Record<string, never>; result: AcqList[] }
2982
+ createList: { params: Omit<CreateListParams, 'organizationId'>; result: AcqList }
2983
+ updateList: { params: { id: string } & UpdateListParams; result: AcqList }
2984
+ deleteList: { params: { id: string }; result: void }
2985
+ addContactsToList: { params: Omit<AddContactsToListParams, 'organizationId'>; result: AddContactsToListResult }
2986
+ updateCompanyStage: {
2987
+ params: Omit<UpdateCompanyStageParams, 'organizationId'>
2988
+ result: void
2989
+ }
2990
+ updateContactStage: {
2991
+ params: Omit<UpdateContactStageParams, 'organizationId'>
2992
+ result: void
2993
+ }
2994
+ // Company operations
2995
+ createCompany: { params: Omit<CreateCompanyParams, 'organizationId'>; result: AcqCompany }
2996
+ upsertCompany: { params: Omit<UpsertCompanyParams, 'organizationId'>; result: AcqCompany }
2997
+ updateCompany: { params: { id: string } & UpdateCompanyParams; result: AcqCompany }
2998
+ getCompany: { params: { id: string }; result: AcqCompany | null }
2999
+ listCompanies: { params: CompanyFilters; result: AcqCompany[] }
3000
+ deleteCompany: { params: { id: string }; result: void }
3001
+ // Contact operations
3002
+ createContact: { params: Omit<CreateContactParams, 'organizationId'>; result: AcqContact }
3003
+ upsertContact: { params: Omit<UpsertContactParams, 'organizationId'>; result: AcqContact }
3004
+ updateContact: { params: { id: string } & UpdateContactParams; result: AcqContact }
3005
+ getContact: { params: { id: string }; result: AcqContact | null }
3006
+ getContactByEmail: { params: { email: string }; result: AcqContact | null }
3007
+ listContacts: {
3008
+ params: ContactFilters & { limit?: number; offset?: number }
3009
+ result: PaginatedResult<AcqContact>
3010
+ }
3011
+ deleteContact: { params: { id: string }; result: void }
3012
+ bulkImportContacts: { params: Omit<BulkImportParams, 'organizationId'>; result: BulkImportResult }
3013
+ bulkImportCompanies: {
3014
+ params: Omit<BulkImportCompaniesParams, 'organizationId'>
3015
+ result: BulkImportCompaniesResult
3016
+ }
3017
+ deactivateContactsByCompany: {
3018
+ params: { companyId: string }
3019
+ result: { deactivated: number }
3020
+ }
3021
+ // Deal operations
3022
+ upsertDeal: { params: Omit<UpsertDealParams, 'organizationId'>; result: AcqDeal }
3023
+ getDealByEmail: { params: { email: string }; result: AcqDeal | null }
3024
+ getDealByEnvelopeId: { params: { envelopeId: string }; result: AcqDeal | null }
3025
+ updateDealEnvelopeId: { params: { dealId: string; envelopeId: string }; result: AcqDeal | null }
3026
+ getDealById: { params: Omit<GetDealByIdParams, 'organizationId'>; result: AcqDeal | null }
3027
+ getContactById: { params: Omit<GetContactByIdParams, 'organizationId'>; result: AcqContact | null }
3028
+ getCompanyById: { params: Omit<GetCompanyByIdParams, 'organizationId'>; result: AcqCompany | null }
3029
+ // Deal-sync operations
3030
+ updateDiscoveryData: { params: Omit<UpdateDiscoveryDataParams, 'organizationId'>; result: void }
3031
+ updateProposalData: { params: Omit<UpdateProposalDataParams, 'organizationId'>; result: void }
3032
+ markProposalSent: { params: Omit<MarkProposalSentParams, 'organizationId'>; result: void }
3033
+ markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
3034
+ updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
3035
+ updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
3036
+ transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
3037
+ setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
3038
+ cancelSchedulesAndHitlByEmail: {
3039
+ params: Omit<CancelSchedulesAndHitlByEmailParams, 'organizationId'>
3040
+ result: { schedulesCancelled: number; hitlDeleted: number }
3041
+ }
3042
+ cancelHitlByDealId: { params: Omit<CancelHitlByDealIdParams, 'organizationId'>; result: { hitlDeleted: number } }
3043
+ clearDealFields: { params: Omit<ClearDealFieldsParams, 'organizationId'>; result: void }
3044
+ deleteDeal: { params: Omit<DeleteDealParams, 'organizationId'>; result: void }
3045
+ recordDealActivity: {
3046
+ params: Omit<RecordDealActivityParams, 'organizationId'>
3047
+ result: void
3048
+ }
3049
+ // Deal note operations
3050
+ createDealNote: {
3051
+ params: Omit<CreateDealNoteParams, 'organizationId'>
3052
+ result: AcqDealNote
3053
+ }
3054
+ listDealNotes: {
3055
+ params: Omit<ListDealNotesParams, 'organizationId'>
3056
+ result: AcqDealNote[]
3057
+ }
3058
+ // Deal task operations
3059
+ createDealTask: {
3060
+ params: Omit<CreateDealTaskParams, 'organizationId'>
3061
+ result: AcqDealTask
3062
+ }
3063
+ listDealTasks: {
3064
+ params: Omit<ListDealTasksParams, 'organizationId'>
3065
+ result: AcqDealTask[]
3066
+ }
3067
+ listDealTasksDue: {
3068
+ params: Omit<ListDealTasksDueParams, 'organizationId'>
3069
+ result: AcqDealTask[]
3070
+ }
3071
+ completeDealTask: {
3072
+ params: Omit<CompleteDealTaskParams, 'organizationId'>
3073
+ result: AcqDealTask
3074
+ }
3075
+ // Deal query & analytics operations
3076
+ listDeals: { params: DealFilters; result: AcqDeal[] }
3077
+ getDealPipelineAnalytics: { params: { recentLimit?: number }; result: DealPipelineAnalytics }
3078
+ // Enrichment data operations
3079
+ mergeEnrichmentData: {
3080
+ params: { id: string; table: 'acq_companies' | 'acq_contacts'; data: Record<string, unknown> }
3081
+ result: void
3082
+ }
3083
+ // Social monitoring operations
3084
+ upsertSocialPosts: {
3085
+ params: { posts: Omit<UpsertSocialPostParams, 'organizationId'>[] }
3086
+ result: UpsertSocialPostsResult
3087
+ }
3088
+ setDealStateKey: {
3089
+ params: {
3090
+ dealId: string
3091
+ stateKey: string
3092
+ }
3093
+ result: { ok: true }
3094
+ }
3095
+ // CRM workflow helpers
3096
+ transitionDeal: {
3097
+ params: {
3098
+ dealId: string
3099
+ toStage: string
3100
+ toState?: string
3101
+ }
3102
+ result: { deal: AcqDeal }
3103
+ }
3104
+ loadDeal: {
3105
+ params: { dealId: string }
3106
+ result: DealDetail | null
3107
+ }
3399
3108
  }
3400
3109
  ```
3401
3110
 
3402
3111
  ### `ListToolMap`
3403
3112
 
3404
3113
  ```typescript
3405
- export type ListToolMap = {
3406
- getConfig: { params: { listId: string }; result: ListConfig }
3407
- recordExecution: {
3408
- params: Omit<RecordListExecutionParams, 'organizationId'>
3409
- result: void
3410
- }
3411
- updateCompanyStage: {
3412
- params: Omit<UpdateCompanyStageParams, 'organizationId'>
3413
- result: void
3414
- }
3415
- updateContactStage: {
3416
- params: Omit<UpdateContactStageParams, 'organizationId'>
3417
- result: void
3418
- }
3114
+ export type ListToolMap = {
3115
+ getConfig: {
3116
+ params: { listId: string }
3117
+ result: { scrapingConfig: ScrapingConfig; icp: IcpRubric; pipelineConfig: PipelineConfig }
3118
+ }
3119
+ recordExecution: {
3120
+ params: Omit<RecordListExecutionParams, 'organizationId'>
3121
+ result: void
3122
+ }
3123
+ updateCompanyStage: {
3124
+ params: Omit<UpdateCompanyStageParams, 'organizationId'>
3125
+ result: void
3126
+ }
3127
+ updateContactStage: {
3128
+ params: Omit<UpdateContactStageParams, 'organizationId'>
3129
+ result: void
3130
+ }
3419
3131
  }
3420
3132
  ```