@minded-ai/mindedjs 1.0.0-ec2-beta-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (454) hide show
  1. package/README.md +6 -0
  2. package/dist/agent.d.ts +256 -0
  3. package/dist/agent.d.ts.map +1 -0
  4. package/dist/agent.js +896 -0
  5. package/dist/agent.js.map +1 -0
  6. package/dist/browserTask/README.md +419 -0
  7. package/dist/browserTask/browserAgent.py +632 -0
  8. package/dist/browserTask/captcha_isolated.png +0 -0
  9. package/dist/browserTask/executeBrowserTask.d.ts +14 -0
  10. package/dist/browserTask/executeBrowserTask.d.ts.map +1 -0
  11. package/dist/browserTask/executeBrowserTask.js +195 -0
  12. package/dist/browserTask/executeBrowserTask.js.map +1 -0
  13. package/dist/browserTask/executeBrowserTask.py +153 -0
  14. package/dist/browserTask/executeBrowserTask.ts +79 -0
  15. package/dist/browserTask/localBrowserTask.d.ts +49 -0
  16. package/dist/browserTask/localBrowserTask.d.ts.map +1 -0
  17. package/dist/browserTask/localBrowserTask.js +284 -0
  18. package/dist/browserTask/localBrowserTask.js.map +1 -0
  19. package/dist/browserTask/requirements.txt +8 -0
  20. package/dist/browserTask/setup.sh +144 -0
  21. package/dist/browserTask/types.d.ts +35 -0
  22. package/dist/browserTask/types.d.ts.map +1 -0
  23. package/dist/browserTask/types.js +10 -0
  24. package/dist/browserTask/types.js.map +1 -0
  25. package/dist/checkpointer/checkpointSaverFactory.d.ts +7 -0
  26. package/dist/checkpointer/checkpointSaverFactory.d.ts.map +1 -0
  27. package/dist/checkpointer/checkpointSaverFactory.js +53 -0
  28. package/dist/checkpointer/checkpointSaverFactory.js.map +1 -0
  29. package/dist/cli/index.d.ts +3 -0
  30. package/dist/cli/index.d.ts.map +1 -0
  31. package/dist/cli/index.js +209 -0
  32. package/dist/cli/index.js.map +1 -0
  33. package/dist/cli/lambdaHandlerTemplate.d.ts +10 -0
  34. package/dist/cli/lambdaHandlerTemplate.d.ts.map +1 -0
  35. package/dist/cli/lambdaHandlerTemplate.js +76 -0
  36. package/dist/cli/lambdaHandlerTemplate.js.map +1 -0
  37. package/dist/cli/lambdaHandlerTemplate.ts +78 -0
  38. package/dist/cli/localOperatorSetup.d.ts +6 -0
  39. package/dist/cli/localOperatorSetup.d.ts.map +1 -0
  40. package/dist/cli/localOperatorSetup.js +310 -0
  41. package/dist/cli/localOperatorSetup.js.map +1 -0
  42. package/dist/debugging/index.d.ts +2 -0
  43. package/dist/debugging/index.d.ts.map +1 -0
  44. package/dist/debugging/index.js +6 -0
  45. package/dist/debugging/index.js.map +1 -0
  46. package/dist/debugging/llmCallbackHandler.d.ts +36 -0
  47. package/dist/debugging/llmCallbackHandler.d.ts.map +1 -0
  48. package/dist/debugging/llmCallbackHandler.js +101 -0
  49. package/dist/debugging/llmCallbackHandler.js.map +1 -0
  50. package/dist/edges/createDirectEdge.d.ts +4 -0
  51. package/dist/edges/createDirectEdge.d.ts.map +1 -0
  52. package/dist/edges/createDirectEdge.js +24 -0
  53. package/dist/edges/createDirectEdge.js.map +1 -0
  54. package/dist/edges/createLogicalRouter.d.ts +8 -0
  55. package/dist/edges/createLogicalRouter.d.ts.map +1 -0
  56. package/dist/edges/createLogicalRouter.js +194 -0
  57. package/dist/edges/createLogicalRouter.js.map +1 -0
  58. package/dist/edges/createPromptRouter.d.ts +12 -0
  59. package/dist/edges/createPromptRouter.d.ts.map +1 -0
  60. package/dist/edges/createPromptRouter.js +176 -0
  61. package/dist/edges/createPromptRouter.js.map +1 -0
  62. package/dist/edges/edgeFactory.d.ts +14 -0
  63. package/dist/edges/edgeFactory.d.ts.map +1 -0
  64. package/dist/edges/edgeFactory.js +125 -0
  65. package/dist/edges/edgeFactory.js.map +1 -0
  66. package/dist/events/AgentEvents.d.ts +56 -0
  67. package/dist/events/AgentEvents.d.ts.map +1 -0
  68. package/dist/events/AgentEvents.js +13 -0
  69. package/dist/events/AgentEvents.js.map +1 -0
  70. package/dist/events/index.d.ts +3 -0
  71. package/dist/events/index.d.ts.map +1 -0
  72. package/dist/events/index.js +5 -0
  73. package/dist/events/index.js.map +1 -0
  74. package/dist/index.d.ts +35 -0
  75. package/dist/index.d.ts.map +1 -0
  76. package/dist/index.js +98 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/interfaces/zendesk.d.ts +35 -0
  79. package/dist/interfaces/zendesk.d.ts.map +1 -0
  80. package/dist/interfaces/zendesk.js +219 -0
  81. package/dist/interfaces/zendesk.js.map +1 -0
  82. package/dist/internalTools/appActionRunnerTool.d.ts +5 -0
  83. package/dist/internalTools/appActionRunnerTool.d.ts.map +1 -0
  84. package/dist/internalTools/appActionRunnerTool.js +88 -0
  85. package/dist/internalTools/appActionRunnerTool.js.map +1 -0
  86. package/dist/internalTools/documentExtraction/documentExtraction.d.ts +129 -0
  87. package/dist/internalTools/documentExtraction/documentExtraction.d.ts.map +1 -0
  88. package/dist/internalTools/documentExtraction/documentExtraction.js +736 -0
  89. package/dist/internalTools/documentExtraction/documentExtraction.js.map +1 -0
  90. package/dist/internalTools/documentExtraction/types.d.ts +29 -0
  91. package/dist/internalTools/documentExtraction/types.d.ts.map +1 -0
  92. package/dist/internalTools/documentExtraction/types.js +35 -0
  93. package/dist/internalTools/documentExtraction/types.js.map +1 -0
  94. package/dist/internalTools/libraryActionRunnerTool.d.ts +4 -0
  95. package/dist/internalTools/libraryActionRunnerTool.d.ts.map +1 -0
  96. package/dist/internalTools/libraryActionRunnerTool.js +53 -0
  97. package/dist/internalTools/libraryActionRunnerTool.js.map +1 -0
  98. package/dist/internalTools/retell.d.ts +12 -0
  99. package/dist/internalTools/retell.d.ts.map +1 -0
  100. package/dist/internalTools/retell.js +54 -0
  101. package/dist/internalTools/retell.js.map +1 -0
  102. package/dist/internalTools/sendPlaceholderMessage.d.ts +14 -0
  103. package/dist/internalTools/sendPlaceholderMessage.d.ts.map +1 -0
  104. package/dist/internalTools/sendPlaceholderMessage.js +61 -0
  105. package/dist/internalTools/sendPlaceholderMessage.js.map +1 -0
  106. package/dist/internalTools/timer.d.ts +99 -0
  107. package/dist/internalTools/timer.d.ts.map +1 -0
  108. package/dist/internalTools/timer.js +139 -0
  109. package/dist/internalTools/timer.js.map +1 -0
  110. package/dist/internalTools/voice/escalateVoiceCall.d.ts +2 -0
  111. package/dist/internalTools/voice/escalateVoiceCall.d.ts.map +1 -0
  112. package/dist/internalTools/voice/escalateVoiceCall.js +52 -0
  113. package/dist/internalTools/voice/escalateVoiceCall.js.map +1 -0
  114. package/dist/internalTools/voice/retell.d.ts +12 -0
  115. package/dist/internalTools/voice/retell.d.ts.map +1 -0
  116. package/dist/internalTools/voice/retell.js +54 -0
  117. package/dist/internalTools/voice/retell.js.map +1 -0
  118. package/dist/internalTools/voice/sendPlaceholderMessage.d.ts +14 -0
  119. package/dist/internalTools/voice/sendPlaceholderMessage.d.ts.map +1 -0
  120. package/dist/internalTools/voice/sendPlaceholderMessage.js +61 -0
  121. package/dist/internalTools/voice/sendPlaceholderMessage.js.map +1 -0
  122. package/dist/interrupts/BaseInterruptSessionManager.d.ts +49 -0
  123. package/dist/interrupts/BaseInterruptSessionManager.d.ts.map +1 -0
  124. package/dist/interrupts/BaseInterruptSessionManager.js +34 -0
  125. package/dist/interrupts/BaseInterruptSessionManager.js.map +1 -0
  126. package/dist/interrupts/MemoryInterruptSessionManager.d.ts +14 -0
  127. package/dist/interrupts/MemoryInterruptSessionManager.d.ts.map +1 -0
  128. package/dist/interrupts/MemoryInterruptSessionManager.js +60 -0
  129. package/dist/interrupts/MemoryInterruptSessionManager.js.map +1 -0
  130. package/dist/interrupts/MindedInterruptSessionManager.d.ts +13 -0
  131. package/dist/interrupts/MindedInterruptSessionManager.d.ts.map +1 -0
  132. package/dist/interrupts/MindedInterruptSessionManager.js +162 -0
  133. package/dist/interrupts/MindedInterruptSessionManager.js.map +1 -0
  134. package/dist/interrupts/interruptSessionManagerFactory.d.ts +3 -0
  135. package/dist/interrupts/interruptSessionManagerFactory.d.ts.map +1 -0
  136. package/dist/interrupts/interruptSessionManagerFactory.js +56 -0
  137. package/dist/interrupts/interruptSessionManagerFactory.js.map +1 -0
  138. package/dist/llm/createLlmInstance.d.ts +3 -0
  139. package/dist/llm/createLlmInstance.d.ts.map +1 -0
  140. package/dist/llm/createLlmInstance.js +31 -0
  141. package/dist/llm/createLlmInstance.js.map +1 -0
  142. package/dist/nodes/addAppToolNode.d.ts +13 -0
  143. package/dist/nodes/addAppToolNode.d.ts.map +1 -0
  144. package/dist/nodes/addAppToolNode.js +87 -0
  145. package/dist/nodes/addAppToolNode.js.map +1 -0
  146. package/dist/nodes/addBrowserTaskNode.d.ts +13 -0
  147. package/dist/nodes/addBrowserTaskNode.d.ts.map +1 -0
  148. package/dist/nodes/addBrowserTaskNode.js +167 -0
  149. package/dist/nodes/addBrowserTaskNode.js.map +1 -0
  150. package/dist/nodes/addBrowserTaskRunNode.d.ts +13 -0
  151. package/dist/nodes/addBrowserTaskRunNode.d.ts.map +1 -0
  152. package/dist/nodes/addBrowserTaskRunNode.js +167 -0
  153. package/dist/nodes/addBrowserTaskRunNode.js.map +1 -0
  154. package/dist/nodes/addHumanInTheLoopNode.d.ts +9 -0
  155. package/dist/nodes/addHumanInTheLoopNode.d.ts.map +1 -0
  156. package/dist/nodes/addHumanInTheLoopNode.js +22 -0
  157. package/dist/nodes/addHumanInTheLoopNode.js.map +1 -0
  158. package/dist/nodes/addJumpToNode.d.ts +7 -0
  159. package/dist/nodes/addJumpToNode.d.ts.map +1 -0
  160. package/dist/nodes/addJumpToNode.js +24 -0
  161. package/dist/nodes/addJumpToNode.js.map +1 -0
  162. package/dist/nodes/addJunctionNode.d.ts +7 -0
  163. package/dist/nodes/addJunctionNode.d.ts.map +1 -0
  164. package/dist/nodes/addJunctionNode.js +20 -0
  165. package/dist/nodes/addJunctionNode.js.map +1 -0
  166. package/dist/nodes/addPromptNode.d.ts +18 -0
  167. package/dist/nodes/addPromptNode.d.ts.map +1 -0
  168. package/dist/nodes/addPromptNode.js +253 -0
  169. package/dist/nodes/addPromptNode.js.map +1 -0
  170. package/dist/nodes/addRpaNode.d.ts +18 -0
  171. package/dist/nodes/addRpaNode.d.ts.map +1 -0
  172. package/dist/nodes/addRpaNode.js +180 -0
  173. package/dist/nodes/addRpaNode.js.map +1 -0
  174. package/dist/nodes/addToolNode.d.ts +13 -0
  175. package/dist/nodes/addToolNode.d.ts.map +1 -0
  176. package/dist/nodes/addToolNode.js +67 -0
  177. package/dist/nodes/addToolNode.js.map +1 -0
  178. package/dist/nodes/addToolRunNode.d.ts +17 -0
  179. package/dist/nodes/addToolRunNode.d.ts.map +1 -0
  180. package/dist/nodes/addToolRunNode.js +59 -0
  181. package/dist/nodes/addToolRunNode.js.map +1 -0
  182. package/dist/nodes/addTriggerNode.d.ts +7 -0
  183. package/dist/nodes/addTriggerNode.d.ts.map +1 -0
  184. package/dist/nodes/addTriggerNode.js +25 -0
  185. package/dist/nodes/addTriggerNode.js.map +1 -0
  186. package/dist/nodes/compilePrompt.d.ts +5 -0
  187. package/dist/nodes/compilePrompt.d.ts.map +1 -0
  188. package/dist/nodes/compilePrompt.js +76 -0
  189. package/dist/nodes/compilePrompt.js.map +1 -0
  190. package/dist/nodes/nodeFactory.d.ts +16 -0
  191. package/dist/nodes/nodeFactory.d.ts.map +1 -0
  192. package/dist/nodes/nodeFactory.js +45 -0
  193. package/dist/nodes/nodeFactory.js.map +1 -0
  194. package/dist/nodes/rpaStepsExecutor.d.ts +5 -0
  195. package/dist/nodes/rpaStepsExecutor.d.ts.map +1 -0
  196. package/dist/nodes/rpaStepsExecutor.js +156 -0
  197. package/dist/nodes/rpaStepsExecutor.js.map +1 -0
  198. package/dist/platform/config.d.ts +16 -0
  199. package/dist/platform/config.d.ts.map +1 -0
  200. package/dist/platform/config.js +80 -0
  201. package/dist/platform/config.js.map +1 -0
  202. package/dist/platform/mindedCheckpointSaver.d.ts +10 -0
  203. package/dist/platform/mindedCheckpointSaver.d.ts.map +1 -0
  204. package/dist/platform/mindedCheckpointSaver.js +137 -0
  205. package/dist/platform/mindedCheckpointSaver.js.map +1 -0
  206. package/dist/platform/mindedConnection.d.ts +15 -0
  207. package/dist/platform/mindedConnection.d.ts.map +1 -0
  208. package/dist/platform/mindedConnection.js +254 -0
  209. package/dist/platform/mindedConnection.js.map +1 -0
  210. package/dist/platform/mindedConnectionTypes.d.ts +404 -0
  211. package/dist/platform/mindedConnectionTypes.d.ts.map +1 -0
  212. package/dist/platform/mindedConnectionTypes.js +51 -0
  213. package/dist/platform/mindedConnectionTypes.js.map +1 -0
  214. package/dist/platform/models/mindedChatOpenAI.d.ts +20 -0
  215. package/dist/platform/models/mindedChatOpenAI.d.ts.map +1 -0
  216. package/dist/platform/models/mindedChatOpenAI.js +32 -0
  217. package/dist/platform/models/mindedChatOpenAI.js.map +1 -0
  218. package/dist/platform/models/parallelWrapper.d.ts +17 -0
  219. package/dist/platform/models/parallelWrapper.d.ts.map +1 -0
  220. package/dist/platform/models/parallelWrapper.js +105 -0
  221. package/dist/platform/models/parallelWrapper.js.map +1 -0
  222. package/dist/platform/piiGateway/gateway.d.ts +14 -0
  223. package/dist/platform/piiGateway/gateway.d.ts.map +1 -0
  224. package/dist/platform/piiGateway/gateway.js +117 -0
  225. package/dist/platform/piiGateway/gateway.js.map +1 -0
  226. package/dist/platform/piiGateway/index.d.ts +3 -0
  227. package/dist/platform/piiGateway/index.d.ts.map +1 -0
  228. package/dist/platform/piiGateway/index.js +7 -0
  229. package/dist/platform/piiGateway/index.js.map +1 -0
  230. package/dist/platform/piiGateway/types.d.ts +27 -0
  231. package/dist/platform/piiGateway/types.d.ts.map +1 -0
  232. package/dist/platform/piiGateway/types.js +3 -0
  233. package/dist/platform/piiGateway/types.js.map +1 -0
  234. package/dist/platform/toolExecutor.d.ts +29 -0
  235. package/dist/platform/toolExecutor.d.ts.map +1 -0
  236. package/dist/platform/toolExecutor.js +84 -0
  237. package/dist/platform/toolExecutor.js.map +1 -0
  238. package/dist/platform/utils/parseAttachments.d.ts +14 -0
  239. package/dist/platform/utils/parseAttachments.d.ts.map +1 -0
  240. package/dist/platform/utils/parseAttachments.js +53 -0
  241. package/dist/platform/utils/parseAttachments.js.map +1 -0
  242. package/dist/platform/utils/tools.d.ts +6 -0
  243. package/dist/platform/utils/tools.d.ts.map +1 -0
  244. package/dist/platform/utils/tools.js +57 -0
  245. package/dist/platform/utils/tools.js.map +1 -0
  246. package/dist/playbooks/playbooks.d.ts +15 -0
  247. package/dist/playbooks/playbooks.d.ts.map +1 -0
  248. package/dist/playbooks/playbooks.js +208 -0
  249. package/dist/playbooks/playbooks.js.map +1 -0
  250. package/dist/toolsLibrary/classifier.d.ts +74 -0
  251. package/dist/toolsLibrary/classifier.d.ts.map +1 -0
  252. package/dist/toolsLibrary/classifier.js +256 -0
  253. package/dist/toolsLibrary/classifier.js.map +1 -0
  254. package/dist/toolsLibrary/extraction.d.ts +83 -0
  255. package/dist/toolsLibrary/extraction.d.ts.map +1 -0
  256. package/dist/toolsLibrary/extraction.js +328 -0
  257. package/dist/toolsLibrary/extraction.js.map +1 -0
  258. package/dist/toolsLibrary/index.d.ts +9 -0
  259. package/dist/toolsLibrary/index.d.ts.map +1 -0
  260. package/dist/toolsLibrary/index.js +46 -0
  261. package/dist/toolsLibrary/index.js.map +1 -0
  262. package/dist/toolsLibrary/parseDocument.d.ts +30 -0
  263. package/dist/toolsLibrary/parseDocument.d.ts.map +1 -0
  264. package/dist/toolsLibrary/parseDocument.js +119 -0
  265. package/dist/toolsLibrary/parseDocument.js.map +1 -0
  266. package/dist/triggers/triggerTypeToDefaultMessage.d.ts +4 -0
  267. package/dist/triggers/triggerTypeToDefaultMessage.d.ts.map +1 -0
  268. package/dist/triggers/triggerTypeToDefaultMessage.js +10 -0
  269. package/dist/triggers/triggerTypeToDefaultMessage.js.map +1 -0
  270. package/dist/types/Agent.types.d.ts +60 -0
  271. package/dist/types/Agent.types.d.ts.map +1 -0
  272. package/dist/types/Agent.types.js +9 -0
  273. package/dist/types/Agent.types.js.map +1 -0
  274. package/dist/types/Flows.types.d.ts +232 -0
  275. package/dist/types/Flows.types.d.ts.map +1 -0
  276. package/dist/types/Flows.types.js +65 -0
  277. package/dist/types/Flows.types.js.map +1 -0
  278. package/dist/types/LLM.types.d.ts +7 -0
  279. package/dist/types/LLM.types.d.ts.map +1 -0
  280. package/dist/types/LLM.types.js +11 -0
  281. package/dist/types/LLM.types.js.map +1 -0
  282. package/dist/types/LangGraph.types.d.ts +45 -0
  283. package/dist/types/LangGraph.types.d.ts.map +1 -0
  284. package/dist/types/LangGraph.types.js +77 -0
  285. package/dist/types/LangGraph.types.js.map +1 -0
  286. package/dist/types/Platform.types.d.ts +7 -0
  287. package/dist/types/Platform.types.d.ts.map +1 -0
  288. package/dist/types/Platform.types.js +11 -0
  289. package/dist/types/Platform.types.js.map +1 -0
  290. package/dist/types/Tools.types.d.ts +26 -0
  291. package/dist/types/Tools.types.d.ts.map +1 -0
  292. package/dist/types/Tools.types.js +3 -0
  293. package/dist/types/Tools.types.js.map +1 -0
  294. package/dist/types/Voice.types.d.ts +5 -0
  295. package/dist/types/Voice.types.d.ts.map +1 -0
  296. package/dist/types/Voice.types.js +3 -0
  297. package/dist/types/Voice.types.js.map +1 -0
  298. package/dist/utils/agentUtils.d.ts +5 -0
  299. package/dist/utils/agentUtils.d.ts.map +1 -0
  300. package/dist/utils/agentUtils.js +97 -0
  301. package/dist/utils/agentUtils.js.map +1 -0
  302. package/dist/utils/extractStateMemoryResponse.d.ts +5 -0
  303. package/dist/utils/extractStateMemoryResponse.d.ts.map +1 -0
  304. package/dist/utils/extractStateMemoryResponse.js +91 -0
  305. package/dist/utils/extractStateMemoryResponse.js.map +1 -0
  306. package/dist/utils/history.d.ts +4 -0
  307. package/dist/utils/history.d.ts.map +1 -0
  308. package/dist/utils/history.js +33 -0
  309. package/dist/utils/history.js.map +1 -0
  310. package/dist/utils/logger.d.ts +3 -0
  311. package/dist/utils/logger.d.ts.map +1 -0
  312. package/dist/utils/logger.js +39 -0
  313. package/dist/utils/logger.js.map +1 -0
  314. package/dist/utils/schemaUtils.d.ts +15 -0
  315. package/dist/utils/schemaUtils.d.ts.map +1 -0
  316. package/dist/utils/schemaUtils.js +56 -0
  317. package/dist/utils/schemaUtils.js.map +1 -0
  318. package/dist/utils/wait.d.ts +2 -0
  319. package/dist/utils/wait.d.ts.map +1 -0
  320. package/dist/utils/wait.js +6 -0
  321. package/dist/utils/wait.js.map +1 -0
  322. package/dist/voice/elevenLabsUtils.d.ts +65 -0
  323. package/dist/voice/elevenLabsUtils.d.ts.map +1 -0
  324. package/dist/voice/elevenLabsUtils.js +4 -0
  325. package/dist/voice/elevenLabsUtils.js.map +1 -0
  326. package/dist/voice/voiceSession.d.ts +37 -0
  327. package/dist/voice/voiceSession.d.ts.map +1 -0
  328. package/dist/voice/voiceSession.js +306 -0
  329. package/dist/voice/voiceSession.js.map +1 -0
  330. package/docs/.gitbook/assets/ADLC.png +0 -0
  331. package/docs/.gitbook/assets/PII-masking.png +0 -0
  332. package/docs/.gitbook/assets/image.png +0 -0
  333. package/docs/.gitbook/assets/on-prem.svg +4 -0
  334. package/docs/README.md +54 -0
  335. package/docs/SUMMARY.md +56 -0
  336. package/docs/examples/order-refund-flow.md +566 -0
  337. package/docs/getting-started/environment-configuration.md +158 -0
  338. package/docs/getting-started/installation.md +44 -0
  339. package/docs/getting-started/project-configuration.md +206 -0
  340. package/docs/getting-started/quick-start.md +262 -0
  341. package/docs/integrations/zendesk.md +554 -0
  342. package/docs/low-code-editor/edges.md +396 -0
  343. package/docs/low-code-editor/flows.md +74 -0
  344. package/docs/low-code-editor/nodes.md +367 -0
  345. package/docs/low-code-editor/playbooks.md +280 -0
  346. package/docs/low-code-editor/tools.md +358 -0
  347. package/docs/low-code-editor/triggers.md +182 -0
  348. package/docs/platform/on-prem.md +182 -0
  349. package/docs/platform/operator.md +89 -0
  350. package/docs/platform/pii-masking.md +221 -0
  351. package/docs/platform/scenarios.md +43 -0
  352. package/docs/platform/secrets.md +99 -0
  353. package/docs/platform/sso.md +27 -0
  354. package/docs/resources/your-first-eval.md +108 -0
  355. package/docs/sdk/agent-api.md +540 -0
  356. package/docs/sdk/debugging.md +80 -0
  357. package/docs/sdk/events.md +595 -0
  358. package/docs/sdk/logging.md +72 -0
  359. package/docs/sdk/memory.md +271 -0
  360. package/docs/sdk/parallel-llm.md +242 -0
  361. package/docs/sdk/vectorstore-query.md +60 -0
  362. package/docs/tooling/classifier.md +217 -0
  363. package/docs/tooling/document-processing.md +389 -0
  364. package/docs/tooling/extraction.md +78 -0
  365. package/docs/tooling/timers.md +61 -0
  366. package/package.json +73 -0
  367. package/src/agent.ts +1019 -0
  368. package/src/browserTask/executeBrowserTask.py +153 -0
  369. package/src/browserTask/executeBrowserTask.ts +253 -0
  370. package/src/browserTask/localBrowserTask.ts +300 -0
  371. package/src/browserTask/profile/Default/Extension Rules/000003.log +0 -0
  372. package/src/browserTask/profile/Default/Extension Scripts/000003.log +0 -0
  373. package/src/browserTask/profile/Default/Extension State/000003.log +0 -0
  374. package/src/browserTask/profile/Default/GCM Store/000003.log +0 -0
  375. package/src/browserTask/profile/Default/Local Storage/leveldb/000004.log +0 -0
  376. package/src/browserTask/profile/Default/Session Storage/000003.log +0 -0
  377. package/src/browserTask/profile/Default/Site Characteristics Database/000003.log +0 -0
  378. package/src/browserTask/profile/Default/Sync Data/LevelDB/000003.log +0 -0
  379. package/src/browserTask/profile/Default/shared_proto_db/000003.log +0 -0
  380. package/src/browserTask/profile/Default/shared_proto_db/metadata/000003.log +0 -0
  381. package/src/browserTask/types.ts +37 -0
  382. package/src/checkpointer/checkpointSaverFactory.ts +18 -0
  383. package/src/cli/index.ts +188 -0
  384. package/src/cli/lambdaHandlerTemplate.ts +78 -0
  385. package/src/cli/localOperatorSetup.ts +308 -0
  386. package/src/debugging/index.ts +1 -0
  387. package/src/debugging/llmCallbackHandler.ts +125 -0
  388. package/src/edges/createDirectEdge.ts +22 -0
  389. package/src/edges/createLogicalRouter.ts +182 -0
  390. package/src/edges/createPromptRouter.ts +213 -0
  391. package/src/edges/edgeFactory.ts +167 -0
  392. package/src/events/AgentEvents.ts +58 -0
  393. package/src/events/index.ts +3 -0
  394. package/src/index.ts +105 -0
  395. package/src/interfaces/zendesk.ts +212 -0
  396. package/src/internalTools/appActionRunnerTool.ts +68 -0
  397. package/src/internalTools/documentExtraction/documentExtraction.ts +804 -0
  398. package/src/internalTools/documentExtraction/types.ts +59 -0
  399. package/src/internalTools/libraryActionRunnerTool.ts +62 -0
  400. package/src/internalTools/timer.ts +125 -0
  401. package/src/internalTools/voice/escalateVoiceCall.ts +15 -0
  402. package/src/internalTools/voice/retell.ts +28 -0
  403. package/src/internalTools/voice/sendPlaceholderMessage.ts +27 -0
  404. package/src/interrupts/BaseInterruptSessionManager.ts +80 -0
  405. package/src/interrupts/MemoryInterruptSessionManager.ts +63 -0
  406. package/src/interrupts/MindedInterruptSessionManager.ts +163 -0
  407. package/src/interrupts/interruptSessionManagerFactory.ts +20 -0
  408. package/src/llm/createLlmInstance.ts +33 -0
  409. package/src/nodes/addAppToolNode.ts +111 -0
  410. package/src/nodes/addBrowserTaskNode.ts +191 -0
  411. package/src/nodes/addBrowserTaskRunNode.ts +190 -0
  412. package/src/nodes/addHumanInTheLoopNode.ts +26 -0
  413. package/src/nodes/addJumpToNode.ts +26 -0
  414. package/src/nodes/addJunctionNode.ts +21 -0
  415. package/src/nodes/addPromptNode.ts +305 -0
  416. package/src/nodes/addRpaNode.ts +217 -0
  417. package/src/nodes/addToolNode.ts +84 -0
  418. package/src/nodes/addToolRunNode.ts +80 -0
  419. package/src/nodes/addTriggerNode.ts +27 -0
  420. package/src/nodes/compilePrompt.ts +44 -0
  421. package/src/nodes/nodeFactory.ts +61 -0
  422. package/src/nodes/rpaStepsExecutor.ts +175 -0
  423. package/src/platform/config.ts +89 -0
  424. package/src/platform/mindedCheckpointSaver.ts +146 -0
  425. package/src/platform/mindedConnection.ts +250 -0
  426. package/src/platform/mindedConnectionTypes.ts +495 -0
  427. package/src/platform/models/mindedChatOpenAI.ts +49 -0
  428. package/src/platform/models/parallelWrapper.ts +141 -0
  429. package/src/platform/piiGateway/gateway.ts +103 -0
  430. package/src/platform/piiGateway/index.ts +5 -0
  431. package/src/platform/piiGateway/types.ts +29 -0
  432. package/src/platform/toolExecutor.ts +106 -0
  433. package/src/platform/utils/parseAttachments.ts +56 -0
  434. package/src/platform/utils/tools.ts +55 -0
  435. package/src/playbooks/playbooks.ts +200 -0
  436. package/src/toolsLibrary/classifier.ts +326 -0
  437. package/src/toolsLibrary/extraction.ts +393 -0
  438. package/src/toolsLibrary/index.ts +10 -0
  439. package/src/toolsLibrary/parseDocument.ts +129 -0
  440. package/src/triggers/triggerTypeToDefaultMessage.ts +9 -0
  441. package/src/types/Agent.types.ts +73 -0
  442. package/src/types/Flows.types.ts +262 -0
  443. package/src/types/LLM.types.ts +15 -0
  444. package/src/types/LangGraph.types.ts +86 -0
  445. package/src/types/Platform.types.ts +6 -0
  446. package/src/types/Tools.types.ts +28 -0
  447. package/src/types/Voice.types.ts +4 -0
  448. package/src/utils/agentUtils.ts +69 -0
  449. package/src/utils/history.ts +38 -0
  450. package/src/utils/logger.ts +38 -0
  451. package/src/utils/schemaUtils.ts +68 -0
  452. package/src/utils/wait.ts +1 -0
  453. package/src/voice/elevenLabsUtils.ts +81 -0
  454. package/src/voice/voiceSession.ts +309 -0
@@ -0,0 +1,393 @@
1
+ import { z } from 'zod';
2
+ import { zodToJsonSchema } from 'zod-to-json-schema';
3
+ import { Tool } from '../types/Tools.types';
4
+ import { logger } from '../utils/logger';
5
+ import { JsonOutputParser } from '@langchain/core/output_parsers';
6
+ import { SystemMessage } from '@langchain/core/messages';
7
+ import { BaseLanguageModel } from '@langchain/core/language_models/base';
8
+
9
+ // Type guard for checking if LLM supports structured output
10
+ interface StructuredOutputLLM extends BaseLanguageModel {
11
+ withStructuredOutput<T extends z.ZodType>(schema: T): BaseLanguageModel;
12
+ }
13
+
14
+ function supportsStructuredOutput(llm: BaseLanguageModel): llm is StructuredOutputLLM {
15
+ return 'withStructuredOutput' in llm && typeof (llm as any).withStructuredOutput === 'function';
16
+ }
17
+
18
+ // Type definitions for extraction configuration using Zod
19
+ export type ExtractionSchema = z.ZodTypeAny;
20
+
21
+ export interface ExtractionConfig {
22
+ schema: ExtractionSchema;
23
+ systemPrompt?: string;
24
+ examples?: Array<{ input: string; output?: any }>;
25
+ defaultValue?: any;
26
+ maxRetries?: number;
27
+ strictMode?: boolean; // If true, will validate against schema
28
+ }
29
+
30
+ export type ExtractionResult = z.infer<ExtractionSchema>;
31
+
32
+ // Default configuration
33
+ const DEFAULT_CONFIG: Partial<ExtractionConfig> = {
34
+ maxRetries: 3,
35
+ strictMode: true,
36
+ };
37
+
38
+ /**
39
+ * Convert Zod schema to JSON schema format for prompt
40
+ */
41
+ function schemaToJsonFormat(schema: ExtractionSchema): string {
42
+ // Use zod-to-json-schema for robust conversion
43
+ const jsonSchema = zodToJsonSchema(schema, {
44
+ target: 'openApi3',
45
+ $refStrategy: 'none', // Inline all references for simpler prompts
46
+ });
47
+
48
+ // Remove the $schema property for cleaner output
49
+ if (typeof jsonSchema === 'object' && jsonSchema !== null && '$schema' in jsonSchema) {
50
+ delete (jsonSchema as any).$schema;
51
+ }
52
+
53
+ return JSON.stringify(jsonSchema, null, 2);
54
+ }
55
+
56
+ /**
57
+ * Build prompt with schema for JSON parsing mode
58
+ */
59
+ function buildPromptWithSchema(
60
+ basePrompt: string,
61
+ schema: ExtractionSchema,
62
+ examples: Array<{ input: string; output?: any }> | undefined,
63
+ content: string,
64
+ ): string {
65
+ const schemaDescription = schemaToJsonFormat(schema);
66
+ let prompt = `${basePrompt}\n\nExpected JSON format:\n${schemaDescription}\n\n`;
67
+
68
+ // Add examples if provided
69
+ if (examples && examples.length > 0) {
70
+ prompt += 'Examples:\n';
71
+ for (const example of examples) {
72
+ prompt += `Input: ${example.input}\nOutput: ${JSON.stringify(example.output)}\n\n`;
73
+ }
74
+ }
75
+
76
+ prompt += 'Return ONLY valid JSON that matches the schema. No additional text or explanation.\n\n';
77
+ prompt += `Content to extract from:\n${content}`;
78
+
79
+ return prompt;
80
+ }
81
+
82
+ /**
83
+ * Validate extraction result against Zod schema
84
+ */
85
+ function validateResult(result: any, schema: ExtractionSchema): { valid: boolean; errors: string[] } {
86
+ try {
87
+ // Use Zod's built-in validation
88
+ schema.parse(result);
89
+ return { valid: true, errors: [] };
90
+ } catch (error) {
91
+ if (error instanceof z.ZodError) {
92
+ // Extract error messages from Zod validation
93
+ const errors = error.errors.map((err) => {
94
+ const path = err.path.join('.');
95
+ return path ? `${path}: ${err.message}` : err.message;
96
+ });
97
+ return { valid: false, errors };
98
+ }
99
+ // Handle non-Zod errors
100
+ return { valid: false, errors: [error instanceof Error ? error.message : 'Unknown validation error'] };
101
+ }
102
+ }
103
+
104
+ /**
105
+ * Generic extraction utility that can be used standalone
106
+ *
107
+ * When strictMode is true:
108
+ * - If the LLM supports withStructuredOutput, it will use that for guaranteed schema compliance
109
+ * - Otherwise, it falls back to JSON parsing with Zod validation and retries
110
+ *
111
+ * When strictMode is false:
112
+ * - Uses JSON parsing without validation for more flexibility
113
+ *
114
+ * @param content The content to extract from
115
+ * @param config The extraction configuration
116
+ * @param llm The language model to use for extraction
117
+ * @param attemptNumber Current attempt number (used internally for retries)
118
+ * @returns The extraction result
119
+ */
120
+ export async function extract(
121
+ content: string,
122
+ config: ExtractionConfig,
123
+ llm: BaseLanguageModel,
124
+ attemptNumber: number = 0,
125
+ ): Promise<ExtractionResult> {
126
+ const mergedConfig = { ...DEFAULT_CONFIG, ...config };
127
+
128
+ try {
129
+ const basePrompt = mergedConfig.systemPrompt || 'Extract structured information from the given content:';
130
+
131
+ let result: any;
132
+
133
+ if (mergedConfig.strictMode) {
134
+ // Use structured output when strict mode is enabled
135
+ try {
136
+ // Check if the LLM supports structured output
137
+ if (supportsStructuredOutput(llm)) {
138
+ // When using withStructuredOutput, we don't need to include the schema in the prompt
139
+ // The LLM already knows the structure from the withStructuredOutput method
140
+ let prompt = basePrompt;
141
+
142
+ // Add examples if provided (still useful for context)
143
+ if (mergedConfig.examples && mergedConfig.examples.length > 0) {
144
+ prompt += '\n\nExamples:\n';
145
+ for (const example of mergedConfig.examples) {
146
+ prompt += `Input: ${example.input}\nOutput: ${JSON.stringify(example.output)}\n\n`;
147
+ }
148
+ }
149
+
150
+ prompt += `\n\nContent to extract from:\n${content}`;
151
+
152
+ const structuredLLM = llm.withStructuredOutput(mergedConfig.schema);
153
+ const messages = [new SystemMessage(prompt)];
154
+ result = await structuredLLM.invoke(messages);
155
+
156
+ // The result should already be validated by withStructuredOutput
157
+ return result as ExtractionResult;
158
+ } else {
159
+ // Fallback to JSON parser with validation if withStructuredOutput is not available
160
+ logger.info({
161
+ message: 'LLM does not support withStructuredOutput, falling back to JSON parser with validation',
162
+ });
163
+
164
+ // For JSON parsing mode, we need to include the schema in the prompt
165
+ const prompt = buildPromptWithSchema(basePrompt, mergedConfig.schema, mergedConfig.examples, content);
166
+
167
+ const parser = new JsonOutputParser();
168
+ const messages = [new SystemMessage(prompt)];
169
+ result = await llm.pipe(parser).invoke(messages);
170
+
171
+ // Validate the result
172
+ const validation = validateResult(result, mergedConfig.schema);
173
+
174
+ if (!validation.valid && attemptNumber < (mergedConfig.maxRetries || 3)) {
175
+ logger.warn({
176
+ message: 'Extraction validation failed, retrying',
177
+ errors: validation.errors,
178
+ attempt: attemptNumber + 1,
179
+ });
180
+
181
+ // Add validation errors to prompt for retry
182
+ const retryConfig = {
183
+ ...config,
184
+ systemPrompt: `${basePrompt}\n\nPrevious attempt had these errors:\n${validation.errors.join(
185
+ '\n',
186
+ )}\n\nPlease correct these issues and provide valid JSON.`,
187
+ };
188
+
189
+ return extract(content, retryConfig, llm, attemptNumber + 1);
190
+ } else if (!validation.valid) {
191
+ logger.error({
192
+ message: 'Extraction validation failed after max retries',
193
+ errors: validation.errors,
194
+ });
195
+
196
+ if (mergedConfig.defaultValue) {
197
+ return mergedConfig.defaultValue;
198
+ }
199
+
200
+ throw new Error(`Extraction validation failed: ${validation.errors.join(', ')}`);
201
+ }
202
+ }
203
+ } catch (err) {
204
+ // If structured output fails, retry with adjusted config
205
+ if (attemptNumber < (mergedConfig.maxRetries || 3)) {
206
+ logger.warn({
207
+ message: 'Structured output failed, retrying',
208
+ error: err instanceof Error ? err.message : 'Unknown error',
209
+ attempt: attemptNumber + 1,
210
+ });
211
+
212
+ return extract(content, config, llm, attemptNumber + 1);
213
+ } else {
214
+ throw err;
215
+ }
216
+ }
217
+ } else {
218
+ // Non-strict mode: use JSON parser without validation
219
+ const prompt = buildPromptWithSchema(basePrompt, mergedConfig.schema, mergedConfig.examples, content);
220
+
221
+ const parser = new JsonOutputParser();
222
+ const messages = [new SystemMessage(prompt)];
223
+ result = await llm.pipe(parser).invoke(messages);
224
+ }
225
+
226
+ return result as ExtractionResult;
227
+ } catch (err) {
228
+ logger.error({ message: 'Extraction failed', err });
229
+
230
+ if (mergedConfig.defaultValue) {
231
+ return mergedConfig.defaultValue;
232
+ }
233
+
234
+ throw err;
235
+ }
236
+ }
237
+
238
+ /**
239
+ * Create a simple extractor for common use cases
240
+ * @param schemaOrPrompt Either a Zod schema or a simple prompt string
241
+ * @param options Additional configuration options
242
+ * @returns A configured extract function
243
+ */
244
+ export function createExtractor(schemaOrPrompt: ExtractionSchema | string, options?: Partial<ExtractionConfig>) {
245
+ let config: ExtractionConfig;
246
+
247
+ if (typeof schemaOrPrompt === 'string') {
248
+ // Simple prompt-based extraction - create a Zod schema for a single string result
249
+ config = {
250
+ schema: z.object({
251
+ result: z.string().describe('The extracted result'),
252
+ }),
253
+ systemPrompt: schemaOrPrompt,
254
+ ...options,
255
+ };
256
+ } else {
257
+ // Schema-based extraction
258
+ config = {
259
+ schema: schemaOrPrompt,
260
+ ...options,
261
+ };
262
+ }
263
+
264
+ return (content: string, llm: BaseLanguageModel) => extract(content, config, llm);
265
+ }
266
+
267
+ // Schema for the extraction tool
268
+ export const schema = z.object({
269
+ content: z.string().describe('The content to extract information from'),
270
+ schema: z.record(z.any()).optional().describe('Extraction schema defining the structure of data to extract'),
271
+ systemPrompt: z.string().optional().describe('Custom system prompt for extraction'),
272
+ examples: z
273
+ .array(
274
+ z.object({
275
+ input: z.string(),
276
+ output: z.any(),
277
+ }),
278
+ )
279
+ .optional()
280
+ .describe('Examples to guide the extraction'),
281
+ strictMode: z.boolean().optional().default(true).describe('Whether to validate the extraction against the schema'),
282
+ maxRetries: z.number().optional().default(3).describe('Maximum number of retries if validation fails'),
283
+ defaultValue: z.any().optional().describe('Default value to return if extraction fails'),
284
+ });
285
+
286
+ const extractionTool: Tool<typeof schema, any> = {
287
+ name: 'minded-extraction',
288
+ description:
289
+ 'Extract structured data from unstructured text using AI. Supports custom Zod schemas, validation, examples, and retries. When strictMode is enabled, uses LLM structured output (if available) for guaranteed schema compliance. Perfect for extracting specific information like country codes, emails, dates, or any custom data structure.',
290
+ input: schema,
291
+ isGlobal: false,
292
+ execute: async ({ input, state, agent }) => {
293
+ const { content, schema: inputSchema, systemPrompt, examples, strictMode, maxRetries, defaultValue } = input;
294
+
295
+ logger.info({
296
+ message: 'Extracting structured data',
297
+ sessionId: state.sessionId,
298
+ contentLength: content.length,
299
+ hasSchema: !!inputSchema,
300
+ });
301
+
302
+ // Convert input schema to Zod schema if provided
303
+ let extractionSchema: ExtractionSchema;
304
+ if (inputSchema) {
305
+ // Build a Zod schema from the input schema object
306
+ const zodShape: Record<string, z.ZodType> = {};
307
+
308
+ for (const [key, value] of Object.entries(inputSchema)) {
309
+ if (typeof value === 'object' && value !== null) {
310
+ const fieldConfig = value as any;
311
+ let zodType: z.ZodType;
312
+
313
+ // Create appropriate Zod type based on the field configuration
314
+ if (fieldConfig.type === 'string') {
315
+ zodType = z.string();
316
+ } else if (fieldConfig.type === 'number') {
317
+ zodType = z.number();
318
+ } else if (fieldConfig.type === 'boolean') {
319
+ zodType = z.boolean();
320
+ } else if (fieldConfig.type === 'array') {
321
+ zodType = z.array(z.any());
322
+ } else if (fieldConfig.type === 'object') {
323
+ zodType = z.object({});
324
+ } else {
325
+ // Default to string if type not specified
326
+ zodType = z.string();
327
+ }
328
+
329
+ // Add description if available
330
+ if (fieldConfig.description) {
331
+ zodType = zodType.describe(fieldConfig.description);
332
+ }
333
+
334
+ // Handle optional fields
335
+ if (fieldConfig.required === false) {
336
+ zodType = zodType.optional();
337
+ }
338
+
339
+ zodShape[key] = zodType;
340
+ } else {
341
+ // Default to string for simple values
342
+ zodShape[key] = z.string();
343
+ }
344
+ }
345
+
346
+ extractionSchema = z.object(zodShape);
347
+ } else {
348
+ // Default schema if none provided
349
+ extractionSchema = z.object({
350
+ result: z.string().describe('The extracted result'),
351
+ });
352
+ }
353
+
354
+ const config: ExtractionConfig = {
355
+ schema: extractionSchema,
356
+ systemPrompt,
357
+ examples,
358
+ strictMode,
359
+ maxRetries,
360
+ defaultValue,
361
+ };
362
+
363
+ try {
364
+ const result = await extract(content, config, agent.llm);
365
+
366
+ logger.info({
367
+ message: 'Extraction completed',
368
+ sessionId: state.sessionId,
369
+ resultKeys: Object.keys(result),
370
+ });
371
+
372
+ state.memory.lastExtraction = {
373
+ content: content.substring(0, 100) + (content.length > 100 ? '...' : ''),
374
+ result,
375
+ timestamp: new Date().toISOString(),
376
+ };
377
+
378
+ return {
379
+ result,
380
+ };
381
+ } catch (err) {
382
+ logger.error({
383
+ message: 'Extraction failed',
384
+ sessionId: state.sessionId,
385
+ err,
386
+ });
387
+
388
+ throw err;
389
+ }
390
+ },
391
+ };
392
+
393
+ export default extractionTool;
@@ -0,0 +1,10 @@
1
+ import * as parseDocument from './parseDocument';
2
+ import * as classifier from './classifier';
3
+ import * as extraction from './extraction';
4
+
5
+ // Export all tools as a collection for easy discovery
6
+ export const tools = {
7
+ 'minded-parse-documents': parseDocument,
8
+ 'minded-classifier': classifier,
9
+ 'minded-extraction': extraction,
10
+ };
@@ -0,0 +1,129 @@
1
+ import { z } from 'zod';
2
+ import { Tool } from '../types/Tools.types';
3
+ import { extractFromDocument } from '../internalTools/documentExtraction/documentExtraction';
4
+ import { logger } from '../utils/logger';
5
+
6
+ // Schema for the tool - these are the parameters that can be inferred by LLM
7
+ export const schema = z.object({
8
+ // Document source parameters - only one should be provided based on loadFrom setting
9
+ documentPath: z.string().optional().nullable().describe('Path to the document file to parse (when loadFrom is "path")'),
10
+ documentContent: z
11
+ .union([z.instanceof(Buffer), z.string()])
12
+ .optional()
13
+ .nullable()
14
+ .describe('Document content as Buffer or string (when loadFrom is "buffer" or "string")'),
15
+ documentUrl: z.string().optional().nullable().describe('URL to fetch the document from (when loadFrom is "url")'),
16
+
17
+ // Processing parameters - these can be predefined in the UI
18
+ extractRaw: z.boolean().optional().nullable().describe('Extract raw text without AI processing'),
19
+ schema: z.any().optional().nullable().describe('Zod schema for structured data extraction (when not extracting raw)'),
20
+
21
+ // Load source indicator - this would be set from UI
22
+ loadFrom: z.enum(['url', 'path', 'buffer', 'string']).optional().nullable().describe('Source type for the document'),
23
+ systemPrompt: z.string().optional().nullable().describe('Prompt for guiding extraction (when not using schema or extracting raw)'),
24
+ });
25
+
26
+ const parseDocumentTool: Tool<typeof schema, any> = {
27
+ name: 'minded-parse-documents',
28
+ description:
29
+ 'Parse and extract data from documents (PDFs, images, Word docs, etc.). Supports multiple input sources (URL, file path, buffer, or string) and can extract raw text, structured data with a schema, or unstructured data with a prompt. Parameters can be predefined in the flow configuration.',
30
+ input: schema,
31
+ isGlobal: false,
32
+ execute: async ({ input, state, agent }) => {
33
+ // The input here will be the combined input from both LLM and UI properties
34
+ const combinedInput = input as z.infer<typeof schema>;
35
+
36
+ logger.info({
37
+ msg: '*Action: Parse document*',
38
+ sessionId: state.sessionId,
39
+ loadFrom: combinedInput.loadFrom,
40
+ hasPath: !!combinedInput.documentPath,
41
+ hasContent: !!combinedInput.documentContent,
42
+ hasUrl: !!combinedInput.documentUrl,
43
+ hasSchema: !!combinedInput.schema,
44
+ hasPrompt: !!combinedInput.systemPrompt,
45
+ extractRaw: combinedInput.extractRaw,
46
+ });
47
+
48
+ try {
49
+ // Validate document source based on loadFrom parameter
50
+ if (combinedInput.loadFrom) {
51
+ switch (combinedInput.loadFrom) {
52
+ case 'url':
53
+ if (!combinedInput.documentUrl) {
54
+ throw new Error('documentUrl is required when loadFrom is "url"');
55
+ }
56
+ break;
57
+ case 'path':
58
+ if (!combinedInput.documentPath) {
59
+ throw new Error('documentPath is required when loadFrom is "path"');
60
+ }
61
+ break;
62
+ case 'buffer':
63
+ case 'string':
64
+ if (!combinedInput.documentContent) {
65
+ throw new Error('documentContent is required when loadFrom is "buffer" or "string"');
66
+ }
67
+ break;
68
+ }
69
+ } else {
70
+ // Fallback to original validation if loadFrom is not specified
71
+ if (!combinedInput.documentPath && !combinedInput.documentContent && !combinedInput.documentUrl) {
72
+ throw new Error('At least one document source must be provided: documentPath, documentContent, or documentUrl');
73
+ }
74
+ }
75
+
76
+ // Prepare extraction options, filtering out null/undefined values
77
+ const extractionOptions: Parameters<typeof extractFromDocument>[0] = {};
78
+
79
+ if (combinedInput.documentPath) {
80
+ extractionOptions.documentPath = combinedInput.documentPath;
81
+ }
82
+ if (combinedInput.documentContent) {
83
+ extractionOptions.documentContent = combinedInput.documentContent;
84
+ }
85
+ if (combinedInput.documentUrl) {
86
+ extractionOptions.documentUrl = combinedInput.documentUrl;
87
+ }
88
+
89
+ // Only include LLM if not extracting raw text
90
+ if (!combinedInput.extractRaw) {
91
+ extractionOptions.llm = agent.llm;
92
+
93
+ // Include schema or system prompt if provided
94
+ if (combinedInput.schema) {
95
+ extractionOptions.schema = combinedInput.schema;
96
+ } else if (combinedInput.systemPrompt) {
97
+ extractionOptions.systemPrompt = combinedInput.systemPrompt;
98
+ }
99
+ }
100
+
101
+ // Extract from document using the SDK's document extraction capabilities
102
+ const result = await extractFromDocument(extractionOptions);
103
+
104
+ state.memory.lastParsedDocument = {
105
+ source: combinedInput.documentPath || combinedInput.documentUrl || 'content',
106
+ extractedAt: new Date().toISOString(),
107
+ extractedRaw: !!combinedInput.extractRaw,
108
+ };
109
+
110
+ // Return only the extracted data, not the metadata as requested
111
+ return {
112
+ result: result.data,
113
+ };
114
+ } catch (err) {
115
+ logger.error({
116
+ message: 'Failed to parse document',
117
+ sessionId: state.sessionId,
118
+ err,
119
+ });
120
+
121
+ state.memory.documentParsingError = err instanceof Error ? err.message : String(err);
122
+ return {
123
+ result: `Failed to parse document: ${err instanceof Error ? err.message : String(err)}`,
124
+ };
125
+ }
126
+ },
127
+ };
128
+
129
+ export default parseDocumentTool;
@@ -0,0 +1,9 @@
1
+ import { BaseMessage, HumanMessage } from '@langchain/core/messages';
2
+
3
+ const triggerTypeToDefaultMessage: Record<string, Record<string, (triggerBody: any) => Array<BaseMessage>>> = {
4
+ ['Slack']: {
5
+ 'New Direct Message (Instant)': (triggerBody: any) => [new HumanMessage({ content: triggerBody.text })],
6
+ },
7
+ };
8
+
9
+ export default triggerTypeToDefaultMessage;
@@ -0,0 +1,73 @@
1
+ import { AgentEventRequestPayloads, AgentEventResponsePayloads } from '../events/AgentEvents';
2
+ import { LLMConfig } from './LLM.types';
3
+ import { NodeType } from './Flows.types';
4
+
5
+ export type EmitSignature<Memory, E extends keyof AgentEventRequestPayloads<Memory>> = (
6
+ event: E,
7
+ payload: AgentEventRequestPayloads<Memory>[E],
8
+ ) => Promise<AgentEventResponsePayloads[E][]>;
9
+
10
+ export type MindedSDKConfig = {
11
+ flows: string[];
12
+ llm: LLMConfig;
13
+ tools: string[];
14
+ /**
15
+ * Optional directories containing playbook definition files. If omitted, no playbooks will be loaded.
16
+ */
17
+ playbooks?: string[];
18
+ };
19
+
20
+ /**
21
+ * Parameters for the Agent invoke method
22
+ */
23
+ export interface AgentInvokeParams extends TriggerEvent {
24
+ /** Internal flag to bypass session processing check for recursive calls */
25
+ bypassSessionCheck?: boolean;
26
+ }
27
+
28
+ export interface HistoryStep {
29
+ type: NodeType;
30
+ step: number;
31
+ raw: any;
32
+ nodeId: string;
33
+ nodeDisplayName: string;
34
+ messageIds?: string[];
35
+ }
36
+
37
+ export interface AppTriggerHistoryStep extends HistoryStep {
38
+ type: NodeType.TRIGGER;
39
+ appName: string;
40
+ triggerBody: any;
41
+ }
42
+
43
+ export interface TriggerHistoryStep extends HistoryStep {
44
+ type: NodeType.TRIGGER;
45
+ triggerBody: any;
46
+ }
47
+
48
+ export interface AppActionInvocationHistoryStep extends HistoryStep {
49
+ type: NodeType.APP_TOOL;
50
+ appName: string;
51
+ }
52
+
53
+ export interface CustomActionInvocationHistoryStep extends HistoryStep {
54
+ type: NodeType.TOOL;
55
+ }
56
+
57
+ export interface JunctionHistoryStep extends HistoryStep {
58
+ type: NodeType.JUNCTION;
59
+ }
60
+
61
+ export enum SessionType {
62
+ VOICE = 'voice',
63
+ TEXT = 'text',
64
+ }
65
+
66
+ export interface TriggerEvent {
67
+ /** The payload/data associated with the trigger */
68
+ triggerBody: any;
69
+ /** The name/type of the trigger being invoked */
70
+ triggerName: string;
71
+ /** Optional name of the application triggering the agent in case of an app trigger */
72
+ appName?: string;
73
+ }