@minded-ai/mindedjs 1.0.108 → 1.0.109-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 (112) hide show
  1. package/dist/agent.d.ts +12 -12
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +37 -13
  4. package/dist/agent.js.map +1 -1
  5. package/dist/browserTask/README.md +419 -0
  6. package/dist/browserTask/browserAgent.py +632 -0
  7. package/dist/browserTask/captcha_isolated.png +0 -0
  8. package/dist/browserTask/executeBrowserTask.d.ts +1 -11
  9. package/dist/browserTask/executeBrowserTask.d.ts.map +1 -1
  10. package/dist/browserTask/executeBrowserTask.js +67 -170
  11. package/dist/browserTask/executeBrowserTask.js.map +1 -1
  12. package/dist/browserTask/executeBrowserTask.ts +79 -0
  13. package/dist/browserTask/requirements.txt +8 -0
  14. package/dist/browserTask/setup.sh +144 -0
  15. package/dist/cli/index.js +103 -1
  16. package/dist/cli/index.js.map +1 -1
  17. package/dist/edges/createLogicalRouter.d.ts +3 -1
  18. package/dist/edges/createLogicalRouter.d.ts.map +1 -1
  19. package/dist/edges/createLogicalRouter.js +41 -2
  20. package/dist/edges/createLogicalRouter.js.map +1 -1
  21. package/dist/edges/edgeFactory.d.ts.map +1 -1
  22. package/dist/edges/edgeFactory.js +7 -7
  23. package/dist/edges/edgeFactory.js.map +1 -1
  24. package/dist/events/AgentEvents.d.ts +19 -1
  25. package/dist/events/AgentEvents.d.ts.map +1 -1
  26. package/dist/events/AgentEvents.js +2 -0
  27. package/dist/events/AgentEvents.js.map +1 -1
  28. package/dist/index.d.ts +2 -0
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +4 -1
  31. package/dist/index.js.map +1 -1
  32. package/dist/internalTools/timer.d.ts +3 -3
  33. package/dist/internalTools/timer.d.ts.map +1 -1
  34. package/dist/internalTools/timer.js +3 -3
  35. package/dist/internalTools/timer.js.map +1 -1
  36. package/dist/nodes/addBrowserTaskNode.d.ts +1 -3
  37. package/dist/nodes/addBrowserTaskNode.d.ts.map +1 -1
  38. package/dist/nodes/addBrowserTaskNode.js +54 -186
  39. package/dist/nodes/addBrowserTaskNode.js.map +1 -1
  40. package/dist/nodes/nodeFactory.js +1 -1
  41. package/dist/nodes/nodeFactory.js.map +1 -1
  42. package/docs/SUMMARY.md +8 -4
  43. package/docs/low-code-editor/edges.md +4 -0
  44. package/docs/sdk/debugging.md +342 -0
  45. package/docs/{platform → sdk}/events.md +168 -1
  46. package/package.json +12 -5
  47. package/dist/nodes/addBrowserTaskRunNode.d.ts +0 -13
  48. package/dist/nodes/addBrowserTaskRunNode.d.ts.map +0 -1
  49. package/dist/nodes/addBrowserTaskRunNode.js +0 -130
  50. package/dist/nodes/addBrowserTaskRunNode.js.map +0 -1
  51. package/src/agent.ts +0 -928
  52. package/src/browserTask/executeBrowserTask.ts +0 -213
  53. package/src/checkpointer/checkpointSaverFactory.ts +0 -18
  54. package/src/cli/index.ts +0 -170
  55. package/src/cli/lambdaHandlerTemplate.ts +0 -45
  56. package/src/edges/createDirectEdge.ts +0 -16
  57. package/src/edges/createLogicalRouter.ts +0 -114
  58. package/src/edges/createPromptRouter.ts +0 -218
  59. package/src/edges/edgeFactory.ts +0 -141
  60. package/src/events/AgentEvents.ts +0 -47
  61. package/src/events/index.ts +0 -3
  62. package/src/index.ts +0 -70
  63. package/src/interfaces/zendesk.ts +0 -157
  64. package/src/internalTools/appActionRunnerTool.ts +0 -68
  65. package/src/internalTools/documentExtraction/documentExtraction.ts +0 -809
  66. package/src/internalTools/documentExtraction/types.ts +0 -59
  67. package/src/internalTools/libraryActionRunnerTool.ts +0 -63
  68. package/src/internalTools/retell.ts +0 -28
  69. package/src/internalTools/sendPlaceholderMessage.ts +0 -27
  70. package/src/internalTools/timer.ts +0 -137
  71. package/src/llm/createLlmInstance.ts +0 -33
  72. package/src/nodes/addAppToolNode.ts +0 -106
  73. package/src/nodes/addBrowserTaskNode.ts +0 -231
  74. package/src/nodes/addBrowserTaskRunNode.ts +0 -144
  75. package/src/nodes/addHumanInTheLoopNode.ts +0 -25
  76. package/src/nodes/addJumpToNode.ts +0 -25
  77. package/src/nodes/addJunctionNode.ts +0 -20
  78. package/src/nodes/addPromptNode.ts +0 -119
  79. package/src/nodes/addToolNode.ts +0 -72
  80. package/src/nodes/addToolRunNode.ts +0 -76
  81. package/src/nodes/addTriggerNode.ts +0 -27
  82. package/src/nodes/nodeFactory.ts +0 -57
  83. package/src/platform/config.ts +0 -77
  84. package/src/platform/mindedCheckpointSaver.ts +0 -146
  85. package/src/platform/mindedConnection.ts +0 -199
  86. package/src/platform/mindedConnectionTypes.ts +0 -220
  87. package/src/platform/models/mindedChatOpenAI.ts +0 -49
  88. package/src/platform/models/parallelWrapper.ts +0 -141
  89. package/src/platform/piiGateway/gateway.ts +0 -103
  90. package/src/platform/piiGateway/index.ts +0 -5
  91. package/src/platform/piiGateway/types.ts +0 -29
  92. package/src/platform/utils/parseAttachments.ts +0 -56
  93. package/src/playbooks/playbooks.ts +0 -209
  94. package/src/toolsLibrary/index.ts +0 -6
  95. package/src/toolsLibrary/parseDocument.ts +0 -136
  96. package/src/triggers/triggerTypeToDefaultMessage.ts +0 -9
  97. package/src/types/Agent.types.ts +0 -67
  98. package/src/types/Flows.types.ts +0 -200
  99. package/src/types/LLM.types.ts +0 -15
  100. package/src/types/LangGraph.types.ts +0 -53
  101. package/src/types/Platform.types.ts +0 -1
  102. package/src/types/Tools.types.ts +0 -31
  103. package/src/types/Voice.types.ts +0 -4
  104. package/src/utils/extractStateMemoryResponse.ts +0 -16
  105. package/src/utils/history.ts +0 -9
  106. package/src/utils/logger.ts +0 -22
  107. package/src/utils/wait.ts +0 -1
  108. package/src/voice/elevenLabsUtils.ts +0 -81
  109. package/src/voice/voiceSession.ts +0 -294
  110. /package/docs/{platform → sdk}/logging.md +0 -0
  111. /package/docs/{platform → sdk}/memory.md +0 -0
  112. /package/docs/{platform → sdk}/parallel-llm.md +0 -0
@@ -1,218 +0,0 @@
1
- import { z } from 'zod';
2
- import { PromptConditionEdge } from '../types/Flows.types';
3
- import { BaseLanguageModel } from '@langchain/core/language_models/base';
4
- import { SystemMessage } from '@langchain/core/messages';
5
- import { stateAnnotation } from '../types/LangGraph.types';
6
- import { logger } from '../utils/logger';
7
-
8
- const ROUTER_PROMPT = `
9
- You are a routing agent that decides which node to take in a flow based on the current state.
10
- Based on the conversation history and memory state, you should classify the next step for the conversation.
11
- Each step has a nodeId and a condition. You should decide to move to the right step based on the condition.
12
-
13
- Here are the available options and their conditions:
14
- {steps}
15
-
16
- Current memory state:
17
- {memory}
18
-
19
- Recent messages:
20
- {messages}
21
-
22
- You MUST respond with the exact nodeId from the options above. Do not use step numbers or any other identifiers.
23
-
24
- You should output the result in the following JSON format:
25
- {
26
- "nextNodeId": "exact_node_name_from_options_above",
27
- "reasoning": "I think the next step should be exact_node_name_from_options_above because of the following reasons: ..."
28
- }
29
-
30
- Return JSON and nothing more.
31
- `;
32
-
33
- const ROUTER_PROMPT_WITHOUT_REASONING = `
34
- You are a routing agent that decides which node to take in a flow based on the current state.
35
- Based on the conversation history and memory state, you should classify the next step for the conversation.
36
- Each step has a nodeId and a condition. You should decide to move to the right step based on the condition.
37
-
38
- Here are the available options and their conditions:
39
- {steps}
40
-
41
- Current memory state:
42
- {memory}
43
-
44
- Recent messages:
45
- {messages}
46
-
47
- You MUST respond with the exact nodeId from the options above. Do not use step numbers or any other identifiers.
48
-
49
- You should output the result in the following JSON format:
50
- {
51
- "nextNodeId": "exact_node_name_from_options_above"
52
- }
53
-
54
- Return JSON and nothing more.
55
- `;
56
-
57
- export const createPromptRouter = ({
58
- edges,
59
- llm,
60
- includeReasoning = true,
61
- maxRetries = 3,
62
- canStayInCurrentNode = false,
63
- currentNodeName,
64
- }: {
65
- edges: PromptConditionEdge[];
66
- llm: BaseLanguageModel;
67
- includeReasoning?: boolean;
68
- maxRetries?: number;
69
- canStayInCurrentNode?: boolean;
70
- currentNodeName?: string;
71
- }) => {
72
- return async (state: typeof stateAnnotation.State) => {
73
- logger.debug({ msg: `[Router] Executing prompt router`, edges: JSON.stringify(edges) });
74
-
75
- if (state.goto) {
76
- console.log('Jumping to node', state.goto);
77
- return state.goto;
78
- }
79
-
80
- // If canStayInCurrentNode is true and there are no edges, return current node immediately
81
- if (canStayInCurrentNode && edges.length === 0 && currentNodeName) {
82
- logger.info({
83
- msg: `[Router] Stay at node, No edges available and canStayInCurrentNode==true`,
84
- node: currentNodeName,
85
- });
86
- return currentNodeName;
87
- }
88
-
89
- // Prepare the steps string
90
- let stepsStr = '';
91
-
92
- // Add "stay in current node" option if enabled
93
- if (canStayInCurrentNode && currentNodeName) {
94
- stepsStr = `- Node: "${currentNodeName}" (stay in current node)\n`;
95
- }
96
-
97
- // Add the edge options
98
- stepsStr += edges.map((edge) => `- Node: "${edge.target}" - Condition: "${edge.prompt}"`).join('\n');
99
-
100
- // Prepare recent messages (last 10 messages for context)
101
- const recentMessages = state.messages.slice(-10);
102
- const messagesStr = recentMessages
103
- .map((msg) => {
104
- const role = msg._getType();
105
- const content = typeof msg.content === 'string' ? msg.content : JSON.stringify(msg.content);
106
- return `${role}: ${content}`;
107
- })
108
- .join('\n');
109
-
110
- // Select prompt based on reasoning preference
111
- let routerPrompt = includeReasoning ? ROUTER_PROMPT : ROUTER_PROMPT_WITHOUT_REASONING;
112
-
113
- // Replace placeholders in prompt
114
- routerPrompt = routerPrompt
115
- .replace('{steps}', stepsStr)
116
- .replace('{memory}', JSON.stringify(state.memory, null, 2))
117
- .replace('{messages}', messagesStr);
118
-
119
- // Define response schema
120
- const responseSchema = includeReasoning
121
- ? z.object({
122
- nextNodeId: z.string(),
123
- reasoning: z.string(),
124
- })
125
- : z.object({
126
- nextNodeId: z.string(),
127
- });
128
-
129
- let attempts = 0;
130
- let lastError: Error | null = null;
131
-
132
- while (attempts < maxRetries) {
133
- try {
134
- attempts++;
135
-
136
- // Create messages for the LLM
137
- const messages = [new SystemMessage(routerPrompt)];
138
-
139
- // If this is a retry, add the error message
140
- if (lastError) {
141
- messages.push(
142
- new SystemMessage(`Previous attempt failed with error: ${lastError.message}. Please provide a valid JSON response.`),
143
- );
144
- }
145
-
146
- // Call the LLM with structured output
147
- const response = await llm.invoke(messages);
148
-
149
- // Extract content from response
150
- let content = '';
151
- if (typeof response.content === 'string') {
152
- content = response.content;
153
- } else if (response.content && typeof response.content === 'object' && 'text' in response.content) {
154
- content = (response.content as any).text;
155
- }
156
-
157
- // Try to parse JSON from the response
158
- let parsedResponse;
159
- try {
160
- // Clean the response - remove markdown code blocks if present
161
- content = content
162
- .replace(/```json\n?/g, '')
163
- .replace(/```\n?/g, '')
164
- .trim();
165
- parsedResponse = JSON.parse(content);
166
- } catch {
167
- throw new Error(`Failed to parse JSON response: ${content}`);
168
- }
169
-
170
- // Validate the response
171
- const validatedResponse = responseSchema.parse(parsedResponse);
172
-
173
- // Check if the selected node is valid
174
- const validTargets = edges.map((e) => e.target);
175
- if (canStayInCurrentNode && currentNodeName) {
176
- validTargets.push(currentNodeName);
177
- }
178
-
179
- if (!validTargets.includes(validatedResponse.nextNodeId)) {
180
- throw new Error(`Invalid nextNodeId: ${validatedResponse.nextNodeId}. Must be one of: ${validTargets.join(', ')}`);
181
- }
182
-
183
- const decision = validatedResponse.nextNodeId === currentNodeName ? 'stay in current node' : validatedResponse.nextNodeId;
184
- const reasoning = includeReasoning && 'reasoning' in validatedResponse ? ` - Reasoning: ${validatedResponse.reasoning}` : '';
185
- logger.debug({ msg: `[Router] Decision: ${decision}`, reasoning });
186
-
187
- return validatedResponse.nextNodeId;
188
- } catch (error) {
189
- lastError = error instanceof Error ? error : new Error(String(error));
190
- logger.warn({
191
- msg: `[Router] Prompt router attempt ${attempts} failed`,
192
- error: lastError.message,
193
- attempt: attempts,
194
- maxRetries,
195
- });
196
-
197
- if (attempts >= maxRetries) {
198
- // If all retries failed, return the first available edge as fallback
199
- const fallbackNode = edges[0]?.target;
200
- logger.error({
201
- msg: '[Router] Prompt router reached max retries, using fallback',
202
- fallbackNode,
203
- lastError: lastError.message,
204
- });
205
-
206
- if (!fallbackNode) {
207
- throw new Error('No edges available for routing');
208
- }
209
-
210
- return fallbackNode;
211
- }
212
- }
213
- }
214
-
215
- // This should never be reached, but TypeScript needs it
216
- throw new Error('Unexpected error in prompt router');
217
- };
218
- };
@@ -1,141 +0,0 @@
1
- import {
2
- Edge,
3
- EdgeType,
4
- Node,
5
- PromptConditionEdge,
6
- LogicalConditionEdge,
7
- StepForwardEdge,
8
- NodeType,
9
- ToolNode,
10
- BrowserTaskNode,
11
- } from '../types/Flows.types';
12
- import { PreCompiledGraph } from '../types/LangGraph.types';
13
- import { BaseLanguageModel } from '@langchain/core/language_models/base';
14
- import { createPromptRouter } from './createPromptRouter';
15
- import { createLogicalRouter } from './createLogicalRouter';
16
- import { createDirectEdge } from './createDirectEdge';
17
- import { addHumanInTheLoopNode, buildHumanInTheLoopNodeName } from '../nodes/addHumanInTheLoopNode';
18
- import { addToolRunNode, buildToolRunNodeName } from '../nodes/addToolRunNode';
19
- import { addBrowserTaskRunNode, buildBrowserTaskRunNodeName } from '../nodes/addBrowserTaskRunNode';
20
- import { Tool } from '../types/Tools.types';
21
- import { Agent } from '../agent';
22
- import { logger } from '../utils/logger';
23
-
24
- type EdgesBySource = {
25
- stepForward?: StepForwardEdge;
26
- logical: LogicalConditionEdge[];
27
- prompt: PromptConditionEdge[];
28
- };
29
-
30
- export const edgeFactory = ({
31
- graph,
32
- edges,
33
- nodes,
34
- tools,
35
- llm,
36
- agent,
37
- }: {
38
- graph: PreCompiledGraph;
39
- edges: Edge[];
40
- nodes: Record<string, Node>;
41
- tools: Tool<any, any>[];
42
- llm: BaseLanguageModel;
43
- agent: Agent;
44
- }) => {
45
- /**
46
- * Creates a combined router that handles edge priority: step forward > logical > prompt
47
- */
48
- const createCombinedRouter = (sourceNode: string, edgesBySource: EdgesBySource, originalNode: Node) => {
49
- return async (state: any) => {
50
- // Priority 1: Step forward edge (max 1)
51
- if (edgesBySource.stepForward) {
52
- const directRouter = createDirectEdge(edgesBySource.stepForward);
53
- return await directRouter(state);
54
- }
55
-
56
- // Priority 2: Logical condition edges
57
- if (edgesBySource.logical.length > 0) {
58
- const logicalRouter = createLogicalRouter({ edges: edgesBySource.logical });
59
- const result = await logicalRouter(state);
60
- if (result) {
61
- return result;
62
- } else {
63
- logger.debug('No logical conditions matched, continuing to prompt conditions');
64
- }
65
- }
66
-
67
- // Priority 3: Prompt condition edges
68
- if (edgesBySource.prompt.length > 0) {
69
- // Use the original node to check canStayOnNode property
70
- const canStayInCurrentNode = originalNode?.canStayOnNode === true;
71
-
72
- const promptRouter = createPromptRouter({
73
- edges: edgesBySource.prompt,
74
- llm,
75
- canStayInCurrentNode,
76
- currentNodeName: originalNode?.name || sourceNode,
77
- });
78
- return await promptRouter(state);
79
- }
80
-
81
- // Fallback: stay at current source node
82
- const source = originalNode?.name || sourceNode;
83
- logger.info(`No conditions matched, returning to source: ${source}`);
84
- return source;
85
- };
86
- };
87
-
88
- /**
89
- * Processes all edges for a specific source node with enhanced capabilities
90
- */
91
- const processEdgesForNode = (source: string, edgesBySource: EdgesBySource): void => {
92
- let effectiveSource = source;
93
- const originalNode = nodes[source];
94
-
95
- // Handle human-in-the-loop enhancement
96
- if (originalNode?.humanInTheLoop) {
97
- addHumanInTheLoopNode({ graph, attachedToNodeName: source });
98
- effectiveSource = buildHumanInTheLoopNodeName(source);
99
- }
100
-
101
- if (originalNode?.type === NodeType.TOOL) {
102
- addToolRunNode({ graph, tools, llm, toolNode: originalNode as ToolNode, attachedToNodeName: source, agent });
103
- effectiveSource = buildToolRunNodeName(source);
104
- }
105
-
106
- if (originalNode?.type === NodeType.BROWSER_TASK) {
107
- addBrowserTaskRunNode({ graph, browserTaskNode: originalNode as BrowserTaskNode, attachedToNodeName: source, agent });
108
- effectiveSource = buildBrowserTaskRunNodeName(source);
109
- }
110
-
111
- // Create and add the combined conditional edge with original node reference
112
- const combinedRouter = createCombinedRouter(effectiveSource, edgesBySource, originalNode);
113
- graph.addConditionalEdges(effectiveSource as any, combinedRouter);
114
- };
115
-
116
- // Get all unique source nodes and categorize their edges in a single pass
117
- const edgesBySource = edges.reduce((acc, edge) => {
118
- if (!acc[edge.source]) {
119
- acc[edge.source] = {
120
- stepForward: undefined,
121
- logical: [],
122
- prompt: [],
123
- };
124
- }
125
-
126
- if (edge.type === EdgeType.STEP_FORWARD) {
127
- acc[edge.source].stepForward = edge as StepForwardEdge;
128
- } else if (edge.type === EdgeType.LOGICAL_CONDITION) {
129
- acc[edge.source].logical.push(edge as LogicalConditionEdge);
130
- } else if (edge.type === EdgeType.PROMPT_CONDITION) {
131
- acc[edge.source].prompt.push(edge as PromptConditionEdge);
132
- }
133
-
134
- return acc;
135
- }, {} as Record<string, EdgesBySource>);
136
-
137
- // Process edges for each source node
138
- Object.entries(edgesBySource).forEach(([source, categorizedEdges]) => {
139
- processEdgesForNode(source, categorizedEdges);
140
- });
141
- };
@@ -1,47 +0,0 @@
1
- import { BaseMessage } from '@langchain/core/messages';
2
- import { HistoryStep } from '../types/Agent.types';
3
- import { State } from '../types/LangGraph.types';
4
-
5
- export enum AgentEvents {
6
- INIT = 'INIT',
7
- AI_MESSAGE = 'AI_MESSAGE',
8
- TRIGGER_EVENT = 'TRIGGER_EVENT',
9
- VOICE_SESSION_START = 'VOICE_SESSION_START',
10
- ERROR = 'ERROR'
11
- }
12
-
13
- export type AgentEventRequestPayloads<Memory> = {
14
- [AgentEvents.INIT]: {
15
- state: State<Memory>;
16
- };
17
- [AgentEvents.AI_MESSAGE]: {
18
- message: string;
19
- state: State<Memory>;
20
- };
21
- [AgentEvents.TRIGGER_EVENT]: {
22
- triggerName: string;
23
- triggerBody: any;
24
- sessionId?: string;
25
- };
26
- [AgentEvents.VOICE_SESSION_START]: {
27
- sessionId: string;
28
- };
29
- [AgentEvents.ERROR]: {
30
- error: Error;
31
- state?: State<Memory>;
32
- };
33
- };
34
-
35
- export type AgentEventResponsePayloads<Memory> = {
36
- [AgentEvents.INIT]: void;
37
- [AgentEvents.AI_MESSAGE]: void;
38
- [AgentEvents.TRIGGER_EVENT]: {
39
- isQualified: boolean;
40
- messages?: BaseMessage[];
41
- memory?: Memory;
42
- history?: HistoryStep[];
43
- sessionId?: string;
44
- };
45
- [AgentEvents.VOICE_SESSION_START]: void;
46
- [AgentEvents.ERROR]: void;
47
- };
@@ -1,3 +0,0 @@
1
- import { AgentEvents } from './AgentEvents';
2
-
3
- export default AgentEvents;
package/src/index.ts DELETED
@@ -1,70 +0,0 @@
1
- import { Agent } from './agent';
2
- import events from './events';
3
- import { logger } from './utils/logger';
4
- import { sendPlaceholderMessage } from './internalTools/sendPlaceholderMessage';
5
- import { resetTimer, cancelTimer, onTimer } from './internalTools/timer';
6
- import { retellCall, retellGetCall } from './internalTools/retell';
7
-
8
- export type { ElevenLabsContext } from './types/Voice.types';
9
- export { Agent, events, logger, sendPlaceholderMessage, resetTimer, cancelTimer, onTimer, retellCall, retellGetCall };
10
-
11
- // Export LLM implementations
12
- export { MindedChatOpenAI } from './platform/models/mindedChatOpenAI';
13
- export { createParallelWrapper } from './platform/models/parallelWrapper';
14
- export type { MindedChatOpenAIFields, BaseParallelChatFields } from './platform/models/mindedChatOpenAI';
15
- export type { BaseParallelChatFields as ParallelWrapperFields } from './platform/models/parallelWrapper';
16
-
17
- // HTTP module for PII masking - only public API
18
- export type { PIIGatewayInstance, HttpRequestConfig, HttpResponse } from './platform/piiGateway';
19
-
20
- export type {
21
- Flow,
22
- Node,
23
- Edge,
24
- TriggerNode,
25
- AppTriggerNode,
26
- PromptNode,
27
- PromptConditionEdge,
28
- LogicalConditionEdge,
29
- StepForwardEdge,
30
- ManualTriggerNode,
31
- JunctionNode,
32
- ToolNode,
33
- AppToolNode,
34
- VoiceTriggerNode,
35
- WebhookTriggerNode,
36
- } from './types/Flows.types';
37
- export {
38
- NodeType,
39
- TriggerType,
40
- EdgeType,
41
- AppNodeMetadata,
42
- AppNodeMetadataType,
43
- NodeMetadata,
44
- KnownTriggerNames,
45
- } from './types/Flows.types';
46
- export type { Tool, ToolExecuteInput } from './types/Tools.types';
47
-
48
- // Document processing utilities
49
- export { DocumentProcessor, extractFromDocument } from './internalTools/documentExtraction/documentExtraction';
50
- export type {
51
- DocumentProcessorConfig,
52
- DocumentExtractionOptions,
53
- DocumentProcessingResult,
54
- } from './internalTools/documentExtraction/types';
55
-
56
- export {
57
- HistoryStep,
58
- TriggerHistoryStep,
59
- AppActionInvocationHistoryStep,
60
- AppTriggerHistoryStep,
61
- CustomActionInvocationHistoryStep,
62
- SessionType,
63
- } from './types/Agent.types';
64
- export type { AgentInvokeParams, MindedSDKConfig } from './types/Agent.types';
65
- export type { Environment } from './types/Platform.types';
66
- export type { State } from './types/LangGraph.types';
67
- export { zendesk } from './interfaces/zendesk';
68
-
69
- // Export tools library
70
- export * as toolsLibrary from './toolsLibrary';
@@ -1,157 +0,0 @@
1
- import { Agent } from '../agent';
2
- import * as mindedConnection from '../platform/mindedConnection';
3
- import { mindedConnectionSocketMessageType } from '../platform/mindedConnectionTypes';
4
-
5
- export const zendesk = {
6
- agent: null as Agent | null,
7
- init: async (agent: Agent) => {
8
- zendesk.agent = agent;
9
- },
10
-
11
- sendMessage: async (sessionId: string, message: string) => {
12
- if (!mindedConnection.isConnected()) return;
13
- return await mindedConnection.awaitEmit(mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL, {
14
- type: mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL,
15
- interfaceName: 'zendesk',
16
- sessionId,
17
- functionName: 'sendMessage',
18
- functionArgs: { message },
19
- });
20
- },
21
-
22
- sendComment: async (sessionId: string, comment: string) => {
23
- if (!mindedConnection.isConnected()) return;
24
- return await mindedConnection.awaitEmit(mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL, {
25
- type: mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL,
26
- interfaceName: 'zendesk',
27
- sessionId,
28
- functionName: 'sendComment',
29
- functionArgs: { comment },
30
- });
31
- },
32
-
33
- sendPublicComment: async (sessionId: string, comment: string) => {
34
- if (!mindedConnection.isConnected()) return;
35
- return await mindedConnection.awaitEmit(mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL, {
36
- type: mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL,
37
- interfaceName: 'zendesk',
38
- sessionId,
39
- functionName: 'sendPublicComment',
40
- functionArgs: { comment },
41
- });
42
- },
43
-
44
- getConversation: async (sessionId: string) => {
45
- if (!mindedConnection.isConnected()) return;
46
- return await mindedConnection.awaitEmit(mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL, {
47
- type: mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL,
48
- interfaceName: 'zendesk',
49
- sessionId,
50
- functionName: 'getConversation',
51
- functionArgs: {},
52
- });
53
- },
54
-
55
- getConversationMessages: async (sessionId: string) => {
56
- if (!mindedConnection.isConnected()) return;
57
- return await mindedConnection.awaitEmit(mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL, {
58
- type: mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL,
59
- interfaceName: 'zendesk',
60
- sessionId,
61
- functionName: 'getConversationMessages',
62
- functionArgs: {},
63
- });
64
- },
65
-
66
- addTag: async (sessionId: string, tag: string) => {
67
- if (!mindedConnection.isConnected()) return;
68
- return await mindedConnection.awaitEmit(mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL, {
69
- type: mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL,
70
- interfaceName: 'zendesk',
71
- sessionId,
72
- functionName: 'addTag',
73
- functionArgs: { tag },
74
- });
75
- },
76
-
77
- getTicket: async (sessionId: string) => {
78
- if (!mindedConnection.isConnected()) return;
79
- return await mindedConnection.awaitEmit(mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL, {
80
- type: mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL,
81
- interfaceName: 'zendesk',
82
- sessionId,
83
- functionName: 'getTicket',
84
- functionArgs: {
85
- sessionId,
86
- },
87
- });
88
- },
89
-
90
- createTicket: async ({
91
- sessionId,
92
- subject,
93
- ticketBody,
94
- priority,
95
- tags,
96
- customFields,
97
- }: {
98
- sessionId: string;
99
- subject: string;
100
- ticketBody: string;
101
- priority: string;
102
- tags: string[];
103
- customFields: any[];
104
- }) => {
105
- if (!mindedConnection.isConnected()) return;
106
- return await mindedConnection.awaitEmit(mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL, {
107
- type: mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL,
108
- interfaceName: 'zendesk',
109
- sessionId,
110
- functionName: 'createTicket',
111
- functionArgs: { subject, ticketBody, priority, tags, customFields },
112
- });
113
- },
114
- markTicketAsSolved: async ({ sessionId }: { sessionId: string }) => {
115
- if (!mindedConnection.isConnected()) return;
116
- return await mindedConnection.awaitEmit(mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL, {
117
- type: mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL,
118
- interfaceName: 'zendesk',
119
- sessionId,
120
- functionName: 'markTicketAsSolved',
121
- functionArgs: { sessionId },
122
- });
123
- },
124
-
125
- markTicketAsOpen: async ({ sessionId }: { sessionId: string }) => {
126
- if (!mindedConnection.isConnected()) return;
127
- return await mindedConnection.awaitEmit(mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL, {
128
- type: mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL,
129
- interfaceName: 'zendesk',
130
- sessionId,
131
- functionName: 'markTicketAsOpen',
132
- functionArgs: { sessionId },
133
- });
134
- },
135
-
136
- setCustomFields: async ({ sessionId, fields }: { sessionId: string; fields: any[] }) => {
137
- if (!mindedConnection.isConnected()) return;
138
- return await mindedConnection.awaitEmit(mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL, {
139
- type: mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL,
140
- interfaceName: 'zendesk',
141
- sessionId,
142
- functionName: 'setCustomFields',
143
- functionArgs: { sessionId, fields },
144
- });
145
- },
146
-
147
- search: async ({ sessionId, query }: { sessionId: string; query: string }) => {
148
- if (!mindedConnection.isConnected()) return;
149
- return await mindedConnection.awaitEmit(mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL, {
150
- type: mindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL,
151
- interfaceName: 'zendesk',
152
- sessionId,
153
- functionName: 'search',
154
- functionArgs: { query },
155
- });
156
- },
157
- };