@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.
- package/README.md +6 -0
- package/dist/agent.d.ts +256 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +896 -0
- package/dist/agent.js.map +1 -0
- package/dist/browserTask/README.md +419 -0
- package/dist/browserTask/browserAgent.py +632 -0
- package/dist/browserTask/captcha_isolated.png +0 -0
- package/dist/browserTask/executeBrowserTask.d.ts +14 -0
- package/dist/browserTask/executeBrowserTask.d.ts.map +1 -0
- package/dist/browserTask/executeBrowserTask.js +195 -0
- package/dist/browserTask/executeBrowserTask.js.map +1 -0
- package/dist/browserTask/executeBrowserTask.py +153 -0
- package/dist/browserTask/executeBrowserTask.ts +79 -0
- package/dist/browserTask/localBrowserTask.d.ts +49 -0
- package/dist/browserTask/localBrowserTask.d.ts.map +1 -0
- package/dist/browserTask/localBrowserTask.js +284 -0
- package/dist/browserTask/localBrowserTask.js.map +1 -0
- package/dist/browserTask/requirements.txt +8 -0
- package/dist/browserTask/setup.sh +144 -0
- package/dist/browserTask/types.d.ts +35 -0
- package/dist/browserTask/types.d.ts.map +1 -0
- package/dist/browserTask/types.js +10 -0
- package/dist/browserTask/types.js.map +1 -0
- package/dist/checkpointer/checkpointSaverFactory.d.ts +7 -0
- package/dist/checkpointer/checkpointSaverFactory.d.ts.map +1 -0
- package/dist/checkpointer/checkpointSaverFactory.js +53 -0
- package/dist/checkpointer/checkpointSaverFactory.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +209 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/lambdaHandlerTemplate.d.ts +10 -0
- package/dist/cli/lambdaHandlerTemplate.d.ts.map +1 -0
- package/dist/cli/lambdaHandlerTemplate.js +76 -0
- package/dist/cli/lambdaHandlerTemplate.js.map +1 -0
- package/dist/cli/lambdaHandlerTemplate.ts +78 -0
- package/dist/cli/localOperatorSetup.d.ts +6 -0
- package/dist/cli/localOperatorSetup.d.ts.map +1 -0
- package/dist/cli/localOperatorSetup.js +310 -0
- package/dist/cli/localOperatorSetup.js.map +1 -0
- package/dist/debugging/index.d.ts +2 -0
- package/dist/debugging/index.d.ts.map +1 -0
- package/dist/debugging/index.js +6 -0
- package/dist/debugging/index.js.map +1 -0
- package/dist/debugging/llmCallbackHandler.d.ts +36 -0
- package/dist/debugging/llmCallbackHandler.d.ts.map +1 -0
- package/dist/debugging/llmCallbackHandler.js +101 -0
- package/dist/debugging/llmCallbackHandler.js.map +1 -0
- package/dist/edges/createDirectEdge.d.ts +4 -0
- package/dist/edges/createDirectEdge.d.ts.map +1 -0
- package/dist/edges/createDirectEdge.js +24 -0
- package/dist/edges/createDirectEdge.js.map +1 -0
- package/dist/edges/createLogicalRouter.d.ts +8 -0
- package/dist/edges/createLogicalRouter.d.ts.map +1 -0
- package/dist/edges/createLogicalRouter.js +194 -0
- package/dist/edges/createLogicalRouter.js.map +1 -0
- package/dist/edges/createPromptRouter.d.ts +12 -0
- package/dist/edges/createPromptRouter.d.ts.map +1 -0
- package/dist/edges/createPromptRouter.js +176 -0
- package/dist/edges/createPromptRouter.js.map +1 -0
- package/dist/edges/edgeFactory.d.ts +14 -0
- package/dist/edges/edgeFactory.d.ts.map +1 -0
- package/dist/edges/edgeFactory.js +125 -0
- package/dist/edges/edgeFactory.js.map +1 -0
- package/dist/events/AgentEvents.d.ts +56 -0
- package/dist/events/AgentEvents.d.ts.map +1 -0
- package/dist/events/AgentEvents.js +13 -0
- package/dist/events/AgentEvents.js.map +1 -0
- package/dist/events/index.d.ts +3 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +5 -0
- package/dist/events/index.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +98 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/zendesk.d.ts +35 -0
- package/dist/interfaces/zendesk.d.ts.map +1 -0
- package/dist/interfaces/zendesk.js +219 -0
- package/dist/interfaces/zendesk.js.map +1 -0
- package/dist/internalTools/appActionRunnerTool.d.ts +5 -0
- package/dist/internalTools/appActionRunnerTool.d.ts.map +1 -0
- package/dist/internalTools/appActionRunnerTool.js +88 -0
- package/dist/internalTools/appActionRunnerTool.js.map +1 -0
- package/dist/internalTools/documentExtraction/documentExtraction.d.ts +129 -0
- package/dist/internalTools/documentExtraction/documentExtraction.d.ts.map +1 -0
- package/dist/internalTools/documentExtraction/documentExtraction.js +736 -0
- package/dist/internalTools/documentExtraction/documentExtraction.js.map +1 -0
- package/dist/internalTools/documentExtraction/types.d.ts +29 -0
- package/dist/internalTools/documentExtraction/types.d.ts.map +1 -0
- package/dist/internalTools/documentExtraction/types.js +35 -0
- package/dist/internalTools/documentExtraction/types.js.map +1 -0
- package/dist/internalTools/libraryActionRunnerTool.d.ts +4 -0
- package/dist/internalTools/libraryActionRunnerTool.d.ts.map +1 -0
- package/dist/internalTools/libraryActionRunnerTool.js +53 -0
- package/dist/internalTools/libraryActionRunnerTool.js.map +1 -0
- package/dist/internalTools/retell.d.ts +12 -0
- package/dist/internalTools/retell.d.ts.map +1 -0
- package/dist/internalTools/retell.js +54 -0
- package/dist/internalTools/retell.js.map +1 -0
- package/dist/internalTools/sendPlaceholderMessage.d.ts +14 -0
- package/dist/internalTools/sendPlaceholderMessage.d.ts.map +1 -0
- package/dist/internalTools/sendPlaceholderMessage.js +61 -0
- package/dist/internalTools/sendPlaceholderMessage.js.map +1 -0
- package/dist/internalTools/timer.d.ts +99 -0
- package/dist/internalTools/timer.d.ts.map +1 -0
- package/dist/internalTools/timer.js +139 -0
- package/dist/internalTools/timer.js.map +1 -0
- package/dist/internalTools/voice/escalateVoiceCall.d.ts +2 -0
- package/dist/internalTools/voice/escalateVoiceCall.d.ts.map +1 -0
- package/dist/internalTools/voice/escalateVoiceCall.js +52 -0
- package/dist/internalTools/voice/escalateVoiceCall.js.map +1 -0
- package/dist/internalTools/voice/retell.d.ts +12 -0
- package/dist/internalTools/voice/retell.d.ts.map +1 -0
- package/dist/internalTools/voice/retell.js +54 -0
- package/dist/internalTools/voice/retell.js.map +1 -0
- package/dist/internalTools/voice/sendPlaceholderMessage.d.ts +14 -0
- package/dist/internalTools/voice/sendPlaceholderMessage.d.ts.map +1 -0
- package/dist/internalTools/voice/sendPlaceholderMessage.js +61 -0
- package/dist/internalTools/voice/sendPlaceholderMessage.js.map +1 -0
- package/dist/interrupts/BaseInterruptSessionManager.d.ts +49 -0
- package/dist/interrupts/BaseInterruptSessionManager.d.ts.map +1 -0
- package/dist/interrupts/BaseInterruptSessionManager.js +34 -0
- package/dist/interrupts/BaseInterruptSessionManager.js.map +1 -0
- package/dist/interrupts/MemoryInterruptSessionManager.d.ts +14 -0
- package/dist/interrupts/MemoryInterruptSessionManager.d.ts.map +1 -0
- package/dist/interrupts/MemoryInterruptSessionManager.js +60 -0
- package/dist/interrupts/MemoryInterruptSessionManager.js.map +1 -0
- package/dist/interrupts/MindedInterruptSessionManager.d.ts +13 -0
- package/dist/interrupts/MindedInterruptSessionManager.d.ts.map +1 -0
- package/dist/interrupts/MindedInterruptSessionManager.js +162 -0
- package/dist/interrupts/MindedInterruptSessionManager.js.map +1 -0
- package/dist/interrupts/interruptSessionManagerFactory.d.ts +3 -0
- package/dist/interrupts/interruptSessionManagerFactory.d.ts.map +1 -0
- package/dist/interrupts/interruptSessionManagerFactory.js +56 -0
- package/dist/interrupts/interruptSessionManagerFactory.js.map +1 -0
- package/dist/llm/createLlmInstance.d.ts +3 -0
- package/dist/llm/createLlmInstance.d.ts.map +1 -0
- package/dist/llm/createLlmInstance.js +31 -0
- package/dist/llm/createLlmInstance.js.map +1 -0
- package/dist/nodes/addAppToolNode.d.ts +13 -0
- package/dist/nodes/addAppToolNode.d.ts.map +1 -0
- package/dist/nodes/addAppToolNode.js +87 -0
- package/dist/nodes/addAppToolNode.js.map +1 -0
- package/dist/nodes/addBrowserTaskNode.d.ts +13 -0
- package/dist/nodes/addBrowserTaskNode.d.ts.map +1 -0
- package/dist/nodes/addBrowserTaskNode.js +167 -0
- package/dist/nodes/addBrowserTaskNode.js.map +1 -0
- package/dist/nodes/addBrowserTaskRunNode.d.ts +13 -0
- package/dist/nodes/addBrowserTaskRunNode.d.ts.map +1 -0
- package/dist/nodes/addBrowserTaskRunNode.js +167 -0
- package/dist/nodes/addBrowserTaskRunNode.js.map +1 -0
- package/dist/nodes/addHumanInTheLoopNode.d.ts +9 -0
- package/dist/nodes/addHumanInTheLoopNode.d.ts.map +1 -0
- package/dist/nodes/addHumanInTheLoopNode.js +22 -0
- package/dist/nodes/addHumanInTheLoopNode.js.map +1 -0
- package/dist/nodes/addJumpToNode.d.ts +7 -0
- package/dist/nodes/addJumpToNode.d.ts.map +1 -0
- package/dist/nodes/addJumpToNode.js +24 -0
- package/dist/nodes/addJumpToNode.js.map +1 -0
- package/dist/nodes/addJunctionNode.d.ts +7 -0
- package/dist/nodes/addJunctionNode.d.ts.map +1 -0
- package/dist/nodes/addJunctionNode.js +20 -0
- package/dist/nodes/addJunctionNode.js.map +1 -0
- package/dist/nodes/addPromptNode.d.ts +18 -0
- package/dist/nodes/addPromptNode.d.ts.map +1 -0
- package/dist/nodes/addPromptNode.js +253 -0
- package/dist/nodes/addPromptNode.js.map +1 -0
- package/dist/nodes/addRpaNode.d.ts +18 -0
- package/dist/nodes/addRpaNode.d.ts.map +1 -0
- package/dist/nodes/addRpaNode.js +180 -0
- package/dist/nodes/addRpaNode.js.map +1 -0
- package/dist/nodes/addToolNode.d.ts +13 -0
- package/dist/nodes/addToolNode.d.ts.map +1 -0
- package/dist/nodes/addToolNode.js +67 -0
- package/dist/nodes/addToolNode.js.map +1 -0
- package/dist/nodes/addToolRunNode.d.ts +17 -0
- package/dist/nodes/addToolRunNode.d.ts.map +1 -0
- package/dist/nodes/addToolRunNode.js +59 -0
- package/dist/nodes/addToolRunNode.js.map +1 -0
- package/dist/nodes/addTriggerNode.d.ts +7 -0
- package/dist/nodes/addTriggerNode.d.ts.map +1 -0
- package/dist/nodes/addTriggerNode.js +25 -0
- package/dist/nodes/addTriggerNode.js.map +1 -0
- package/dist/nodes/compilePrompt.d.ts +5 -0
- package/dist/nodes/compilePrompt.d.ts.map +1 -0
- package/dist/nodes/compilePrompt.js +76 -0
- package/dist/nodes/compilePrompt.js.map +1 -0
- package/dist/nodes/nodeFactory.d.ts +16 -0
- package/dist/nodes/nodeFactory.d.ts.map +1 -0
- package/dist/nodes/nodeFactory.js +45 -0
- package/dist/nodes/nodeFactory.js.map +1 -0
- package/dist/nodes/rpaStepsExecutor.d.ts +5 -0
- package/dist/nodes/rpaStepsExecutor.d.ts.map +1 -0
- package/dist/nodes/rpaStepsExecutor.js +156 -0
- package/dist/nodes/rpaStepsExecutor.js.map +1 -0
- package/dist/platform/config.d.ts +16 -0
- package/dist/platform/config.d.ts.map +1 -0
- package/dist/platform/config.js +80 -0
- package/dist/platform/config.js.map +1 -0
- package/dist/platform/mindedCheckpointSaver.d.ts +10 -0
- package/dist/platform/mindedCheckpointSaver.d.ts.map +1 -0
- package/dist/platform/mindedCheckpointSaver.js +137 -0
- package/dist/platform/mindedCheckpointSaver.js.map +1 -0
- package/dist/platform/mindedConnection.d.ts +15 -0
- package/dist/platform/mindedConnection.d.ts.map +1 -0
- package/dist/platform/mindedConnection.js +254 -0
- package/dist/platform/mindedConnection.js.map +1 -0
- package/dist/platform/mindedConnectionTypes.d.ts +404 -0
- package/dist/platform/mindedConnectionTypes.d.ts.map +1 -0
- package/dist/platform/mindedConnectionTypes.js +51 -0
- package/dist/platform/mindedConnectionTypes.js.map +1 -0
- package/dist/platform/models/mindedChatOpenAI.d.ts +20 -0
- package/dist/platform/models/mindedChatOpenAI.d.ts.map +1 -0
- package/dist/platform/models/mindedChatOpenAI.js +32 -0
- package/dist/platform/models/mindedChatOpenAI.js.map +1 -0
- package/dist/platform/models/parallelWrapper.d.ts +17 -0
- package/dist/platform/models/parallelWrapper.d.ts.map +1 -0
- package/dist/platform/models/parallelWrapper.js +105 -0
- package/dist/platform/models/parallelWrapper.js.map +1 -0
- package/dist/platform/piiGateway/gateway.d.ts +14 -0
- package/dist/platform/piiGateway/gateway.d.ts.map +1 -0
- package/dist/platform/piiGateway/gateway.js +117 -0
- package/dist/platform/piiGateway/gateway.js.map +1 -0
- package/dist/platform/piiGateway/index.d.ts +3 -0
- package/dist/platform/piiGateway/index.d.ts.map +1 -0
- package/dist/platform/piiGateway/index.js +7 -0
- package/dist/platform/piiGateway/index.js.map +1 -0
- package/dist/platform/piiGateway/types.d.ts +27 -0
- package/dist/platform/piiGateway/types.d.ts.map +1 -0
- package/dist/platform/piiGateway/types.js +3 -0
- package/dist/platform/piiGateway/types.js.map +1 -0
- package/dist/platform/toolExecutor.d.ts +29 -0
- package/dist/platform/toolExecutor.d.ts.map +1 -0
- package/dist/platform/toolExecutor.js +84 -0
- package/dist/platform/toolExecutor.js.map +1 -0
- package/dist/platform/utils/parseAttachments.d.ts +14 -0
- package/dist/platform/utils/parseAttachments.d.ts.map +1 -0
- package/dist/platform/utils/parseAttachments.js +53 -0
- package/dist/platform/utils/parseAttachments.js.map +1 -0
- package/dist/platform/utils/tools.d.ts +6 -0
- package/dist/platform/utils/tools.d.ts.map +1 -0
- package/dist/platform/utils/tools.js +57 -0
- package/dist/platform/utils/tools.js.map +1 -0
- package/dist/playbooks/playbooks.d.ts +15 -0
- package/dist/playbooks/playbooks.d.ts.map +1 -0
- package/dist/playbooks/playbooks.js +208 -0
- package/dist/playbooks/playbooks.js.map +1 -0
- package/dist/toolsLibrary/classifier.d.ts +74 -0
- package/dist/toolsLibrary/classifier.d.ts.map +1 -0
- package/dist/toolsLibrary/classifier.js +256 -0
- package/dist/toolsLibrary/classifier.js.map +1 -0
- package/dist/toolsLibrary/extraction.d.ts +83 -0
- package/dist/toolsLibrary/extraction.d.ts.map +1 -0
- package/dist/toolsLibrary/extraction.js +328 -0
- package/dist/toolsLibrary/extraction.js.map +1 -0
- package/dist/toolsLibrary/index.d.ts +9 -0
- package/dist/toolsLibrary/index.d.ts.map +1 -0
- package/dist/toolsLibrary/index.js +46 -0
- package/dist/toolsLibrary/index.js.map +1 -0
- package/dist/toolsLibrary/parseDocument.d.ts +30 -0
- package/dist/toolsLibrary/parseDocument.d.ts.map +1 -0
- package/dist/toolsLibrary/parseDocument.js +119 -0
- package/dist/toolsLibrary/parseDocument.js.map +1 -0
- package/dist/triggers/triggerTypeToDefaultMessage.d.ts +4 -0
- package/dist/triggers/triggerTypeToDefaultMessage.d.ts.map +1 -0
- package/dist/triggers/triggerTypeToDefaultMessage.js +10 -0
- package/dist/triggers/triggerTypeToDefaultMessage.js.map +1 -0
- package/dist/types/Agent.types.d.ts +60 -0
- package/dist/types/Agent.types.d.ts.map +1 -0
- package/dist/types/Agent.types.js +9 -0
- package/dist/types/Agent.types.js.map +1 -0
- package/dist/types/Flows.types.d.ts +232 -0
- package/dist/types/Flows.types.d.ts.map +1 -0
- package/dist/types/Flows.types.js +65 -0
- package/dist/types/Flows.types.js.map +1 -0
- package/dist/types/LLM.types.d.ts +7 -0
- package/dist/types/LLM.types.d.ts.map +1 -0
- package/dist/types/LLM.types.js +11 -0
- package/dist/types/LLM.types.js.map +1 -0
- package/dist/types/LangGraph.types.d.ts +45 -0
- package/dist/types/LangGraph.types.d.ts.map +1 -0
- package/dist/types/LangGraph.types.js +77 -0
- package/dist/types/LangGraph.types.js.map +1 -0
- package/dist/types/Platform.types.d.ts +7 -0
- package/dist/types/Platform.types.d.ts.map +1 -0
- package/dist/types/Platform.types.js +11 -0
- package/dist/types/Platform.types.js.map +1 -0
- package/dist/types/Tools.types.d.ts +26 -0
- package/dist/types/Tools.types.d.ts.map +1 -0
- package/dist/types/Tools.types.js +3 -0
- package/dist/types/Tools.types.js.map +1 -0
- package/dist/types/Voice.types.d.ts +5 -0
- package/dist/types/Voice.types.d.ts.map +1 -0
- package/dist/types/Voice.types.js +3 -0
- package/dist/types/Voice.types.js.map +1 -0
- package/dist/utils/agentUtils.d.ts +5 -0
- package/dist/utils/agentUtils.d.ts.map +1 -0
- package/dist/utils/agentUtils.js +97 -0
- package/dist/utils/agentUtils.js.map +1 -0
- package/dist/utils/extractStateMemoryResponse.d.ts +5 -0
- package/dist/utils/extractStateMemoryResponse.d.ts.map +1 -0
- package/dist/utils/extractStateMemoryResponse.js +91 -0
- package/dist/utils/extractStateMemoryResponse.js.map +1 -0
- package/dist/utils/history.d.ts +4 -0
- package/dist/utils/history.d.ts.map +1 -0
- package/dist/utils/history.js +33 -0
- package/dist/utils/history.js.map +1 -0
- package/dist/utils/logger.d.ts +3 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +39 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/schemaUtils.d.ts +15 -0
- package/dist/utils/schemaUtils.d.ts.map +1 -0
- package/dist/utils/schemaUtils.js +56 -0
- package/dist/utils/schemaUtils.js.map +1 -0
- package/dist/utils/wait.d.ts +2 -0
- package/dist/utils/wait.d.ts.map +1 -0
- package/dist/utils/wait.js +6 -0
- package/dist/utils/wait.js.map +1 -0
- package/dist/voice/elevenLabsUtils.d.ts +65 -0
- package/dist/voice/elevenLabsUtils.d.ts.map +1 -0
- package/dist/voice/elevenLabsUtils.js +4 -0
- package/dist/voice/elevenLabsUtils.js.map +1 -0
- package/dist/voice/voiceSession.d.ts +37 -0
- package/dist/voice/voiceSession.d.ts.map +1 -0
- package/dist/voice/voiceSession.js +306 -0
- package/dist/voice/voiceSession.js.map +1 -0
- package/docs/.gitbook/assets/ADLC.png +0 -0
- package/docs/.gitbook/assets/PII-masking.png +0 -0
- package/docs/.gitbook/assets/image.png +0 -0
- package/docs/.gitbook/assets/on-prem.svg +4 -0
- package/docs/README.md +54 -0
- package/docs/SUMMARY.md +56 -0
- package/docs/examples/order-refund-flow.md +566 -0
- package/docs/getting-started/environment-configuration.md +158 -0
- package/docs/getting-started/installation.md +44 -0
- package/docs/getting-started/project-configuration.md +206 -0
- package/docs/getting-started/quick-start.md +262 -0
- package/docs/integrations/zendesk.md +554 -0
- package/docs/low-code-editor/edges.md +396 -0
- package/docs/low-code-editor/flows.md +74 -0
- package/docs/low-code-editor/nodes.md +367 -0
- package/docs/low-code-editor/playbooks.md +280 -0
- package/docs/low-code-editor/tools.md +358 -0
- package/docs/low-code-editor/triggers.md +182 -0
- package/docs/platform/on-prem.md +182 -0
- package/docs/platform/operator.md +89 -0
- package/docs/platform/pii-masking.md +221 -0
- package/docs/platform/scenarios.md +43 -0
- package/docs/platform/secrets.md +99 -0
- package/docs/platform/sso.md +27 -0
- package/docs/resources/your-first-eval.md +108 -0
- package/docs/sdk/agent-api.md +540 -0
- package/docs/sdk/debugging.md +80 -0
- package/docs/sdk/events.md +595 -0
- package/docs/sdk/logging.md +72 -0
- package/docs/sdk/memory.md +271 -0
- package/docs/sdk/parallel-llm.md +242 -0
- package/docs/sdk/vectorstore-query.md +60 -0
- package/docs/tooling/classifier.md +217 -0
- package/docs/tooling/document-processing.md +389 -0
- package/docs/tooling/extraction.md +78 -0
- package/docs/tooling/timers.md +61 -0
- package/package.json +73 -0
- package/src/agent.ts +1019 -0
- package/src/browserTask/executeBrowserTask.py +153 -0
- package/src/browserTask/executeBrowserTask.ts +253 -0
- package/src/browserTask/localBrowserTask.ts +300 -0
- package/src/browserTask/profile/Default/Extension Rules/000003.log +0 -0
- package/src/browserTask/profile/Default/Extension Scripts/000003.log +0 -0
- package/src/browserTask/profile/Default/Extension State/000003.log +0 -0
- package/src/browserTask/profile/Default/GCM Store/000003.log +0 -0
- package/src/browserTask/profile/Default/Local Storage/leveldb/000004.log +0 -0
- package/src/browserTask/profile/Default/Session Storage/000003.log +0 -0
- package/src/browserTask/profile/Default/Site Characteristics Database/000003.log +0 -0
- package/src/browserTask/profile/Default/Sync Data/LevelDB/000003.log +0 -0
- package/src/browserTask/profile/Default/shared_proto_db/000003.log +0 -0
- package/src/browserTask/profile/Default/shared_proto_db/metadata/000003.log +0 -0
- package/src/browserTask/types.ts +37 -0
- package/src/checkpointer/checkpointSaverFactory.ts +18 -0
- package/src/cli/index.ts +188 -0
- package/src/cli/lambdaHandlerTemplate.ts +78 -0
- package/src/cli/localOperatorSetup.ts +308 -0
- package/src/debugging/index.ts +1 -0
- package/src/debugging/llmCallbackHandler.ts +125 -0
- package/src/edges/createDirectEdge.ts +22 -0
- package/src/edges/createLogicalRouter.ts +182 -0
- package/src/edges/createPromptRouter.ts +213 -0
- package/src/edges/edgeFactory.ts +167 -0
- package/src/events/AgentEvents.ts +58 -0
- package/src/events/index.ts +3 -0
- package/src/index.ts +105 -0
- package/src/interfaces/zendesk.ts +212 -0
- package/src/internalTools/appActionRunnerTool.ts +68 -0
- package/src/internalTools/documentExtraction/documentExtraction.ts +804 -0
- package/src/internalTools/documentExtraction/types.ts +59 -0
- package/src/internalTools/libraryActionRunnerTool.ts +62 -0
- package/src/internalTools/timer.ts +125 -0
- package/src/internalTools/voice/escalateVoiceCall.ts +15 -0
- package/src/internalTools/voice/retell.ts +28 -0
- package/src/internalTools/voice/sendPlaceholderMessage.ts +27 -0
- package/src/interrupts/BaseInterruptSessionManager.ts +80 -0
- package/src/interrupts/MemoryInterruptSessionManager.ts +63 -0
- package/src/interrupts/MindedInterruptSessionManager.ts +163 -0
- package/src/interrupts/interruptSessionManagerFactory.ts +20 -0
- package/src/llm/createLlmInstance.ts +33 -0
- package/src/nodes/addAppToolNode.ts +111 -0
- package/src/nodes/addBrowserTaskNode.ts +191 -0
- package/src/nodes/addBrowserTaskRunNode.ts +190 -0
- package/src/nodes/addHumanInTheLoopNode.ts +26 -0
- package/src/nodes/addJumpToNode.ts +26 -0
- package/src/nodes/addJunctionNode.ts +21 -0
- package/src/nodes/addPromptNode.ts +305 -0
- package/src/nodes/addRpaNode.ts +217 -0
- package/src/nodes/addToolNode.ts +84 -0
- package/src/nodes/addToolRunNode.ts +80 -0
- package/src/nodes/addTriggerNode.ts +27 -0
- package/src/nodes/compilePrompt.ts +44 -0
- package/src/nodes/nodeFactory.ts +61 -0
- package/src/nodes/rpaStepsExecutor.ts +175 -0
- package/src/platform/config.ts +89 -0
- package/src/platform/mindedCheckpointSaver.ts +146 -0
- package/src/platform/mindedConnection.ts +250 -0
- package/src/platform/mindedConnectionTypes.ts +495 -0
- package/src/platform/models/mindedChatOpenAI.ts +49 -0
- package/src/platform/models/parallelWrapper.ts +141 -0
- package/src/platform/piiGateway/gateway.ts +103 -0
- package/src/platform/piiGateway/index.ts +5 -0
- package/src/platform/piiGateway/types.ts +29 -0
- package/src/platform/toolExecutor.ts +106 -0
- package/src/platform/utils/parseAttachments.ts +56 -0
- package/src/platform/utils/tools.ts +55 -0
- package/src/playbooks/playbooks.ts +200 -0
- package/src/toolsLibrary/classifier.ts +326 -0
- package/src/toolsLibrary/extraction.ts +393 -0
- package/src/toolsLibrary/index.ts +10 -0
- package/src/toolsLibrary/parseDocument.ts +129 -0
- package/src/triggers/triggerTypeToDefaultMessage.ts +9 -0
- package/src/types/Agent.types.ts +73 -0
- package/src/types/Flows.types.ts +262 -0
- package/src/types/LLM.types.ts +15 -0
- package/src/types/LangGraph.types.ts +86 -0
- package/src/types/Platform.types.ts +6 -0
- package/src/types/Tools.types.ts +28 -0
- package/src/types/Voice.types.ts +4 -0
- package/src/utils/agentUtils.ts +69 -0
- package/src/utils/history.ts +38 -0
- package/src/utils/logger.ts +38 -0
- package/src/utils/schemaUtils.ts +68 -0
- package/src/utils/wait.ts +1 -0
- package/src/voice/elevenLabsUtils.ts +81 -0
- package/src/voice/voiceSession.ts +309 -0
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
# Tools
|
|
2
|
+
|
|
3
|
+
Tools are reusable functions that agents can call to perform specific actions like processing payments, sending emails, or updating databases.
|
|
4
|
+
|
|
5
|
+
## Tool Structure
|
|
6
|
+
|
|
7
|
+
Every tool must implement the `Tool` interface:
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
interface Tool<Input extends z.ZodSchema, Memory> {
|
|
11
|
+
name: string; // Unique tool identifier
|
|
12
|
+
description: string; // What the tool does (used by LLM)
|
|
13
|
+
input: Input; // Zod schema for input validation
|
|
14
|
+
isGlobal?: boolean; // Optional: available across all LLM calls
|
|
15
|
+
execute: ({ input, state, agent }) => Promise<{ result? }>;
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Execute Function Signature
|
|
20
|
+
|
|
21
|
+
The `execute` function is the core of every tool. It receives validated input from the LLM, current state (including memory), and the agent instance, then modifies state by reference and returns an optional result.
|
|
22
|
+
|
|
23
|
+
### Parameters
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
execute: ({ input, state, agent }) => Promise<{ result? }>;
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- **`input`**: Validated data matching your Zod schema - contains the parameters the LLM extracted from the conversation
|
|
30
|
+
- **`state`**: Current conversation state including memory, sessionId, and other context data
|
|
31
|
+
- **`agent`**: Agent instance providing access to PII gateway, logging, and other platform features
|
|
32
|
+
|
|
33
|
+
### Return Value
|
|
34
|
+
|
|
35
|
+
The execute function returns a Promise with an object containing:
|
|
36
|
+
|
|
37
|
+
- **`result?`** (optional): Result that gets sent back to the LLM as the tool's response
|
|
38
|
+
|
|
39
|
+
**Important v2.0 Change**: State is now updated by reference directly within the execute function. You no longer return state updates - instead, modify the state object directly.
|
|
40
|
+
|
|
41
|
+
## State Object Structure
|
|
42
|
+
|
|
43
|
+
The `state` object contains:
|
|
44
|
+
|
|
45
|
+
- **`memory`**: Your user-defined memory schema - the main working memory for your agent
|
|
46
|
+
- **`sessionId`**: Unique identifier for the current session
|
|
47
|
+
- **`messages`**: Array of conversation messages (AI, Human, System, etc.)
|
|
48
|
+
- **`history`**: Array of HistoryStep objects tracking the flow execution (node visits, trigger events, tool calls)
|
|
49
|
+
- **Other platform context**: Additional fields managed by the platform
|
|
50
|
+
|
|
51
|
+
## Basic Tool Example
|
|
52
|
+
|
|
53
|
+
Here's a simple refund processing tool:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { z } from 'zod';
|
|
57
|
+
import { Tool } from 'mindedjs/src/types/Tools.types';
|
|
58
|
+
import { logger } from 'mindedjs';
|
|
59
|
+
import memorySchema from '../schema';
|
|
60
|
+
|
|
61
|
+
type Memory = z.infer<typeof memorySchema>;
|
|
62
|
+
|
|
63
|
+
const schema = z.object({
|
|
64
|
+
orderId: z.string(),
|
|
65
|
+
customerName: z.string(),
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const refundOrderTool: Tool<typeof schema, Memory> = {
|
|
69
|
+
name: 'refundOrder',
|
|
70
|
+
description: 'Process a customer refund for their order',
|
|
71
|
+
input: schema,
|
|
72
|
+
execute: async ({ input, state, agent }) => {
|
|
73
|
+
// Access current memory
|
|
74
|
+
const currentMemory = state.memory;
|
|
75
|
+
|
|
76
|
+
// Use the provided logger [[memory:4133901]]
|
|
77
|
+
logger.info('Processing refund', {
|
|
78
|
+
sessionId: state.sessionId,
|
|
79
|
+
orderId: input.orderId,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// Your business logic here
|
|
83
|
+
const refundAmount = await processRefundInSystem(input.orderId);
|
|
84
|
+
|
|
85
|
+
// Update state directly by reference (v2.0 change)
|
|
86
|
+
state.memory.orderId = input.orderId;
|
|
87
|
+
state.memory.customerName = input.customerName;
|
|
88
|
+
state.memory.issue = `Refund processed: $${refundAmount}`;
|
|
89
|
+
|
|
90
|
+
// Only return result, no state
|
|
91
|
+
return {
|
|
92
|
+
result: `Refund processed successfully for order ${input.orderId}`,
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export default refundOrderTool;
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Input Schema Configuration
|
|
101
|
+
|
|
102
|
+
Input schemas use Zod for validation and provide important metadata to help the LLM understand how to better use each input parameter.
|
|
103
|
+
|
|
104
|
+
### Parameter Descriptions
|
|
105
|
+
|
|
106
|
+
Add descriptions to parameters using Zod's `.describe()` method. These descriptions help the LLM understand what each parameter represents:
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
const schema = z.object({
|
|
110
|
+
orderId: z.string().describe('The unique identifier of the customer order to process'),
|
|
111
|
+
customerName: z.string().describe('Full name of the customer requesting the refund'),
|
|
112
|
+
refundAmount: z.number().describe('Amount to refund in dollars (optional if full refund)'),
|
|
113
|
+
reason: z.string().describe('Reason for the refund request'),
|
|
114
|
+
});
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Optional Parameters
|
|
118
|
+
|
|
119
|
+
Make parameters optional using Zod's `.optional()` method. Optional parameters don't need to be provided by the LLM:
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
const schema = z.object({
|
|
123
|
+
orderId: z.string().describe('The unique identifier of the customer order'),
|
|
124
|
+
customerName: z.string().describe('Full name of the customer'),
|
|
125
|
+
refundAmount: z.number().optional().describe('Specific refund amount, defaults to full order amount'),
|
|
126
|
+
expedited: z.boolean().optional().describe('Whether to expedite the refund process'),
|
|
127
|
+
});
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Combining Descriptions and Optional Parameters
|
|
131
|
+
|
|
132
|
+
You can chain Zod methods to create descriptive optional parameters:
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
const updateOrderSchema = z.object({
|
|
136
|
+
orderId: z.string().describe('The order ID that needs to be updated'),
|
|
137
|
+
newAddress: z.string().optional().describe('Updated shipping address if customer wants to change it'),
|
|
138
|
+
specialInstructions: z.string().optional().describe('Any special delivery instructions from the customer'),
|
|
139
|
+
urgentDelivery: z.boolean().optional().describe('Whether customer needs urgent delivery (additional charges may apply)'),
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Tool Registration
|
|
144
|
+
|
|
145
|
+
### Global Tools
|
|
146
|
+
|
|
147
|
+
Mark tools as global if you want them to be available in all LLM calls.
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
const auditLogTool: Tool<typeof auditSchema, Memory> = {
|
|
151
|
+
name: 'auditLog',
|
|
152
|
+
description: 'Log user action for compliance',
|
|
153
|
+
isGlobal: true, // Available in all flows
|
|
154
|
+
input: z.object({
|
|
155
|
+
action: z.string(),
|
|
156
|
+
details: z.string(),
|
|
157
|
+
}),
|
|
158
|
+
execute: async ({ input, state, agent }) => {
|
|
159
|
+
logger.info('Audit log entry', {
|
|
160
|
+
sessionId: state.sessionId,
|
|
161
|
+
action: input.action,
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
await auditService.log({
|
|
165
|
+
userId: state.memory.userId,
|
|
166
|
+
action: input.action,
|
|
167
|
+
details: input.details,
|
|
168
|
+
timestamp: new Date(),
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
// No return value needed for tools that don't produce results
|
|
172
|
+
return {};
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## State Management
|
|
178
|
+
|
|
179
|
+
Tools can read and update state including memory by reference:
|
|
180
|
+
|
|
181
|
+
```ts
|
|
182
|
+
const updateProfileTool: Tool<typeof profileSchema, Memory> = {
|
|
183
|
+
name: 'updateProfile',
|
|
184
|
+
description: 'Update customer profile information',
|
|
185
|
+
input: z.object({
|
|
186
|
+
field: z.string(),
|
|
187
|
+
value: z.string(),
|
|
188
|
+
}),
|
|
189
|
+
execute: async ({ input, state, agent }) => {
|
|
190
|
+
// Read current memory from state
|
|
191
|
+
console.log(`Current customer: ${state.memory.customerName}`);
|
|
192
|
+
|
|
193
|
+
// Update external system
|
|
194
|
+
await profileService.update(state.memory.customerId, {
|
|
195
|
+
[input.field]: input.value,
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// Update state directly by reference (v2.0 change)
|
|
199
|
+
state.memory[`${input.field}Updated`] = true;
|
|
200
|
+
|
|
201
|
+
// No state in return value
|
|
202
|
+
return {};
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Error Handling
|
|
208
|
+
|
|
209
|
+
Handle errors gracefully in tools:
|
|
210
|
+
|
|
211
|
+
````ts
|
|
212
|
+
const paymentTool: Tool<typeof paymentSchema, Memory> = {
|
|
213
|
+
name: 'processPayment',
|
|
214
|
+
description: 'Process customer payment',
|
|
215
|
+
input: z.object({
|
|
216
|
+
amount: z.number(),
|
|
217
|
+
cardToken: z.string(),
|
|
218
|
+
}),
|
|
219
|
+
execute: async ({ input, state, agent }) => {
|
|
220
|
+
try {
|
|
221
|
+
const result = await paymentService.charge({
|
|
222
|
+
amount: input.amount,
|
|
223
|
+
cardToken: input.cardToken,
|
|
224
|
+
customerId: state.memory.customerId,
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
// Update state directly by reference
|
|
228
|
+
state.memory.lastPaymentId = result.transactionId;
|
|
229
|
+
|
|
230
|
+
return {
|
|
231
|
+
result: `Payment successful: ${result.transactionId}`,
|
|
232
|
+
};
|
|
233
|
+
} catch (err) {
|
|
234
|
+
logger.error({
|
|
235
|
+
message: 'Payment failed',
|
|
236
|
+
sessionId: state.sessionId,
|
|
237
|
+
err,
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
// Update state directly by reference
|
|
241
|
+
state.memory.paymentError = err.message;
|
|
242
|
+
|
|
243
|
+
return {
|
|
244
|
+
result: 'Payment failed. Please try again or contact support.',
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
## Flow Control with goto
|
|
251
|
+
|
|
252
|
+
Tools can control the flow by setting the `goto` property directly on the state object. This allows tools to programmatically jump to a specific node by setting `state.goto` to the target node ID. This is useful for dynamic flow control based on runtime conditions.
|
|
253
|
+
|
|
254
|
+
### Basic goto Usage
|
|
255
|
+
|
|
256
|
+
```ts
|
|
257
|
+
const moveToAnotherRepresentativeTool: Tool<typeof schema, Memory> = {
|
|
258
|
+
name: 'moveToAnotherRepresentative',
|
|
259
|
+
description: 'Transfer the conversation to another representative or department',
|
|
260
|
+
input: schema,
|
|
261
|
+
execute: async ({ input, state }) => {
|
|
262
|
+
logger.info({
|
|
263
|
+
message: 'Moving conversation to another representative',
|
|
264
|
+
sessionId: state.sessionId,
|
|
265
|
+
department: input.department,
|
|
266
|
+
reason: input.reason,
|
|
267
|
+
priority: input.priority,
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
// Update state directly by reference (v2.0 change)
|
|
271
|
+
state.goto = 'share-new-representative';
|
|
272
|
+
state.memory.orderId = 'share-new-representative';
|
|
273
|
+
|
|
274
|
+
return {};
|
|
275
|
+
},
|
|
276
|
+
};
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Dynamic Routing Example
|
|
280
|
+
|
|
281
|
+
```typescript
|
|
282
|
+
const routingTool: Tool<typeof routingSchema, Memory> = {
|
|
283
|
+
name: 'routingTool',
|
|
284
|
+
description: 'Route conversation based on urgency',
|
|
285
|
+
input: routingSchema,
|
|
286
|
+
execute: async ({ input, state }) => {
|
|
287
|
+
// Perform logic to determine routing
|
|
288
|
+
if (input.condition === 'urgent') {
|
|
289
|
+
// Jump to urgent handler node by updating state directly
|
|
290
|
+
state.goto = 'urgent-handler-node';
|
|
291
|
+
|
|
292
|
+
return {
|
|
293
|
+
result: 'Routing to urgent handler',
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// Normal flow continues
|
|
298
|
+
return { result: 'Continue normal flow' };
|
|
299
|
+
},
|
|
300
|
+
};
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
> **Important:** The jump occurs only when the current invocation completes and the next one begins. The agent will finish executing the current node/tool before jumping to the specified node.
|
|
304
|
+
|
|
305
|
+
## Best Practices
|
|
306
|
+
|
|
307
|
+
1. **Clear Descriptions**: Write descriptions that help the LLM understand when to use the tool
|
|
308
|
+
2. **Input Validation**: Use Zod schemas to validate all inputs
|
|
309
|
+
3. **State Updates**: Update state directly by reference - modify only the parts that need to change
|
|
310
|
+
4. **Error Handling**: Always handle errors gracefully and provide meaningful messages
|
|
311
|
+
5. **Async Operations**: Use async/await for external API calls and database operations
|
|
312
|
+
6. **Logging**: Use the provided logger for consistent, structured logging with session context
|
|
313
|
+
|
|
314
|
+
## Tool Nodes
|
|
315
|
+
|
|
316
|
+
Tool nodes force execution of specific tools at defined points in your flow, bypassing LLM decision-making.
|
|
317
|
+
|
|
318
|
+
### Configuration
|
|
319
|
+
|
|
320
|
+
```yaml
|
|
321
|
+
nodes:
|
|
322
|
+
- name: 'Force Refund Processing'
|
|
323
|
+
type: 'tool'
|
|
324
|
+
toolName: 'refundOrder'
|
|
325
|
+
````
|
|
326
|
+
|
|
327
|
+
### Tool Node vs Automatic Tool Calls
|
|
328
|
+
|
|
329
|
+
| Feature | Tool Nodes | Automatic Tool Calls |
|
|
330
|
+
| ------------- | ------------------------------- | ----------------------------------- |
|
|
331
|
+
| **Execution** | Guaranteed when node is reached | Only when LLM decides to call |
|
|
332
|
+
| **Control** | Explicit flow control | LLM-driven decision |
|
|
333
|
+
| **Use Case** | Required business logic steps | Flexible, context-dependent actions |
|
|
334
|
+
|
|
335
|
+
### Example
|
|
336
|
+
|
|
337
|
+
```yaml
|
|
338
|
+
nodes:
|
|
339
|
+
- name: 'Customer Support Start'
|
|
340
|
+
type: 'prompt'
|
|
341
|
+
prompt: 'How can I help you today?'
|
|
342
|
+
- name: 'Log Interaction'
|
|
343
|
+
type: 'tool'
|
|
344
|
+
toolName: 'auditLog'
|
|
345
|
+
|
|
346
|
+
edges:
|
|
347
|
+
- source: 'Customer Support Start'
|
|
348
|
+
target: 'Log Interaction'
|
|
349
|
+
type: 'always'
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### Best Practices
|
|
353
|
+
|
|
354
|
+
1. **Strategic Placement**: Use for critical business logic that must always execute
|
|
355
|
+
2. **Clear Context**: Ensure conversation provides context for parameter extraction
|
|
356
|
+
3. **Error Handling**: Handle errors gracefully since they bypass LLM error recovery
|
|
357
|
+
|
|
358
|
+
Tool parameters are automatically extracted from conversation context and memory state using an internal LLM agent.
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Triggers
|
|
2
|
+
|
|
3
|
+
Triggers are the entry points into your agent's flows. They serve as the initial contact point between external systems and your agent, handling incoming events and initializing conversations with appropriate context and memory.
|
|
4
|
+
|
|
5
|
+
## Trigger Types
|
|
6
|
+
|
|
7
|
+
MindedJS supports three types of triggers:
|
|
8
|
+
|
|
9
|
+
### 1. Manual Triggers
|
|
10
|
+
|
|
11
|
+
- **Invocation**: Triggered directly by calling the `agent.invoke()` method in your code
|
|
12
|
+
- **Use Case**: Perfect for testing or programmatic agent invocation
|
|
13
|
+
- **Setup**: No platform configuration required - simply call the method with your parameters
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
// Manual trigger example
|
|
17
|
+
const result = await agent.invoke({
|
|
18
|
+
triggerName: 'manual-trigger',
|
|
19
|
+
triggerBody: { message: 'Hello agent' },
|
|
20
|
+
sessionId: 'user-session-123',
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 2. App Triggers
|
|
25
|
+
|
|
26
|
+
- **Invocation**: Triggered by specific applications and external integrations (e.g., Slack, Zendesk)
|
|
27
|
+
- **Setup**: Configured through the Minded platform interface
|
|
28
|
+
- **Identification**: Each app trigger is identified by a unique `appTriggerId`
|
|
29
|
+
- **Data Handling**: Supports automatic message conversion for certain apps (e.g., Slack messages)
|
|
30
|
+
|
|
31
|
+
### 3. Webhook Triggers
|
|
32
|
+
|
|
33
|
+
- **Invocation**: Triggered by HTTP requests to specific endpoints in the Minded platform
|
|
34
|
+
- **Setup**: Configured through the Minded platform interface
|
|
35
|
+
- **Agent Specific**: Each webhook trigger belongs to a specific agent and cannot be shared between agents
|
|
36
|
+
- **Use Case**: Ideal for receiving data from external systems, APIs, or third-party services that can send HTTP requests
|
|
37
|
+
|
|
38
|
+
> **Note**: Both app triggers and webhook triggers are configured and managed through the Minded platform. All triggers are agent-specific and cannot be shared between different agents.
|
|
39
|
+
|
|
40
|
+
### Trigger Invocation History
|
|
41
|
+
|
|
42
|
+
When a trigger is invoked, it creates a comprehensive record of the event that is:
|
|
43
|
+
|
|
44
|
+
1. Added to the flow history for tracking and debugging
|
|
45
|
+
2. Preserved throughout the flow's execution as a history step
|
|
46
|
+
|
|
47
|
+
This history allows tools and handlers to:
|
|
48
|
+
|
|
49
|
+
- Access the original trigger context
|
|
50
|
+
- Make decisions based on the triggering event
|
|
51
|
+
- Maintain conversation continuity
|
|
52
|
+
- Debug flow execution
|
|
53
|
+
- Track the agent's execution path through different nodes
|
|
54
|
+
|
|
55
|
+
Each history step contains the following information:
|
|
56
|
+
|
|
57
|
+
- `step`: Sequential step number in the agent's execution flow
|
|
58
|
+
- `type`: Type of the step (TRIGGER_NODE, APP_TRIGGER_NODE, TOOL_NODE, etc.)
|
|
59
|
+
- `nodeId`: ID of the node that was executed
|
|
60
|
+
- `nodeDisplayName`: Human-readable name of the node
|
|
61
|
+
- `raw`: Raw data associated with the step (e.g., trigger input, tool output)
|
|
62
|
+
- `messageIds`: IDs of messages associated with this step
|
|
63
|
+
|
|
64
|
+
Example:
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
const tool: Tool = {
|
|
68
|
+
name: 'myTool',
|
|
69
|
+
execute: async ({ input, state }) => {
|
|
70
|
+
// Access trigger information from history
|
|
71
|
+
const triggerStep = state.history.find((step) => step.type === 'TRIGGER_NODE' || step.type === 'APP_TRIGGER_NODE');
|
|
72
|
+
|
|
73
|
+
if (triggerStep) {
|
|
74
|
+
console.log(`Processing request from node: ${triggerStep.nodeDisplayName}`);
|
|
75
|
+
|
|
76
|
+
// Handle different trigger types based on history
|
|
77
|
+
if (triggerStep.nodeDisplayName === 'manual-trigger') {
|
|
78
|
+
// Handle manual trigger
|
|
79
|
+
console.log('Manual trigger data:', triggerStep.raw);
|
|
80
|
+
} else if (triggerStep.type === 'APP_TRIGGER_NODE' && triggerStep.appName === 'Slack') {
|
|
81
|
+
// Handle app trigger from Slack
|
|
82
|
+
console.log('Slack trigger data:', triggerStep.raw);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return { result: 'Success' };
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Default Message Behavior
|
|
92
|
+
|
|
93
|
+
MindedJS provides intelligent message handling for a few app triggers through the `triggerTypeToDefaultMessage` mapping. This system:
|
|
94
|
+
|
|
95
|
+
- Automatically converts trigger data into appropriate message formats
|
|
96
|
+
- Maintains conversation context without manual intervention
|
|
97
|
+
- Supports different message types for different applications
|
|
98
|
+
- Can be overridden using the `onTriggerEvent` handler
|
|
99
|
+
|
|
100
|
+
Currently supported default messages:
|
|
101
|
+
|
|
102
|
+
- **App Triggers (Slack)**: For "New Direct Message (Instant)" triggers, the message text is automatically converted to a human message
|
|
103
|
+
- **Manual Triggers**: No automatic message conversion - you control the flow entirely
|
|
104
|
+
- **Webhook Triggers**: Flexible message handling based on the HTTP payload structure
|
|
105
|
+
|
|
106
|
+
Example:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
// Manual trigger - full control over the flow
|
|
110
|
+
const manualResult = await agent.invoke({
|
|
111
|
+
triggerName: 'manual-trigger',
|
|
112
|
+
triggerBody: { customData: 'Hello manually' },
|
|
113
|
+
sessionId: 'manual-session-123',
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// App trigger (Slack) - automatic message conversion
|
|
117
|
+
const slackResult = await agent.invoke({
|
|
118
|
+
triggerName: 'New Direct Message (Instant)',
|
|
119
|
+
triggerBody: { text: 'Hello from Slack' },
|
|
120
|
+
appName: 'Slack',
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// Webhook trigger - handled based on HTTP payload
|
|
124
|
+
const webhookResult = await agent.invoke({
|
|
125
|
+
triggerName: 'webhook-endpoint-name',
|
|
126
|
+
triggerBody: { payload: 'Hello from webhook' },
|
|
127
|
+
appName: 'Webhook',
|
|
128
|
+
});
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Validate Trigger Input
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
// ✅ Good - Input validation
|
|
135
|
+
agent.on(AgentEvents.TRIGGER_EVENT, async ({ triggerName, triggerBody, sessionId }) => {
|
|
136
|
+
if (!triggerBody.customerId || !triggerBody.message) {
|
|
137
|
+
return { isQualified: false }; // Disqualify invalid triggers
|
|
138
|
+
}
|
|
139
|
+
// Process valid trigger
|
|
140
|
+
return { isQualified: true };
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// ❌ Avoid - No validation
|
|
144
|
+
agent.on(AgentEvents.TRIGGER_EVENT, async ({ triggerBody, sessionId }) => {
|
|
145
|
+
// Process without validation
|
|
146
|
+
return { isQualified: true };
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Session ID in Trigger Events
|
|
151
|
+
|
|
152
|
+
The `sessionId` parameter in `TRIGGER_EVENT` is automatically provided by the platform in different environments:
|
|
153
|
+
|
|
154
|
+
- **Sandbox Playground**: The platform automatically generates and provides a default `sessionId` for each trigger execution. It's important to pass it forward in sandbox environment.
|
|
155
|
+
- **Production Applications**: Users are expected to provide their own `sessionId` if they wish to suppport resuming sessions.
|
|
156
|
+
- **Session Continuity**: When a `sessionId` is provided that matches an existing session, the agent will resume from the previous state instead of starting fresh
|
|
157
|
+
|
|
158
|
+
## Webhook Headers
|
|
159
|
+
|
|
160
|
+
When handling webhook triggers, request headers are available through `triggerBody.headers`. This allows you to access important metadata about the incoming request.
|
|
161
|
+
|
|
162
|
+
### Accessing Headers
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
agent.on(AgentEvents.TRIGGER_EVENT, async ({ triggerBody }) => {
|
|
166
|
+
// Access webhook sender's IP address
|
|
167
|
+
const senderIP = triggerBody.headers?.['x-forwarded-for'];
|
|
168
|
+
|
|
169
|
+
// Access other headers
|
|
170
|
+
const contentType = triggerBody.headers?.['content-type'];
|
|
171
|
+
const userAgent = triggerBody.headers?.['user-agent'];
|
|
172
|
+
|
|
173
|
+
return { isQualified: true };
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Common headers available:
|
|
178
|
+
|
|
179
|
+
- `x-forwarded-for` - Original sender's IP address
|
|
180
|
+
- `content-type` - Request content type
|
|
181
|
+
- `user-agent` - Client user agent string
|
|
182
|
+
- Custom headers sent by the webhook sender
|