@elevasis/core 0.7.0 → 0.8.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 (473) hide show
  1. package/package.json +3 -3
  2. package/src/README.md +41 -41
  3. package/src/__tests__/publish.test.ts +18 -18
  4. package/src/__tests__/{template-foundations-compatibility.test.ts → template-core-compatibility.test.ts} +99 -99
  5. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +1135 -1131
  6. package/src/_gen/__tests__/scaffold-contracts.test.ts +53 -53
  7. package/src/_gen/scaffold-contracts.ts +45 -45
  8. package/src/auth/multi-tenancy/credentials/README.md +38 -38
  9. package/src/auth/multi-tenancy/credentials/index.ts +6 -6
  10. package/src/auth/multi-tenancy/credentials/server/encryption.ts +39 -39
  11. package/src/auth/multi-tenancy/credentials/server/service.ts +60 -60
  12. package/src/auth/multi-tenancy/index.ts +17 -17
  13. package/src/auth/multi-tenancy/invitations/api-schemas.ts +107 -107
  14. package/src/auth/multi-tenancy/invitations/index.ts +37 -37
  15. package/src/auth/multi-tenancy/invitations/invitation.ts +86 -86
  16. package/src/auth/multi-tenancy/invitations/server/index.ts +25 -25
  17. package/src/auth/multi-tenancy/invitations/server/transforms.ts +24 -24
  18. package/src/auth/multi-tenancy/invitations/server/workos.ts +24 -24
  19. package/src/auth/multi-tenancy/invitations/supabase.ts +50 -50
  20. package/src/auth/multi-tenancy/memberships/api-schemas.ts +126 -126
  21. package/src/auth/multi-tenancy/memberships/index.ts +21 -21
  22. package/src/auth/multi-tenancy/memberships/membership.ts +138 -138
  23. package/src/auth/multi-tenancy/memberships/server/index.ts +15 -15
  24. package/src/auth/multi-tenancy/memberships/server/transforms.ts +32 -32
  25. package/src/auth/multi-tenancy/memberships/server/workos.ts +21 -21
  26. package/src/auth/multi-tenancy/memberships/supabase.ts +46 -46
  27. package/src/auth/multi-tenancy/organizations/api-schemas.ts +128 -128
  28. package/src/auth/multi-tenancy/organizations/index.ts +23 -23
  29. package/src/auth/multi-tenancy/organizations/organization.ts +24 -24
  30. package/src/auth/multi-tenancy/organizations/server/index.ts +10 -10
  31. package/src/auth/multi-tenancy/organizations/server/transforms.ts +35 -35
  32. package/src/auth/multi-tenancy/organizations/server/workos.ts +20 -20
  33. package/src/auth/multi-tenancy/types.ts +83 -83
  34. package/src/auth/multi-tenancy/users/api-schemas.ts +194 -194
  35. package/src/auth/multi-tenancy/users/index.ts +27 -27
  36. package/src/auth/multi-tenancy/users/server/index.ts +19 -19
  37. package/src/auth/multi-tenancy/users/server/transforms.ts +21 -21
  38. package/src/auth/multi-tenancy/users/server/workos.ts +16 -16
  39. package/src/auth/multi-tenancy/users/user.ts +65 -65
  40. package/src/business/README.md +52 -52
  41. package/src/business/__tests__/entities-published.test.ts +33 -33
  42. package/src/business/acquisition/api-schemas.ts +759 -759
  43. package/src/business/acquisition/index.ts +109 -109
  44. package/src/business/acquisition/types.ts +402 -402
  45. package/src/business/base-entities.test.ts +481 -481
  46. package/src/business/base-entities.ts +241 -241
  47. package/src/business/entities-published.ts +24 -24
  48. package/src/business/index.ts +15 -15
  49. package/src/business/pdf/browser/pdfmake-browser.ts +229 -229
  50. package/src/business/pdf/index.ts +10 -10
  51. package/src/business/pdf/server/index.ts +21 -21
  52. package/src/business/pdf/server/themes/default.ts +8 -8
  53. package/src/business/pdf/server/themes/index.ts +9 -9
  54. package/src/business/pdf/server/themes/types.ts +8 -8
  55. package/src/business/pdf/types.ts +272 -272
  56. package/src/business/projects/index.ts +2 -1
  57. package/src/business/projects/sse-events.ts +21 -0
  58. package/src/business/projects/types.ts +89 -89
  59. package/src/business/sales/api-schemas.ts +75 -75
  60. package/src/business/seo/__tests__/linking.test.ts +549 -549
  61. package/src/business/seo/__tests__/types.test.ts +404 -404
  62. package/src/business/seo/index.ts +2 -2
  63. package/src/business/seo/linking.ts +281 -281
  64. package/src/business/seo/types.ts +199 -199
  65. package/src/commands/queue/index.ts +3 -3
  66. package/src/commands/queue/schemas.test.ts +593 -593
  67. package/src/commands/queue/schemas.ts +125 -125
  68. package/src/commands/queue/sse-events.ts +61 -61
  69. package/src/commands/queue/types/action.ts +52 -52
  70. package/src/commands/queue/types/checkpoint.ts +44 -44
  71. package/src/commands/queue/types/index.ts +7 -7
  72. package/src/commands/queue/types/task.ts +116 -116
  73. package/src/commands/queue/types.ts +14 -14
  74. package/src/content/distribution-metadata.ts +61 -61
  75. package/src/content/index.ts +10 -10
  76. package/src/deployments/index.ts +22 -22
  77. package/src/execution/core/__tests__/archived-logs.test.ts +72 -72
  78. package/src/execution/core/index.ts +11 -11
  79. package/src/execution/core/runner-types.ts +80 -80
  80. package/src/execution/core/server/environment.ts +31 -31
  81. package/src/execution/core/sse-executions.ts +119 -119
  82. package/src/execution/core/types.ts +29 -29
  83. package/src/execution/engine/__tests__/fixtures/test-agents.ts +4 -4
  84. package/src/execution/engine/__tests__/timeout.test.ts +565 -565
  85. package/src/execution/engine/agent/__tests__/errors.test.ts +508 -508
  86. package/src/execution/engine/agent/actions/__tests__/processor.test.ts +531 -531
  87. package/src/execution/engine/agent/actions/executor.ts +205 -205
  88. package/src/execution/engine/agent/actions/navigate-knowledge-executor.ts +230 -230
  89. package/src/execution/engine/agent/actions/processor.ts +116 -116
  90. package/src/execution/engine/agent/actions/types.ts +70 -70
  91. package/src/execution/engine/agent/core/agent.ts +810 -810
  92. package/src/execution/engine/agent/core/types.ts +155 -155
  93. package/src/execution/engine/agent/errors.ts +251 -251
  94. package/src/execution/engine/agent/index.ts +78 -78
  95. package/src/execution/engine/agent/knowledge-map/types.ts +106 -106
  96. package/src/execution/engine/agent/knowledge-map/utils.ts +101 -101
  97. package/src/execution/engine/agent/memory/__tests__/manager.test.ts +754 -754
  98. package/src/execution/engine/agent/memory/domains.ts +99 -99
  99. package/src/execution/engine/agent/memory/manager.ts +365 -365
  100. package/src/execution/engine/agent/memory/processor.ts +66 -66
  101. package/src/execution/engine/agent/memory/types.ts +90 -90
  102. package/src/execution/engine/agent/memory/utils.ts +134 -134
  103. package/src/execution/engine/agent/observability/logging.ts +467 -467
  104. package/src/execution/engine/agent/observability/types.ts +64 -64
  105. package/src/execution/engine/agent/reasoning/adapters/agent-adapter-helpers.ts +349 -349
  106. package/src/execution/engine/agent/reasoning/processor.ts +92 -92
  107. package/src/execution/engine/agent/reasoning/prompt-sections/base-actions.ts +134 -134
  108. package/src/execution/engine/agent/reasoning/prompt-sections/completion.ts +49 -49
  109. package/src/execution/engine/agent/reasoning/prompt-sections/knowledge-map.ts +93 -93
  110. package/src/execution/engine/agent/reasoning/prompt-sections/memory.ts +65 -65
  111. package/src/execution/engine/agent/reasoning/prompt-sections/tools.ts +44 -44
  112. package/src/execution/engine/agent/reasoning/request-builder.ts +169 -169
  113. package/src/execution/engine/agent/reasoning/types.ts +18 -18
  114. package/src/execution/engine/base/errors.ts +118 -118
  115. package/src/execution/engine/base/index.ts +2 -2
  116. package/src/execution/engine/base/logging.ts +31 -31
  117. package/src/execution/engine/base/serialization.ts +324 -324
  118. package/src/execution/engine/base/types.ts +126 -126
  119. package/src/execution/engine/base/utils.ts +41 -41
  120. package/src/execution/engine/index.ts +434 -434
  121. package/src/execution/engine/interface/index.ts +1 -1
  122. package/src/execution/engine/interface/types.ts +62 -62
  123. package/src/execution/engine/llm/__tests__/model-info.test.ts +50 -50
  124. package/src/execution/engine/llm/__tests__/model-validation.test.ts +321 -321
  125. package/src/execution/engine/llm/__tests__/response-schema-validator.test.ts +115 -115
  126. package/src/execution/engine/llm/adapters/__tests__/adapter-factory.test.ts +375 -375
  127. package/src/execution/engine/llm/adapters/__tests__/anthropic-adapter.test.ts +463 -463
  128. package/src/execution/engine/llm/adapters/__tests__/anthropic.integration.test.ts +177 -177
  129. package/src/execution/engine/llm/adapters/__tests__/google-adapter.test.ts +722 -722
  130. package/src/execution/engine/llm/adapters/__tests__/google.integration.test.ts +376 -376
  131. package/src/execution/engine/llm/adapters/__tests__/openai-adapter.test.ts +551 -551
  132. package/src/execution/engine/llm/adapters/__tests__/openrouter-adapter.test.ts +563 -563
  133. package/src/execution/engine/llm/adapters/__tests__/openrouter.integration.test.ts +105 -105
  134. package/src/execution/engine/llm/adapters/__tests__/universal-adapter.test.ts +537 -537
  135. package/src/execution/engine/llm/adapters/circuit-breaker.ts +147 -147
  136. package/src/execution/engine/llm/adapters/index.ts +17 -17
  137. package/src/execution/engine/llm/adapters/mock-adapter.ts +116 -116
  138. package/src/execution/engine/llm/adapters/server/adapter-factory.ts +130 -130
  139. package/src/execution/engine/llm/adapters/server/anthropic.ts +137 -137
  140. package/src/execution/engine/llm/adapters/server/google.ts +283 -283
  141. package/src/execution/engine/llm/adapters/server/index.ts +12 -12
  142. package/src/execution/engine/llm/adapters/server/openai.ts +206 -206
  143. package/src/execution/engine/llm/adapters/server/openrouter.ts +235 -235
  144. package/src/execution/engine/llm/adapters/universal-adapter.ts +230 -230
  145. package/src/execution/engine/llm/errors.ts +186 -186
  146. package/src/execution/engine/llm/model-info.ts +332 -332
  147. package/src/execution/engine/llm/response-schema-validator.ts +113 -113
  148. package/src/execution/engine/llm/types.ts +86 -86
  149. package/src/execution/engine/test-utils/index.ts +6 -6
  150. package/src/execution/engine/test-utils/mocks.ts +56 -56
  151. package/src/execution/engine/tools/integration/base-integration-adapter.ts +50 -50
  152. package/src/execution/engine/tools/integration/index.ts +53 -53
  153. package/src/execution/engine/tools/integration/server/adapters/anymailfinder/anymailfinder-adapter.ts +73 -73
  154. package/src/execution/engine/tools/integration/server/adapters/anymailfinder/anymailfinder-tools.ts +209 -209
  155. package/src/execution/engine/tools/integration/server/adapters/anymailfinder/fetch/find-company-email/index.ts +82 -82
  156. package/src/execution/engine/tools/integration/server/adapters/anymailfinder/fetch/find-decision-maker-email/index.ts +122 -122
  157. package/src/execution/engine/tools/integration/server/adapters/anymailfinder/fetch/find-person-email/index.ts +89 -89
  158. package/src/execution/engine/tools/integration/server/adapters/anymailfinder/fetch/verify-email/index.ts +84 -84
  159. package/src/execution/engine/tools/integration/server/adapters/anymailfinder/index.ts +16 -16
  160. package/src/execution/engine/tools/integration/server/adapters/apify/__tests__/apify-run-actor.integration.test.ts +293 -293
  161. package/src/execution/engine/tools/integration/server/adapters/apify/apify-adapter.ts +100 -100
  162. package/src/execution/engine/tools/integration/server/adapters/apify/apify-tools.ts +217 -217
  163. package/src/execution/engine/tools/integration/server/adapters/apify/fetch/get-dataset-items/index.ts +92 -92
  164. package/src/execution/engine/tools/integration/server/adapters/apify/fetch/run-actor/index.ts +218 -218
  165. package/src/execution/engine/tools/integration/server/adapters/apify/fetch/start-actor/index.ts +87 -87
  166. package/src/execution/engine/tools/integration/server/adapters/apify/index.ts +11 -11
  167. package/src/execution/engine/tools/integration/server/adapters/attio/__tests__/attio-crud.integration.test.ts +361 -361
  168. package/src/execution/engine/tools/integration/server/adapters/attio/attio-adapter.ts +162 -162
  169. package/src/execution/engine/tools/integration/server/adapters/attio/attio-tools.ts +594 -594
  170. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/create-attribute/index.ts +214 -214
  171. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/create-note/index.ts +152 -152
  172. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/create-record/index.ts +141 -141
  173. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/delete-note/index.ts +86 -86
  174. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/delete-record/index.ts +105 -105
  175. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/get-record/index.ts +118 -118
  176. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/list-attributes/index.ts +165 -165
  177. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/list-notes/index.ts +96 -96
  178. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/list-objects/index.ts +104 -104
  179. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/list-records/index.ts +156 -156
  180. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/update-attribute/index.ts +220 -220
  181. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/update-record/index.ts +140 -140
  182. package/src/execution/engine/tools/integration/server/adapters/attio/fetch/utils/types.ts +146 -146
  183. package/src/execution/engine/tools/integration/server/adapters/attio/index.ts +31 -31
  184. package/src/execution/engine/tools/integration/server/adapters/gmail/gmail-adapter.ts +210 -210
  185. package/src/execution/engine/tools/integration/server/adapters/gmail/gmail-tools.ts +104 -104
  186. package/src/execution/engine/tools/integration/server/adapters/google-sheets/__tests__/google-sheets.integration.test.ts +261 -261
  187. package/src/execution/engine/tools/integration/server/adapters/google-sheets/google-sheets-adapter.ts +1189 -1189
  188. package/src/execution/engine/tools/integration/server/adapters/google-sheets/google-sheets-tools.ts +641 -641
  189. package/src/execution/engine/tools/integration/server/adapters/google-sheets/index.ts +18 -18
  190. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/activate-campaign/index.ts +86 -86
  191. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/add-to-campaign/__tests__/index.test.ts +289 -289
  192. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/add-to-campaign/index.ts +154 -154
  193. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/bulk-add-leads/__tests__/index.test.ts +325 -325
  194. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/bulk-add-leads/index.ts +153 -153
  195. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/bulk-delete-leads/index.ts +84 -84
  196. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/create-campaign/index.ts +125 -125
  197. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/create-inbox-test/index.ts +107 -107
  198. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/delete-campaign/index.ts +85 -85
  199. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/get-account-health/index.ts +91 -91
  200. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/get-campaign/index.ts +92 -92
  201. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/get-campaign-analytics/__tests__/index.test.ts +195 -195
  202. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/get-campaign-analytics/index.ts +113 -113
  203. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/get-daily-campaign-analytics/index.ts +104 -104
  204. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/get-emails/index.ts +155 -155
  205. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/get-step-analytics/__tests__/index.test.ts +196 -196
  206. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/get-step-analytics/index.ts +102 -102
  207. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/list-campaigns/__tests__/index.test.ts +189 -189
  208. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/list-campaigns/index.ts +87 -87
  209. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/list-leads/index.ts +112 -112
  210. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/patch-lead/index.ts +76 -76
  211. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/pause-campaign/index.ts +86 -86
  212. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/remove-from-subsequence/index.ts +98 -98
  213. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/send-reply/index.ts +126 -126
  214. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/update-campaign/__tests__/index.test.ts +193 -193
  215. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/update-campaign/index.ts +99 -99
  216. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/update-interest-status/__tests__/index.test.ts +621 -621
  217. package/src/execution/engine/tools/integration/server/adapters/instantly/fetch/update-interest-status/index.ts +125 -125
  218. package/src/execution/engine/tools/integration/server/adapters/instantly/index.ts +29 -29
  219. package/src/execution/engine/tools/integration/server/adapters/instantly/instantly-adapter.ts +178 -178
  220. package/src/execution/engine/tools/integration/server/adapters/instantly/instantly-tools.ts +1473 -1473
  221. package/src/execution/engine/tools/integration/server/adapters/millionverifier/fetch/check-credits/index.ts +59 -59
  222. package/src/execution/engine/tools/integration/server/adapters/millionverifier/fetch/verify-email/index.ts +102 -102
  223. package/src/execution/engine/tools/integration/server/adapters/millionverifier/index.ts +17 -17
  224. package/src/execution/engine/tools/integration/server/adapters/millionverifier/millionverifier-adapter.ts +80 -80
  225. package/src/execution/engine/tools/integration/server/adapters/millionverifier/millionverifier-tools.ts +102 -102
  226. package/src/execution/engine/tools/integration/server/adapters/resend/fetch/get-email/index.ts +102 -102
  227. package/src/execution/engine/tools/integration/server/adapters/resend/fetch/send-email/index.ts +134 -134
  228. package/src/execution/engine/tools/integration/server/adapters/resend/fetch/utils/types.ts +75 -75
  229. package/src/execution/engine/tools/integration/server/adapters/resend/index.ts +27 -27
  230. package/src/execution/engine/tools/integration/server/adapters/resend/resend-adapter.ts +108 -108
  231. package/src/execution/engine/tools/integration/server/adapters/resend/resend-tools.ts +132 -132
  232. package/src/execution/engine/tools/integration/server/adapters/signature-api/fetch/create-envelope/index.ts +274 -274
  233. package/src/execution/engine/tools/integration/server/adapters/signature-api/fetch/download-document/index.ts +230 -230
  234. package/src/execution/engine/tools/integration/server/adapters/signature-api/fetch/get-envelope/index.ts +133 -133
  235. package/src/execution/engine/tools/integration/server/adapters/signature-api/fetch/void-envelope/index.ts +90 -90
  236. package/src/execution/engine/tools/integration/server/adapters/stripe/fetch/utils/types.ts +210 -210
  237. package/src/execution/engine/tools/integration/server/adapters/stripe/stripe-adapter.ts +517 -517
  238. package/src/execution/engine/tools/integration/server/adapters/stripe/stripe-tools.ts +309 -309
  239. package/src/execution/engine/tools/integration/server/adapters/tomba/fetch/domain-search/index.ts +133 -133
  240. package/src/execution/engine/tools/integration/server/adapters/tomba/fetch/email-finder/index.ts +122 -122
  241. package/src/execution/engine/tools/integration/server/adapters/tomba/fetch/email-verifier/index.ts +111 -111
  242. package/src/execution/engine/tools/integration/server/adapters/tomba/index.ts +11 -11
  243. package/src/execution/engine/tools/integration/server/adapters/tomba/tomba-adapter.ts +78 -78
  244. package/src/execution/engine/tools/integration/server/adapters/tomba/tomba-tools.ts +222 -222
  245. package/src/execution/engine/tools/integration/server/index.ts +61 -61
  246. package/src/execution/engine/tools/integration/service.ts +161 -161
  247. package/src/execution/engine/tools/integration/tool.ts +253 -253
  248. package/src/execution/engine/tools/integration/types/anymailfinder.ts +74 -74
  249. package/src/execution/engine/tools/integration/types/apify.ts +92 -92
  250. package/src/execution/engine/tools/integration/types/index.ts +19 -19
  251. package/src/execution/engine/tools/integration/types/instantly.ts +557 -557
  252. package/src/execution/engine/tools/integration/types/millionverifier.ts +56 -56
  253. package/src/execution/engine/tools/integration/types/stripe.ts +162 -162
  254. package/src/execution/engine/tools/integration/types/tomba.ts +94 -94
  255. package/src/execution/engine/tools/lead-service-types.ts +884 -884
  256. package/src/execution/engine/tools/llm/index.ts +11 -11
  257. package/src/execution/engine/tools/llm/server/index.ts +8 -8
  258. package/src/execution/engine/tools/llm/server/llm-call-tool.ts +118 -118
  259. package/src/execution/engine/tools/platform/__tests__/pdf.test.ts +441 -441
  260. package/src/execution/engine/tools/platform/acquisition/company-tools.ts +248 -248
  261. package/src/execution/engine/tools/platform/acquisition/contact-tools.ts +319 -319
  262. package/src/execution/engine/tools/platform/acquisition/index.ts +43 -43
  263. package/src/execution/engine/tools/platform/acquisition/list-tools.ts +148 -148
  264. package/src/execution/engine/tools/platform/acquisition/types.ts +260 -260
  265. package/src/execution/engine/tools/platform/email/index.ts +122 -122
  266. package/src/execution/engine/tools/platform/email/types.ts +96 -96
  267. package/src/execution/engine/tools/platform/index.ts +157 -157
  268. package/src/execution/engine/tools/platform/notification.ts +81 -81
  269. package/src/execution/engine/tools/platform/pdf/index.ts +110 -110
  270. package/src/execution/engine/tools/platform/pdf/types.ts +77 -77
  271. package/src/execution/engine/tools/platform/scheduler.ts +87 -87
  272. package/src/execution/engine/tools/platform/storage/index.ts +370 -370
  273. package/src/execution/engine/tools/platform/types.ts +148 -148
  274. package/src/execution/engine/tools/registry.ts +700 -699
  275. package/src/execution/engine/tools/tool-maps.ts +786 -786
  276. package/src/execution/engine/tools/types.ts +233 -233
  277. package/src/execution/engine/workflow/__tests__/errors.test.ts +139 -139
  278. package/src/execution/engine/workflow/errors.ts +63 -63
  279. package/src/execution/engine/workflow/helpers/index.ts +11 -11
  280. package/src/execution/engine/workflow/helpers/server/index.ts +8 -8
  281. package/src/execution/engine/workflow/helpers/server/llm-call.ts +93 -93
  282. package/src/execution/engine/workflow/index.ts +19 -19
  283. package/src/execution/engine/workflow/log-truncate.ts +26 -26
  284. package/src/execution/engine/workflow/logging.ts +191 -191
  285. package/src/execution/engine/workflow/types.ts +182 -182
  286. package/src/execution/engine/workflow/utils.ts +280 -280
  287. package/src/execution/engine/workflow/workflow.ts +168 -168
  288. package/src/execution/index.ts +3 -3
  289. package/src/execution/scheduler/__tests__/api-schemas.test.ts +733 -733
  290. package/src/execution/scheduler/__tests__/utils.test.ts +1009 -1009
  291. package/src/execution/scheduler/api-schemas.ts +296 -296
  292. package/src/execution/scheduler/index.ts +50 -50
  293. package/src/execution/scheduler/schemas.ts +264 -264
  294. package/src/execution/scheduler/types.ts +111 -111
  295. package/src/execution/scheduler/utils.ts +364 -364
  296. package/src/forms/index.ts +7 -7
  297. package/src/forms/schemas.ts +69 -69
  298. package/src/forms/types.ts +70 -70
  299. package/src/index.ts +71 -60
  300. package/src/integrations/credentials/__tests__/schemas.test.ts +82 -82
  301. package/src/integrations/credentials/__tests__/utils.test.ts +144 -144
  302. package/src/integrations/credentials/api-schemas.ts +143 -143
  303. package/src/integrations/credentials/index.ts +32 -32
  304. package/src/integrations/credentials/schemas.ts +164 -164
  305. package/src/integrations/credentials/utils.ts +59 -59
  306. package/src/integrations/oauth/__tests__/provider-registry.test.ts +59 -59
  307. package/src/integrations/oauth/api-schemas.ts +92 -92
  308. package/src/integrations/oauth/index.ts +19 -19
  309. package/src/integrations/oauth/provider-registry.ts +61 -61
  310. package/src/integrations/oauth/server/__tests__/refresh-concurrent.test.ts +183 -183
  311. package/src/integrations/oauth/server/__tests__/refresh.test.ts +577 -577
  312. package/src/integrations/oauth/server/credentials.ts +39 -39
  313. package/src/integrations/oauth/server/refresh.ts +214 -214
  314. package/src/integrations/oauth/types.ts +34 -34
  315. package/src/integrations/webhook-endpoints/__tests__/api-schemas.test.ts +318 -318
  316. package/src/integrations/webhook-endpoints/api-schemas.ts +102 -102
  317. package/src/integrations/webhook-endpoints/index.ts +28 -28
  318. package/src/integrations/webhook-endpoints/types.ts +51 -51
  319. package/src/operations/activities/api-schemas.ts +79 -79
  320. package/src/operations/activities/index.ts +9 -9
  321. package/src/operations/activities/sse-events.ts +30 -30
  322. package/src/operations/activities/types.ts +63 -63
  323. package/src/operations/debug-logs/client.ts +60 -60
  324. package/src/operations/debug-logs/debug-logger.ts +83 -83
  325. package/src/operations/debug-logs/index.ts +8 -8
  326. package/src/operations/debug-logs/server.ts +19 -19
  327. package/src/operations/debug-logs/types.ts +33 -33
  328. package/src/operations/index.ts +50 -50
  329. package/src/operations/notifications/api-schemas.ts +91 -91
  330. package/src/operations/notifications/index.ts +3 -3
  331. package/src/operations/notifications/sse-events.ts +21 -21
  332. package/src/operations/notifications/types.ts +47 -47
  333. package/src/operations/observability/__tests__/openrouter-cost-flow.test.ts +297 -297
  334. package/src/operations/observability/__tests__/utils.test.ts +54 -54
  335. package/src/operations/observability/ai-usage-collector.ts +64 -64
  336. package/src/operations/observability/index.ts +13 -13
  337. package/src/operations/observability/metrics-collector.ts +49 -49
  338. package/src/operations/observability/schemas.ts +39 -39
  339. package/src/operations/observability/types.ts +463 -463
  340. package/src/operations/observability/utils.ts +77 -77
  341. package/src/operations/sessions/__tests__/manager.test.ts +821 -821
  342. package/src/operations/sessions/index.ts +26 -26
  343. package/src/operations/sessions/server/manager.ts +90 -90
  344. package/src/operations/sessions/server/session.ts +180 -180
  345. package/src/operations/sessions/types.ts +98 -98
  346. package/src/operations/triggers/index.ts +12 -12
  347. package/src/operations/triggers/webhook/definitions/instantly-account-error.ts +44 -44
  348. package/src/operations/triggers/webhook/definitions/instantly-auto-reply-received.ts +51 -51
  349. package/src/operations/triggers/webhook/definitions/instantly-campaign-completed.ts +45 -45
  350. package/src/operations/triggers/webhook/definitions/instantly-email-bounced.ts +49 -49
  351. package/src/operations/triggers/webhook/definitions/instantly-lead-unsubscribed.ts +45 -45
  352. package/src/operations/triggers/webhook/definitions/instantly-reply-received.ts +54 -54
  353. package/src/operations/triggers/webhook/index.ts +35 -35
  354. package/src/operations/triggers/webhook/types.ts +74 -74
  355. package/src/organization-model/README.md +97 -97
  356. package/src/organization-model/__tests__/defaults.test.ts +175 -175
  357. package/src/organization-model/__tests__/domains/customers.test.ts +295 -295
  358. package/src/organization-model/__tests__/domains/goals.test.ts +479 -479
  359. package/src/organization-model/__tests__/domains/identity.test.ts +279 -279
  360. package/src/organization-model/__tests__/domains/navigation.test.ts +212 -212
  361. package/src/organization-model/__tests__/domains/offerings.test.ts +419 -419
  362. package/src/organization-model/__tests__/domains/operations.test.ts +203 -203
  363. package/src/organization-model/__tests__/domains/resource-mappings.test.ts +362 -362
  364. package/src/organization-model/__tests__/domains/roles.test.ts +347 -347
  365. package/src/organization-model/__tests__/domains/statuses.test.ts +243 -243
  366. package/src/organization-model/__tests__/foundation.test.ts +105 -105
  367. package/src/organization-model/__tests__/graph.test.ts +894 -894
  368. package/src/organization-model/__tests__/resolve.test.ts +690 -690
  369. package/src/organization-model/__tests__/schema.test.ts +407 -407
  370. package/src/organization-model/contracts.ts +14 -14
  371. package/src/organization-model/defaults.ts +148 -148
  372. package/src/organization-model/domains/branding.ts +22 -22
  373. package/src/organization-model/domains/customers.ts +75 -75
  374. package/src/organization-model/domains/features.ts +22 -22
  375. package/src/organization-model/domains/goals.ts +80 -80
  376. package/src/organization-model/domains/identity.ts +94 -94
  377. package/src/organization-model/domains/navigation.ts +391 -391
  378. package/src/organization-model/domains/offerings.ts +66 -66
  379. package/src/organization-model/domains/operations.ts +85 -85
  380. package/src/organization-model/domains/projects.ts +48 -48
  381. package/src/organization-model/domains/prospecting.ts +33 -33
  382. package/src/organization-model/domains/roles.ts +55 -55
  383. package/src/organization-model/domains/sales.ts +94 -94
  384. package/src/organization-model/domains/shared.ts +62 -62
  385. package/src/organization-model/domains/statuses.ts +130 -130
  386. package/src/organization-model/foundation.ts +97 -97
  387. package/src/organization-model/graph/build.ts +399 -399
  388. package/src/organization-model/graph/index.ts +4 -4
  389. package/src/organization-model/graph/schema.ts +48 -48
  390. package/src/organization-model/graph/types.ts +40 -40
  391. package/src/organization-model/index.ts +13 -13
  392. package/src/organization-model/organization-graph.mdx +272 -272
  393. package/src/organization-model/organization-model.mdx +320 -320
  394. package/src/organization-model/published.ts +85 -85
  395. package/src/organization-model/resolve.ts +66 -66
  396. package/src/organization-model/schema.ts +287 -287
  397. package/src/organization-model/types.ts +46 -46
  398. package/src/platform/api/index.ts +1 -1
  399. package/src/platform/api/types.ts +35 -35
  400. package/src/platform/constants/http.ts +37 -37
  401. package/src/platform/constants/index.ts +5 -5
  402. package/src/platform/constants/limits.ts +32 -32
  403. package/src/platform/constants/resilience.ts +51 -51
  404. package/src/platform/constants/timeouts.ts +20 -20
  405. package/src/platform/constants/versions.ts +3 -3
  406. package/src/platform/registry/__tests__/resource-registry-static.test.ts +347 -347
  407. package/src/platform/registry/__tests__/resource-registry.integration.test.ts +1028 -1028
  408. package/src/platform/registry/__tests__/resource-registry.list-executable.test.ts +393 -393
  409. package/src/platform/registry/__tests__/resource-registry.test.ts +2005 -2005
  410. package/src/platform/registry/__tests__/serialization.test.ts +1127 -1127
  411. package/src/platform/registry/command-view.ts +180 -180
  412. package/src/platform/registry/domains.ts +165 -165
  413. package/src/platform/registry/index.ts +93 -93
  414. package/src/platform/registry/reserved.ts +24 -24
  415. package/src/platform/registry/resource-metadata.ts +59 -59
  416. package/src/platform/registry/resource-registry.command-queue-groups.test.ts +129 -129
  417. package/src/platform/registry/resource-registry.ts +876 -876
  418. package/src/platform/registry/serialization.ts +273 -273
  419. package/src/platform/registry/serialized-types.ts +231 -231
  420. package/src/platform/registry/stats-types.ts +66 -66
  421. package/src/platform/registry/types.ts +404 -404
  422. package/src/platform/registry/validation.ts +513 -513
  423. package/src/platform/resilience/__tests__/rate-limiter.test.ts +471 -471
  424. package/src/platform/resilience/circuit-breaker.ts +164 -164
  425. package/src/platform/resilience/errors.ts +68 -68
  426. package/src/platform/resilience/http-error-mapper.ts +129 -129
  427. package/src/platform/resilience/index.ts +93 -93
  428. package/src/platform/resilience/rate-limiter-types.ts +46 -46
  429. package/src/platform/resilience/rate-limiter.ts +140 -140
  430. package/src/platform/resilience/retry.ts +89 -89
  431. package/src/platform/resilience/timeout.ts +63 -63
  432. package/src/platform/sse/events.ts +37 -34
  433. package/src/platform/sse/index.ts +7 -7
  434. package/src/platform/utils/__tests__/validation.test.ts +1083 -1083
  435. package/src/platform/utils/currency.ts +96 -96
  436. package/src/platform/utils/debounce.ts +52 -52
  437. package/src/platform/utils/error.ts +41 -41
  438. package/src/platform/utils/hmac.test.ts +97 -97
  439. package/src/platform/utils/index.ts +32 -32
  440. package/src/platform/utils/server/betterstack-logger.ts +210 -210
  441. package/src/platform/utils/server/hmac.ts +44 -44
  442. package/src/platform/utils/server/unsubscribe.ts +111 -111
  443. package/src/platform/utils/token-counter.ts +96 -96
  444. package/src/platform/utils/validation.ts +425 -425
  445. package/src/projects/api-schemas.ts +268 -268
  446. package/src/published.ts +1 -1
  447. package/src/reference/_generated/contracts.md +611 -607
  448. package/src/reference/glossary.md +105 -105
  449. package/src/requests/__tests__/api-schemas.test.ts +277 -277
  450. package/src/requests/api-schemas.ts +83 -83
  451. package/src/requests/index.ts +1 -1
  452. package/src/scaffold-registry/__tests__/index.test.ts +17 -0
  453. package/src/scaffold-registry/__tests__/schema.test.ts +329 -230
  454. package/src/scaffold-registry/index.ts +205 -189
  455. package/src/scaffold-registry/schema.ts +196 -128
  456. package/src/server.ts +272 -272
  457. package/src/supabase/database.types.ts +2719 -2719
  458. package/src/supabase/helpers.ts +20 -20
  459. package/src/supabase/index.ts +52 -52
  460. package/src/supabase/server/client.ts +58 -58
  461. package/src/test-utils/README.md +38 -38
  462. package/src/test-utils/browser-mocks.ts +54 -54
  463. package/src/test-utils/fixtures/api-keys.ts +52 -52
  464. package/src/test-utils/fixtures/index.ts +4 -4
  465. package/src/test-utils/fixtures/memberships.ts +80 -80
  466. package/src/test-utils/fixtures/organizations.ts +69 -69
  467. package/src/test-utils/fixtures/users.ts +79 -79
  468. package/src/test-utils/index.ts +11 -11
  469. package/src/test-utils/mocks/index.ts +2 -2
  470. package/src/test-utils/mocks/supabase.ts +142 -142
  471. package/src/test-utils/mocks/workos.ts +108 -108
  472. package/src/test-utils/rls/RLSTestContext.ts +556 -556
  473. package/src/test-utils/rls/index.ts +1 -1
@@ -1,786 +1,786 @@
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
- SyncDealStageParams,
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 CrmUpdateDealStageParams = z.infer<typeof DealSchemas.DealIdParams> &
406
- z.infer<typeof DealSchemas.SyncDealStageRequest>
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
- updateDealStage: { params: CrmUpdateDealStageParams; result: void }
420
- createDealNote: { params: CrmDealNoteParams; result: AcqDealNote }
421
- listDealNotes: { params: Omit<ListDealNotesParams, 'organizationId'>; result: AcqDealNote[] }
422
- createDealTask: { params: CrmDealTaskParams; result: AcqDealTask }
423
- listDealTasks: { params: Omit<ListDealTasksParams, 'organizationId'>; result: AcqDealTask[] }
424
- listDealTasksDue: { params: CrmTaskDueParams; result: AcqDealTask[] }
425
- completeDealTask: { params: Omit<CompleteDealTaskParams, 'organizationId'>; result: AcqDealTask }
426
- recordActivity: { params: CrmRecordActivityParams; result: void }
427
- deleteDeal: { params: CrmDeleteDealParams; result: void }
428
- }
429
-
430
- // ---------------------------------------------------------------------------
431
- // Stripe (integration adapter, 6 methods)
432
- // ---------------------------------------------------------------------------
433
-
434
- export type StripeToolMap = {
435
- createPaymentLink: { params: CreatePaymentLinkParams; result: CreatePaymentLinkResult }
436
- getPaymentLink: { params: GetPaymentLinkParams; result: GetPaymentLinkResult }
437
- updatePaymentLink: { params: UpdatePaymentLinkParams; result: UpdatePaymentLinkResult }
438
- listPaymentLinks: { params: ListPaymentLinksParams; result: ListPaymentLinksResult }
439
- createAutoPaymentLink: { params: CreateAutoPaymentLinkParams; result: CreateAutoPaymentLinkResult }
440
- createCheckoutSession: { params: CreateCheckoutSessionParams; result: CreateCheckoutSessionResult }
441
- }
442
-
443
- // ---------------------------------------------------------------------------
444
- // Google Sheets (integration adapter, 13 methods)
445
- // ---------------------------------------------------------------------------
446
-
447
- export type GoogleSheetsToolMap = {
448
- readSheet: { params: ReadSheetParams; result: ReadSheetResult }
449
- writeSheet: { params: WriteSheetParams; result: WriteSheetResult }
450
- appendRows: { params: AppendRowsParams; result: AppendRowsResult }
451
- clearRange: { params: ClearRangeParams; result: ClearRangeResult }
452
- getSpreadsheetMetadata: { params: GetSpreadsheetMetadataParams; result: GetSpreadsheetMetadataResult }
453
- batchUpdate: { params: BatchUpdateParams; result: BatchUpdateResult }
454
- getHeaders: { params: GetHeadersParams; result: GetHeadersResult }
455
- getLastRow: { params: GetLastRowParams; result: GetLastRowResult }
456
- getRowByValue: { params: GetRowByValueParams; result: GetRowByValueResult }
457
- updateRowByValue: { params: UpdateRowByValueParams; result: UpdateRowByValueResult }
458
- upsertRow: { params: UpsertRowParams; result: UpsertRowResult }
459
- filterRows: { params: FilterRowsParams; result: FilterRowsResult }
460
- deleteRowByValue: { params: DeleteRowByValueParams; result: DeleteRowByValueResult }
461
- }
462
-
463
- // ---------------------------------------------------------------------------
464
- // Resend (integration adapter, 2 methods)
465
- // ---------------------------------------------------------------------------
466
-
467
- export type ResendToolMap = {
468
- sendEmail: { params: ResendSendEmailParams; result: ResendSendEmailResult }
469
- getEmail: { params: ResendGetEmailParams; result: ResendGetEmailResult }
470
- }
471
-
472
- // ---------------------------------------------------------------------------
473
- // Apify (integration adapter, 2 methods)
474
- // ---------------------------------------------------------------------------
475
-
476
- export type ApifyToolMap = {
477
- runActor: { params: RunActorParams; result: RunActorResult }
478
- getDatasetItems: { params: GetDatasetItemsParams; result: GetDatasetItemsResult }
479
- startActor: { params: StartActorParams; result: StartActorResult }
480
- }
481
-
482
- // ---------------------------------------------------------------------------
483
- // Gmail (integration adapter, 1 method)
484
- // ---------------------------------------------------------------------------
485
-
486
- export type GmailToolMap = {
487
- sendEmail: { params: GmailSendEmailParams; result: GmailSendEmailResult }
488
- }
489
-
490
- // ---------------------------------------------------------------------------
491
- // Dropbox (integration adapter, 2 methods)
492
- // ---------------------------------------------------------------------------
493
-
494
- export type DropboxToolMap = {
495
- uploadFile: { params: UploadFileParams; result: UploadFileResult }
496
- createFolder: { params: CreateFolderParams; result: CreateFolderResult }
497
- }
498
-
499
- // ---------------------------------------------------------------------------
500
- // SignatureAPI (integration adapter, 4 methods)
501
- // ---------------------------------------------------------------------------
502
-
503
- export type SignatureApiToolMap = {
504
- createEnvelope: { params: CreateEnvelopeParams; result: CreateEnvelopeResult }
505
- voidEnvelope: { params: VoidEnvelopeParams; result: VoidEnvelopeResult }
506
- downloadDocument: { params: DownloadDocumentParams; result: DownloadDocumentResult }
507
- getEnvelope: { params: GetEnvelopeParams; result: GetEnvelopeResult }
508
- }
509
-
510
- // ---------------------------------------------------------------------------
511
- // Instantly (integration adapter, 21 methods)
512
- // ---------------------------------------------------------------------------
513
-
514
- export type InstantlyToolMap = {
515
- sendReply: { params: SendReplyParams; result: SendReplyResult }
516
- removeFromSubsequence: { params: RemoveFromSubsequenceParams; result: RemoveFromSubsequenceResult }
517
- getEmails: { params: GetEmailsParams; result: GetEmailsResult }
518
- updateInterestStatus: { params: UpdateInterestStatusParams; result: UpdateInterestStatusResult }
519
- addToCampaign: { params: AddToCampaignParams; result: AddToCampaignResult }
520
- listCampaigns: { params: ListCampaignsParams; result: ListCampaignsResult }
521
- getCampaign: { params: GetCampaignParams; result: GetCampaignResult }
522
- updateCampaign: { params: UpdateCampaignParams; result: UpdateCampaignResult }
523
- pauseCampaign: { params: PauseCampaignParams; result: PauseCampaignResult }
524
- activateCampaign: { params: ActivateCampaignParams; result: ActivateCampaignResult }
525
- getCampaignAnalytics: { params: GetCampaignAnalyticsParams; result: GetCampaignAnalyticsResult }
526
- getStepAnalytics: { params: GetStepAnalyticsParams; result: GetStepAnalyticsResult }
527
- bulkAddLeads: { params: BulkAddLeadsParams; result: BulkAddLeadsResult }
528
- getAccountHealth: { params: GetAccountHealthParams; result: GetAccountHealthResult }
529
- createInboxTest: { params: CreateInboxTestParams; result: CreateInboxTestResult }
530
- createCampaign: { params: CreateCampaignParams; result: CreateCampaignResult }
531
- getDailyCampaignAnalytics: { params: GetDailyCampaignAnalyticsParams; result: GetDailyCampaignAnalyticsResult }
532
- listLeads: { params: ListLeadsParams; result: ListLeadsResult }
533
- bulkDeleteLeads: { params: BulkDeleteLeadsParams; result: BulkDeleteLeadsResult }
534
- deleteCampaign: { params: DeleteCampaignParams; result: DeleteCampaignResult }
535
- patchLead: { params: PatchLeadParams; result: PatchLeadResult }
536
- }
537
-
538
- // ---------------------------------------------------------------------------
539
- // Anymailfinder (integration adapter, 4 methods)
540
- // ---------------------------------------------------------------------------
541
-
542
- export type AnymailfinderToolMap = {
543
- findCompanyEmail: { params: FindCompanyEmailParams; result: FindCompanyEmailResult }
544
- findPersonEmail: { params: FindPersonEmailParams; result: FindPersonEmailResult }
545
- findDecisionMakerEmail: { params: FindDecisionMakerEmailParams; result: FindDecisionMakerEmailResult }
546
- verifyEmail: { params: VerifyEmailParams; result: VerifyEmailResult }
547
- }
548
-
549
- // ---------------------------------------------------------------------------
550
- // Tomba (integration adapter, 3 methods)
551
- // ---------------------------------------------------------------------------
552
-
553
- export type TombaToolMap = {
554
- emailFinder: { params: EmailFinderParams; result: EmailFinderResult }
555
- domainSearch: { params: DomainSearchParams; result: DomainSearchResult }
556
- emailVerifier: { params: EmailVerifierParams; result: EmailVerifierResult }
557
- }
558
-
559
- // ---------------------------------------------------------------------------
560
- // MillionVerifier (integration adapter, 2 methods)
561
- // ---------------------------------------------------------------------------
562
-
563
- export type MillionVerifierToolMap = {
564
- verifyEmail: { params: MillionVerifierVerifyEmailParams; result: MillionVerifierVerifyEmailResult }
565
- checkCredits: { params: MillionVerifierCheckCreditsParams; result: MillionVerifierCheckCreditsResult }
566
- }
567
-
568
- // ---------------------------------------------------------------------------
569
- // Lead (platform tool, 46 methods)
570
- // ---------------------------------------------------------------------------
571
-
572
- export type LeadToolMap = {
573
- // List operations
574
- listLists: { params: Record<string, never>; result: AcqList[] }
575
- createList: { params: Omit<CreateListParams, 'organizationId'>; result: AcqList }
576
- updateList: { params: { id: string } & UpdateListParams; result: AcqList }
577
- deleteList: { params: { id: string }; result: void }
578
- addContactsToList: { params: Omit<AddContactsToListParams, 'organizationId'>; result: AddContactsToListResult }
579
- // Company operations
580
- createCompany: { params: Omit<CreateCompanyParams, 'organizationId'>; result: AcqCompany }
581
- upsertCompany: { params: Omit<UpsertCompanyParams, 'organizationId'>; result: AcqCompany }
582
- updateCompany: { params: { id: string } & UpdateCompanyParams; result: AcqCompany }
583
- getCompany: { params: { id: string }; result: AcqCompany | null }
584
- listCompanies: { params: CompanyFilters; result: AcqCompany[] }
585
- deleteCompany: { params: { id: string }; result: void }
586
- // Contact operations
587
- createContact: { params: Omit<CreateContactParams, 'organizationId'>; result: AcqContact }
588
- upsertContact: { params: Omit<UpsertContactParams, 'organizationId'>; result: AcqContact }
589
- updateContact: { params: { id: string } & UpdateContactParams; result: AcqContact }
590
- getContact: { params: { id: string }; result: AcqContact | null }
591
- getContactByEmail: { params: { email: string }; result: AcqContact | null }
592
- listContacts: {
593
- params: ContactFilters & { limit?: number; offset?: number }
594
- result: PaginatedResult<AcqContact>
595
- }
596
- deleteContact: { params: { id: string }; result: void }
597
- bulkImportContacts: { params: Omit<BulkImportParams, 'organizationId'>; result: BulkImportResult }
598
- bulkImportCompanies: {
599
- params: Omit<BulkImportCompaniesParams, 'organizationId'>
600
- result: BulkImportCompaniesResult
601
- }
602
- deactivateContactsByCompany: {
603
- params: { companyId: string }
604
- result: { deactivated: number }
605
- }
606
- // Deal operations
607
- upsertDeal: { params: Omit<UpsertDealParams, 'organizationId'>; result: AcqDeal }
608
- getDealByEmail: { params: { email: string }; result: AcqDeal | null }
609
- getDealByEnvelopeId: { params: { envelopeId: string }; result: AcqDeal | null }
610
- updateDealEnvelopeId: { params: { dealId: string; envelopeId: string }; result: AcqDeal | null }
611
- getDealById: { params: Omit<GetDealByIdParams, 'organizationId'>; result: AcqDeal | null }
612
- getContactById: { params: Omit<GetContactByIdParams, 'organizationId'>; result: AcqContact | null }
613
- getCompanyById: { params: Omit<GetCompanyByIdParams, 'organizationId'>; result: AcqCompany | null }
614
- // Deal-sync operations
615
- updateDiscoveryData: { params: Omit<UpdateDiscoveryDataParams, 'organizationId'>; result: void }
616
- updateProposalData: { params: Omit<UpdateProposalDataParams, 'organizationId'>; result: void }
617
- markProposalSent: { params: Omit<MarkProposalSentParams, 'organizationId'>; result: void }
618
- markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
619
- updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
620
- updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
621
- syncDealStage: { params: Omit<SyncDealStageParams, 'organizationId'>; result: void }
622
- setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
623
- cancelSchedulesAndHitlByEmail: {
624
- params: Omit<CancelSchedulesAndHitlByEmailParams, 'organizationId'>
625
- result: { schedulesCancelled: number; hitlDeleted: number }
626
- }
627
- cancelHitlByDealId: { params: Omit<CancelHitlByDealIdParams, 'organizationId'>; result: { hitlDeleted: number } }
628
- clearDealFields: { params: Omit<ClearDealFieldsParams, 'organizationId'>; result: void }
629
- deleteDeal: { params: Omit<DeleteDealParams, 'organizationId'>; result: void }
630
- recordDealActivity: {
631
- params: Omit<RecordDealActivityParams, 'organizationId'>
632
- result: void
633
- }
634
- // Deal note operations
635
- createDealNote: {
636
- params: Omit<CreateDealNoteParams, 'organizationId'>
637
- result: AcqDealNote
638
- }
639
- listDealNotes: {
640
- params: Omit<ListDealNotesParams, 'organizationId'>
641
- result: AcqDealNote[]
642
- }
643
- // Deal task operations
644
- createDealTask: {
645
- params: Omit<CreateDealTaskParams, 'organizationId'>
646
- result: AcqDealTask
647
- }
648
- listDealTasks: {
649
- params: Omit<ListDealTasksParams, 'organizationId'>
650
- result: AcqDealTask[]
651
- }
652
- listDealTasksDue: {
653
- params: Omit<ListDealTasksDueParams, 'organizationId'>
654
- result: AcqDealTask[]
655
- }
656
- completeDealTask: {
657
- params: Omit<CompleteDealTaskParams, 'organizationId'>
658
- result: AcqDealTask
659
- }
660
- // Deal query & analytics operations
661
- listDeals: { params: DealFilters; result: AcqDeal[] }
662
- getDealPipelineAnalytics: { params: { recentLimit?: number }; result: DealPipelineAnalytics }
663
- // Enrichment data operations
664
- mergeEnrichmentData: {
665
- params: { id: string; table: 'acq_companies' | 'acq_contacts'; data: Record<string, unknown> }
666
- result: void
667
- }
668
- // Social monitoring operations
669
- upsertSocialPosts: {
670
- params: { posts: Omit<UpsertSocialPostParams, 'organizationId'>[] }
671
- result: UpsertSocialPostsResult
672
- }
673
- }
674
-
675
- // ---------------------------------------------------------------------------
676
- // List (platform tool, 4 methods)
677
- // ---------------------------------------------------------------------------
678
-
679
- export type ListToolMap = {
680
- getConfig: { params: { listId: string }; result: ListConfig }
681
- recordExecution: {
682
- params: Omit<RecordListExecutionParams, 'organizationId'>
683
- result: void
684
- }
685
- updateCompanyStage: {
686
- params: Omit<UpdateCompanyStageParams, 'organizationId'>
687
- result: void
688
- }
689
- updateContactStage: {
690
- params: Omit<UpdateContactStageParams, 'organizationId'>
691
- result: void
692
- }
693
- }
694
-
695
- // ---------------------------------------------------------------------------
696
- // PDF (platform tool, 2 methods)
697
- // ---------------------------------------------------------------------------
698
-
699
- export type PdfToolMap = {
700
- render: {
701
- params: {
702
- document: Record<string, unknown>
703
- theme?: Record<string, unknown>
704
- storage: { bucket: string; path: string }
705
- }
706
- result: { success: boolean; pdfUrl: string; size: number }
707
- }
708
- renderToBuffer: {
709
- params: {
710
- document: Record<string, unknown>
711
- theme?: Record<string, unknown>
712
- }
713
- result: { buffer: string }
714
- }
715
- }
716
-
717
- // ---------------------------------------------------------------------------
718
- // Approval (platform tool, 2 methods)
719
- // ---------------------------------------------------------------------------
720
-
721
- export type ApprovalToolMap = {
722
- create: {
723
- params: {
724
- actions: Array<{
725
- id: string
726
- label: string
727
- type: 'primary' | 'secondary' | 'danger' | 'outline'
728
- icon?: string
729
- color?: string
730
- target?: { resourceType: 'agent' | 'workflow'; resourceId: string; sessionId?: string }
731
- form?: Record<string, unknown>
732
- requiresConfirmation?: boolean
733
- confirmationMessage?: string
734
- description?: string
735
- }>
736
- context: Record<string, unknown>
737
- description?: string
738
- priority?: number
739
- humanCheckpoint?: string
740
- metadata?: Record<string, unknown>
741
- expiresAt?: string
742
- idempotencyKey?: string
743
- }
744
- result: { id: string }
745
- }
746
- deleteByMetadata: {
747
- params: { metadata: Record<string, unknown>; status?: string }
748
- result: { deleted: number }
749
- }
750
- }
751
-
752
- // ---------------------------------------------------------------------------
753
- // Execution (platform tool, 1 method)
754
- // ---------------------------------------------------------------------------
755
-
756
- export type ExecutionToolMap = {
757
- trigger: {
758
- params: { resourceId: string; input?: unknown }
759
- result: { success: boolean; executionId: string; output: unknown; error?: string }
760
- }
761
- triggerAsync: {
762
- params: { resourceId: string; input?: unknown }
763
- result: { executionId: string }
764
- }
765
- }
766
-
767
- // ---------------------------------------------------------------------------
768
- // Email (platform tool, 1 method)
769
- // ---------------------------------------------------------------------------
770
-
771
- export type EmailToolMap = {
772
- send: {
773
- params: {
774
- subject: string
775
- html?: string
776
- text?: string
777
- replyTo?: string
778
- tags?: Array<{ name: string; value: string }>
779
- } & (
780
- | { userIds: string[]; targetRole?: never; targetAll?: never }
781
- | { targetRole: string; userIds?: never; targetAll?: never }
782
- | { targetAll: true; userIds?: never; targetRole?: never }
783
- )
784
- result: { sent: number; failed: number; errors?: Array<{ userId: string; email: string; error: string }> }
785
- }
786
- }
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
+ SyncDealStageParams,
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 CrmUpdateDealStageParams = z.infer<typeof DealSchemas.DealIdParams> &
406
+ z.infer<typeof DealSchemas.SyncDealStageRequest>
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
+ updateDealStage: { params: CrmUpdateDealStageParams; result: void }
420
+ createDealNote: { params: CrmDealNoteParams; result: AcqDealNote }
421
+ listDealNotes: { params: Omit<ListDealNotesParams, 'organizationId'>; result: AcqDealNote[] }
422
+ createDealTask: { params: CrmDealTaskParams; result: AcqDealTask }
423
+ listDealTasks: { params: Omit<ListDealTasksParams, 'organizationId'>; result: AcqDealTask[] }
424
+ listDealTasksDue: { params: CrmTaskDueParams; result: AcqDealTask[] }
425
+ completeDealTask: { params: Omit<CompleteDealTaskParams, 'organizationId'>; result: AcqDealTask }
426
+ recordActivity: { params: CrmRecordActivityParams; result: void }
427
+ deleteDeal: { params: CrmDeleteDealParams; result: void }
428
+ }
429
+
430
+ // ---------------------------------------------------------------------------
431
+ // Stripe (integration adapter, 6 methods)
432
+ // ---------------------------------------------------------------------------
433
+
434
+ export type StripeToolMap = {
435
+ createPaymentLink: { params: CreatePaymentLinkParams; result: CreatePaymentLinkResult }
436
+ getPaymentLink: { params: GetPaymentLinkParams; result: GetPaymentLinkResult }
437
+ updatePaymentLink: { params: UpdatePaymentLinkParams; result: UpdatePaymentLinkResult }
438
+ listPaymentLinks: { params: ListPaymentLinksParams; result: ListPaymentLinksResult }
439
+ createAutoPaymentLink: { params: CreateAutoPaymentLinkParams; result: CreateAutoPaymentLinkResult }
440
+ createCheckoutSession: { params: CreateCheckoutSessionParams; result: CreateCheckoutSessionResult }
441
+ }
442
+
443
+ // ---------------------------------------------------------------------------
444
+ // Google Sheets (integration adapter, 13 methods)
445
+ // ---------------------------------------------------------------------------
446
+
447
+ export type GoogleSheetsToolMap = {
448
+ readSheet: { params: ReadSheetParams; result: ReadSheetResult }
449
+ writeSheet: { params: WriteSheetParams; result: WriteSheetResult }
450
+ appendRows: { params: AppendRowsParams; result: AppendRowsResult }
451
+ clearRange: { params: ClearRangeParams; result: ClearRangeResult }
452
+ getSpreadsheetMetadata: { params: GetSpreadsheetMetadataParams; result: GetSpreadsheetMetadataResult }
453
+ batchUpdate: { params: BatchUpdateParams; result: BatchUpdateResult }
454
+ getHeaders: { params: GetHeadersParams; result: GetHeadersResult }
455
+ getLastRow: { params: GetLastRowParams; result: GetLastRowResult }
456
+ getRowByValue: { params: GetRowByValueParams; result: GetRowByValueResult }
457
+ updateRowByValue: { params: UpdateRowByValueParams; result: UpdateRowByValueResult }
458
+ upsertRow: { params: UpsertRowParams; result: UpsertRowResult }
459
+ filterRows: { params: FilterRowsParams; result: FilterRowsResult }
460
+ deleteRowByValue: { params: DeleteRowByValueParams; result: DeleteRowByValueResult }
461
+ }
462
+
463
+ // ---------------------------------------------------------------------------
464
+ // Resend (integration adapter, 2 methods)
465
+ // ---------------------------------------------------------------------------
466
+
467
+ export type ResendToolMap = {
468
+ sendEmail: { params: ResendSendEmailParams; result: ResendSendEmailResult }
469
+ getEmail: { params: ResendGetEmailParams; result: ResendGetEmailResult }
470
+ }
471
+
472
+ // ---------------------------------------------------------------------------
473
+ // Apify (integration adapter, 2 methods)
474
+ // ---------------------------------------------------------------------------
475
+
476
+ export type ApifyToolMap = {
477
+ runActor: { params: RunActorParams; result: RunActorResult }
478
+ getDatasetItems: { params: GetDatasetItemsParams; result: GetDatasetItemsResult }
479
+ startActor: { params: StartActorParams; result: StartActorResult }
480
+ }
481
+
482
+ // ---------------------------------------------------------------------------
483
+ // Gmail (integration adapter, 1 method)
484
+ // ---------------------------------------------------------------------------
485
+
486
+ export type GmailToolMap = {
487
+ sendEmail: { params: GmailSendEmailParams; result: GmailSendEmailResult }
488
+ }
489
+
490
+ // ---------------------------------------------------------------------------
491
+ // Dropbox (integration adapter, 2 methods)
492
+ // ---------------------------------------------------------------------------
493
+
494
+ export type DropboxToolMap = {
495
+ uploadFile: { params: UploadFileParams; result: UploadFileResult }
496
+ createFolder: { params: CreateFolderParams; result: CreateFolderResult }
497
+ }
498
+
499
+ // ---------------------------------------------------------------------------
500
+ // SignatureAPI (integration adapter, 4 methods)
501
+ // ---------------------------------------------------------------------------
502
+
503
+ export type SignatureApiToolMap = {
504
+ createEnvelope: { params: CreateEnvelopeParams; result: CreateEnvelopeResult }
505
+ voidEnvelope: { params: VoidEnvelopeParams; result: VoidEnvelopeResult }
506
+ downloadDocument: { params: DownloadDocumentParams; result: DownloadDocumentResult }
507
+ getEnvelope: { params: GetEnvelopeParams; result: GetEnvelopeResult }
508
+ }
509
+
510
+ // ---------------------------------------------------------------------------
511
+ // Instantly (integration adapter, 21 methods)
512
+ // ---------------------------------------------------------------------------
513
+
514
+ export type InstantlyToolMap = {
515
+ sendReply: { params: SendReplyParams; result: SendReplyResult }
516
+ removeFromSubsequence: { params: RemoveFromSubsequenceParams; result: RemoveFromSubsequenceResult }
517
+ getEmails: { params: GetEmailsParams; result: GetEmailsResult }
518
+ updateInterestStatus: { params: UpdateInterestStatusParams; result: UpdateInterestStatusResult }
519
+ addToCampaign: { params: AddToCampaignParams; result: AddToCampaignResult }
520
+ listCampaigns: { params: ListCampaignsParams; result: ListCampaignsResult }
521
+ getCampaign: { params: GetCampaignParams; result: GetCampaignResult }
522
+ updateCampaign: { params: UpdateCampaignParams; result: UpdateCampaignResult }
523
+ pauseCampaign: { params: PauseCampaignParams; result: PauseCampaignResult }
524
+ activateCampaign: { params: ActivateCampaignParams; result: ActivateCampaignResult }
525
+ getCampaignAnalytics: { params: GetCampaignAnalyticsParams; result: GetCampaignAnalyticsResult }
526
+ getStepAnalytics: { params: GetStepAnalyticsParams; result: GetStepAnalyticsResult }
527
+ bulkAddLeads: { params: BulkAddLeadsParams; result: BulkAddLeadsResult }
528
+ getAccountHealth: { params: GetAccountHealthParams; result: GetAccountHealthResult }
529
+ createInboxTest: { params: CreateInboxTestParams; result: CreateInboxTestResult }
530
+ createCampaign: { params: CreateCampaignParams; result: CreateCampaignResult }
531
+ getDailyCampaignAnalytics: { params: GetDailyCampaignAnalyticsParams; result: GetDailyCampaignAnalyticsResult }
532
+ listLeads: { params: ListLeadsParams; result: ListLeadsResult }
533
+ bulkDeleteLeads: { params: BulkDeleteLeadsParams; result: BulkDeleteLeadsResult }
534
+ deleteCampaign: { params: DeleteCampaignParams; result: DeleteCampaignResult }
535
+ patchLead: { params: PatchLeadParams; result: PatchLeadResult }
536
+ }
537
+
538
+ // ---------------------------------------------------------------------------
539
+ // Anymailfinder (integration adapter, 4 methods)
540
+ // ---------------------------------------------------------------------------
541
+
542
+ export type AnymailfinderToolMap = {
543
+ findCompanyEmail: { params: FindCompanyEmailParams; result: FindCompanyEmailResult }
544
+ findPersonEmail: { params: FindPersonEmailParams; result: FindPersonEmailResult }
545
+ findDecisionMakerEmail: { params: FindDecisionMakerEmailParams; result: FindDecisionMakerEmailResult }
546
+ verifyEmail: { params: VerifyEmailParams; result: VerifyEmailResult }
547
+ }
548
+
549
+ // ---------------------------------------------------------------------------
550
+ // Tomba (integration adapter, 3 methods)
551
+ // ---------------------------------------------------------------------------
552
+
553
+ export type TombaToolMap = {
554
+ emailFinder: { params: EmailFinderParams; result: EmailFinderResult }
555
+ domainSearch: { params: DomainSearchParams; result: DomainSearchResult }
556
+ emailVerifier: { params: EmailVerifierParams; result: EmailVerifierResult }
557
+ }
558
+
559
+ // ---------------------------------------------------------------------------
560
+ // MillionVerifier (integration adapter, 2 methods)
561
+ // ---------------------------------------------------------------------------
562
+
563
+ export type MillionVerifierToolMap = {
564
+ verifyEmail: { params: MillionVerifierVerifyEmailParams; result: MillionVerifierVerifyEmailResult }
565
+ checkCredits: { params: MillionVerifierCheckCreditsParams; result: MillionVerifierCheckCreditsResult }
566
+ }
567
+
568
+ // ---------------------------------------------------------------------------
569
+ // Lead (platform tool, 46 methods)
570
+ // ---------------------------------------------------------------------------
571
+
572
+ export type LeadToolMap = {
573
+ // List operations
574
+ listLists: { params: Record<string, never>; result: AcqList[] }
575
+ createList: { params: Omit<CreateListParams, 'organizationId'>; result: AcqList }
576
+ updateList: { params: { id: string } & UpdateListParams; result: AcqList }
577
+ deleteList: { params: { id: string }; result: void }
578
+ addContactsToList: { params: Omit<AddContactsToListParams, 'organizationId'>; result: AddContactsToListResult }
579
+ // Company operations
580
+ createCompany: { params: Omit<CreateCompanyParams, 'organizationId'>; result: AcqCompany }
581
+ upsertCompany: { params: Omit<UpsertCompanyParams, 'organizationId'>; result: AcqCompany }
582
+ updateCompany: { params: { id: string } & UpdateCompanyParams; result: AcqCompany }
583
+ getCompany: { params: { id: string }; result: AcqCompany | null }
584
+ listCompanies: { params: CompanyFilters; result: AcqCompany[] }
585
+ deleteCompany: { params: { id: string }; result: void }
586
+ // Contact operations
587
+ createContact: { params: Omit<CreateContactParams, 'organizationId'>; result: AcqContact }
588
+ upsertContact: { params: Omit<UpsertContactParams, 'organizationId'>; result: AcqContact }
589
+ updateContact: { params: { id: string } & UpdateContactParams; result: AcqContact }
590
+ getContact: { params: { id: string }; result: AcqContact | null }
591
+ getContactByEmail: { params: { email: string }; result: AcqContact | null }
592
+ listContacts: {
593
+ params: ContactFilters & { limit?: number; offset?: number }
594
+ result: PaginatedResult<AcqContact>
595
+ }
596
+ deleteContact: { params: { id: string }; result: void }
597
+ bulkImportContacts: { params: Omit<BulkImportParams, 'organizationId'>; result: BulkImportResult }
598
+ bulkImportCompanies: {
599
+ params: Omit<BulkImportCompaniesParams, 'organizationId'>
600
+ result: BulkImportCompaniesResult
601
+ }
602
+ deactivateContactsByCompany: {
603
+ params: { companyId: string }
604
+ result: { deactivated: number }
605
+ }
606
+ // Deal operations
607
+ upsertDeal: { params: Omit<UpsertDealParams, 'organizationId'>; result: AcqDeal }
608
+ getDealByEmail: { params: { email: string }; result: AcqDeal | null }
609
+ getDealByEnvelopeId: { params: { envelopeId: string }; result: AcqDeal | null }
610
+ updateDealEnvelopeId: { params: { dealId: string; envelopeId: string }; result: AcqDeal | null }
611
+ getDealById: { params: Omit<GetDealByIdParams, 'organizationId'>; result: AcqDeal | null }
612
+ getContactById: { params: Omit<GetContactByIdParams, 'organizationId'>; result: AcqContact | null }
613
+ getCompanyById: { params: Omit<GetCompanyByIdParams, 'organizationId'>; result: AcqCompany | null }
614
+ // Deal-sync operations
615
+ updateDiscoveryData: { params: Omit<UpdateDiscoveryDataParams, 'organizationId'>; result: void }
616
+ updateProposalData: { params: Omit<UpdateProposalDataParams, 'organizationId'>; result: void }
617
+ markProposalSent: { params: Omit<MarkProposalSentParams, 'organizationId'>; result: void }
618
+ markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
619
+ updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
620
+ updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
621
+ syncDealStage: { params: Omit<SyncDealStageParams, 'organizationId'>; result: void }
622
+ setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
623
+ cancelSchedulesAndHitlByEmail: {
624
+ params: Omit<CancelSchedulesAndHitlByEmailParams, 'organizationId'>
625
+ result: { schedulesCancelled: number; hitlDeleted: number }
626
+ }
627
+ cancelHitlByDealId: { params: Omit<CancelHitlByDealIdParams, 'organizationId'>; result: { hitlDeleted: number } }
628
+ clearDealFields: { params: Omit<ClearDealFieldsParams, 'organizationId'>; result: void }
629
+ deleteDeal: { params: Omit<DeleteDealParams, 'organizationId'>; result: void }
630
+ recordDealActivity: {
631
+ params: Omit<RecordDealActivityParams, 'organizationId'>
632
+ result: void
633
+ }
634
+ // Deal note operations
635
+ createDealNote: {
636
+ params: Omit<CreateDealNoteParams, 'organizationId'>
637
+ result: AcqDealNote
638
+ }
639
+ listDealNotes: {
640
+ params: Omit<ListDealNotesParams, 'organizationId'>
641
+ result: AcqDealNote[]
642
+ }
643
+ // Deal task operations
644
+ createDealTask: {
645
+ params: Omit<CreateDealTaskParams, 'organizationId'>
646
+ result: AcqDealTask
647
+ }
648
+ listDealTasks: {
649
+ params: Omit<ListDealTasksParams, 'organizationId'>
650
+ result: AcqDealTask[]
651
+ }
652
+ listDealTasksDue: {
653
+ params: Omit<ListDealTasksDueParams, 'organizationId'>
654
+ result: AcqDealTask[]
655
+ }
656
+ completeDealTask: {
657
+ params: Omit<CompleteDealTaskParams, 'organizationId'>
658
+ result: AcqDealTask
659
+ }
660
+ // Deal query & analytics operations
661
+ listDeals: { params: DealFilters; result: AcqDeal[] }
662
+ getDealPipelineAnalytics: { params: { recentLimit?: number }; result: DealPipelineAnalytics }
663
+ // Enrichment data operations
664
+ mergeEnrichmentData: {
665
+ params: { id: string; table: 'acq_companies' | 'acq_contacts'; data: Record<string, unknown> }
666
+ result: void
667
+ }
668
+ // Social monitoring operations
669
+ upsertSocialPosts: {
670
+ params: { posts: Omit<UpsertSocialPostParams, 'organizationId'>[] }
671
+ result: UpsertSocialPostsResult
672
+ }
673
+ }
674
+
675
+ // ---------------------------------------------------------------------------
676
+ // List (platform tool, 4 methods)
677
+ // ---------------------------------------------------------------------------
678
+
679
+ export type ListToolMap = {
680
+ getConfig: { params: { listId: string }; result: ListConfig }
681
+ recordExecution: {
682
+ params: Omit<RecordListExecutionParams, 'organizationId'>
683
+ result: void
684
+ }
685
+ updateCompanyStage: {
686
+ params: Omit<UpdateCompanyStageParams, 'organizationId'>
687
+ result: void
688
+ }
689
+ updateContactStage: {
690
+ params: Omit<UpdateContactStageParams, 'organizationId'>
691
+ result: void
692
+ }
693
+ }
694
+
695
+ // ---------------------------------------------------------------------------
696
+ // PDF (platform tool, 2 methods)
697
+ // ---------------------------------------------------------------------------
698
+
699
+ export type PdfToolMap = {
700
+ render: {
701
+ params: {
702
+ document: Record<string, unknown>
703
+ theme?: Record<string, unknown>
704
+ storage: { bucket: string; path: string }
705
+ }
706
+ result: { success: boolean; pdfUrl: string; size: number }
707
+ }
708
+ renderToBuffer: {
709
+ params: {
710
+ document: Record<string, unknown>
711
+ theme?: Record<string, unknown>
712
+ }
713
+ result: { buffer: string }
714
+ }
715
+ }
716
+
717
+ // ---------------------------------------------------------------------------
718
+ // Approval (platform tool, 2 methods)
719
+ // ---------------------------------------------------------------------------
720
+
721
+ export type ApprovalToolMap = {
722
+ create: {
723
+ params: {
724
+ actions: Array<{
725
+ id: string
726
+ label: string
727
+ type: 'primary' | 'secondary' | 'danger' | 'outline'
728
+ icon?: string
729
+ color?: string
730
+ target?: { resourceType: 'agent' | 'workflow'; resourceId: string; sessionId?: string }
731
+ form?: Record<string, unknown>
732
+ requiresConfirmation?: boolean
733
+ confirmationMessage?: string
734
+ description?: string
735
+ }>
736
+ context: Record<string, unknown>
737
+ description?: string
738
+ priority?: number
739
+ humanCheckpoint?: string
740
+ metadata?: Record<string, unknown>
741
+ expiresAt?: string
742
+ idempotencyKey?: string
743
+ }
744
+ result: { id: string }
745
+ }
746
+ deleteByMetadata: {
747
+ params: { metadata: Record<string, unknown>; status?: string }
748
+ result: { deleted: number }
749
+ }
750
+ }
751
+
752
+ // ---------------------------------------------------------------------------
753
+ // Execution (platform tool, 1 method)
754
+ // ---------------------------------------------------------------------------
755
+
756
+ export type ExecutionToolMap = {
757
+ trigger: {
758
+ params: { resourceId: string; input?: unknown }
759
+ result: { success: boolean; executionId: string; output: unknown; error?: string }
760
+ }
761
+ triggerAsync: {
762
+ params: { resourceId: string; input?: unknown }
763
+ result: { executionId: string }
764
+ }
765
+ }
766
+
767
+ // ---------------------------------------------------------------------------
768
+ // Email (platform tool, 1 method)
769
+ // ---------------------------------------------------------------------------
770
+
771
+ export type EmailToolMap = {
772
+ send: {
773
+ params: {
774
+ subject: string
775
+ html?: string
776
+ text?: string
777
+ replyTo?: string
778
+ tags?: Array<{ name: string; value: string }>
779
+ } & (
780
+ | { userIds: string[]; targetRole?: never; targetAll?: never }
781
+ | { targetRole: string; userIds?: never; targetAll?: never }
782
+ | { targetAll: true; userIds?: never; targetRole?: never }
783
+ )
784
+ result: { sent: number; failed: number; errors?: Array<{ userId: string; email: string; error: string }> }
785
+ }
786
+ }