@elevasis/core 0.14.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +60 -0
- package/dist/index.js +198 -1
- package/dist/organization-model/index.d.ts +60 -0
- package/dist/organization-model/index.js +198 -1
- package/dist/test-utils/index.d.ts +399 -363
- package/dist/test-utils/index.js +198 -1
- package/package.json +3 -3
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +444 -309
- package/src/business/acquisition/activity-events.ts +12 -3
- package/src/business/acquisition/api-schemas.test.ts +315 -4
- package/src/business/acquisition/api-schemas.ts +140 -17
- package/src/business/acquisition/build-templates.ts +44 -0
- package/src/business/acquisition/crm-next-action.test.ts +262 -0
- package/src/business/acquisition/crm-next-action.ts +220 -0
- package/src/business/acquisition/crm-priority.test.ts +216 -0
- package/src/business/acquisition/crm-priority.ts +349 -0
- package/src/business/acquisition/crm-state-actions.test.ts +12 -21
- package/src/business/acquisition/deal-ownership.test.ts +351 -0
- package/src/business/acquisition/deal-ownership.ts +120 -0
- package/src/business/acquisition/derive-actions.test.ts +101 -37
- package/src/business/acquisition/derive-actions.ts +49 -24
- package/src/business/acquisition/index.ts +163 -149
- package/src/business/acquisition/types.ts +48 -4
- package/src/execution/engine/index.ts +4 -3
- package/src/execution/engine/tools/lead-service-types.ts +68 -51
- package/src/execution/engine/tools/platform/acquisition/list-tools.ts +6 -5
- package/src/execution/engine/tools/platform/acquisition/types.ts +3 -1
- package/src/execution/engine/tools/registry.ts +4 -3
- package/src/execution/engine/tools/tool-maps.ts +821 -816
- package/src/organization-model/domains/prospecting.ts +204 -1
- package/src/organization-model/domains/sales.test.ts +218 -0
- package/src/organization-model/domains/sales.ts +558 -366
- package/src/organization-model/types.ts +2 -2
- package/src/platform/constants/versions.ts +1 -1
- package/src/reference/_generated/contracts.md +444 -309
- package/src/supabase/database.types.ts +2978 -2958
|
@@ -885,6 +885,26 @@ export interface AcqContact {
|
|
|
885
885
|
export type DealStage = 'interested' | 'proposal' | 'closing' | 'closed_won' | 'closed_lost' | 'nurturing'
|
|
886
886
|
```
|
|
887
887
|
|
|
888
|
+
### `DealPriorityBucketKey`
|
|
889
|
+
|
|
890
|
+
```typescript
|
|
891
|
+
export type DealPriorityBucketKey = 'needs_response' | 'follow_up_due' | 'waiting' | 'stale' | 'closed_low'
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
### `DealPriority`
|
|
895
|
+
|
|
896
|
+
```typescript
|
|
897
|
+
export interface DealPriority {
|
|
898
|
+
bucketKey: DealPriorityBucketKey
|
|
899
|
+
rank: number
|
|
900
|
+
label: string
|
|
901
|
+
color: string
|
|
902
|
+
reason: string
|
|
903
|
+
latestActivityAt: string | null
|
|
904
|
+
nextActionAt: string | null
|
|
905
|
+
}
|
|
906
|
+
```
|
|
907
|
+
|
|
888
908
|
### `KanbanStageConfig`
|
|
889
909
|
|
|
890
910
|
```typescript
|
|
@@ -941,8 +961,11 @@ export interface DealFilters {
|
|
|
941
961
|
|
|
942
962
|
```typescript
|
|
943
963
|
/** Deal list item with joined contact and company data */
|
|
944
|
-
export interface DealListItem extends AcqDealRow {
|
|
945
|
-
|
|
964
|
+
export interface DealListItem extends AcqDealRow {
|
|
965
|
+
priority: DealPriority
|
|
966
|
+
ownership: 'us' | 'them' | null
|
|
967
|
+
nextAction: string | null
|
|
968
|
+
contact: DealContact | null
|
|
946
969
|
}
|
|
947
970
|
```
|
|
948
971
|
|
|
@@ -983,6 +1006,66 @@ export interface AcqDealTask {
|
|
|
983
1006
|
}
|
|
984
1007
|
```
|
|
985
1008
|
|
|
1009
|
+
### `CrmPriorityBucketKey`
|
|
1010
|
+
|
|
1011
|
+
```typescript
|
|
1012
|
+
export type CrmPriorityBucketKey = 'needs_response' | 'follow_up_due' | 'waiting' | 'stale' | 'closed_low'
|
|
1013
|
+
```
|
|
1014
|
+
|
|
1015
|
+
### `CrmPriorityBucketDefinition`
|
|
1016
|
+
|
|
1017
|
+
```typescript
|
|
1018
|
+
export interface CrmPriorityBucketDefinition {
|
|
1019
|
+
bucketKey: CrmPriorityBucketKey
|
|
1020
|
+
label: string
|
|
1021
|
+
/** Lower ranks sort first in deal lists and pipeline columns. */
|
|
1022
|
+
rank: number
|
|
1023
|
+
/** UI color token. Consumers may map this to their design system. */
|
|
1024
|
+
color: string
|
|
1025
|
+
}
|
|
1026
|
+
```
|
|
1027
|
+
|
|
1028
|
+
### `CrmPriorityRuleConfig`
|
|
1029
|
+
|
|
1030
|
+
```typescript
|
|
1031
|
+
export interface CrmPriorityRuleConfig {
|
|
1032
|
+
buckets: CrmPriorityBucketDefinition[]
|
|
1033
|
+
closedStageKeys: string[]
|
|
1034
|
+
followUpAfterDaysByStateKey: Record<string, number>
|
|
1035
|
+
staleAfterDays: number
|
|
1036
|
+
}
|
|
1037
|
+
```
|
|
1038
|
+
|
|
1039
|
+
### `CRM_PRIORITY_BUCKETS`
|
|
1040
|
+
|
|
1041
|
+
```typescript
|
|
1042
|
+
export const CRM_PRIORITY_BUCKETS: CrmPriorityBucketDefinition[] = [
|
|
1043
|
+
{ bucketKey: 'needs_response', label: 'Needs Response', rank: 10, color: 'red' },
|
|
1044
|
+
{ bucketKey: 'follow_up_due', label: 'Follow-up Due', rank: 20, color: 'orange' },
|
|
1045
|
+
{ bucketKey: 'waiting', label: 'Waiting', rank: 30, color: 'blue' },
|
|
1046
|
+
{ bucketKey: 'stale', label: 'Stale', rank: 40, color: 'gray' },
|
|
1047
|
+
{ bucketKey: 'closed_low', label: 'Closed', rank: 50, color: 'dark' }
|
|
1048
|
+
]
|
|
1049
|
+
```
|
|
1050
|
+
|
|
1051
|
+
### `DEFAULT_CRM_PRIORITY_RULE_CONFIG`
|
|
1052
|
+
|
|
1053
|
+
```typescript
|
|
1054
|
+
export const DEFAULT_CRM_PRIORITY_RULE_CONFIG: CrmPriorityRuleConfig = {
|
|
1055
|
+
buckets: CRM_PRIORITY_BUCKETS,
|
|
1056
|
+
closedStageKeys: ['closed_won', 'closed_lost'],
|
|
1057
|
+
followUpAfterDaysByStateKey: {
|
|
1058
|
+
discovery_link_sent: 3,
|
|
1059
|
+
discovery_nudging: 2,
|
|
1060
|
+
reply_sent: 3,
|
|
1061
|
+
followup_1_sent: 3,
|
|
1062
|
+
followup_2_sent: 5,
|
|
1063
|
+
followup_3_sent: 7
|
|
1064
|
+
},
|
|
1065
|
+
staleAfterDays: 14
|
|
1066
|
+
}
|
|
1067
|
+
```
|
|
1068
|
+
|
|
986
1069
|
### `DealStageSchema`
|
|
987
1070
|
|
|
988
1071
|
```typescript
|
|
@@ -1138,6 +1221,20 @@ export const DealContactSummarySchema = z.object({
|
|
|
1138
1221
|
})
|
|
1139
1222
|
```
|
|
1140
1223
|
|
|
1224
|
+
### `DealPrioritySchema`
|
|
1225
|
+
|
|
1226
|
+
```typescript
|
|
1227
|
+
export const DealPrioritySchema = z.object({
|
|
1228
|
+
bucketKey: z.enum(['needs_response', 'follow_up_due', 'waiting', 'stale', 'closed_low']),
|
|
1229
|
+
rank: z.number().int(),
|
|
1230
|
+
label: z.string(),
|
|
1231
|
+
color: z.string(),
|
|
1232
|
+
reason: z.string(),
|
|
1233
|
+
latestActivityAt: z.string().nullable(),
|
|
1234
|
+
nextActionAt: z.string().nullable()
|
|
1235
|
+
})
|
|
1236
|
+
```
|
|
1237
|
+
|
|
1141
1238
|
### `DealListItemSchema`
|
|
1142
1239
|
|
|
1143
1240
|
```typescript
|
|
@@ -1168,10 +1265,13 @@ export const DealListItemSchema = z.object({
|
|
|
1168
1265
|
monthly_fee: z.number().nullable(),
|
|
1169
1266
|
closed_lost_at: z.string().nullable(),
|
|
1170
1267
|
closed_lost_reason: z.string().nullable(),
|
|
1171
|
-
created_at: z.string(),
|
|
1172
|
-
updated_at: z.string(),
|
|
1173
|
-
|
|
1174
|
-
|
|
1268
|
+
created_at: z.string(),
|
|
1269
|
+
updated_at: z.string(),
|
|
1270
|
+
priority: DealPrioritySchema,
|
|
1271
|
+
ownership: z.enum(['us', 'them']).nullable(),
|
|
1272
|
+
nextAction: z.string().nullable(),
|
|
1273
|
+
// joined relation
|
|
1274
|
+
contact: DealContactSummarySchema.nullable()
|
|
1175
1275
|
})
|
|
1176
1276
|
```
|
|
1177
1277
|
|
|
@@ -1191,9 +1291,11 @@ export const DealListResponseSchema = z.object({
|
|
|
1191
1291
|
```typescript
|
|
1192
1292
|
/**
|
|
1193
1293
|
* Deal detail shape — currently the same as a list item (full joined record).
|
|
1194
|
-
*
|
|
1294
|
+
* Additive fields keep existing DealListItem callers compatible.
|
|
1195
1295
|
*/
|
|
1196
|
-
export const DealDetailResponseSchema = DealListItemSchema
|
|
1296
|
+
export const DealDetailResponseSchema = DealListItemSchema.extend({
|
|
1297
|
+
conversation: DealConversationSchema
|
|
1298
|
+
})
|
|
1197
1299
|
```
|
|
1198
1300
|
|
|
1199
1301
|
### `DealNoteResponseSchema`
|
|
@@ -1266,13 +1368,16 @@ export const DealSchemas = {
|
|
|
1266
1368
|
CreateDealNoteRequest: CreateDealNoteRequestSchema,
|
|
1267
1369
|
CreateDealTaskRequest: CreateDealTaskRequestSchema,
|
|
1268
1370
|
TransitionItemRequest: TransitionItemRequestSchema,
|
|
1371
|
+
TransitionDealStateRequest: TransitionDealStateRequestSchema,
|
|
1269
1372
|
ExecuteActionParams: ExecuteActionParamsSchema,
|
|
1270
1373
|
ExecuteActionRequest: ExecuteActionRequestSchema,
|
|
1271
1374
|
|
|
1272
1375
|
// Responses
|
|
1376
|
+
DealPriority: DealPrioritySchema,
|
|
1273
1377
|
DealListResponse: DealListResponseSchema,
|
|
1274
1378
|
DealSummaryResponse: DealSummaryResponseSchema,
|
|
1275
1379
|
DealLookupResponse: DealLookupResponseSchema,
|
|
1380
|
+
ConversationMessage: ConversationMessageSchema,
|
|
1276
1381
|
DealDetailResponse: DealDetailResponseSchema,
|
|
1277
1382
|
DealNoteResponse: DealNoteResponseSchema,
|
|
1278
1383
|
DealNoteListResponse: DealNoteListResponseSchema,
|
|
@@ -1294,12 +1399,12 @@ export interface Action {
|
|
|
1294
1399
|
### `ActionDef`
|
|
1295
1400
|
|
|
1296
1401
|
```typescript
|
|
1297
|
-
export interface ActionDef {
|
|
1298
|
-
key: string
|
|
1299
|
-
label: string
|
|
1300
|
-
isAvailableFor: (deal: AcqDealRow) => boolean
|
|
1301
|
-
workflowId: string
|
|
1302
|
-
payloadSchema?: z.ZodTypeAny
|
|
1402
|
+
export interface ActionDef {
|
|
1403
|
+
key: string
|
|
1404
|
+
label: string
|
|
1405
|
+
isAvailableFor: (deal: AcqDealRow) => boolean
|
|
1406
|
+
workflowId: string
|
|
1407
|
+
payloadSchema?: z.ZodTypeAny
|
|
1303
1408
|
}
|
|
1304
1409
|
```
|
|
1305
1410
|
|
|
@@ -1340,20 +1445,22 @@ export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
|
|
|
1340
1445
|
workflowId: 'move_to_nurturing-workflow'
|
|
1341
1446
|
},
|
|
1342
1447
|
{
|
|
1343
|
-
key: 'send_reply',
|
|
1344
|
-
label: 'Send Reply',
|
|
1345
|
-
isAvailableFor: (deal) =>
|
|
1346
|
-
deal.stage_key === 'interested' &&
|
|
1347
|
-
(deal
|
|
1348
|
-
|
|
1349
|
-
deal.state_key ===
|
|
1448
|
+
key: 'send_reply',
|
|
1449
|
+
label: 'Send Reply',
|
|
1450
|
+
isAvailableFor: (deal) =>
|
|
1451
|
+
deal.stage_key === 'interested' &&
|
|
1452
|
+
isOurReplyAction(deal) &&
|
|
1453
|
+
(deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey ||
|
|
1454
|
+
deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
|
|
1455
|
+
deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
|
|
1350
1456
|
workflowId: 'crm-send-reply-workflow',
|
|
1351
1457
|
payloadSchema: SendReplyActionPayloadSchema
|
|
1352
1458
|
},
|
|
1353
1459
|
{
|
|
1354
1460
|
key: 'send_link',
|
|
1355
1461
|
label: 'Send Booking Link',
|
|
1356
|
-
isAvailableFor: (deal) =>
|
|
1462
|
+
isAvailableFor: (deal) =>
|
|
1463
|
+
deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey,
|
|
1357
1464
|
workflowId: 'crm-send-booking-link-workflow'
|
|
1358
1465
|
},
|
|
1359
1466
|
{
|
|
@@ -1361,13 +1468,15 @@ export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
|
|
|
1361
1468
|
label: 'Send Nudge',
|
|
1362
1469
|
isAvailableFor: (deal) =>
|
|
1363
1470
|
deal.stage_key === 'interested' &&
|
|
1364
|
-
(deal.state_key ===
|
|
1471
|
+
(deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
|
|
1472
|
+
deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
|
|
1365
1473
|
workflowId: 'crm-send-nudge-workflow'
|
|
1366
1474
|
},
|
|
1367
1475
|
{
|
|
1368
1476
|
key: 'mark_no_show',
|
|
1369
1477
|
label: 'Mark No-Show',
|
|
1370
|
-
isAvailableFor: (deal) =>
|
|
1478
|
+
isAvailableFor: (deal) =>
|
|
1479
|
+
deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey,
|
|
1371
1480
|
// Mirrors the auto-timeout precedent in operations/sales/crm/pipeline/timeout-actions.ts:
|
|
1372
1481
|
// both manual-click and timeout move the deal to closed_lost. The action_taken activity
|
|
1373
1482
|
// event captures operator intent and distinguishes the manual variant from the timed one.
|
|
@@ -1376,7 +1485,8 @@ export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
|
|
|
1376
1485
|
{
|
|
1377
1486
|
key: 'rebook',
|
|
1378
1487
|
label: 'Rebook',
|
|
1379
|
-
isAvailableFor: (deal) =>
|
|
1488
|
+
isAvailableFor: (deal) =>
|
|
1489
|
+
deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_BOOKING_CANCELLED_STATE.stateKey,
|
|
1380
1490
|
workflowId: 'crm-rebook-workflow'
|
|
1381
1491
|
}
|
|
1382
1492
|
]
|
|
@@ -1385,19 +1495,19 @@ export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
|
|
|
1385
1495
|
### `CrmToolMap`
|
|
1386
1496
|
|
|
1387
1497
|
```typescript
|
|
1388
|
-
export type CrmToolMap = {
|
|
1389
|
-
getRecentActivity: { params: CrmRecentActivityParams; result: RecentActivityEntry[] }
|
|
1390
|
-
listDeals: { params: CrmListDealsParams; result: DealListItem[] }
|
|
1391
|
-
getDeal: { params: CrmGetDealParams; result: DealDetail | null }
|
|
1392
|
-
getDealByEmail: { params: CrmGetDealByEmailParams; result: DealDetail | null }
|
|
1393
|
-
createDealNote: { params: CrmDealNoteParams; result: AcqDealNote }
|
|
1394
|
-
listDealNotes: { params: Omit<ListDealNotesParams, 'organizationId'>; result: AcqDealNote[] }
|
|
1395
|
-
createDealTask: { params: CrmDealTaskParams; result: AcqDealTask }
|
|
1396
|
-
listDealTasks: { params: Omit<ListDealTasksParams, 'organizationId'>; result: AcqDealTask[] }
|
|
1397
|
-
listDealTasksDue: { params: CrmTaskDueParams; result: AcqDealTask[] }
|
|
1398
|
-
completeDealTask: { params: Omit<CompleteDealTaskParams, 'organizationId'>; result: AcqDealTask }
|
|
1399
|
-
recordActivity: { params: CrmRecordActivityParams; result: void }
|
|
1400
|
-
deleteDeal: { params: CrmDeleteDealParams; result: void }
|
|
1498
|
+
export type CrmToolMap = {
|
|
1499
|
+
getRecentActivity: { params: CrmRecentActivityParams; result: RecentActivityEntry[] }
|
|
1500
|
+
listDeals: { params: CrmListDealsParams; result: DealListItem[] }
|
|
1501
|
+
getDeal: { params: CrmGetDealParams; result: DealDetail | null }
|
|
1502
|
+
getDealByEmail: { params: CrmGetDealByEmailParams; result: DealDetail | null }
|
|
1503
|
+
createDealNote: { params: CrmDealNoteParams; result: AcqDealNote }
|
|
1504
|
+
listDealNotes: { params: Omit<ListDealNotesParams, 'organizationId'>; result: AcqDealNote[] }
|
|
1505
|
+
createDealTask: { params: CrmDealTaskParams; result: AcqDealTask }
|
|
1506
|
+
listDealTasks: { params: Omit<ListDealTasksParams, 'organizationId'>; result: AcqDealTask[] }
|
|
1507
|
+
listDealTasksDue: { params: CrmTaskDueParams; result: AcqDealTask[] }
|
|
1508
|
+
completeDealTask: { params: Omit<CompleteDealTaskParams, 'organizationId'>; result: AcqDealTask }
|
|
1509
|
+
recordActivity: { params: CrmRecordActivityParams; result: void }
|
|
1510
|
+
deleteDeal: { params: CrmDeleteDealParams; result: void }
|
|
1401
1511
|
}
|
|
1402
1512
|
```
|
|
1403
1513
|
|
|
@@ -1553,7 +1663,7 @@ export interface AcqList {
|
|
|
1553
1663
|
scrapingConfig: ScrapingConfig
|
|
1554
1664
|
icp: IcpRubric
|
|
1555
1665
|
pipelineConfig: PipelineConfig
|
|
1556
|
-
metadata:
|
|
1666
|
+
metadata: AcqListMetadata
|
|
1557
1667
|
launchedAt: Date | null
|
|
1558
1668
|
completedAt: Date | null
|
|
1559
1669
|
createdAt: Date
|
|
@@ -1639,6 +1749,7 @@ export interface AcqContact {
|
|
|
1639
1749
|
/**
|
|
1640
1750
|
* Live-scan aggregate telemetry for a single list, computed on demand from
|
|
1641
1751
|
* the list junction tables and current contact deliverability state.
|
|
1752
|
+
* `stageCounts` are attempted counts from list-row processing_state.
|
|
1642
1753
|
*/
|
|
1643
1754
|
export interface ListTelemetry {
|
|
1644
1755
|
listId: string
|
|
@@ -1669,6 +1780,8 @@ export interface ListTelemetry {
|
|
|
1669
1780
|
|
|
1670
1781
|
```typescript
|
|
1671
1782
|
export const ListStageCountsSchema = z.object({
|
|
1783
|
+
// Attempted counts by canonical lead-gen stage. The detailed status
|
|
1784
|
+
// distribution lives on ListProgress; telemetry keeps the overview payload small.
|
|
1672
1785
|
stageCounts: z.object({
|
|
1673
1786
|
populated: z.number().int(),
|
|
1674
1787
|
extracted: z.number().int(),
|
|
@@ -1717,6 +1830,7 @@ export const CreateListRequestSchema = z
|
|
|
1717
1830
|
name: z.string().trim().min(1).max(255),
|
|
1718
1831
|
description: z.string().trim().nullable().optional(),
|
|
1719
1832
|
status: ListStatusSchema.optional(),
|
|
1833
|
+
buildTemplateId: ProspectingBuildTemplateIdSchema.optional(),
|
|
1720
1834
|
scrapingConfig: ScrapingConfigSchema.optional(),
|
|
1721
1835
|
icp: IcpRubricSchema.optional(),
|
|
1722
1836
|
pipelineConfig: PipelineConfigSchema.optional()
|
|
@@ -1731,11 +1845,24 @@ export const UpdateListRequestSchema = z
|
|
|
1731
1845
|
.object({
|
|
1732
1846
|
name: z.string().trim().min(1).max(255).optional(),
|
|
1733
1847
|
description: z.string().trim().nullable().optional(),
|
|
1734
|
-
batchIds: z.array(z.string()).optional()
|
|
1848
|
+
batchIds: z.array(z.string()).optional(),
|
|
1849
|
+
buildTemplateId: ProspectingBuildTemplateIdSchema.optional(),
|
|
1850
|
+
confirmBuildTemplateChange: z.literal(true).optional()
|
|
1735
1851
|
})
|
|
1736
1852
|
.strict()
|
|
1737
|
-
.refine(
|
|
1738
|
-
|
|
1853
|
+
.refine(
|
|
1854
|
+
(data) =>
|
|
1855
|
+
data.name !== undefined ||
|
|
1856
|
+
data.description !== undefined ||
|
|
1857
|
+
data.batchIds !== undefined ||
|
|
1858
|
+
data.buildTemplateId !== undefined,
|
|
1859
|
+
{
|
|
1860
|
+
message: 'At least one field (name, description, batchIds, or buildTemplateId) must be provided'
|
|
1861
|
+
}
|
|
1862
|
+
)
|
|
1863
|
+
.refine((data) => data.buildTemplateId === undefined || data.confirmBuildTemplateChange === true, {
|
|
1864
|
+
message: 'confirmBuildTemplateChange must be true when changing buildTemplateId',
|
|
1865
|
+
path: ['confirmBuildTemplateChange']
|
|
1739
1866
|
})
|
|
1740
1867
|
```
|
|
1741
1868
|
|
|
@@ -1812,12 +1939,11 @@ export const AcqListResponseSchema = z.object({
|
|
|
1812
1939
|
organizationId: z.string(),
|
|
1813
1940
|
name: z.string(),
|
|
1814
1941
|
description: z.string().nullable(),
|
|
1815
|
-
type: z.string(),
|
|
1816
1942
|
batchIds: z.array(z.string()),
|
|
1817
1943
|
instantlyCampaignId: z.string().nullable(),
|
|
1818
1944
|
/** Lifecycle status (draft | enriching | launched | closing | archived). */
|
|
1819
1945
|
status: ListStatusSchema,
|
|
1820
|
-
metadata:
|
|
1946
|
+
metadata: AcqListMetadataSchema,
|
|
1821
1947
|
launchedAt: z.string().nullable(),
|
|
1822
1948
|
completedAt: z.string().nullable(),
|
|
1823
1949
|
createdAt: z.string(),
|
|
@@ -2351,6 +2477,10 @@ export const AcqListSchemas = {
|
|
|
2351
2477
|
IcpRubric: IcpRubricSchema,
|
|
2352
2478
|
PipelineConfig: PipelineConfigSchema,
|
|
2353
2479
|
PipelineStage: PipelineStageSchema,
|
|
2480
|
+
BuildPlanSnapshot: BuildPlanSnapshotSchema,
|
|
2481
|
+
BuildPlanSnapshotStep: BuildPlanSnapshotStepSchema,
|
|
2482
|
+
AcqListMetadata: AcqListMetadataSchema,
|
|
2483
|
+
ProcessingStageStatus: ProcessingStageStatusSchema,
|
|
2354
2484
|
ListStageCounts: ListStageCountsSchema,
|
|
2355
2485
|
ListTelemetry: ListTelemetrySchema,
|
|
2356
2486
|
|
|
@@ -2446,134 +2576,134 @@ export const StatefulSchema = z.object({
|
|
|
2446
2576
|
### `StatefulStateDefinition`
|
|
2447
2577
|
|
|
2448
2578
|
```typescript
|
|
2449
|
-
/** One state within a stage — minimal shape: key + display label. */
|
|
2450
|
-
export interface StatefulStateDefinition {
|
|
2451
|
-
/** Matches state_key values written by workflow steps. */
|
|
2452
|
-
stateKey: string
|
|
2453
|
-
label: string
|
|
2579
|
+
/** One state within a stage — minimal shape: key + display label. */
|
|
2580
|
+
export interface StatefulStateDefinition {
|
|
2581
|
+
/** Matches state_key values written by workflow steps. */
|
|
2582
|
+
stateKey: string
|
|
2583
|
+
label: string
|
|
2454
2584
|
}
|
|
2455
2585
|
```
|
|
2456
2586
|
|
|
2457
2587
|
### `StatefulStageDefinition`
|
|
2458
2588
|
|
|
2459
2589
|
```typescript
|
|
2460
|
-
/** One stage within a pipeline — has a stage_key and an ordered list of valid states. */
|
|
2461
|
-
export interface StatefulStageDefinition {
|
|
2462
|
-
/** Matches stage_key values written by workflow steps. */
|
|
2463
|
-
stageKey: string
|
|
2464
|
-
label: string
|
|
2465
|
-
states: StatefulStateDefinition[]
|
|
2590
|
+
/** One stage within a pipeline — has a stage_key and an ordered list of valid states. */
|
|
2591
|
+
export interface StatefulStageDefinition {
|
|
2592
|
+
/** Matches stage_key values written by workflow steps. */
|
|
2593
|
+
stageKey: string
|
|
2594
|
+
label: string
|
|
2595
|
+
states: StatefulStateDefinition[]
|
|
2466
2596
|
}
|
|
2467
2597
|
```
|
|
2468
2598
|
|
|
2469
2599
|
### `StatefulPipelineDefinition`
|
|
2470
2600
|
|
|
2471
2601
|
```typescript
|
|
2472
|
-
/**
|
|
2473
|
-
* Pipeline definition for a single entity participating in the Stateful trait.
|
|
2474
|
-
* Parallel to acq_deals' pipeline_key concept but structured for lead-gen entities.
|
|
2475
|
-
*/
|
|
2476
|
-
export interface StatefulPipelineDefinition {
|
|
2477
|
-
/** Matches pipeline_key values in the database (e.g. 'lead-gen'). */
|
|
2478
|
-
pipelineKey: string
|
|
2479
|
-
label: string
|
|
2480
|
-
/** Entity this pipeline applies to (e.g. 'acq.list', 'acq.list-member', 'acq.list-company'). */
|
|
2481
|
-
entityKey: string
|
|
2482
|
-
stages: StatefulStageDefinition[]
|
|
2602
|
+
/**
|
|
2603
|
+
* Pipeline definition for a single entity participating in the Stateful trait.
|
|
2604
|
+
* Parallel to acq_deals' pipeline_key concept but structured for lead-gen entities.
|
|
2605
|
+
*/
|
|
2606
|
+
export interface StatefulPipelineDefinition {
|
|
2607
|
+
/** Matches pipeline_key values in the database (e.g. 'lead-gen'). */
|
|
2608
|
+
pipelineKey: string
|
|
2609
|
+
label: string
|
|
2610
|
+
/** Entity this pipeline applies to (e.g. 'acq.list', 'acq.list-member', 'acq.list-company'). */
|
|
2611
|
+
entityKey: string
|
|
2612
|
+
stages: StatefulStageDefinition[]
|
|
2483
2613
|
}
|
|
2484
2614
|
```
|
|
2485
2615
|
|
|
2486
2616
|
### `ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE`
|
|
2487
2617
|
|
|
2488
2618
|
```typescript
|
|
2489
|
-
/**
|
|
2490
|
-
* Lead-gen pipeline definition for acq_list_members (contacts).
|
|
2491
|
-
* Three stages matching the post-restructure sales subdomain tree.
|
|
2492
|
-
*
|
|
2493
|
-
* Note: members visit outreach and prospecting states depending on which
|
|
2494
|
-
* workflow last processed them. stage_key is set per-transition by the workflow.
|
|
2495
|
-
*/
|
|
2496
|
-
export const ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
|
|
2497
|
-
pipelineKey: 'lead-gen',
|
|
2498
|
-
label: 'Lead Generation',
|
|
2499
|
-
entityKey: 'acq.list-member',
|
|
2500
|
-
stages: [
|
|
2501
|
-
{
|
|
2502
|
-
stageKey: 'outreach',
|
|
2503
|
-
label: 'Outreach',
|
|
2504
|
-
states: [
|
|
2505
|
-
PENDING_STATE,
|
|
2506
|
-
{ stateKey: 'personalized', label: 'Personalized' },
|
|
2507
|
-
{ stateKey: 'uploaded', label: 'Uploaded' },
|
|
2508
|
-
{ stateKey: 'interested', label: 'Interested' }
|
|
2509
|
-
]
|
|
2510
|
-
},
|
|
2511
|
-
{
|
|
2512
|
-
stageKey: 'prospecting',
|
|
2513
|
-
label: 'Prospecting',
|
|
2514
|
-
states: [
|
|
2515
|
-
PENDING_STATE,
|
|
2516
|
-
{ stateKey: 'discovered', label: 'Discovered' },
|
|
2517
|
-
{ stateKey: 'verified', label: 'Verified' }
|
|
2518
|
-
]
|
|
2519
|
-
},
|
|
2520
|
-
{
|
|
2521
|
-
stageKey: 'qualification',
|
|
2522
|
-
label: 'Qualification',
|
|
2523
|
-
states: [PENDING_STATE]
|
|
2524
|
-
}
|
|
2525
|
-
]
|
|
2619
|
+
/**
|
|
2620
|
+
* Lead-gen pipeline definition for acq_list_members (contacts).
|
|
2621
|
+
* Three stages matching the post-restructure sales subdomain tree.
|
|
2622
|
+
*
|
|
2623
|
+
* Note: members visit outreach and prospecting states depending on which
|
|
2624
|
+
* workflow last processed them. stage_key is set per-transition by the workflow.
|
|
2625
|
+
*/
|
|
2626
|
+
export const ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
|
|
2627
|
+
pipelineKey: 'lead-gen',
|
|
2628
|
+
label: 'Lead Generation',
|
|
2629
|
+
entityKey: 'acq.list-member',
|
|
2630
|
+
stages: [
|
|
2631
|
+
{
|
|
2632
|
+
stageKey: 'outreach',
|
|
2633
|
+
label: 'Outreach',
|
|
2634
|
+
states: [
|
|
2635
|
+
PENDING_STATE,
|
|
2636
|
+
{ stateKey: 'personalized', label: 'Personalized' },
|
|
2637
|
+
{ stateKey: 'uploaded', label: 'Uploaded' },
|
|
2638
|
+
{ stateKey: 'interested', label: 'Interested' }
|
|
2639
|
+
]
|
|
2640
|
+
},
|
|
2641
|
+
{
|
|
2642
|
+
stageKey: 'prospecting',
|
|
2643
|
+
label: 'Prospecting',
|
|
2644
|
+
states: [
|
|
2645
|
+
PENDING_STATE,
|
|
2646
|
+
{ stateKey: 'discovered', label: 'Discovered' },
|
|
2647
|
+
{ stateKey: 'verified', label: 'Verified' }
|
|
2648
|
+
]
|
|
2649
|
+
},
|
|
2650
|
+
{
|
|
2651
|
+
stageKey: 'qualification',
|
|
2652
|
+
label: 'Qualification',
|
|
2653
|
+
states: [PENDING_STATE]
|
|
2654
|
+
}
|
|
2655
|
+
]
|
|
2526
2656
|
}
|
|
2527
2657
|
```
|
|
2528
2658
|
|
|
2529
2659
|
### `ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE`
|
|
2530
2660
|
|
|
2531
2661
|
```typescript
|
|
2532
|
-
/**
|
|
2533
|
-
* Lead-gen pipeline definition for acq_list_companies.
|
|
2534
|
-
* Three stages matching the post-restructure sales subdomain tree.
|
|
2535
|
-
*
|
|
2536
|
-
* Note: companies visit prospecting and qualification states depending on which
|
|
2537
|
-
* workflow last processed them. stage_key is set per-transition by the workflow.
|
|
2538
|
-
*/
|
|
2539
|
-
export const ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
|
|
2540
|
-
pipelineKey: 'lead-gen',
|
|
2541
|
-
label: 'Lead Generation',
|
|
2542
|
-
entityKey: 'acq.list-company',
|
|
2543
|
-
stages: [
|
|
2544
|
-
{
|
|
2545
|
-
stageKey: 'outreach',
|
|
2546
|
-
label: 'Outreach',
|
|
2547
|
-
states: [PENDING_STATE]
|
|
2548
|
-
},
|
|
2549
|
-
{
|
|
2550
|
-
stageKey: 'prospecting',
|
|
2551
|
-
label: 'Prospecting',
|
|
2552
|
-
states: [
|
|
2553
|
-
PENDING_STATE,
|
|
2554
|
-
{ stateKey: 'populated', label: 'Populated' },
|
|
2555
|
-
{ stateKey: 'extracted', label: 'Extracted' }
|
|
2556
|
-
]
|
|
2557
|
-
},
|
|
2558
|
-
{
|
|
2559
|
-
stageKey: 'qualification',
|
|
2560
|
-
label: 'Qualification',
|
|
2561
|
-
states: [PENDING_STATE, { stateKey: 'qualified', label: 'Qualified' }]
|
|
2562
|
-
}
|
|
2563
|
-
]
|
|
2662
|
+
/**
|
|
2663
|
+
* Lead-gen pipeline definition for acq_list_companies.
|
|
2664
|
+
* Three stages matching the post-restructure sales subdomain tree.
|
|
2665
|
+
*
|
|
2666
|
+
* Note: companies visit prospecting and qualification states depending on which
|
|
2667
|
+
* workflow last processed them. stage_key is set per-transition by the workflow.
|
|
2668
|
+
*/
|
|
2669
|
+
export const ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE: StatefulPipelineDefinition = {
|
|
2670
|
+
pipelineKey: 'lead-gen',
|
|
2671
|
+
label: 'Lead Generation',
|
|
2672
|
+
entityKey: 'acq.list-company',
|
|
2673
|
+
stages: [
|
|
2674
|
+
{
|
|
2675
|
+
stageKey: 'outreach',
|
|
2676
|
+
label: 'Outreach',
|
|
2677
|
+
states: [PENDING_STATE]
|
|
2678
|
+
},
|
|
2679
|
+
{
|
|
2680
|
+
stageKey: 'prospecting',
|
|
2681
|
+
label: 'Prospecting',
|
|
2682
|
+
states: [
|
|
2683
|
+
PENDING_STATE,
|
|
2684
|
+
{ stateKey: 'populated', label: 'Populated' },
|
|
2685
|
+
{ stateKey: 'extracted', label: 'Extracted' }
|
|
2686
|
+
]
|
|
2687
|
+
},
|
|
2688
|
+
{
|
|
2689
|
+
stageKey: 'qualification',
|
|
2690
|
+
label: 'Qualification',
|
|
2691
|
+
states: [PENDING_STATE, { stateKey: 'qualified', label: 'Qualified' }]
|
|
2692
|
+
}
|
|
2693
|
+
]
|
|
2564
2694
|
}
|
|
2565
2695
|
```
|
|
2566
2696
|
|
|
2567
2697
|
### `LEAD_GEN_PIPELINE_DEFINITIONS`
|
|
2568
2698
|
|
|
2569
2699
|
```typescript
|
|
2570
|
-
/**
|
|
2571
|
-
* All lead-gen pipeline definitions indexed by entity key.
|
|
2572
|
-
* Use findPipeline() to locate a definition by pipeline_key within any of these arrays.
|
|
2573
|
-
*/
|
|
2574
|
-
export const LEAD_GEN_PIPELINE_DEFINITIONS: Record<string, StatefulPipelineDefinition[]> = {
|
|
2575
|
-
'acq.list-member': [ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE],
|
|
2576
|
-
'acq.list-company': [ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE]
|
|
2700
|
+
/**
|
|
2701
|
+
* All lead-gen pipeline definitions indexed by entity key.
|
|
2702
|
+
* Use findPipeline() to locate a definition by pipeline_key within any of these arrays.
|
|
2703
|
+
*/
|
|
2704
|
+
export const LEAD_GEN_PIPELINE_DEFINITIONS: Record<string, StatefulPipelineDefinition[]> = {
|
|
2705
|
+
'acq.list-member': [ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE],
|
|
2706
|
+
'acq.list-company': [ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE]
|
|
2577
2707
|
}
|
|
2578
2708
|
```
|
|
2579
2709
|
|
|
@@ -2606,11 +2736,12 @@ export interface CreateListParams {
|
|
|
2606
2736
|
description?: string
|
|
2607
2737
|
type?: string
|
|
2608
2738
|
batchIds?: string[]
|
|
2609
|
-
instantlyCampaignId?: string
|
|
2610
|
-
status?: ListStatus
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2739
|
+
instantlyCampaignId?: string
|
|
2740
|
+
status?: ListStatus
|
|
2741
|
+
buildTemplateId?: string
|
|
2742
|
+
metadata?: Record<string, unknown>
|
|
2743
|
+
scrapingConfig?: ScrapingConfig
|
|
2744
|
+
icp?: IcpRubric
|
|
2614
2745
|
pipelineConfig?: PipelineConfig
|
|
2615
2746
|
}
|
|
2616
2747
|
```
|
|
@@ -2618,10 +2749,10 @@ export interface CreateListParams {
|
|
|
2618
2749
|
### `UpdateListParams`
|
|
2619
2750
|
|
|
2620
2751
|
```typescript
|
|
2621
|
-
export interface UpdateListParams {
|
|
2622
|
-
name?: string
|
|
2623
|
-
description?: string
|
|
2624
|
-
batchIds?: string[]
|
|
2752
|
+
export interface UpdateListParams {
|
|
2753
|
+
name?: string
|
|
2754
|
+
description?: string
|
|
2755
|
+
batchIds?: string[]
|
|
2625
2756
|
}
|
|
2626
2757
|
```
|
|
2627
2758
|
|
|
@@ -2832,24 +2963,26 @@ export interface UpdateListConfigParams {
|
|
|
2832
2963
|
### `UpdateCompanyStageParams`
|
|
2833
2964
|
|
|
2834
2965
|
```typescript
|
|
2835
|
-
export interface UpdateCompanyStageParams {
|
|
2836
|
-
organizationId: string
|
|
2837
|
-
listId: string
|
|
2838
|
-
companyId: string
|
|
2839
|
-
stage: string
|
|
2840
|
-
|
|
2966
|
+
export interface UpdateCompanyStageParams {
|
|
2967
|
+
organizationId: string
|
|
2968
|
+
listId: string
|
|
2969
|
+
companyId: string
|
|
2970
|
+
stage: string
|
|
2971
|
+
status?: ProcessingStageStatus
|
|
2972
|
+
executionId?: string
|
|
2841
2973
|
}
|
|
2842
2974
|
```
|
|
2843
2975
|
|
|
2844
2976
|
### `UpdateContactStageParams`
|
|
2845
2977
|
|
|
2846
2978
|
```typescript
|
|
2847
|
-
export interface UpdateContactStageParams {
|
|
2848
|
-
organizationId: string
|
|
2849
|
-
listId: string
|
|
2850
|
-
contactId: string
|
|
2851
|
-
stage: string
|
|
2852
|
-
|
|
2979
|
+
export interface UpdateContactStageParams {
|
|
2980
|
+
organizationId: string
|
|
2981
|
+
listId: string
|
|
2982
|
+
contactId: string
|
|
2983
|
+
stage: string
|
|
2984
|
+
status?: ProcessingStageStatus
|
|
2985
|
+
executionId?: string
|
|
2853
2986
|
}
|
|
2854
2987
|
```
|
|
2855
2988
|
|
|
@@ -2973,157 +3106,159 @@ export interface BulkImportCompaniesResult {
|
|
|
2973
3106
|
### `LeadToolMap`
|
|
2974
3107
|
|
|
2975
3108
|
```typescript
|
|
2976
|
-
export type LeadToolMap = {
|
|
2977
|
-
// List operations
|
|
2978
|
-
listLists: { params: Record<string, never>; result: AcqList[] }
|
|
2979
|
-
createList: { params: Omit<CreateListParams, 'organizationId'>; result: AcqList }
|
|
2980
|
-
updateList: { params: { id: string } & UpdateListParams; result: AcqList }
|
|
2981
|
-
deleteList: { params: { id: string }; result: void }
|
|
2982
|
-
addContactsToList: { params: Omit<AddContactsToListParams, 'organizationId'>; result: AddContactsToListResult }
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3109
|
+
export type LeadToolMap = {
|
|
3110
|
+
// List operations
|
|
3111
|
+
listLists: { params: Record<string, never>; result: AcqList[] }
|
|
3112
|
+
createList: { params: Omit<CreateListParams, 'organizationId'>; result: AcqList }
|
|
3113
|
+
updateList: { params: { id: string } & UpdateListParams; result: AcqList }
|
|
3114
|
+
deleteList: { params: { id: string }; result: void }
|
|
3115
|
+
addContactsToList: { params: Omit<AddContactsToListParams, 'organizationId'>; result: AddContactsToListResult }
|
|
3116
|
+
addCompaniesToList: { params: Omit<AddCompaniesToListParams, 'organizationId'>; result: AddCompaniesToListResult }
|
|
3117
|
+
updateCompanyStage: {
|
|
3118
|
+
params: Omit<UpdateCompanyStageParams, 'organizationId'>
|
|
3119
|
+
result: void
|
|
3120
|
+
}
|
|
3121
|
+
updateContactStage: {
|
|
3122
|
+
params: Omit<UpdateContactStageParams, 'organizationId'>
|
|
3123
|
+
result: void
|
|
3124
|
+
}
|
|
3125
|
+
// Company operations
|
|
3126
|
+
createCompany: { params: Omit<CreateCompanyParams, 'organizationId'>; result: AcqCompany }
|
|
3127
|
+
upsertCompany: { params: Omit<UpsertCompanyParams, 'organizationId'>; result: AcqCompany }
|
|
3128
|
+
updateCompany: { params: { id: string } & UpdateCompanyParams; result: AcqCompany }
|
|
3129
|
+
getCompany: { params: { id: string }; result: AcqCompany | null }
|
|
3130
|
+
listCompanies: { params: CompanyFilters; result: AcqCompany[] }
|
|
3131
|
+
deleteCompany: { params: { id: string }; result: void }
|
|
3132
|
+
// Contact operations
|
|
3133
|
+
createContact: { params: Omit<CreateContactParams, 'organizationId'>; result: AcqContact }
|
|
3134
|
+
upsertContact: { params: Omit<UpsertContactParams, 'organizationId'>; result: AcqContact }
|
|
3135
|
+
updateContact: { params: { id: string } & UpdateContactParams; result: AcqContact }
|
|
3136
|
+
getContact: { params: { id: string }; result: AcqContact | null }
|
|
3137
|
+
getContactByEmail: { params: { email: string }; result: AcqContact | null }
|
|
3138
|
+
listContacts: {
|
|
3139
|
+
params: ContactFilters & { limit?: number; offset?: number }
|
|
3140
|
+
result: PaginatedResult<AcqContact>
|
|
3141
|
+
}
|
|
3142
|
+
deleteContact: { params: { id: string }; result: void }
|
|
3143
|
+
bulkImportContacts: { params: Omit<BulkImportParams, 'organizationId'>; result: BulkImportResult }
|
|
3144
|
+
bulkImportCompanies: {
|
|
3145
|
+
params: Omit<BulkImportCompaniesParams, 'organizationId'>
|
|
3146
|
+
result: BulkImportCompaniesResult
|
|
3147
|
+
}
|
|
3148
|
+
deactivateContactsByCompany: {
|
|
3149
|
+
params: { companyId: string }
|
|
3150
|
+
result: { deactivated: number }
|
|
3151
|
+
}
|
|
3152
|
+
// Deal operations
|
|
3153
|
+
upsertDeal: { params: Omit<UpsertDealParams, 'organizationId'>; result: AcqDeal }
|
|
3154
|
+
getDealByEmail: { params: { email: string }; result: AcqDeal | null }
|
|
3155
|
+
getDealByEnvelopeId: { params: { envelopeId: string }; result: AcqDeal | null }
|
|
3156
|
+
updateDealEnvelopeId: { params: { dealId: string; envelopeId: string }; result: AcqDeal | null }
|
|
3157
|
+
getDealById: { params: Omit<GetDealByIdParams, 'organizationId'>; result: AcqDeal | null }
|
|
3158
|
+
getContactById: { params: Omit<GetContactByIdParams, 'organizationId'>; result: AcqContact | null }
|
|
3159
|
+
getCompanyById: { params: Omit<GetCompanyByIdParams, 'organizationId'>; result: AcqCompany | null }
|
|
3160
|
+
// Deal-sync operations
|
|
3161
|
+
updateDiscoveryData: { params: Omit<UpdateDiscoveryDataParams, 'organizationId'>; result: void }
|
|
3162
|
+
updateProposalData: { params: Omit<UpdateProposalDataParams, 'organizationId'>; result: void }
|
|
3163
|
+
markProposalSent: { params: Omit<MarkProposalSentParams, 'organizationId'>; result: void }
|
|
3164
|
+
markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
|
|
3165
|
+
updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
|
|
3166
|
+
updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
|
|
3167
|
+
cacheInstantlyThreadIds: { params: Omit<CacheInstantlyThreadIdsParams, 'organizationId'>; result: void }
|
|
3168
|
+
transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
|
|
3169
|
+
setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
|
|
3170
|
+
cancelSchedulesAndHitlByEmail: {
|
|
3171
|
+
params: Omit<CancelSchedulesAndHitlByEmailParams, 'organizationId'>
|
|
3172
|
+
result: { schedulesCancelled: number; hitlDeleted: number }
|
|
3173
|
+
}
|
|
3174
|
+
cancelHitlByDealId: { params: Omit<CancelHitlByDealIdParams, 'organizationId'>; result: { hitlDeleted: number } }
|
|
3175
|
+
clearDealFields: { params: Omit<ClearDealFieldsParams, 'organizationId'>; result: void }
|
|
3176
|
+
deleteDeal: { params: Omit<DeleteDealParams, 'organizationId'>; result: void }
|
|
3177
|
+
recordDealActivity: {
|
|
3178
|
+
params: Omit<RecordDealActivityParams, 'organizationId'>
|
|
3179
|
+
result: void
|
|
3180
|
+
}
|
|
3181
|
+
// Deal note operations
|
|
3182
|
+
createDealNote: {
|
|
3183
|
+
params: Omit<CreateDealNoteParams, 'organizationId'>
|
|
3184
|
+
result: AcqDealNote
|
|
3185
|
+
}
|
|
3186
|
+
listDealNotes: {
|
|
3187
|
+
params: Omit<ListDealNotesParams, 'organizationId'>
|
|
3188
|
+
result: AcqDealNote[]
|
|
3189
|
+
}
|
|
3190
|
+
// Deal task operations
|
|
3191
|
+
createDealTask: {
|
|
3192
|
+
params: Omit<CreateDealTaskParams, 'organizationId'>
|
|
3193
|
+
result: AcqDealTask
|
|
3194
|
+
}
|
|
3195
|
+
listDealTasks: {
|
|
3196
|
+
params: Omit<ListDealTasksParams, 'organizationId'>
|
|
3197
|
+
result: AcqDealTask[]
|
|
3198
|
+
}
|
|
3199
|
+
listDealTasksDue: {
|
|
3200
|
+
params: Omit<ListDealTasksDueParams, 'organizationId'>
|
|
3201
|
+
result: AcqDealTask[]
|
|
3202
|
+
}
|
|
3203
|
+
completeDealTask: {
|
|
3204
|
+
params: Omit<CompleteDealTaskParams, 'organizationId'>
|
|
3205
|
+
result: AcqDealTask
|
|
3206
|
+
}
|
|
3207
|
+
// Deal query & analytics operations
|
|
3208
|
+
listDeals: { params: DealFilters; result: AcqDeal[] }
|
|
3209
|
+
getDealPipelineAnalytics: { params: { recentLimit?: number }; result: DealPipelineAnalytics }
|
|
3210
|
+
// Enrichment data operations
|
|
3211
|
+
mergeEnrichmentData: {
|
|
3212
|
+
params: { id: string; table: 'acq_companies' | 'acq_contacts'; data: Record<string, unknown> }
|
|
3213
|
+
result: void
|
|
3214
|
+
}
|
|
3215
|
+
// Social monitoring operations
|
|
3216
|
+
upsertSocialPosts: {
|
|
3217
|
+
params: { posts: Omit<UpsertSocialPostParams, 'organizationId'>[] }
|
|
3218
|
+
result: UpsertSocialPostsResult
|
|
3219
|
+
}
|
|
3220
|
+
setDealStateKey: {
|
|
3221
|
+
params: {
|
|
3222
|
+
dealId: string
|
|
3223
|
+
stateKey: string
|
|
3224
|
+
}
|
|
3225
|
+
result: { ok: true }
|
|
3226
|
+
}
|
|
3227
|
+
// CRM workflow helpers
|
|
3228
|
+
transitionDeal: {
|
|
3229
|
+
params: {
|
|
3230
|
+
dealId: string
|
|
3231
|
+
toStage: string
|
|
3232
|
+
toState?: string
|
|
3233
|
+
}
|
|
3234
|
+
result: { deal: AcqDeal }
|
|
3235
|
+
}
|
|
3236
|
+
loadDeal: {
|
|
3237
|
+
params: { dealId: string }
|
|
3238
|
+
result: DealDetail | null
|
|
3239
|
+
}
|
|
3105
3240
|
}
|
|
3106
3241
|
```
|
|
3107
3242
|
|
|
3108
3243
|
### `ListToolMap`
|
|
3109
3244
|
|
|
3110
3245
|
```typescript
|
|
3111
|
-
export type ListToolMap = {
|
|
3112
|
-
getConfig: {
|
|
3113
|
-
params: { listId: string }
|
|
3114
|
-
result: { scrapingConfig: ScrapingConfig; icp: IcpRubric; pipelineConfig: PipelineConfig }
|
|
3115
|
-
}
|
|
3116
|
-
recordExecution: {
|
|
3117
|
-
params: Omit<RecordListExecutionParams, 'organizationId'>
|
|
3118
|
-
result: void
|
|
3119
|
-
}
|
|
3120
|
-
updateCompanyStage: {
|
|
3121
|
-
params: Omit<UpdateCompanyStageParams, 'organizationId'>
|
|
3122
|
-
result: void
|
|
3123
|
-
}
|
|
3124
|
-
updateContactStage: {
|
|
3125
|
-
params: Omit<UpdateContactStageParams, 'organizationId'>
|
|
3126
|
-
result: void
|
|
3127
|
-
}
|
|
3246
|
+
export type ListToolMap = {
|
|
3247
|
+
getConfig: {
|
|
3248
|
+
params: { listId: string }
|
|
3249
|
+
result: { scrapingConfig: ScrapingConfig; icp: IcpRubric; pipelineConfig: PipelineConfig }
|
|
3250
|
+
}
|
|
3251
|
+
recordExecution: {
|
|
3252
|
+
params: Omit<RecordListExecutionParams, 'organizationId'>
|
|
3253
|
+
result: void
|
|
3254
|
+
}
|
|
3255
|
+
updateCompanyStage: {
|
|
3256
|
+
params: Omit<UpdateCompanyStageParams, 'organizationId'>
|
|
3257
|
+
result: void
|
|
3258
|
+
}
|
|
3259
|
+
updateContactStage: {
|
|
3260
|
+
params: Omit<UpdateContactStageParams, 'organizationId'>
|
|
3261
|
+
result: void
|
|
3262
|
+
}
|
|
3128
3263
|
}
|
|
3129
3264
|
```
|