@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.
Files changed (36) hide show
  1. package/dist/index.d.ts +60 -0
  2. package/dist/index.js +198 -1
  3. package/dist/organization-model/index.d.ts +60 -0
  4. package/dist/organization-model/index.js +198 -1
  5. package/dist/test-utils/index.d.ts +399 -363
  6. package/dist/test-utils/index.js +198 -1
  7. package/package.json +3 -3
  8. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +444 -309
  9. package/src/business/acquisition/activity-events.ts +12 -3
  10. package/src/business/acquisition/api-schemas.test.ts +315 -4
  11. package/src/business/acquisition/api-schemas.ts +140 -17
  12. package/src/business/acquisition/build-templates.ts +44 -0
  13. package/src/business/acquisition/crm-next-action.test.ts +262 -0
  14. package/src/business/acquisition/crm-next-action.ts +220 -0
  15. package/src/business/acquisition/crm-priority.test.ts +216 -0
  16. package/src/business/acquisition/crm-priority.ts +349 -0
  17. package/src/business/acquisition/crm-state-actions.test.ts +12 -21
  18. package/src/business/acquisition/deal-ownership.test.ts +351 -0
  19. package/src/business/acquisition/deal-ownership.ts +120 -0
  20. package/src/business/acquisition/derive-actions.test.ts +101 -37
  21. package/src/business/acquisition/derive-actions.ts +49 -24
  22. package/src/business/acquisition/index.ts +163 -149
  23. package/src/business/acquisition/types.ts +48 -4
  24. package/src/execution/engine/index.ts +4 -3
  25. package/src/execution/engine/tools/lead-service-types.ts +68 -51
  26. package/src/execution/engine/tools/platform/acquisition/list-tools.ts +6 -5
  27. package/src/execution/engine/tools/platform/acquisition/types.ts +3 -1
  28. package/src/execution/engine/tools/registry.ts +4 -3
  29. package/src/execution/engine/tools/tool-maps.ts +821 -816
  30. package/src/organization-model/domains/prospecting.ts +204 -1
  31. package/src/organization-model/domains/sales.test.ts +218 -0
  32. package/src/organization-model/domains/sales.ts +558 -366
  33. package/src/organization-model/types.ts +2 -2
  34. package/src/platform/constants/versions.ts +1 -1
  35. package/src/reference/_generated/contracts.md +444 -309
  36. package/src/supabase/database.types.ts +2978 -2958
@@ -1,816 +1,821 @@
1
- /**
2
- * Tool Method Maps
3
- *
4
- * Single source of truth for tool -> method -> params -> result type mappings.
5
- * Used by SDK adapters (compile-time typed wrappers) and optionally by the
6
- * server-side dispatcher for type checking.
7
- *
8
- * Browser-safe: no Node.js imports, pure type definitions.
9
- */
10
-
11
- import type {
12
- CreateRecordParams,
13
- CreateRecordResult,
14
- UpdateRecordParams,
15
- UpdateRecordResult,
16
- QueryRecordsParams,
17
- QueryRecordsResult,
18
- GetRecordParams,
19
- GetRecordResult,
20
- DeleteRecordParams,
21
- DeleteRecordResult,
22
- ListObjectsResult,
23
- ListAttributesParams,
24
- ListAttributesResult,
25
- CreateAttributeParams,
26
- CreateAttributeResult,
27
- UpdateAttributeParams,
28
- UpdateAttributeResult,
29
- CreateNoteParams,
30
- CreateNoteResult,
31
- ListNotesParams,
32
- ListNotesResult,
33
- DeleteNoteParams,
34
- DeleteNoteResult
35
- } from './integration/types/attio'
36
-
37
- import type {
38
- RunActorParams,
39
- RunActorResult,
40
- GetDatasetItemsParams,
41
- GetDatasetItemsResult,
42
- StartActorParams,
43
- StartActorResult
44
- } from './integration/types/apify'
45
-
46
- import type {
47
- UploadFileParams,
48
- UploadFileResult,
49
- CreateFolderParams,
50
- CreateFolderResult
51
- } from './integration/types/dropbox'
52
-
53
- import type { GmailSendEmailParams, GmailSendEmailResult } from './integration/types/gmail'
54
-
55
- import type {
56
- ReadSheetParams,
57
- ReadSheetResult,
58
- WriteSheetParams,
59
- WriteSheetResult,
60
- AppendRowsParams,
61
- AppendRowsResult,
62
- ClearRangeParams,
63
- ClearRangeResult,
64
- GetSpreadsheetMetadataParams,
65
- GetSpreadsheetMetadataResult,
66
- BatchUpdateParams,
67
- BatchUpdateResult,
68
- GetHeadersParams,
69
- GetHeadersResult,
70
- GetLastRowParams,
71
- GetLastRowResult,
72
- GetRowByValueParams,
73
- GetRowByValueResult,
74
- UpdateRowByValueParams,
75
- UpdateRowByValueResult,
76
- UpsertRowParams,
77
- UpsertRowResult,
78
- FilterRowsParams,
79
- FilterRowsResult,
80
- DeleteRowByValueParams,
81
- DeleteRowByValueResult
82
- } from './integration/types/google-sheets'
83
-
84
- import type {
85
- SendReplyParams,
86
- SendReplyResult,
87
- RemoveFromSubsequenceParams,
88
- RemoveFromSubsequenceResult,
89
- GetEmailsParams,
90
- GetEmailsResult,
91
- UpdateInterestStatusParams,
92
- UpdateInterestStatusResult,
93
- AddToCampaignParams,
94
- AddToCampaignResult,
95
- ListCampaignsParams,
96
- ListCampaignsResult,
97
- GetCampaignParams,
98
- GetCampaignResult,
99
- UpdateCampaignParams,
100
- UpdateCampaignResult,
101
- PauseCampaignParams,
102
- PauseCampaignResult,
103
- ActivateCampaignParams,
104
- ActivateCampaignResult,
105
- GetCampaignAnalyticsParams,
106
- GetCampaignAnalyticsResult,
107
- GetStepAnalyticsParams,
108
- GetStepAnalyticsResult,
109
- BulkAddLeadsParams,
110
- BulkAddLeadsResult,
111
- GetAccountHealthParams,
112
- GetAccountHealthResult,
113
- CreateInboxTestParams,
114
- CreateInboxTestResult,
115
- CreateCampaignParams,
116
- CreateCampaignResult,
117
- GetDailyCampaignAnalyticsParams,
118
- GetDailyCampaignAnalyticsResult,
119
- ListLeadsParams,
120
- ListLeadsResult,
121
- BulkDeleteLeadsParams,
122
- BulkDeleteLeadsResult,
123
- DeleteCampaignParams,
124
- DeleteCampaignResult,
125
- PatchLeadParams,
126
- PatchLeadResult
127
- } from './integration/types/instantly'
128
-
129
- import type {
130
- MillionVerifierVerifyEmailParams,
131
- MillionVerifierVerifyEmailResult,
132
- MillionVerifierCheckCreditsParams,
133
- MillionVerifierCheckCreditsResult
134
- } from './integration/types/millionverifier'
135
-
136
- import type {
137
- FindCompanyEmailParams,
138
- FindCompanyEmailResult,
139
- FindPersonEmailParams,
140
- FindPersonEmailResult,
141
- FindDecisionMakerEmailParams,
142
- FindDecisionMakerEmailResult,
143
- VerifyEmailParams,
144
- VerifyEmailResult
145
- } from './integration/types/anymailfinder'
146
-
147
- import type {
148
- EmailFinderParams,
149
- EmailFinderResult,
150
- DomainSearchParams,
151
- DomainSearchResult,
152
- EmailVerifierParams,
153
- EmailVerifierResult
154
- } from './integration/types/tomba'
155
-
156
- import type {
157
- ResendSendEmailParams,
158
- ResendSendEmailResult,
159
- ResendGetEmailParams,
160
- ResendGetEmailResult
161
- } from './integration/types/resend'
162
-
163
- import type {
164
- CreateEnvelopeParams,
165
- CreateEnvelopeResult,
166
- VoidEnvelopeParams,
167
- VoidEnvelopeResult,
168
- DownloadDocumentParams,
169
- DownloadDocumentResult,
170
- GetEnvelopeParams,
171
- GetEnvelopeResult
172
- } from './integration/types/signature-api'
173
-
174
- import type {
175
- CreatePaymentLinkParams,
176
- CreatePaymentLinkResult,
177
- GetPaymentLinkParams,
178
- GetPaymentLinkResult,
179
- UpdatePaymentLinkParams,
180
- UpdatePaymentLinkResult,
181
- ListPaymentLinksParams,
182
- ListPaymentLinksResult,
183
- CreateAutoPaymentLinkParams,
184
- CreateAutoPaymentLinkResult,
185
- CreateCheckoutSessionParams,
186
- CreateCheckoutSessionResult
187
- } from './integration/types/stripe'
188
-
189
- import type {
190
- StorageUploadInput,
191
- StorageUploadOutput,
192
- StorageDownloadInput,
193
- StorageDownloadOutput,
194
- StorageSignedUrlInput,
195
- StorageSignedUrlOutput,
196
- StorageDeleteInput,
197
- StorageDeleteOutput,
198
- StorageListInput,
199
- StorageListOutput
200
- } from './platform/storage/types'
201
-
202
- import type { CreateScheduleInput, TaskSchedule } from '../../scheduler/types'
203
-
204
- import type { CreateNotificationParams } from '../../../operations/notifications/types'
205
-
206
- import type {
207
- AcqList,
208
- AcqCompany,
209
- AcqContact,
210
- PaginatedResult,
211
- CreateListParams,
212
- UpdateListParams,
213
- CreateCompanyParams,
214
- UpdateCompanyParams,
215
- UpsertCompanyParams,
216
- CompanyFilters,
217
- CreateContactParams,
218
- UpdateContactParams,
219
- UpsertContactParams,
220
- ContactFilters,
221
- UpsertDealParams,
222
- AcqDeal,
223
- AcqDealNote,
224
- AcqDealTask,
225
- CreateDealNoteParams,
226
- ListDealNotesParams,
227
- CreateDealTaskParams,
228
- ListDealTasksParams,
229
- ListDealTasksDueParams,
230
- CompleteDealTaskParams,
231
- RecordDealActivityParams,
232
- AddContactsToListParams,
233
- AddContactsToListResult,
234
- BulkImportParams,
235
- BulkImportResult,
236
- BulkImportCompaniesParams,
237
- BulkImportCompaniesResult,
238
- UpdateDiscoveryDataParams,
239
- UpdateProposalDataParams,
240
- MarkProposalSentParams,
241
- MarkProposalReviewedParams,
242
- UpdateCloseLostReasonParams,
243
- UpdateFeesParams,
244
- TransitionItemParams,
245
- SetContactNurtureParams,
246
- CancelSchedulesAndHitlByEmailParams,
247
- CancelHitlByDealIdParams,
248
- ClearDealFieldsParams,
249
- DeleteDealParams,
250
- DealFilters,
251
- DealPipelineAnalytics,
252
- ScrapingConfig,
253
- IcpRubric,
254
- PipelineConfig,
255
- RecordListExecutionParams,
256
- UpdateCompanyStageParams,
257
- UpdateContactStageParams,
258
- UpsertSocialPostParams,
259
- UpsertSocialPostsResult,
260
- GetDealByIdParams,
261
- GetContactByIdParams,
262
- GetCompanyByIdParams
263
- } from './lead-service-types'
264
-
265
- import type { DealListItem, DealDetail } from '../../../business/acquisition'
266
- import { CrmSchemas } from '../../../business/sales/api-schemas'
267
- import type { RecentActivityEntry } from '../../../business/sales/api-schemas'
268
- import { DealSchemas } from '../../../business/acquisition'
269
- import { ProjectSchemas } from '../../../projects/api-schemas'
270
- import type {
271
- ProjectRow,
272
- MilestoneRow,
273
- TaskRow,
274
- NoteRow,
275
- ProjectWithCounts,
276
- ProjectDetail
277
- } from '../../../business/projects'
278
- import type { z } from 'zod'
279
-
280
- // ---------------------------------------------------------------------------
281
- // Generic constraint types
282
- // ---------------------------------------------------------------------------
283
-
284
- /** A single method entry: what params go in, what result comes out */
285
- export interface MethodEntry {
286
- params: unknown
287
- result: unknown
288
- }
289
-
290
- /** A tool's complete method map: method name -> MethodEntry */
291
- export type ToolMethodMap = Record<string, MethodEntry>
292
-
293
- // ---------------------------------------------------------------------------
294
- // Attio (integration adapter, 12 methods)
295
- // ---------------------------------------------------------------------------
296
-
297
- export type AttioToolMap = {
298
- createRecord: { params: CreateRecordParams; result: CreateRecordResult }
299
- updateRecord: { params: UpdateRecordParams; result: UpdateRecordResult }
300
- listRecords: { params: QueryRecordsParams; result: QueryRecordsResult }
301
- getRecord: { params: GetRecordParams; result: GetRecordResult }
302
- deleteRecord: { params: DeleteRecordParams; result: DeleteRecordResult }
303
- listObjects: { params: Record<string, never>; result: ListObjectsResult }
304
- listAttributes: { params: ListAttributesParams; result: ListAttributesResult }
305
- createAttribute: { params: CreateAttributeParams; result: CreateAttributeResult }
306
- updateAttribute: { params: UpdateAttributeParams; result: UpdateAttributeResult }
307
- createNote: { params: CreateNoteParams; result: CreateNoteResult }
308
- listNotes: { params: ListNotesParams; result: ListNotesResult }
309
- deleteNote: { params: DeleteNoteParams; result: DeleteNoteResult }
310
- }
311
-
312
- // ---------------------------------------------------------------------------
313
- // Scheduler (platform tool, 9 methods)
314
- // ---------------------------------------------------------------------------
315
-
316
- export type SchedulerToolMap = {
317
- createSchedule: { params: CreateScheduleInput; result: TaskSchedule }
318
- updateAnchor: { params: { scheduleId: string; anchorAt: string }; result: TaskSchedule }
319
- deleteSchedule: { params: { scheduleId: string }; result: void }
320
- findByIdempotencyKey: { params: { idempotencyKey: string }; result: TaskSchedule | null }
321
- deleteScheduleByIdempotencyKey: { params: { idempotencyKey: string }; result: void }
322
- listSchedules: { params: { status?: string; limit?: number; offset?: number }; result: TaskSchedule[] }
323
- getSchedule: { params: { scheduleId: string }; result: TaskSchedule }
324
- cancelSchedule: { params: { scheduleId: string }; result: void }
325
- cancelSchedulesByMetadata: { params: { metadata: Record<string, unknown> }; result: { cancelledCount: number } }
326
- cancelScheduleByIdempotencyKey: { params: { idempotencyKey: string }; result: { cancelled: boolean } }
327
- }
328
-
329
- // ---------------------------------------------------------------------------
330
- // Storage (platform tool, 5 methods)
331
- // ---------------------------------------------------------------------------
332
-
333
- export type StorageToolMap = {
334
- upload: { params: StorageUploadInput; result: StorageUploadOutput }
335
- download: { params: StorageDownloadInput; result: StorageDownloadOutput }
336
- createSignedUrl: { params: StorageSignedUrlInput; result: StorageSignedUrlOutput }
337
- delete: { params: StorageDeleteInput; result: StorageDeleteOutput }
338
- list: { params: StorageListInput; result: StorageListOutput }
339
- }
340
-
341
- // ---------------------------------------------------------------------------
342
- // Notification (platform tool, 1 method)
343
- // ---------------------------------------------------------------------------
344
-
345
- /**
346
- * SDK-side notification input.
347
- * Omits userId and organizationId which are injected server-side from execution context.
348
- */
349
- export type NotificationSDKInput = Omit<CreateNotificationParams, 'userId' | 'organizationId'>
350
-
351
- export type NotificationToolMap = {
352
- create: { params: NotificationSDKInput; result: void }
353
- }
354
-
355
- // ---------------------------------------------------------------------------
356
- // Projects (platform tool, 18 methods)
357
- // ---------------------------------------------------------------------------
358
-
359
- type ProjectsListParams = z.infer<typeof ProjectSchemas.GetProjectsQuery>
360
- type ProjectCreateParams = z.infer<typeof ProjectSchemas.CreateProjectRequest>
361
- type ProjectUpdateParams = z.infer<typeof ProjectSchemas.UpdateProjectRequest>
362
- type MilestoneCreateParams = z.infer<typeof ProjectSchemas.ProjectIdPathParams> &
363
- z.infer<typeof ProjectSchemas.CreateMilestoneRequest>
364
- type MilestoneUpdateParams = z.infer<typeof ProjectSchemas.UpdateMilestoneRequest>
365
- type TaskListParams = z.infer<typeof ProjectSchemas.ProjectIdPathParams> & z.infer<typeof ProjectSchemas.GetTasksQuery>
366
- type TaskCreateParams = z.infer<typeof ProjectSchemas.CreateTaskRequest>
367
- type TaskUpdateParams = z.infer<typeof ProjectSchemas.UpdateTaskRequest>
368
- type TaskResumeContextParams = z.infer<typeof ProjectSchemas.TaskIdParams> &
369
- z.infer<typeof ProjectSchemas.MergeResumeContextRequest>
370
- type NoteListParams = z.infer<typeof ProjectSchemas.ProjectIdPathParams>
371
- type NoteCreateParams = z.infer<typeof ProjectSchemas.CreateNoteRequest>
372
- type NoteUpdateParams = z.infer<typeof ProjectSchemas.UpdateNoteRequest>
373
- type TaskResumeContextResult = Pick<TaskRow, 'id' | 'resume_context' | 'updated_at'>
374
-
375
- export type ProjectsToolMap = {
376
- listProjects: { params: ProjectsListParams; result: ProjectWithCounts[] }
377
- getProject: { params: z.infer<typeof ProjectSchemas.ProjectIdParams>; result: ProjectDetail }
378
- createProject: { params: ProjectCreateParams; result: ProjectRow }
379
- updateProject: { params: z.infer<typeof ProjectSchemas.ProjectIdParams> & ProjectUpdateParams; result: ProjectRow }
380
- deleteProject: { params: z.infer<typeof ProjectSchemas.ProjectIdParams>; result: void }
381
- listMilestones: { params: z.infer<typeof ProjectSchemas.ProjectIdPathParams>; result: MilestoneRow[] }
382
- createMilestone: { params: MilestoneCreateParams; result: MilestoneRow }
383
- updateMilestone: {
384
- params: z.infer<typeof ProjectSchemas.MilestoneIdParams> & MilestoneUpdateParams
385
- result: MilestoneRow
386
- }
387
- deleteMilestone: { params: z.infer<typeof ProjectSchemas.MilestoneIdParams>; result: void }
388
- listTasks: { params: TaskListParams; result: TaskRow[] }
389
- getTask: { params: z.infer<typeof ProjectSchemas.TaskIdParams>; result: TaskRow }
390
- createTask: { params: TaskCreateParams; result: TaskRow }
391
- updateTask: { params: z.infer<typeof ProjectSchemas.TaskIdParams> & TaskUpdateParams; result: TaskRow }
392
- deleteTask: { params: z.infer<typeof ProjectSchemas.TaskIdParams>; result: void }
393
- mergeTaskResumeContext: { params: TaskResumeContextParams; result: TaskResumeContextResult }
394
- listNotes: { params: NoteListParams; result: NoteRow[] }
395
- createNote: { params: NoteCreateParams; result: NoteRow }
396
- updateNote: { params: z.infer<typeof ProjectSchemas.NoteIdParams> & NoteUpdateParams; result: NoteRow }
397
- deleteNote: { params: z.infer<typeof ProjectSchemas.NoteIdParams>; result: void }
398
- }
399
-
400
- // ---------------------------------------------------------------------------
401
- // CRM (platform tool, 13 methods)
402
- // ---------------------------------------------------------------------------
403
-
404
- type CrmRecentActivityParams = Partial<z.infer<typeof CrmSchemas.GetRecentActivityQuery>>
405
- type CrmListDealsParams = Partial<z.infer<typeof DealSchemas.ListDealsQuery>>
406
- type CrmGetDealParams = z.infer<typeof DealSchemas.DealIdParams>
407
- type CrmGetDealByEmailParams = { email: string }
408
- type CrmTaskDueParams = Partial<z.infer<typeof DealSchemas.ListDealTasksDueQuery>>
409
- type CrmDealTaskParams = Omit<CreateDealTaskParams, 'organizationId'>
410
- type CrmDealNoteParams = Omit<CreateDealNoteParams, 'organizationId'>
411
- type CrmRecordActivityParams = Omit<RecordDealActivityParams, 'organizationId'>
412
- type CrmDeleteDealParams = Omit<DeleteDealParams, 'organizationId'>
413
-
414
- export type CrmToolMap = {
415
- getRecentActivity: { params: CrmRecentActivityParams; result: RecentActivityEntry[] }
416
- listDeals: { params: CrmListDealsParams; result: DealListItem[] }
417
- getDeal: { params: CrmGetDealParams; result: DealDetail | null }
418
- getDealByEmail: { params: CrmGetDealByEmailParams; result: DealDetail | null }
419
- createDealNote: { params: CrmDealNoteParams; result: AcqDealNote }
420
- listDealNotes: { params: Omit<ListDealNotesParams, 'organizationId'>; result: AcqDealNote[] }
421
- createDealTask: { params: CrmDealTaskParams; result: AcqDealTask }
422
- listDealTasks: { params: Omit<ListDealTasksParams, 'organizationId'>; result: AcqDealTask[] }
423
- listDealTasksDue: { params: CrmTaskDueParams; result: AcqDealTask[] }
424
- completeDealTask: { params: Omit<CompleteDealTaskParams, 'organizationId'>; result: AcqDealTask }
425
- recordActivity: { params: CrmRecordActivityParams; result: void }
426
- deleteDeal: { params: CrmDeleteDealParams; result: void }
427
- }
428
-
429
- // ---------------------------------------------------------------------------
430
- // Stripe (integration adapter, 6 methods)
431
- // ---------------------------------------------------------------------------
432
-
433
- export type StripeToolMap = {
434
- createPaymentLink: { params: CreatePaymentLinkParams; result: CreatePaymentLinkResult }
435
- getPaymentLink: { params: GetPaymentLinkParams; result: GetPaymentLinkResult }
436
- updatePaymentLink: { params: UpdatePaymentLinkParams; result: UpdatePaymentLinkResult }
437
- listPaymentLinks: { params: ListPaymentLinksParams; result: ListPaymentLinksResult }
438
- createAutoPaymentLink: { params: CreateAutoPaymentLinkParams; result: CreateAutoPaymentLinkResult }
439
- createCheckoutSession: { params: CreateCheckoutSessionParams; result: CreateCheckoutSessionResult }
440
- }
441
-
442
- // ---------------------------------------------------------------------------
443
- // Google Sheets (integration adapter, 13 methods)
444
- // ---------------------------------------------------------------------------
445
-
446
- export type GoogleSheetsToolMap = {
447
- readSheet: { params: ReadSheetParams; result: ReadSheetResult }
448
- writeSheet: { params: WriteSheetParams; result: WriteSheetResult }
449
- appendRows: { params: AppendRowsParams; result: AppendRowsResult }
450
- clearRange: { params: ClearRangeParams; result: ClearRangeResult }
451
- getSpreadsheetMetadata: { params: GetSpreadsheetMetadataParams; result: GetSpreadsheetMetadataResult }
452
- batchUpdate: { params: BatchUpdateParams; result: BatchUpdateResult }
453
- getHeaders: { params: GetHeadersParams; result: GetHeadersResult }
454
- getLastRow: { params: GetLastRowParams; result: GetLastRowResult }
455
- getRowByValue: { params: GetRowByValueParams; result: GetRowByValueResult }
456
- updateRowByValue: { params: UpdateRowByValueParams; result: UpdateRowByValueResult }
457
- upsertRow: { params: UpsertRowParams; result: UpsertRowResult }
458
- filterRows: { params: FilterRowsParams; result: FilterRowsResult }
459
- deleteRowByValue: { params: DeleteRowByValueParams; result: DeleteRowByValueResult }
460
- }
461
-
462
- // ---------------------------------------------------------------------------
463
- // Resend (integration adapter, 2 methods)
464
- // ---------------------------------------------------------------------------
465
-
466
- export type ResendToolMap = {
467
- sendEmail: { params: ResendSendEmailParams; result: ResendSendEmailResult }
468
- getEmail: { params: ResendGetEmailParams; result: ResendGetEmailResult }
469
- }
470
-
471
- // ---------------------------------------------------------------------------
472
- // Apify (integration adapter, 2 methods)
473
- // ---------------------------------------------------------------------------
474
-
475
- export type ApifyToolMap = {
476
- runActor: { params: RunActorParams; result: RunActorResult }
477
- getDatasetItems: { params: GetDatasetItemsParams; result: GetDatasetItemsResult }
478
- startActor: { params: StartActorParams; result: StartActorResult }
479
- }
480
-
481
- // ---------------------------------------------------------------------------
482
- // Gmail (integration adapter, 1 method)
483
- // ---------------------------------------------------------------------------
484
-
485
- export type GmailToolMap = {
486
- sendEmail: { params: GmailSendEmailParams; result: GmailSendEmailResult }
487
- }
488
-
489
- // ---------------------------------------------------------------------------
490
- // Dropbox (integration adapter, 2 methods)
491
- // ---------------------------------------------------------------------------
492
-
493
- export type DropboxToolMap = {
494
- uploadFile: { params: UploadFileParams; result: UploadFileResult }
495
- createFolder: { params: CreateFolderParams; result: CreateFolderResult }
496
- }
497
-
498
- // ---------------------------------------------------------------------------
499
- // SignatureAPI (integration adapter, 4 methods)
500
- // ---------------------------------------------------------------------------
501
-
502
- export type SignatureApiToolMap = {
503
- createEnvelope: { params: CreateEnvelopeParams; result: CreateEnvelopeResult }
504
- voidEnvelope: { params: VoidEnvelopeParams; result: VoidEnvelopeResult }
505
- downloadDocument: { params: DownloadDocumentParams; result: DownloadDocumentResult }
506
- getEnvelope: { params: GetEnvelopeParams; result: GetEnvelopeResult }
507
- }
508
-
509
- // ---------------------------------------------------------------------------
510
- // Instantly (integration adapter, 21 methods)
511
- // ---------------------------------------------------------------------------
512
-
513
- export type InstantlyToolMap = {
514
- sendReply: { params: SendReplyParams; result: SendReplyResult }
515
- removeFromSubsequence: { params: RemoveFromSubsequenceParams; result: RemoveFromSubsequenceResult }
516
- getEmails: { params: GetEmailsParams; result: GetEmailsResult }
517
- updateInterestStatus: { params: UpdateInterestStatusParams; result: UpdateInterestStatusResult }
518
- addToCampaign: { params: AddToCampaignParams; result: AddToCampaignResult }
519
- listCampaigns: { params: ListCampaignsParams; result: ListCampaignsResult }
520
- getCampaign: { params: GetCampaignParams; result: GetCampaignResult }
521
- updateCampaign: { params: UpdateCampaignParams; result: UpdateCampaignResult }
522
- pauseCampaign: { params: PauseCampaignParams; result: PauseCampaignResult }
523
- activateCampaign: { params: ActivateCampaignParams; result: ActivateCampaignResult }
524
- getCampaignAnalytics: { params: GetCampaignAnalyticsParams; result: GetCampaignAnalyticsResult }
525
- getStepAnalytics: { params: GetStepAnalyticsParams; result: GetStepAnalyticsResult }
526
- bulkAddLeads: { params: BulkAddLeadsParams; result: BulkAddLeadsResult }
527
- getAccountHealth: { params: GetAccountHealthParams; result: GetAccountHealthResult }
528
- createInboxTest: { params: CreateInboxTestParams; result: CreateInboxTestResult }
529
- createCampaign: { params: CreateCampaignParams; result: CreateCampaignResult }
530
- getDailyCampaignAnalytics: { params: GetDailyCampaignAnalyticsParams; result: GetDailyCampaignAnalyticsResult }
531
- listLeads: { params: ListLeadsParams; result: ListLeadsResult }
532
- bulkDeleteLeads: { params: BulkDeleteLeadsParams; result: BulkDeleteLeadsResult }
533
- deleteCampaign: { params: DeleteCampaignParams; result: DeleteCampaignResult }
534
- patchLead: { params: PatchLeadParams; result: PatchLeadResult }
535
- }
536
-
537
- // ---------------------------------------------------------------------------
538
- // Anymailfinder (integration adapter, 4 methods)
539
- // ---------------------------------------------------------------------------
540
-
541
- export type AnymailfinderToolMap = {
542
- findCompanyEmail: { params: FindCompanyEmailParams; result: FindCompanyEmailResult }
543
- findPersonEmail: { params: FindPersonEmailParams; result: FindPersonEmailResult }
544
- findDecisionMakerEmail: { params: FindDecisionMakerEmailParams; result: FindDecisionMakerEmailResult }
545
- verifyEmail: { params: VerifyEmailParams; result: VerifyEmailResult }
546
- }
547
-
548
- // ---------------------------------------------------------------------------
549
- // Tomba (integration adapter, 3 methods)
550
- // ---------------------------------------------------------------------------
551
-
552
- export type TombaToolMap = {
553
- emailFinder: { params: EmailFinderParams; result: EmailFinderResult }
554
- domainSearch: { params: DomainSearchParams; result: DomainSearchResult }
555
- emailVerifier: { params: EmailVerifierParams; result: EmailVerifierResult }
556
- }
557
-
558
- // ---------------------------------------------------------------------------
559
- // MillionVerifier (integration adapter, 2 methods)
560
- // ---------------------------------------------------------------------------
561
-
562
- export type MillionVerifierToolMap = {
563
- verifyEmail: { params: MillionVerifierVerifyEmailParams; result: MillionVerifierVerifyEmailResult }
564
- checkCredits: { params: MillionVerifierCheckCreditsParams; result: MillionVerifierCheckCreditsResult }
565
- }
566
-
567
- // ---------------------------------------------------------------------------
568
- // Lead (platform tool, 46 methods)
569
- // ---------------------------------------------------------------------------
570
-
571
- export type LeadToolMap = {
572
- // List operations
573
- listLists: { params: Record<string, never>; result: AcqList[] }
574
- createList: { params: Omit<CreateListParams, 'organizationId'>; result: AcqList }
575
- updateList: { params: { id: string } & UpdateListParams; result: AcqList }
576
- deleteList: { params: { id: string }; result: void }
577
- addContactsToList: { params: Omit<AddContactsToListParams, 'organizationId'>; result: AddContactsToListResult }
578
- updateCompanyStage: {
579
- params: Omit<UpdateCompanyStageParams, 'organizationId'>
580
- result: void
581
- }
582
- updateContactStage: {
583
- params: Omit<UpdateContactStageParams, 'organizationId'>
584
- result: void
585
- }
586
- // Company operations
587
- createCompany: { params: Omit<CreateCompanyParams, 'organizationId'>; result: AcqCompany }
588
- upsertCompany: { params: Omit<UpsertCompanyParams, 'organizationId'>; result: AcqCompany }
589
- updateCompany: { params: { id: string } & UpdateCompanyParams; result: AcqCompany }
590
- getCompany: { params: { id: string }; result: AcqCompany | null }
591
- listCompanies: { params: CompanyFilters; result: AcqCompany[] }
592
- deleteCompany: { params: { id: string }; result: void }
593
- // Contact operations
594
- createContact: { params: Omit<CreateContactParams, 'organizationId'>; result: AcqContact }
595
- upsertContact: { params: Omit<UpsertContactParams, 'organizationId'>; result: AcqContact }
596
- updateContact: { params: { id: string } & UpdateContactParams; result: AcqContact }
597
- getContact: { params: { id: string }; result: AcqContact | null }
598
- getContactByEmail: { params: { email: string }; result: AcqContact | null }
599
- listContacts: {
600
- params: ContactFilters & { limit?: number; offset?: number }
601
- result: PaginatedResult<AcqContact>
602
- }
603
- deleteContact: { params: { id: string }; result: void }
604
- bulkImportContacts: { params: Omit<BulkImportParams, 'organizationId'>; result: BulkImportResult }
605
- bulkImportCompanies: {
606
- params: Omit<BulkImportCompaniesParams, 'organizationId'>
607
- result: BulkImportCompaniesResult
608
- }
609
- deactivateContactsByCompany: {
610
- params: { companyId: string }
611
- result: { deactivated: number }
612
- }
613
- // Deal operations
614
- upsertDeal: { params: Omit<UpsertDealParams, 'organizationId'>; result: AcqDeal }
615
- getDealByEmail: { params: { email: string }; result: AcqDeal | null }
616
- getDealByEnvelopeId: { params: { envelopeId: string }; result: AcqDeal | null }
617
- updateDealEnvelopeId: { params: { dealId: string; envelopeId: string }; result: AcqDeal | null }
618
- getDealById: { params: Omit<GetDealByIdParams, 'organizationId'>; result: AcqDeal | null }
619
- getContactById: { params: Omit<GetContactByIdParams, 'organizationId'>; result: AcqContact | null }
620
- getCompanyById: { params: Omit<GetCompanyByIdParams, 'organizationId'>; result: AcqCompany | null }
621
- // Deal-sync operations
622
- updateDiscoveryData: { params: Omit<UpdateDiscoveryDataParams, 'organizationId'>; result: void }
623
- updateProposalData: { params: Omit<UpdateProposalDataParams, 'organizationId'>; result: void }
624
- markProposalSent: { params: Omit<MarkProposalSentParams, 'organizationId'>; result: void }
625
- markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
626
- updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
627
- updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
628
- transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
629
- setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
630
- cancelSchedulesAndHitlByEmail: {
631
- params: Omit<CancelSchedulesAndHitlByEmailParams, 'organizationId'>
632
- result: { schedulesCancelled: number; hitlDeleted: number }
633
- }
634
- cancelHitlByDealId: { params: Omit<CancelHitlByDealIdParams, 'organizationId'>; result: { hitlDeleted: number } }
635
- clearDealFields: { params: Omit<ClearDealFieldsParams, 'organizationId'>; result: void }
636
- deleteDeal: { params: Omit<DeleteDealParams, 'organizationId'>; result: void }
637
- recordDealActivity: {
638
- params: Omit<RecordDealActivityParams, 'organizationId'>
639
- result: void
640
- }
641
- // Deal note operations
642
- createDealNote: {
643
- params: Omit<CreateDealNoteParams, 'organizationId'>
644
- result: AcqDealNote
645
- }
646
- listDealNotes: {
647
- params: Omit<ListDealNotesParams, 'organizationId'>
648
- result: AcqDealNote[]
649
- }
650
- // Deal task operations
651
- createDealTask: {
652
- params: Omit<CreateDealTaskParams, 'organizationId'>
653
- result: AcqDealTask
654
- }
655
- listDealTasks: {
656
- params: Omit<ListDealTasksParams, 'organizationId'>
657
- result: AcqDealTask[]
658
- }
659
- listDealTasksDue: {
660
- params: Omit<ListDealTasksDueParams, 'organizationId'>
661
- result: AcqDealTask[]
662
- }
663
- completeDealTask: {
664
- params: Omit<CompleteDealTaskParams, 'organizationId'>
665
- result: AcqDealTask
666
- }
667
- // Deal query & analytics operations
668
- listDeals: { params: DealFilters; result: AcqDeal[] }
669
- getDealPipelineAnalytics: { params: { recentLimit?: number }; result: DealPipelineAnalytics }
670
- // Enrichment data operations
671
- mergeEnrichmentData: {
672
- params: { id: string; table: 'acq_companies' | 'acq_contacts'; data: Record<string, unknown> }
673
- result: void
674
- }
675
- // Social monitoring operations
676
- upsertSocialPosts: {
677
- params: { posts: Omit<UpsertSocialPostParams, 'organizationId'>[] }
678
- result: UpsertSocialPostsResult
679
- }
680
- setDealStateKey: {
681
- params: {
682
- dealId: string
683
- stateKey: string
684
- }
685
- result: { ok: true }
686
- }
687
- // CRM workflow helpers
688
- transitionDeal: {
689
- params: {
690
- dealId: string
691
- toStage: string
692
- toState?: string
693
- }
694
- result: { deal: AcqDeal }
695
- }
696
- loadDeal: {
697
- params: { dealId: string }
698
- result: DealDetail | null
699
- }
700
- }
701
-
702
- // ---------------------------------------------------------------------------
703
- // List (platform tool, 4 methods)
704
- // ---------------------------------------------------------------------------
705
-
706
- export type ListToolMap = {
707
- getConfig: {
708
- params: { listId: string }
709
- result: { scrapingConfig: ScrapingConfig; icp: IcpRubric; pipelineConfig: PipelineConfig }
710
- }
711
- recordExecution: {
712
- params: Omit<RecordListExecutionParams, 'organizationId'>
713
- result: void
714
- }
715
- updateCompanyStage: {
716
- params: Omit<UpdateCompanyStageParams, 'organizationId'>
717
- result: void
718
- }
719
- updateContactStage: {
720
- params: Omit<UpdateContactStageParams, 'organizationId'>
721
- result: void
722
- }
723
- }
724
-
725
- // ---------------------------------------------------------------------------
726
- // PDF (platform tool, 2 methods)
727
- // ---------------------------------------------------------------------------
728
-
729
- export type PdfToolMap = {
730
- render: {
731
- params: {
732
- document: Record<string, unknown>
733
- theme?: Record<string, unknown>
734
- storage: { bucket: string; path: string }
735
- }
736
- result: { success: boolean; pdfUrl: string; size: number }
737
- }
738
- renderToBuffer: {
739
- params: {
740
- document: Record<string, unknown>
741
- theme?: Record<string, unknown>
742
- }
743
- result: { buffer: string }
744
- }
745
- }
746
-
747
- // ---------------------------------------------------------------------------
748
- // Approval (platform tool, 2 methods)
749
- // ---------------------------------------------------------------------------
750
-
751
- export type ApprovalToolMap = {
752
- create: {
753
- params: {
754
- actions: Array<{
755
- id: string
756
- label: string
757
- type: 'primary' | 'secondary' | 'danger' | 'outline'
758
- icon?: string
759
- color?: string
760
- target?: { resourceType: 'agent' | 'workflow'; resourceId: string; sessionId?: string }
761
- form?: Record<string, unknown>
762
- requiresConfirmation?: boolean
763
- confirmationMessage?: string
764
- description?: string
765
- }>
766
- context: Record<string, unknown>
767
- description?: string
768
- priority?: number
769
- humanCheckpoint?: string
770
- metadata?: Record<string, unknown>
771
- expiresAt?: string
772
- idempotencyKey?: string
773
- }
774
- result: { id: string }
775
- }
776
- deleteByMetadata: {
777
- params: { metadata: Record<string, unknown>; status?: string }
778
- result: { deleted: number }
779
- }
780
- }
781
-
782
- // ---------------------------------------------------------------------------
783
- // Execution (platform tool, 1 method)
784
- // ---------------------------------------------------------------------------
785
-
786
- export type ExecutionToolMap = {
787
- trigger: {
788
- params: { resourceId: string; input?: unknown }
789
- result: { success: boolean; executionId: string; output: unknown; error?: string }
790
- }
791
- triggerAsync: {
792
- params: { resourceId: string; input?: unknown }
793
- result: { executionId: string }
794
- }
795
- }
796
-
797
- // ---------------------------------------------------------------------------
798
- // Email (platform tool, 1 method)
799
- // ---------------------------------------------------------------------------
800
-
801
- export type EmailToolMap = {
802
- send: {
803
- params: {
804
- subject: string
805
- html?: string
806
- text?: string
807
- replyTo?: string
808
- tags?: Array<{ name: string; value: string }>
809
- } & (
810
- | { userIds: string[]; targetRole?: never; targetAll?: never }
811
- | { targetRole: string; userIds?: never; targetAll?: never }
812
- | { targetAll: true; userIds?: never; targetRole?: never }
813
- )
814
- result: { sent: number; failed: number; errors?: Array<{ userId: string; email: string; error: string }> }
815
- }
816
- }
1
+ /**
2
+ * Tool Method Maps
3
+ *
4
+ * Single source of truth for tool -> method -> params -> result type mappings.
5
+ * Used by SDK adapters (compile-time typed wrappers) and optionally by the
6
+ * server-side dispatcher for type checking.
7
+ *
8
+ * Browser-safe: no Node.js imports, pure type definitions.
9
+ */
10
+
11
+ import type {
12
+ CreateRecordParams,
13
+ CreateRecordResult,
14
+ UpdateRecordParams,
15
+ UpdateRecordResult,
16
+ QueryRecordsParams,
17
+ QueryRecordsResult,
18
+ GetRecordParams,
19
+ GetRecordResult,
20
+ DeleteRecordParams,
21
+ DeleteRecordResult,
22
+ ListObjectsResult,
23
+ ListAttributesParams,
24
+ ListAttributesResult,
25
+ CreateAttributeParams,
26
+ CreateAttributeResult,
27
+ UpdateAttributeParams,
28
+ UpdateAttributeResult,
29
+ CreateNoteParams,
30
+ CreateNoteResult,
31
+ ListNotesParams,
32
+ ListNotesResult,
33
+ DeleteNoteParams,
34
+ DeleteNoteResult
35
+ } from './integration/types/attio'
36
+
37
+ import type {
38
+ RunActorParams,
39
+ RunActorResult,
40
+ GetDatasetItemsParams,
41
+ GetDatasetItemsResult,
42
+ StartActorParams,
43
+ StartActorResult
44
+ } from './integration/types/apify'
45
+
46
+ import type {
47
+ UploadFileParams,
48
+ UploadFileResult,
49
+ CreateFolderParams,
50
+ CreateFolderResult
51
+ } from './integration/types/dropbox'
52
+
53
+ import type { GmailSendEmailParams, GmailSendEmailResult } from './integration/types/gmail'
54
+
55
+ import type {
56
+ ReadSheetParams,
57
+ ReadSheetResult,
58
+ WriteSheetParams,
59
+ WriteSheetResult,
60
+ AppendRowsParams,
61
+ AppendRowsResult,
62
+ ClearRangeParams,
63
+ ClearRangeResult,
64
+ GetSpreadsheetMetadataParams,
65
+ GetSpreadsheetMetadataResult,
66
+ BatchUpdateParams,
67
+ BatchUpdateResult,
68
+ GetHeadersParams,
69
+ GetHeadersResult,
70
+ GetLastRowParams,
71
+ GetLastRowResult,
72
+ GetRowByValueParams,
73
+ GetRowByValueResult,
74
+ UpdateRowByValueParams,
75
+ UpdateRowByValueResult,
76
+ UpsertRowParams,
77
+ UpsertRowResult,
78
+ FilterRowsParams,
79
+ FilterRowsResult,
80
+ DeleteRowByValueParams,
81
+ DeleteRowByValueResult
82
+ } from './integration/types/google-sheets'
83
+
84
+ import type {
85
+ SendReplyParams,
86
+ SendReplyResult,
87
+ RemoveFromSubsequenceParams,
88
+ RemoveFromSubsequenceResult,
89
+ GetEmailsParams,
90
+ GetEmailsResult,
91
+ UpdateInterestStatusParams,
92
+ UpdateInterestStatusResult,
93
+ AddToCampaignParams,
94
+ AddToCampaignResult,
95
+ ListCampaignsParams,
96
+ ListCampaignsResult,
97
+ GetCampaignParams,
98
+ GetCampaignResult,
99
+ UpdateCampaignParams,
100
+ UpdateCampaignResult,
101
+ PauseCampaignParams,
102
+ PauseCampaignResult,
103
+ ActivateCampaignParams,
104
+ ActivateCampaignResult,
105
+ GetCampaignAnalyticsParams,
106
+ GetCampaignAnalyticsResult,
107
+ GetStepAnalyticsParams,
108
+ GetStepAnalyticsResult,
109
+ BulkAddLeadsParams,
110
+ BulkAddLeadsResult,
111
+ GetAccountHealthParams,
112
+ GetAccountHealthResult,
113
+ CreateInboxTestParams,
114
+ CreateInboxTestResult,
115
+ CreateCampaignParams,
116
+ CreateCampaignResult,
117
+ GetDailyCampaignAnalyticsParams,
118
+ GetDailyCampaignAnalyticsResult,
119
+ ListLeadsParams,
120
+ ListLeadsResult,
121
+ BulkDeleteLeadsParams,
122
+ BulkDeleteLeadsResult,
123
+ DeleteCampaignParams,
124
+ DeleteCampaignResult,
125
+ PatchLeadParams,
126
+ PatchLeadResult
127
+ } from './integration/types/instantly'
128
+
129
+ import type {
130
+ MillionVerifierVerifyEmailParams,
131
+ MillionVerifierVerifyEmailResult,
132
+ MillionVerifierCheckCreditsParams,
133
+ MillionVerifierCheckCreditsResult
134
+ } from './integration/types/millionverifier'
135
+
136
+ import type {
137
+ FindCompanyEmailParams,
138
+ FindCompanyEmailResult,
139
+ FindPersonEmailParams,
140
+ FindPersonEmailResult,
141
+ FindDecisionMakerEmailParams,
142
+ FindDecisionMakerEmailResult,
143
+ VerifyEmailParams,
144
+ VerifyEmailResult
145
+ } from './integration/types/anymailfinder'
146
+
147
+ import type {
148
+ EmailFinderParams,
149
+ EmailFinderResult,
150
+ DomainSearchParams,
151
+ DomainSearchResult,
152
+ EmailVerifierParams,
153
+ EmailVerifierResult
154
+ } from './integration/types/tomba'
155
+
156
+ import type {
157
+ ResendSendEmailParams,
158
+ ResendSendEmailResult,
159
+ ResendGetEmailParams,
160
+ ResendGetEmailResult
161
+ } from './integration/types/resend'
162
+
163
+ import type {
164
+ CreateEnvelopeParams,
165
+ CreateEnvelopeResult,
166
+ VoidEnvelopeParams,
167
+ VoidEnvelopeResult,
168
+ DownloadDocumentParams,
169
+ DownloadDocumentResult,
170
+ GetEnvelopeParams,
171
+ GetEnvelopeResult
172
+ } from './integration/types/signature-api'
173
+
174
+ import type {
175
+ CreatePaymentLinkParams,
176
+ CreatePaymentLinkResult,
177
+ GetPaymentLinkParams,
178
+ GetPaymentLinkResult,
179
+ UpdatePaymentLinkParams,
180
+ UpdatePaymentLinkResult,
181
+ ListPaymentLinksParams,
182
+ ListPaymentLinksResult,
183
+ CreateAutoPaymentLinkParams,
184
+ CreateAutoPaymentLinkResult,
185
+ CreateCheckoutSessionParams,
186
+ CreateCheckoutSessionResult
187
+ } from './integration/types/stripe'
188
+
189
+ import type {
190
+ StorageUploadInput,
191
+ StorageUploadOutput,
192
+ StorageDownloadInput,
193
+ StorageDownloadOutput,
194
+ StorageSignedUrlInput,
195
+ StorageSignedUrlOutput,
196
+ StorageDeleteInput,
197
+ StorageDeleteOutput,
198
+ StorageListInput,
199
+ StorageListOutput
200
+ } from './platform/storage/types'
201
+
202
+ import type { CreateScheduleInput, TaskSchedule } from '../../scheduler/types'
203
+
204
+ import type { CreateNotificationParams } from '../../../operations/notifications/types'
205
+
206
+ import type {
207
+ AcqList,
208
+ AcqCompany,
209
+ AcqContact,
210
+ PaginatedResult,
211
+ CreateListParams,
212
+ UpdateListParams,
213
+ CreateCompanyParams,
214
+ UpdateCompanyParams,
215
+ UpsertCompanyParams,
216
+ CompanyFilters,
217
+ CreateContactParams,
218
+ UpdateContactParams,
219
+ UpsertContactParams,
220
+ ContactFilters,
221
+ UpsertDealParams,
222
+ AcqDeal,
223
+ AcqDealNote,
224
+ AcqDealTask,
225
+ CreateDealNoteParams,
226
+ ListDealNotesParams,
227
+ CreateDealTaskParams,
228
+ ListDealTasksParams,
229
+ ListDealTasksDueParams,
230
+ CompleteDealTaskParams,
231
+ RecordDealActivityParams,
232
+ AddContactsToListParams,
233
+ AddContactsToListResult,
234
+ AddCompaniesToListParams,
235
+ AddCompaniesToListResult,
236
+ BulkImportParams,
237
+ BulkImportResult,
238
+ BulkImportCompaniesParams,
239
+ BulkImportCompaniesResult,
240
+ UpdateDiscoveryDataParams,
241
+ UpdateProposalDataParams,
242
+ MarkProposalSentParams,
243
+ MarkProposalReviewedParams,
244
+ UpdateCloseLostReasonParams,
245
+ UpdateFeesParams,
246
+ CacheInstantlyThreadIdsParams,
247
+ TransitionItemParams,
248
+ SetContactNurtureParams,
249
+ CancelSchedulesAndHitlByEmailParams,
250
+ CancelHitlByDealIdParams,
251
+ ClearDealFieldsParams,
252
+ DeleteDealParams,
253
+ DealFilters,
254
+ DealPipelineAnalytics,
255
+ ScrapingConfig,
256
+ IcpRubric,
257
+ PipelineConfig,
258
+ RecordListExecutionParams,
259
+ UpdateCompanyStageParams,
260
+ UpdateContactStageParams,
261
+ UpsertSocialPostParams,
262
+ UpsertSocialPostsResult,
263
+ GetDealByIdParams,
264
+ GetContactByIdParams,
265
+ GetCompanyByIdParams
266
+ } from './lead-service-types'
267
+
268
+ import type { DealListItem, DealDetail } from '../../../business/acquisition'
269
+ import { CrmSchemas } from '../../../business/sales/api-schemas'
270
+ import type { RecentActivityEntry } from '../../../business/sales/api-schemas'
271
+ import { DealSchemas } from '../../../business/acquisition'
272
+ import { ProjectSchemas } from '../../../projects/api-schemas'
273
+ import type {
274
+ ProjectRow,
275
+ MilestoneRow,
276
+ TaskRow,
277
+ NoteRow,
278
+ ProjectWithCounts,
279
+ ProjectDetail
280
+ } from '../../../business/projects'
281
+ import type { z } from 'zod'
282
+
283
+ // ---------------------------------------------------------------------------
284
+ // Generic constraint types
285
+ // ---------------------------------------------------------------------------
286
+
287
+ /** A single method entry: what params go in, what result comes out */
288
+ export interface MethodEntry {
289
+ params: unknown
290
+ result: unknown
291
+ }
292
+
293
+ /** A tool's complete method map: method name -> MethodEntry */
294
+ export type ToolMethodMap = Record<string, MethodEntry>
295
+
296
+ // ---------------------------------------------------------------------------
297
+ // Attio (integration adapter, 12 methods)
298
+ // ---------------------------------------------------------------------------
299
+
300
+ export type AttioToolMap = {
301
+ createRecord: { params: CreateRecordParams; result: CreateRecordResult }
302
+ updateRecord: { params: UpdateRecordParams; result: UpdateRecordResult }
303
+ listRecords: { params: QueryRecordsParams; result: QueryRecordsResult }
304
+ getRecord: { params: GetRecordParams; result: GetRecordResult }
305
+ deleteRecord: { params: DeleteRecordParams; result: DeleteRecordResult }
306
+ listObjects: { params: Record<string, never>; result: ListObjectsResult }
307
+ listAttributes: { params: ListAttributesParams; result: ListAttributesResult }
308
+ createAttribute: { params: CreateAttributeParams; result: CreateAttributeResult }
309
+ updateAttribute: { params: UpdateAttributeParams; result: UpdateAttributeResult }
310
+ createNote: { params: CreateNoteParams; result: CreateNoteResult }
311
+ listNotes: { params: ListNotesParams; result: ListNotesResult }
312
+ deleteNote: { params: DeleteNoteParams; result: DeleteNoteResult }
313
+ }
314
+
315
+ // ---------------------------------------------------------------------------
316
+ // Scheduler (platform tool, 9 methods)
317
+ // ---------------------------------------------------------------------------
318
+
319
+ export type SchedulerToolMap = {
320
+ createSchedule: { params: CreateScheduleInput; result: TaskSchedule }
321
+ updateAnchor: { params: { scheduleId: string; anchorAt: string }; result: TaskSchedule }
322
+ deleteSchedule: { params: { scheduleId: string }; result: void }
323
+ findByIdempotencyKey: { params: { idempotencyKey: string }; result: TaskSchedule | null }
324
+ deleteScheduleByIdempotencyKey: { params: { idempotencyKey: string }; result: void }
325
+ listSchedules: { params: { status?: string; limit?: number; offset?: number }; result: TaskSchedule[] }
326
+ getSchedule: { params: { scheduleId: string }; result: TaskSchedule }
327
+ cancelSchedule: { params: { scheduleId: string }; result: void }
328
+ cancelSchedulesByMetadata: { params: { metadata: Record<string, unknown> }; result: { cancelledCount: number } }
329
+ cancelScheduleByIdempotencyKey: { params: { idempotencyKey: string }; result: { cancelled: boolean } }
330
+ }
331
+
332
+ // ---------------------------------------------------------------------------
333
+ // Storage (platform tool, 5 methods)
334
+ // ---------------------------------------------------------------------------
335
+
336
+ export type StorageToolMap = {
337
+ upload: { params: StorageUploadInput; result: StorageUploadOutput }
338
+ download: { params: StorageDownloadInput; result: StorageDownloadOutput }
339
+ createSignedUrl: { params: StorageSignedUrlInput; result: StorageSignedUrlOutput }
340
+ delete: { params: StorageDeleteInput; result: StorageDeleteOutput }
341
+ list: { params: StorageListInput; result: StorageListOutput }
342
+ }
343
+
344
+ // ---------------------------------------------------------------------------
345
+ // Notification (platform tool, 1 method)
346
+ // ---------------------------------------------------------------------------
347
+
348
+ /**
349
+ * SDK-side notification input.
350
+ * Omits userId and organizationId which are injected server-side from execution context.
351
+ */
352
+ export type NotificationSDKInput = Omit<CreateNotificationParams, 'userId' | 'organizationId'>
353
+
354
+ export type NotificationToolMap = {
355
+ create: { params: NotificationSDKInput; result: void }
356
+ }
357
+
358
+ // ---------------------------------------------------------------------------
359
+ // Projects (platform tool, 18 methods)
360
+ // ---------------------------------------------------------------------------
361
+
362
+ type ProjectsListParams = z.infer<typeof ProjectSchemas.GetProjectsQuery>
363
+ type ProjectCreateParams = z.infer<typeof ProjectSchemas.CreateProjectRequest>
364
+ type ProjectUpdateParams = z.infer<typeof ProjectSchemas.UpdateProjectRequest>
365
+ type MilestoneCreateParams = z.infer<typeof ProjectSchemas.ProjectIdPathParams> &
366
+ z.infer<typeof ProjectSchemas.CreateMilestoneRequest>
367
+ type MilestoneUpdateParams = z.infer<typeof ProjectSchemas.UpdateMilestoneRequest>
368
+ type TaskListParams = z.infer<typeof ProjectSchemas.ProjectIdPathParams> & z.infer<typeof ProjectSchemas.GetTasksQuery>
369
+ type TaskCreateParams = z.infer<typeof ProjectSchemas.CreateTaskRequest>
370
+ type TaskUpdateParams = z.infer<typeof ProjectSchemas.UpdateTaskRequest>
371
+ type TaskResumeContextParams = z.infer<typeof ProjectSchemas.TaskIdParams> &
372
+ z.infer<typeof ProjectSchemas.MergeResumeContextRequest>
373
+ type NoteListParams = z.infer<typeof ProjectSchemas.ProjectIdPathParams>
374
+ type NoteCreateParams = z.infer<typeof ProjectSchemas.CreateNoteRequest>
375
+ type NoteUpdateParams = z.infer<typeof ProjectSchemas.UpdateNoteRequest>
376
+ type TaskResumeContextResult = Pick<TaskRow, 'id' | 'resume_context' | 'updated_at'>
377
+
378
+ export type ProjectsToolMap = {
379
+ listProjects: { params: ProjectsListParams; result: ProjectWithCounts[] }
380
+ getProject: { params: z.infer<typeof ProjectSchemas.ProjectIdParams>; result: ProjectDetail }
381
+ createProject: { params: ProjectCreateParams; result: ProjectRow }
382
+ updateProject: { params: z.infer<typeof ProjectSchemas.ProjectIdParams> & ProjectUpdateParams; result: ProjectRow }
383
+ deleteProject: { params: z.infer<typeof ProjectSchemas.ProjectIdParams>; result: void }
384
+ listMilestones: { params: z.infer<typeof ProjectSchemas.ProjectIdPathParams>; result: MilestoneRow[] }
385
+ createMilestone: { params: MilestoneCreateParams; result: MilestoneRow }
386
+ updateMilestone: {
387
+ params: z.infer<typeof ProjectSchemas.MilestoneIdParams> & MilestoneUpdateParams
388
+ result: MilestoneRow
389
+ }
390
+ deleteMilestone: { params: z.infer<typeof ProjectSchemas.MilestoneIdParams>; result: void }
391
+ listTasks: { params: TaskListParams; result: TaskRow[] }
392
+ getTask: { params: z.infer<typeof ProjectSchemas.TaskIdParams>; result: TaskRow }
393
+ createTask: { params: TaskCreateParams; result: TaskRow }
394
+ updateTask: { params: z.infer<typeof ProjectSchemas.TaskIdParams> & TaskUpdateParams; result: TaskRow }
395
+ deleteTask: { params: z.infer<typeof ProjectSchemas.TaskIdParams>; result: void }
396
+ mergeTaskResumeContext: { params: TaskResumeContextParams; result: TaskResumeContextResult }
397
+ listNotes: { params: NoteListParams; result: NoteRow[] }
398
+ createNote: { params: NoteCreateParams; result: NoteRow }
399
+ updateNote: { params: z.infer<typeof ProjectSchemas.NoteIdParams> & NoteUpdateParams; result: NoteRow }
400
+ deleteNote: { params: z.infer<typeof ProjectSchemas.NoteIdParams>; result: void }
401
+ }
402
+
403
+ // ---------------------------------------------------------------------------
404
+ // CRM (platform tool, 13 methods)
405
+ // ---------------------------------------------------------------------------
406
+
407
+ type CrmRecentActivityParams = Partial<z.infer<typeof CrmSchemas.GetRecentActivityQuery>>
408
+ type CrmListDealsParams = Partial<z.infer<typeof DealSchemas.ListDealsQuery>>
409
+ type CrmGetDealParams = z.infer<typeof DealSchemas.DealIdParams>
410
+ type CrmGetDealByEmailParams = { email: string }
411
+ type CrmTaskDueParams = Partial<z.infer<typeof DealSchemas.ListDealTasksDueQuery>>
412
+ type CrmDealTaskParams = Omit<CreateDealTaskParams, 'organizationId'>
413
+ type CrmDealNoteParams = Omit<CreateDealNoteParams, 'organizationId'>
414
+ type CrmRecordActivityParams = Omit<RecordDealActivityParams, 'organizationId'>
415
+ type CrmDeleteDealParams = Omit<DeleteDealParams, 'organizationId'>
416
+
417
+ export type CrmToolMap = {
418
+ getRecentActivity: { params: CrmRecentActivityParams; result: RecentActivityEntry[] }
419
+ listDeals: { params: CrmListDealsParams; result: DealListItem[] }
420
+ getDeal: { params: CrmGetDealParams; result: DealDetail | null }
421
+ getDealByEmail: { params: CrmGetDealByEmailParams; result: DealDetail | null }
422
+ createDealNote: { params: CrmDealNoteParams; result: AcqDealNote }
423
+ listDealNotes: { params: Omit<ListDealNotesParams, 'organizationId'>; result: AcqDealNote[] }
424
+ createDealTask: { params: CrmDealTaskParams; result: AcqDealTask }
425
+ listDealTasks: { params: Omit<ListDealTasksParams, 'organizationId'>; result: AcqDealTask[] }
426
+ listDealTasksDue: { params: CrmTaskDueParams; result: AcqDealTask[] }
427
+ completeDealTask: { params: Omit<CompleteDealTaskParams, 'organizationId'>; result: AcqDealTask }
428
+ recordActivity: { params: CrmRecordActivityParams; result: void }
429
+ deleteDeal: { params: CrmDeleteDealParams; result: void }
430
+ }
431
+
432
+ // ---------------------------------------------------------------------------
433
+ // Stripe (integration adapter, 6 methods)
434
+ // ---------------------------------------------------------------------------
435
+
436
+ export type StripeToolMap = {
437
+ createPaymentLink: { params: CreatePaymentLinkParams; result: CreatePaymentLinkResult }
438
+ getPaymentLink: { params: GetPaymentLinkParams; result: GetPaymentLinkResult }
439
+ updatePaymentLink: { params: UpdatePaymentLinkParams; result: UpdatePaymentLinkResult }
440
+ listPaymentLinks: { params: ListPaymentLinksParams; result: ListPaymentLinksResult }
441
+ createAutoPaymentLink: { params: CreateAutoPaymentLinkParams; result: CreateAutoPaymentLinkResult }
442
+ createCheckoutSession: { params: CreateCheckoutSessionParams; result: CreateCheckoutSessionResult }
443
+ }
444
+
445
+ // ---------------------------------------------------------------------------
446
+ // Google Sheets (integration adapter, 13 methods)
447
+ // ---------------------------------------------------------------------------
448
+
449
+ export type GoogleSheetsToolMap = {
450
+ readSheet: { params: ReadSheetParams; result: ReadSheetResult }
451
+ writeSheet: { params: WriteSheetParams; result: WriteSheetResult }
452
+ appendRows: { params: AppendRowsParams; result: AppendRowsResult }
453
+ clearRange: { params: ClearRangeParams; result: ClearRangeResult }
454
+ getSpreadsheetMetadata: { params: GetSpreadsheetMetadataParams; result: GetSpreadsheetMetadataResult }
455
+ batchUpdate: { params: BatchUpdateParams; result: BatchUpdateResult }
456
+ getHeaders: { params: GetHeadersParams; result: GetHeadersResult }
457
+ getLastRow: { params: GetLastRowParams; result: GetLastRowResult }
458
+ getRowByValue: { params: GetRowByValueParams; result: GetRowByValueResult }
459
+ updateRowByValue: { params: UpdateRowByValueParams; result: UpdateRowByValueResult }
460
+ upsertRow: { params: UpsertRowParams; result: UpsertRowResult }
461
+ filterRows: { params: FilterRowsParams; result: FilterRowsResult }
462
+ deleteRowByValue: { params: DeleteRowByValueParams; result: DeleteRowByValueResult }
463
+ }
464
+
465
+ // ---------------------------------------------------------------------------
466
+ // Resend (integration adapter, 2 methods)
467
+ // ---------------------------------------------------------------------------
468
+
469
+ export type ResendToolMap = {
470
+ sendEmail: { params: ResendSendEmailParams; result: ResendSendEmailResult }
471
+ getEmail: { params: ResendGetEmailParams; result: ResendGetEmailResult }
472
+ }
473
+
474
+ // ---------------------------------------------------------------------------
475
+ // Apify (integration adapter, 2 methods)
476
+ // ---------------------------------------------------------------------------
477
+
478
+ export type ApifyToolMap = {
479
+ runActor: { params: RunActorParams; result: RunActorResult }
480
+ getDatasetItems: { params: GetDatasetItemsParams; result: GetDatasetItemsResult }
481
+ startActor: { params: StartActorParams; result: StartActorResult }
482
+ }
483
+
484
+ // ---------------------------------------------------------------------------
485
+ // Gmail (integration adapter, 1 method)
486
+ // ---------------------------------------------------------------------------
487
+
488
+ export type GmailToolMap = {
489
+ sendEmail: { params: GmailSendEmailParams; result: GmailSendEmailResult }
490
+ }
491
+
492
+ // ---------------------------------------------------------------------------
493
+ // Dropbox (integration adapter, 2 methods)
494
+ // ---------------------------------------------------------------------------
495
+
496
+ export type DropboxToolMap = {
497
+ uploadFile: { params: UploadFileParams; result: UploadFileResult }
498
+ createFolder: { params: CreateFolderParams; result: CreateFolderResult }
499
+ }
500
+
501
+ // ---------------------------------------------------------------------------
502
+ // SignatureAPI (integration adapter, 4 methods)
503
+ // ---------------------------------------------------------------------------
504
+
505
+ export type SignatureApiToolMap = {
506
+ createEnvelope: { params: CreateEnvelopeParams; result: CreateEnvelopeResult }
507
+ voidEnvelope: { params: VoidEnvelopeParams; result: VoidEnvelopeResult }
508
+ downloadDocument: { params: DownloadDocumentParams; result: DownloadDocumentResult }
509
+ getEnvelope: { params: GetEnvelopeParams; result: GetEnvelopeResult }
510
+ }
511
+
512
+ // ---------------------------------------------------------------------------
513
+ // Instantly (integration adapter, 21 methods)
514
+ // ---------------------------------------------------------------------------
515
+
516
+ export type InstantlyToolMap = {
517
+ sendReply: { params: SendReplyParams; result: SendReplyResult }
518
+ removeFromSubsequence: { params: RemoveFromSubsequenceParams; result: RemoveFromSubsequenceResult }
519
+ getEmails: { params: GetEmailsParams; result: GetEmailsResult }
520
+ updateInterestStatus: { params: UpdateInterestStatusParams; result: UpdateInterestStatusResult }
521
+ addToCampaign: { params: AddToCampaignParams; result: AddToCampaignResult }
522
+ listCampaigns: { params: ListCampaignsParams; result: ListCampaignsResult }
523
+ getCampaign: { params: GetCampaignParams; result: GetCampaignResult }
524
+ updateCampaign: { params: UpdateCampaignParams; result: UpdateCampaignResult }
525
+ pauseCampaign: { params: PauseCampaignParams; result: PauseCampaignResult }
526
+ activateCampaign: { params: ActivateCampaignParams; result: ActivateCampaignResult }
527
+ getCampaignAnalytics: { params: GetCampaignAnalyticsParams; result: GetCampaignAnalyticsResult }
528
+ getStepAnalytics: { params: GetStepAnalyticsParams; result: GetStepAnalyticsResult }
529
+ bulkAddLeads: { params: BulkAddLeadsParams; result: BulkAddLeadsResult }
530
+ getAccountHealth: { params: GetAccountHealthParams; result: GetAccountHealthResult }
531
+ createInboxTest: { params: CreateInboxTestParams; result: CreateInboxTestResult }
532
+ createCampaign: { params: CreateCampaignParams; result: CreateCampaignResult }
533
+ getDailyCampaignAnalytics: { params: GetDailyCampaignAnalyticsParams; result: GetDailyCampaignAnalyticsResult }
534
+ listLeads: { params: ListLeadsParams; result: ListLeadsResult }
535
+ bulkDeleteLeads: { params: BulkDeleteLeadsParams; result: BulkDeleteLeadsResult }
536
+ deleteCampaign: { params: DeleteCampaignParams; result: DeleteCampaignResult }
537
+ patchLead: { params: PatchLeadParams; result: PatchLeadResult }
538
+ }
539
+
540
+ // ---------------------------------------------------------------------------
541
+ // Anymailfinder (integration adapter, 4 methods)
542
+ // ---------------------------------------------------------------------------
543
+
544
+ export type AnymailfinderToolMap = {
545
+ findCompanyEmail: { params: FindCompanyEmailParams; result: FindCompanyEmailResult }
546
+ findPersonEmail: { params: FindPersonEmailParams; result: FindPersonEmailResult }
547
+ findDecisionMakerEmail: { params: FindDecisionMakerEmailParams; result: FindDecisionMakerEmailResult }
548
+ verifyEmail: { params: VerifyEmailParams; result: VerifyEmailResult }
549
+ }
550
+
551
+ // ---------------------------------------------------------------------------
552
+ // Tomba (integration adapter, 3 methods)
553
+ // ---------------------------------------------------------------------------
554
+
555
+ export type TombaToolMap = {
556
+ emailFinder: { params: EmailFinderParams; result: EmailFinderResult }
557
+ domainSearch: { params: DomainSearchParams; result: DomainSearchResult }
558
+ emailVerifier: { params: EmailVerifierParams; result: EmailVerifierResult }
559
+ }
560
+
561
+ // ---------------------------------------------------------------------------
562
+ // MillionVerifier (integration adapter, 2 methods)
563
+ // ---------------------------------------------------------------------------
564
+
565
+ export type MillionVerifierToolMap = {
566
+ verifyEmail: { params: MillionVerifierVerifyEmailParams; result: MillionVerifierVerifyEmailResult }
567
+ checkCredits: { params: MillionVerifierCheckCreditsParams; result: MillionVerifierCheckCreditsResult }
568
+ }
569
+
570
+ // ---------------------------------------------------------------------------
571
+ // Lead (platform tool, 56 methods)
572
+ // ---------------------------------------------------------------------------
573
+
574
+ export type LeadToolMap = {
575
+ // List operations
576
+ listLists: { params: Record<string, never>; result: AcqList[] }
577
+ createList: { params: Omit<CreateListParams, 'organizationId'>; result: AcqList }
578
+ updateList: { params: { id: string } & UpdateListParams; result: AcqList }
579
+ deleteList: { params: { id: string }; result: void }
580
+ addContactsToList: { params: Omit<AddContactsToListParams, 'organizationId'>; result: AddContactsToListResult }
581
+ addCompaniesToList: { params: Omit<AddCompaniesToListParams, 'organizationId'>; result: AddCompaniesToListResult }
582
+ updateCompanyStage: {
583
+ params: Omit<UpdateCompanyStageParams, 'organizationId'>
584
+ result: void
585
+ }
586
+ updateContactStage: {
587
+ params: Omit<UpdateContactStageParams, 'organizationId'>
588
+ result: void
589
+ }
590
+ // Company operations
591
+ createCompany: { params: Omit<CreateCompanyParams, 'organizationId'>; result: AcqCompany }
592
+ upsertCompany: { params: Omit<UpsertCompanyParams, 'organizationId'>; result: AcqCompany }
593
+ updateCompany: { params: { id: string } & UpdateCompanyParams; result: AcqCompany }
594
+ getCompany: { params: { id: string }; result: AcqCompany | null }
595
+ listCompanies: { params: CompanyFilters; result: AcqCompany[] }
596
+ deleteCompany: { params: { id: string }; result: void }
597
+ // Contact operations
598
+ createContact: { params: Omit<CreateContactParams, 'organizationId'>; result: AcqContact }
599
+ upsertContact: { params: Omit<UpsertContactParams, 'organizationId'>; result: AcqContact }
600
+ updateContact: { params: { id: string } & UpdateContactParams; result: AcqContact }
601
+ getContact: { params: { id: string }; result: AcqContact | null }
602
+ getContactByEmail: { params: { email: string }; result: AcqContact | null }
603
+ listContacts: {
604
+ params: ContactFilters & { limit?: number; offset?: number }
605
+ result: PaginatedResult<AcqContact>
606
+ }
607
+ deleteContact: { params: { id: string }; result: void }
608
+ bulkImportContacts: { params: Omit<BulkImportParams, 'organizationId'>; result: BulkImportResult }
609
+ bulkImportCompanies: {
610
+ params: Omit<BulkImportCompaniesParams, 'organizationId'>
611
+ result: BulkImportCompaniesResult
612
+ }
613
+ deactivateContactsByCompany: {
614
+ params: { companyId: string }
615
+ result: { deactivated: number }
616
+ }
617
+ // Deal operations
618
+ upsertDeal: { params: Omit<UpsertDealParams, 'organizationId'>; result: AcqDeal }
619
+ getDealByEmail: { params: { email: string }; result: AcqDeal | null }
620
+ getDealByEnvelopeId: { params: { envelopeId: string }; result: AcqDeal | null }
621
+ updateDealEnvelopeId: { params: { dealId: string; envelopeId: string }; result: AcqDeal | null }
622
+ getDealById: { params: Omit<GetDealByIdParams, 'organizationId'>; result: AcqDeal | null }
623
+ getContactById: { params: Omit<GetContactByIdParams, 'organizationId'>; result: AcqContact | null }
624
+ getCompanyById: { params: Omit<GetCompanyByIdParams, 'organizationId'>; result: AcqCompany | null }
625
+ // Deal-sync operations
626
+ updateDiscoveryData: { params: Omit<UpdateDiscoveryDataParams, 'organizationId'>; result: void }
627
+ updateProposalData: { params: Omit<UpdateProposalDataParams, 'organizationId'>; result: void }
628
+ markProposalSent: { params: Omit<MarkProposalSentParams, 'organizationId'>; result: void }
629
+ markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
630
+ updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
631
+ updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
632
+ cacheInstantlyThreadIds: { params: Omit<CacheInstantlyThreadIdsParams, 'organizationId'>; result: void }
633
+ transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
634
+ setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
635
+ cancelSchedulesAndHitlByEmail: {
636
+ params: Omit<CancelSchedulesAndHitlByEmailParams, 'organizationId'>
637
+ result: { schedulesCancelled: number; hitlDeleted: number }
638
+ }
639
+ cancelHitlByDealId: { params: Omit<CancelHitlByDealIdParams, 'organizationId'>; result: { hitlDeleted: number } }
640
+ clearDealFields: { params: Omit<ClearDealFieldsParams, 'organizationId'>; result: void }
641
+ deleteDeal: { params: Omit<DeleteDealParams, 'organizationId'>; result: void }
642
+ recordDealActivity: {
643
+ params: Omit<RecordDealActivityParams, 'organizationId'>
644
+ result: void
645
+ }
646
+ // Deal note operations
647
+ createDealNote: {
648
+ params: Omit<CreateDealNoteParams, 'organizationId'>
649
+ result: AcqDealNote
650
+ }
651
+ listDealNotes: {
652
+ params: Omit<ListDealNotesParams, 'organizationId'>
653
+ result: AcqDealNote[]
654
+ }
655
+ // Deal task operations
656
+ createDealTask: {
657
+ params: Omit<CreateDealTaskParams, 'organizationId'>
658
+ result: AcqDealTask
659
+ }
660
+ listDealTasks: {
661
+ params: Omit<ListDealTasksParams, 'organizationId'>
662
+ result: AcqDealTask[]
663
+ }
664
+ listDealTasksDue: {
665
+ params: Omit<ListDealTasksDueParams, 'organizationId'>
666
+ result: AcqDealTask[]
667
+ }
668
+ completeDealTask: {
669
+ params: Omit<CompleteDealTaskParams, 'organizationId'>
670
+ result: AcqDealTask
671
+ }
672
+ // Deal query & analytics operations
673
+ listDeals: { params: DealFilters; result: AcqDeal[] }
674
+ getDealPipelineAnalytics: { params: { recentLimit?: number }; result: DealPipelineAnalytics }
675
+ // Enrichment data operations
676
+ mergeEnrichmentData: {
677
+ params: { id: string; table: 'acq_companies' | 'acq_contacts'; data: Record<string, unknown> }
678
+ result: void
679
+ }
680
+ // Social monitoring operations
681
+ upsertSocialPosts: {
682
+ params: { posts: Omit<UpsertSocialPostParams, 'organizationId'>[] }
683
+ result: UpsertSocialPostsResult
684
+ }
685
+ setDealStateKey: {
686
+ params: {
687
+ dealId: string
688
+ stateKey: string
689
+ }
690
+ result: { ok: true }
691
+ }
692
+ // CRM workflow helpers
693
+ transitionDeal: {
694
+ params: {
695
+ dealId: string
696
+ toStage: string
697
+ toState?: string
698
+ }
699
+ result: { deal: AcqDeal }
700
+ }
701
+ loadDeal: {
702
+ params: { dealId: string }
703
+ result: DealDetail | null
704
+ }
705
+ }
706
+
707
+ // ---------------------------------------------------------------------------
708
+ // List (platform tool, 4 methods)
709
+ // ---------------------------------------------------------------------------
710
+
711
+ export type ListToolMap = {
712
+ getConfig: {
713
+ params: { listId: string }
714
+ result: { scrapingConfig: ScrapingConfig; icp: IcpRubric; pipelineConfig: PipelineConfig }
715
+ }
716
+ recordExecution: {
717
+ params: Omit<RecordListExecutionParams, 'organizationId'>
718
+ result: void
719
+ }
720
+ updateCompanyStage: {
721
+ params: Omit<UpdateCompanyStageParams, 'organizationId'>
722
+ result: void
723
+ }
724
+ updateContactStage: {
725
+ params: Omit<UpdateContactStageParams, 'organizationId'>
726
+ result: void
727
+ }
728
+ }
729
+
730
+ // ---------------------------------------------------------------------------
731
+ // PDF (platform tool, 2 methods)
732
+ // ---------------------------------------------------------------------------
733
+
734
+ export type PdfToolMap = {
735
+ render: {
736
+ params: {
737
+ document: Record<string, unknown>
738
+ theme?: Record<string, unknown>
739
+ storage: { bucket: string; path: string }
740
+ }
741
+ result: { success: boolean; pdfUrl: string; size: number }
742
+ }
743
+ renderToBuffer: {
744
+ params: {
745
+ document: Record<string, unknown>
746
+ theme?: Record<string, unknown>
747
+ }
748
+ result: { buffer: string }
749
+ }
750
+ }
751
+
752
+ // ---------------------------------------------------------------------------
753
+ // Approval (platform tool, 2 methods)
754
+ // ---------------------------------------------------------------------------
755
+
756
+ export type ApprovalToolMap = {
757
+ create: {
758
+ params: {
759
+ actions: Array<{
760
+ id: string
761
+ label: string
762
+ type: 'primary' | 'secondary' | 'danger' | 'outline'
763
+ icon?: string
764
+ color?: string
765
+ target?: { resourceType: 'agent' | 'workflow'; resourceId: string; sessionId?: string }
766
+ form?: Record<string, unknown>
767
+ requiresConfirmation?: boolean
768
+ confirmationMessage?: string
769
+ description?: string
770
+ }>
771
+ context: Record<string, unknown>
772
+ description?: string
773
+ priority?: number
774
+ humanCheckpoint?: string
775
+ metadata?: Record<string, unknown>
776
+ expiresAt?: string
777
+ idempotencyKey?: string
778
+ }
779
+ result: { id: string }
780
+ }
781
+ deleteByMetadata: {
782
+ params: { metadata: Record<string, unknown>; status?: string }
783
+ result: { deleted: number }
784
+ }
785
+ }
786
+
787
+ // ---------------------------------------------------------------------------
788
+ // Execution (platform tool, 1 method)
789
+ // ---------------------------------------------------------------------------
790
+
791
+ export type ExecutionToolMap = {
792
+ trigger: {
793
+ params: { resourceId: string; input?: unknown }
794
+ result: { success: boolean; executionId: string; output: unknown; error?: string }
795
+ }
796
+ triggerAsync: {
797
+ params: { resourceId: string; input?: unknown }
798
+ result: { executionId: string }
799
+ }
800
+ }
801
+
802
+ // ---------------------------------------------------------------------------
803
+ // Email (platform tool, 1 method)
804
+ // ---------------------------------------------------------------------------
805
+
806
+ export type EmailToolMap = {
807
+ send: {
808
+ params: {
809
+ subject: string
810
+ html?: string
811
+ text?: string
812
+ replyTo?: string
813
+ tags?: Array<{ name: string; value: string }>
814
+ } & (
815
+ | { userIds: string[]; targetRole?: never; targetAll?: never }
816
+ | { targetRole: string; userIds?: never; targetAll?: never }
817
+ | { targetAll: true; userIds?: never; targetRole?: never }
818
+ )
819
+ result: { sent: number; failed: number; errors?: Array<{ userId: string; email: string; error: string }> }
820
+ }
821
+ }