@elevasis/core 0.14.0 → 0.15.0

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