@elevasis/core 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +9 -2
  3. package/dist/organization-model/index.d.ts +1 -1
  4. package/dist/organization-model/index.js +9 -2
  5. package/dist/test-utils/index.d.ts +463 -377
  6. package/dist/test-utils/index.js +9 -2
  7. package/package.json +1 -1
  8. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +2324 -0
  9. package/src/business/acquisition/activity-events.test.ts +250 -0
  10. package/src/business/acquisition/activity-events.ts +7 -65
  11. package/src/business/acquisition/api-schemas.test.ts +1180 -0
  12. package/src/business/acquisition/api-schemas.ts +1075 -859
  13. package/src/business/acquisition/crm-state-actions.test.ts +160 -0
  14. package/src/business/acquisition/derive-actions.test.ts +518 -0
  15. package/src/business/acquisition/derive-actions.ts +103 -90
  16. package/src/business/acquisition/index.ts +149 -111
  17. package/src/business/acquisition/stateful.ts +30 -0
  18. package/src/business/acquisition/types.ts +44 -77
  19. package/src/execution/engine/index.ts +437 -434
  20. package/src/execution/engine/tools/integration/server/adapters/attio/__tests__/attio-crud.integration.test.ts +363 -360
  21. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/get-record/index.test.ts +162 -186
  22. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/list-records/index.test.ts +316 -338
  23. package/src/execution/engine/tools/integration/server/adapters/gmail/gmail-adapter.ts +204 -210
  24. package/src/execution/engine/tools/integration/server/adapters/resend/fetch/send-email/index.test.ts +88 -0
  25. package/src/execution/engine/tools/integration/server/adapters/resend/fetch/send-email/index.ts +141 -134
  26. package/src/execution/engine/tools/integration/server/adapters/resend/fetch/utils/types.ts +76 -75
  27. package/src/execution/engine/tools/integration/service.test.ts +34 -9
  28. package/src/execution/engine/tools/integration/service.ts +6 -3
  29. package/src/execution/engine/tools/lead-service-types.ts +945 -888
  30. package/src/execution/engine/tools/platform/acquisition/types.ts +266 -260
  31. package/src/execution/engine/tools/registry.ts +701 -699
  32. package/src/execution/engine/tools/tool-maps.ts +816 -791
  33. package/src/execution/engine/workflow/types.ts +11 -0
  34. package/src/organization-model/contracts.ts +4 -4
  35. package/src/organization-model/domains/navigation.ts +62 -62
  36. package/src/organization-model/domains/sales.ts +272 -0
  37. package/src/organization-model/published.ts +21 -21
  38. package/src/organization-model/resolve.ts +21 -8
  39. package/src/platform/constants/versions.ts +1 -1
  40. package/src/reference/_generated/contracts.md +2324 -0
  41. package/src/supabase/database.types.ts +2958 -2886
@@ -1,791 +1,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
- 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
- ListConfig,
253
- RecordListExecutionParams,
254
- UpdateCompanyStageParams,
255
- UpdateContactStageParams,
256
- UpsertSocialPostParams,
257
- UpsertSocialPostsResult,
258
- GetDealByIdParams,
259
- GetContactByIdParams,
260
- GetCompanyByIdParams
261
- } from './lead-service-types'
262
-
263
- import type { DealListItem, DealDetail } from '../../../business/acquisition'
264
- import { CrmSchemas } from '../../../business/sales/api-schemas'
265
- import type { RecentActivityEntry } from '../../../business/sales/api-schemas'
266
- import { DealSchemas } from '../../../business/acquisition'
267
- import { ProjectSchemas } from '../../../projects/api-schemas'
268
- import type {
269
- ProjectRow,
270
- MilestoneRow,
271
- TaskRow,
272
- NoteRow,
273
- ProjectWithCounts,
274
- ProjectDetail
275
- } from '../../../business/projects'
276
- import type { z } from 'zod'
277
-
278
- // ---------------------------------------------------------------------------
279
- // Generic constraint types
280
- // ---------------------------------------------------------------------------
281
-
282
- /** A single method entry: what params go in, what result comes out */
283
- export interface MethodEntry {
284
- params: unknown
285
- result: unknown
286
- }
287
-
288
- /** A tool's complete method map: method name -> MethodEntry */
289
- export type ToolMethodMap = Record<string, MethodEntry>
290
-
291
- // ---------------------------------------------------------------------------
292
- // Attio (integration adapter, 12 methods)
293
- // ---------------------------------------------------------------------------
294
-
295
- export type AttioToolMap = {
296
- createRecord: { params: CreateRecordParams; result: CreateRecordResult }
297
- updateRecord: { params: UpdateRecordParams; result: UpdateRecordResult }
298
- listRecords: { params: QueryRecordsParams; result: QueryRecordsResult }
299
- getRecord: { params: GetRecordParams; result: GetRecordResult }
300
- deleteRecord: { params: DeleteRecordParams; result: DeleteRecordResult }
301
- listObjects: { params: Record<string, never>; result: ListObjectsResult }
302
- listAttributes: { params: ListAttributesParams; result: ListAttributesResult }
303
- createAttribute: { params: CreateAttributeParams; result: CreateAttributeResult }
304
- updateAttribute: { params: UpdateAttributeParams; result: UpdateAttributeResult }
305
- createNote: { params: CreateNoteParams; result: CreateNoteResult }
306
- listNotes: { params: ListNotesParams; result: ListNotesResult }
307
- deleteNote: { params: DeleteNoteParams; result: DeleteNoteResult }
308
- }
309
-
310
- // ---------------------------------------------------------------------------
311
- // Scheduler (platform tool, 9 methods)
312
- // ---------------------------------------------------------------------------
313
-
314
- export type SchedulerToolMap = {
315
- createSchedule: { params: CreateScheduleInput; result: TaskSchedule }
316
- updateAnchor: { params: { scheduleId: string; anchorAt: string }; result: TaskSchedule }
317
- deleteSchedule: { params: { scheduleId: string }; result: void }
318
- findByIdempotencyKey: { params: { idempotencyKey: string }; result: TaskSchedule | null }
319
- deleteScheduleByIdempotencyKey: { params: { idempotencyKey: string }; result: void }
320
- listSchedules: { params: { status?: string; limit?: number; offset?: number }; result: TaskSchedule[] }
321
- getSchedule: { params: { scheduleId: string }; result: TaskSchedule }
322
- cancelSchedule: { params: { scheduleId: string }; result: void }
323
- cancelSchedulesByMetadata: { params: { metadata: Record<string, unknown> }; result: { cancelledCount: number } }
324
- cancelScheduleByIdempotencyKey: { params: { idempotencyKey: string }; result: { cancelled: boolean } }
325
- }
326
-
327
- // ---------------------------------------------------------------------------
328
- // Storage (platform tool, 5 methods)
329
- // ---------------------------------------------------------------------------
330
-
331
- export type StorageToolMap = {
332
- upload: { params: StorageUploadInput; result: StorageUploadOutput }
333
- download: { params: StorageDownloadInput; result: StorageDownloadOutput }
334
- createSignedUrl: { params: StorageSignedUrlInput; result: StorageSignedUrlOutput }
335
- delete: { params: StorageDeleteInput; result: StorageDeleteOutput }
336
- list: { params: StorageListInput; result: StorageListOutput }
337
- }
338
-
339
- // ---------------------------------------------------------------------------
340
- // Notification (platform tool, 1 method)
341
- // ---------------------------------------------------------------------------
342
-
343
- /**
344
- * SDK-side notification input.
345
- * Omits userId and organizationId which are injected server-side from execution context.
346
- */
347
- export type NotificationSDKInput = Omit<CreateNotificationParams, 'userId' | 'organizationId'>
348
-
349
- export type NotificationToolMap = {
350
- create: { params: NotificationSDKInput; result: void }
351
- }
352
-
353
- // ---------------------------------------------------------------------------
354
- // Projects (platform tool, 18 methods)
355
- // ---------------------------------------------------------------------------
356
-
357
- type ProjectsListParams = z.infer<typeof ProjectSchemas.GetProjectsQuery>
358
- type ProjectCreateParams = z.infer<typeof ProjectSchemas.CreateProjectRequest>
359
- type ProjectUpdateParams = z.infer<typeof ProjectSchemas.UpdateProjectRequest>
360
- type MilestoneCreateParams = z.infer<typeof ProjectSchemas.ProjectIdPathParams> &
361
- z.infer<typeof ProjectSchemas.CreateMilestoneRequest>
362
- type MilestoneUpdateParams = z.infer<typeof ProjectSchemas.UpdateMilestoneRequest>
363
- type TaskListParams = z.infer<typeof ProjectSchemas.ProjectIdPathParams> & z.infer<typeof ProjectSchemas.GetTasksQuery>
364
- type TaskCreateParams = z.infer<typeof ProjectSchemas.CreateTaskRequest>
365
- type TaskUpdateParams = z.infer<typeof ProjectSchemas.UpdateTaskRequest>
366
- type TaskResumeContextParams = z.infer<typeof ProjectSchemas.TaskIdParams> &
367
- z.infer<typeof ProjectSchemas.MergeResumeContextRequest>
368
- type NoteListParams = z.infer<typeof ProjectSchemas.ProjectIdPathParams>
369
- type NoteCreateParams = z.infer<typeof ProjectSchemas.CreateNoteRequest>
370
- type NoteUpdateParams = z.infer<typeof ProjectSchemas.UpdateNoteRequest>
371
- type TaskResumeContextResult = Pick<TaskRow, 'id' | 'resume_context' | 'updated_at'>
372
-
373
- export type ProjectsToolMap = {
374
- listProjects: { params: ProjectsListParams; result: ProjectWithCounts[] }
375
- getProject: { params: z.infer<typeof ProjectSchemas.ProjectIdParams>; result: ProjectDetail }
376
- createProject: { params: ProjectCreateParams; result: ProjectRow }
377
- updateProject: { params: z.infer<typeof ProjectSchemas.ProjectIdParams> & ProjectUpdateParams; result: ProjectRow }
378
- deleteProject: { params: z.infer<typeof ProjectSchemas.ProjectIdParams>; result: void }
379
- listMilestones: { params: z.infer<typeof ProjectSchemas.ProjectIdPathParams>; result: MilestoneRow[] }
380
- createMilestone: { params: MilestoneCreateParams; result: MilestoneRow }
381
- updateMilestone: {
382
- params: z.infer<typeof ProjectSchemas.MilestoneIdParams> & MilestoneUpdateParams
383
- result: MilestoneRow
384
- }
385
- deleteMilestone: { params: z.infer<typeof ProjectSchemas.MilestoneIdParams>; result: void }
386
- listTasks: { params: TaskListParams; result: TaskRow[] }
387
- getTask: { params: z.infer<typeof ProjectSchemas.TaskIdParams>; result: TaskRow }
388
- createTask: { params: TaskCreateParams; result: TaskRow }
389
- updateTask: { params: z.infer<typeof ProjectSchemas.TaskIdParams> & TaskUpdateParams; result: TaskRow }
390
- deleteTask: { params: z.infer<typeof ProjectSchemas.TaskIdParams>; result: void }
391
- mergeTaskResumeContext: { params: TaskResumeContextParams; result: TaskResumeContextResult }
392
- listNotes: { params: NoteListParams; result: NoteRow[] }
393
- createNote: { params: NoteCreateParams; result: NoteRow }
394
- updateNote: { params: z.infer<typeof ProjectSchemas.NoteIdParams> & NoteUpdateParams; result: NoteRow }
395
- deleteNote: { params: z.infer<typeof ProjectSchemas.NoteIdParams>; result: void }
396
- }
397
-
398
- // ---------------------------------------------------------------------------
399
- // CRM (platform tool, 13 methods)
400
- // ---------------------------------------------------------------------------
401
-
402
- type CrmRecentActivityParams = Partial<z.infer<typeof CrmSchemas.GetRecentActivityQuery>>
403
- type CrmListDealsParams = Partial<z.infer<typeof DealSchemas.ListDealsQuery>>
404
- type CrmGetDealParams = z.infer<typeof DealSchemas.DealIdParams>
405
- type CrmGetDealByEmailParams = { email: string }
406
- type CrmTaskDueParams = Partial<z.infer<typeof DealSchemas.ListDealTasksDueQuery>>
407
- type CrmDealTaskParams = Omit<CreateDealTaskParams, 'organizationId'>
408
- type CrmDealNoteParams = Omit<CreateDealNoteParams, 'organizationId'>
409
- type CrmRecordActivityParams = Omit<RecordDealActivityParams, 'organizationId'>
410
- type CrmDeleteDealParams = Omit<DeleteDealParams, 'organizationId'>
411
-
412
- export type CrmToolMap = {
413
- getRecentActivity: { params: CrmRecentActivityParams; result: RecentActivityEntry[] }
414
- listDeals: { params: CrmListDealsParams; result: DealListItem[] }
415
- getDeal: { params: CrmGetDealParams; result: DealDetail | null }
416
- getDealByEmail: { params: CrmGetDealByEmailParams; result: DealDetail | null }
417
- createDealNote: { params: CrmDealNoteParams; result: AcqDealNote }
418
- listDealNotes: { params: Omit<ListDealNotesParams, 'organizationId'>; result: AcqDealNote[] }
419
- createDealTask: { params: CrmDealTaskParams; result: AcqDealTask }
420
- listDealTasks: { params: Omit<ListDealTasksParams, 'organizationId'>; result: AcqDealTask[] }
421
- listDealTasksDue: { params: CrmTaskDueParams; result: AcqDealTask[] }
422
- completeDealTask: { params: Omit<CompleteDealTaskParams, 'organizationId'>; result: AcqDealTask }
423
- recordActivity: { params: CrmRecordActivityParams; result: void }
424
- deleteDeal: { params: CrmDeleteDealParams; result: void }
425
- }
426
-
427
- // ---------------------------------------------------------------------------
428
- // Stripe (integration adapter, 6 methods)
429
- // ---------------------------------------------------------------------------
430
-
431
- export type StripeToolMap = {
432
- createPaymentLink: { params: CreatePaymentLinkParams; result: CreatePaymentLinkResult }
433
- getPaymentLink: { params: GetPaymentLinkParams; result: GetPaymentLinkResult }
434
- updatePaymentLink: { params: UpdatePaymentLinkParams; result: UpdatePaymentLinkResult }
435
- listPaymentLinks: { params: ListPaymentLinksParams; result: ListPaymentLinksResult }
436
- createAutoPaymentLink: { params: CreateAutoPaymentLinkParams; result: CreateAutoPaymentLinkResult }
437
- createCheckoutSession: { params: CreateCheckoutSessionParams; result: CreateCheckoutSessionResult }
438
- }
439
-
440
- // ---------------------------------------------------------------------------
441
- // Google Sheets (integration adapter, 13 methods)
442
- // ---------------------------------------------------------------------------
443
-
444
- export type GoogleSheetsToolMap = {
445
- readSheet: { params: ReadSheetParams; result: ReadSheetResult }
446
- writeSheet: { params: WriteSheetParams; result: WriteSheetResult }
447
- appendRows: { params: AppendRowsParams; result: AppendRowsResult }
448
- clearRange: { params: ClearRangeParams; result: ClearRangeResult }
449
- getSpreadsheetMetadata: { params: GetSpreadsheetMetadataParams; result: GetSpreadsheetMetadataResult }
450
- batchUpdate: { params: BatchUpdateParams; result: BatchUpdateResult }
451
- getHeaders: { params: GetHeadersParams; result: GetHeadersResult }
452
- getLastRow: { params: GetLastRowParams; result: GetLastRowResult }
453
- getRowByValue: { params: GetRowByValueParams; result: GetRowByValueResult }
454
- updateRowByValue: { params: UpdateRowByValueParams; result: UpdateRowByValueResult }
455
- upsertRow: { params: UpsertRowParams; result: UpsertRowResult }
456
- filterRows: { params: FilterRowsParams; result: FilterRowsResult }
457
- deleteRowByValue: { params: DeleteRowByValueParams; result: DeleteRowByValueResult }
458
- }
459
-
460
- // ---------------------------------------------------------------------------
461
- // Resend (integration adapter, 2 methods)
462
- // ---------------------------------------------------------------------------
463
-
464
- export type ResendToolMap = {
465
- sendEmail: { params: ResendSendEmailParams; result: ResendSendEmailResult }
466
- getEmail: { params: ResendGetEmailParams; result: ResendGetEmailResult }
467
- }
468
-
469
- // ---------------------------------------------------------------------------
470
- // Apify (integration adapter, 2 methods)
471
- // ---------------------------------------------------------------------------
472
-
473
- export type ApifyToolMap = {
474
- runActor: { params: RunActorParams; result: RunActorResult }
475
- getDatasetItems: { params: GetDatasetItemsParams; result: GetDatasetItemsResult }
476
- startActor: { params: StartActorParams; result: StartActorResult }
477
- }
478
-
479
- // ---------------------------------------------------------------------------
480
- // Gmail (integration adapter, 1 method)
481
- // ---------------------------------------------------------------------------
482
-
483
- export type GmailToolMap = {
484
- sendEmail: { params: GmailSendEmailParams; result: GmailSendEmailResult }
485
- }
486
-
487
- // ---------------------------------------------------------------------------
488
- // Dropbox (integration adapter, 2 methods)
489
- // ---------------------------------------------------------------------------
490
-
491
- export type DropboxToolMap = {
492
- uploadFile: { params: UploadFileParams; result: UploadFileResult }
493
- createFolder: { params: CreateFolderParams; result: CreateFolderResult }
494
- }
495
-
496
- // ---------------------------------------------------------------------------
497
- // SignatureAPI (integration adapter, 4 methods)
498
- // ---------------------------------------------------------------------------
499
-
500
- export type SignatureApiToolMap = {
501
- createEnvelope: { params: CreateEnvelopeParams; result: CreateEnvelopeResult }
502
- voidEnvelope: { params: VoidEnvelopeParams; result: VoidEnvelopeResult }
503
- downloadDocument: { params: DownloadDocumentParams; result: DownloadDocumentResult }
504
- getEnvelope: { params: GetEnvelopeParams; result: GetEnvelopeResult }
505
- }
506
-
507
- // ---------------------------------------------------------------------------
508
- // Instantly (integration adapter, 21 methods)
509
- // ---------------------------------------------------------------------------
510
-
511
- export type InstantlyToolMap = {
512
- sendReply: { params: SendReplyParams; result: SendReplyResult }
513
- removeFromSubsequence: { params: RemoveFromSubsequenceParams; result: RemoveFromSubsequenceResult }
514
- getEmails: { params: GetEmailsParams; result: GetEmailsResult }
515
- updateInterestStatus: { params: UpdateInterestStatusParams; result: UpdateInterestStatusResult }
516
- addToCampaign: { params: AddToCampaignParams; result: AddToCampaignResult }
517
- listCampaigns: { params: ListCampaignsParams; result: ListCampaignsResult }
518
- getCampaign: { params: GetCampaignParams; result: GetCampaignResult }
519
- updateCampaign: { params: UpdateCampaignParams; result: UpdateCampaignResult }
520
- pauseCampaign: { params: PauseCampaignParams; result: PauseCampaignResult }
521
- activateCampaign: { params: ActivateCampaignParams; result: ActivateCampaignResult }
522
- getCampaignAnalytics: { params: GetCampaignAnalyticsParams; result: GetCampaignAnalyticsResult }
523
- getStepAnalytics: { params: GetStepAnalyticsParams; result: GetStepAnalyticsResult }
524
- bulkAddLeads: { params: BulkAddLeadsParams; result: BulkAddLeadsResult }
525
- getAccountHealth: { params: GetAccountHealthParams; result: GetAccountHealthResult }
526
- createInboxTest: { params: CreateInboxTestParams; result: CreateInboxTestResult }
527
- createCampaign: { params: CreateCampaignParams; result: CreateCampaignResult }
528
- getDailyCampaignAnalytics: { params: GetDailyCampaignAnalyticsParams; result: GetDailyCampaignAnalyticsResult }
529
- listLeads: { params: ListLeadsParams; result: ListLeadsResult }
530
- bulkDeleteLeads: { params: BulkDeleteLeadsParams; result: BulkDeleteLeadsResult }
531
- deleteCampaign: { params: DeleteCampaignParams; result: DeleteCampaignResult }
532
- patchLead: { params: PatchLeadParams; result: PatchLeadResult }
533
- }
534
-
535
- // ---------------------------------------------------------------------------
536
- // Anymailfinder (integration adapter, 4 methods)
537
- // ---------------------------------------------------------------------------
538
-
539
- export type AnymailfinderToolMap = {
540
- findCompanyEmail: { params: FindCompanyEmailParams; result: FindCompanyEmailResult }
541
- findPersonEmail: { params: FindPersonEmailParams; result: FindPersonEmailResult }
542
- findDecisionMakerEmail: { params: FindDecisionMakerEmailParams; result: FindDecisionMakerEmailResult }
543
- verifyEmail: { params: VerifyEmailParams; result: VerifyEmailResult }
544
- }
545
-
546
- // ---------------------------------------------------------------------------
547
- // Tomba (integration adapter, 3 methods)
548
- // ---------------------------------------------------------------------------
549
-
550
- export type TombaToolMap = {
551
- emailFinder: { params: EmailFinderParams; result: EmailFinderResult }
552
- domainSearch: { params: DomainSearchParams; result: DomainSearchResult }
553
- emailVerifier: { params: EmailVerifierParams; result: EmailVerifierResult }
554
- }
555
-
556
- // ---------------------------------------------------------------------------
557
- // MillionVerifier (integration adapter, 2 methods)
558
- // ---------------------------------------------------------------------------
559
-
560
- export type MillionVerifierToolMap = {
561
- verifyEmail: { params: MillionVerifierVerifyEmailParams; result: MillionVerifierVerifyEmailResult }
562
- checkCredits: { params: MillionVerifierCheckCreditsParams; result: MillionVerifierCheckCreditsResult }
563
- }
564
-
565
- // ---------------------------------------------------------------------------
566
- // Lead (platform tool, 46 methods)
567
- // ---------------------------------------------------------------------------
568
-
569
- export type LeadToolMap = {
570
- // List operations
571
- listLists: { params: Record<string, never>; result: AcqList[] }
572
- createList: { params: Omit<CreateListParams, 'organizationId'>; result: AcqList }
573
- updateList: { params: { id: string } & UpdateListParams; result: AcqList }
574
- deleteList: { params: { id: string }; result: void }
575
- addContactsToList: { params: Omit<AddContactsToListParams, 'organizationId'>; result: AddContactsToListResult }
576
- updateCompanyStage: {
577
- params: Omit<UpdateCompanyStageParams, 'organizationId'>
578
- result: void
579
- }
580
- updateContactStage: {
581
- params: Omit<UpdateContactStageParams, 'organizationId'>
582
- result: void
583
- }
584
- // Company operations
585
- createCompany: { params: Omit<CreateCompanyParams, 'organizationId'>; result: AcqCompany }
586
- upsertCompany: { params: Omit<UpsertCompanyParams, 'organizationId'>; result: AcqCompany }
587
- updateCompany: { params: { id: string } & UpdateCompanyParams; result: AcqCompany }
588
- getCompany: { params: { id: string }; result: AcqCompany | null }
589
- listCompanies: { params: CompanyFilters; result: AcqCompany[] }
590
- deleteCompany: { params: { id: string }; result: void }
591
- // Contact operations
592
- createContact: { params: Omit<CreateContactParams, 'organizationId'>; result: AcqContact }
593
- upsertContact: { params: Omit<UpsertContactParams, 'organizationId'>; result: AcqContact }
594
- updateContact: { params: { id: string } & UpdateContactParams; result: AcqContact }
595
- getContact: { params: { id: string }; result: AcqContact | null }
596
- getContactByEmail: { params: { email: string }; result: AcqContact | null }
597
- listContacts: {
598
- params: ContactFilters & { limit?: number; offset?: number }
599
- result: PaginatedResult<AcqContact>
600
- }
601
- deleteContact: { params: { id: string }; result: void }
602
- bulkImportContacts: { params: Omit<BulkImportParams, 'organizationId'>; result: BulkImportResult }
603
- bulkImportCompanies: {
604
- params: Omit<BulkImportCompaniesParams, 'organizationId'>
605
- result: BulkImportCompaniesResult
606
- }
607
- deactivateContactsByCompany: {
608
- params: { companyId: string }
609
- result: { deactivated: number }
610
- }
611
- // Deal operations
612
- upsertDeal: { params: Omit<UpsertDealParams, 'organizationId'>; result: AcqDeal }
613
- getDealByEmail: { params: { email: string }; result: AcqDeal | null }
614
- getDealByEnvelopeId: { params: { envelopeId: string }; result: AcqDeal | null }
615
- updateDealEnvelopeId: { params: { dealId: string; envelopeId: string }; result: AcqDeal | null }
616
- getDealById: { params: Omit<GetDealByIdParams, 'organizationId'>; result: AcqDeal | null }
617
- getContactById: { params: Omit<GetContactByIdParams, 'organizationId'>; result: AcqContact | null }
618
- getCompanyById: { params: Omit<GetCompanyByIdParams, 'organizationId'>; result: AcqCompany | null }
619
- // Deal-sync operations
620
- updateDiscoveryData: { params: Omit<UpdateDiscoveryDataParams, 'organizationId'>; result: void }
621
- updateProposalData: { params: Omit<UpdateProposalDataParams, 'organizationId'>; result: void }
622
- markProposalSent: { params: Omit<MarkProposalSentParams, 'organizationId'>; result: void }
623
- markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
624
- updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
625
- updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
626
- transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
627
- setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
628
- cancelSchedulesAndHitlByEmail: {
629
- params: Omit<CancelSchedulesAndHitlByEmailParams, 'organizationId'>
630
- result: { schedulesCancelled: number; hitlDeleted: number }
631
- }
632
- cancelHitlByDealId: { params: Omit<CancelHitlByDealIdParams, 'organizationId'>; result: { hitlDeleted: number } }
633
- clearDealFields: { params: Omit<ClearDealFieldsParams, 'organizationId'>; result: void }
634
- deleteDeal: { params: Omit<DeleteDealParams, 'organizationId'>; result: void }
635
- recordDealActivity: {
636
- params: Omit<RecordDealActivityParams, 'organizationId'>
637
- result: void
638
- }
639
- // Deal note operations
640
- createDealNote: {
641
- params: Omit<CreateDealNoteParams, 'organizationId'>
642
- result: AcqDealNote
643
- }
644
- listDealNotes: {
645
- params: Omit<ListDealNotesParams, 'organizationId'>
646
- result: AcqDealNote[]
647
- }
648
- // Deal task operations
649
- createDealTask: {
650
- params: Omit<CreateDealTaskParams, 'organizationId'>
651
- result: AcqDealTask
652
- }
653
- listDealTasks: {
654
- params: Omit<ListDealTasksParams, 'organizationId'>
655
- result: AcqDealTask[]
656
- }
657
- listDealTasksDue: {
658
- params: Omit<ListDealTasksDueParams, 'organizationId'>
659
- result: AcqDealTask[]
660
- }
661
- completeDealTask: {
662
- params: Omit<CompleteDealTaskParams, 'organizationId'>
663
- result: AcqDealTask
664
- }
665
- // Deal query & analytics operations
666
- listDeals: { params: DealFilters; result: AcqDeal[] }
667
- getDealPipelineAnalytics: { params: { recentLimit?: number }; result: DealPipelineAnalytics }
668
- // Enrichment data operations
669
- mergeEnrichmentData: {
670
- params: { id: string; table: 'acq_companies' | 'acq_contacts'; data: Record<string, unknown> }
671
- result: void
672
- }
673
- // Social monitoring operations
674
- upsertSocialPosts: {
675
- params: { posts: Omit<UpsertSocialPostParams, 'organizationId'>[] }
676
- result: UpsertSocialPostsResult
677
- }
678
- }
679
-
680
- // ---------------------------------------------------------------------------
681
- // List (platform tool, 4 methods)
682
- // ---------------------------------------------------------------------------
683
-
684
- export type ListToolMap = {
685
- getConfig: { params: { listId: string }; result: ListConfig }
686
- recordExecution: {
687
- params: Omit<RecordListExecutionParams, 'organizationId'>
688
- result: void
689
- }
690
- updateCompanyStage: {
691
- params: Omit<UpdateCompanyStageParams, 'organizationId'>
692
- result: void
693
- }
694
- updateContactStage: {
695
- params: Omit<UpdateContactStageParams, 'organizationId'>
696
- result: void
697
- }
698
- }
699
-
700
- // ---------------------------------------------------------------------------
701
- // PDF (platform tool, 2 methods)
702
- // ---------------------------------------------------------------------------
703
-
704
- export type PdfToolMap = {
705
- render: {
706
- params: {
707
- document: Record<string, unknown>
708
- theme?: Record<string, unknown>
709
- storage: { bucket: string; path: string }
710
- }
711
- result: { success: boolean; pdfUrl: string; size: number }
712
- }
713
- renderToBuffer: {
714
- params: {
715
- document: Record<string, unknown>
716
- theme?: Record<string, unknown>
717
- }
718
- result: { buffer: string }
719
- }
720
- }
721
-
722
- // ---------------------------------------------------------------------------
723
- // Approval (platform tool, 2 methods)
724
- // ---------------------------------------------------------------------------
725
-
726
- export type ApprovalToolMap = {
727
- create: {
728
- params: {
729
- actions: Array<{
730
- id: string
731
- label: string
732
- type: 'primary' | 'secondary' | 'danger' | 'outline'
733
- icon?: string
734
- color?: string
735
- target?: { resourceType: 'agent' | 'workflow'; resourceId: string; sessionId?: string }
736
- form?: Record<string, unknown>
737
- requiresConfirmation?: boolean
738
- confirmationMessage?: string
739
- description?: string
740
- }>
741
- context: Record<string, unknown>
742
- description?: string
743
- priority?: number
744
- humanCheckpoint?: string
745
- metadata?: Record<string, unknown>
746
- expiresAt?: string
747
- idempotencyKey?: string
748
- }
749
- result: { id: string }
750
- }
751
- deleteByMetadata: {
752
- params: { metadata: Record<string, unknown>; status?: string }
753
- result: { deleted: number }
754
- }
755
- }
756
-
757
- // ---------------------------------------------------------------------------
758
- // Execution (platform tool, 1 method)
759
- // ---------------------------------------------------------------------------
760
-
761
- export type ExecutionToolMap = {
762
- trigger: {
763
- params: { resourceId: string; input?: unknown }
764
- result: { success: boolean; executionId: string; output: unknown; error?: string }
765
- }
766
- triggerAsync: {
767
- params: { resourceId: string; input?: unknown }
768
- result: { executionId: string }
769
- }
770
- }
771
-
772
- // ---------------------------------------------------------------------------
773
- // Email (platform tool, 1 method)
774
- // ---------------------------------------------------------------------------
775
-
776
- export type EmailToolMap = {
777
- send: {
778
- params: {
779
- subject: string
780
- html?: string
781
- text?: string
782
- replyTo?: string
783
- tags?: Array<{ name: string; value: string }>
784
- } & (
785
- | { userIds: string[]; targetRole?: never; targetAll?: never }
786
- | { targetRole: string; userIds?: never; targetAll?: never }
787
- | { targetAll: true; userIds?: never; targetRole?: never }
788
- )
789
- result: { sent: number; failed: number; errors?: Array<{ userId: string; email: string; error: string }> }
790
- }
791
- }
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
+ }