@minded-ai/mindedjs 1.0.89 → 1.0.91-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 (83) hide show
  1. package/dist/agent.d.ts +4 -0
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +32 -6
  4. package/dist/agent.js.map +1 -1
  5. package/dist/events/AgentEvents.d.ts +5 -0
  6. package/dist/events/AgentEvents.d.ts.map +1 -1
  7. package/dist/events/AgentEvents.js +1 -0
  8. package/dist/events/AgentEvents.js.map +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +1 -2
  12. package/dist/index.js.map +1 -1
  13. package/dist/nodes/addAppToolNode.d.ts.map +1 -1
  14. package/dist/nodes/addAppToolNode.js +2 -2
  15. package/dist/nodes/addAppToolNode.js.map +1 -1
  16. package/dist/nodes/addJumpToNode.d.ts.map +1 -1
  17. package/dist/nodes/addJumpToNode.js +2 -2
  18. package/dist/nodes/addJumpToNode.js.map +1 -1
  19. package/dist/nodes/addJunctionNode.d.ts +7 -0
  20. package/dist/nodes/addJunctionNode.d.ts.map +1 -0
  21. package/dist/nodes/addJunctionNode.js +20 -0
  22. package/dist/nodes/addJunctionNode.js.map +1 -0
  23. package/dist/nodes/addPromptNode.d.ts.map +1 -1
  24. package/dist/nodes/addPromptNode.js +2 -2
  25. package/dist/nodes/addPromptNode.js.map +1 -1
  26. package/dist/nodes/addToolNode.d.ts.map +1 -1
  27. package/dist/nodes/addToolNode.js +2 -2
  28. package/dist/nodes/addToolNode.js.map +1 -1
  29. package/dist/nodes/addToolRunNode.d.ts.map +1 -1
  30. package/dist/nodes/addToolRunNode.js +2 -3
  31. package/dist/nodes/addToolRunNode.js.map +1 -1
  32. package/dist/nodes/addTriggerNode.d.ts.map +1 -1
  33. package/dist/nodes/addTriggerNode.js +1 -2
  34. package/dist/nodes/addTriggerNode.js.map +1 -1
  35. package/dist/nodes/nodeFactory.d.ts.map +1 -1
  36. package/dist/nodes/nodeFactory.js +2 -5
  37. package/dist/nodes/nodeFactory.js.map +1 -1
  38. package/dist/platform/mindedConnectionTypes.d.ts +5 -0
  39. package/dist/platform/mindedConnectionTypes.d.ts.map +1 -1
  40. package/dist/platform/mindedConnectionTypes.js +1 -0
  41. package/dist/platform/mindedConnectionTypes.js.map +1 -1
  42. package/dist/types/Agent.types.d.ts +11 -6
  43. package/dist/types/Agent.types.d.ts.map +1 -1
  44. package/dist/types/Agent.types.js +1 -0
  45. package/dist/types/Agent.types.js.map +1 -1
  46. package/docs/.gitbook/assets/ADLC.png +0 -0
  47. package/docs/.gitbook/assets/PII-masking.png +0 -0
  48. package/docs/.gitbook/assets/image.png +0 -0
  49. package/docs/README.md +54 -0
  50. package/docs/SUMMARY.md +39 -0
  51. package/docs/examples/order-refund-flow.md +566 -0
  52. package/docs/getting-started/environment-configuration.md +98 -0
  53. package/docs/getting-started/installation.md +44 -0
  54. package/docs/getting-started/project-configuration.md +206 -0
  55. package/docs/getting-started/quick-start.md +262 -0
  56. package/docs/integrations/zendesk.md +554 -0
  57. package/docs/low-code-editor/edges.md +392 -0
  58. package/docs/low-code-editor/flows.md +74 -0
  59. package/docs/low-code-editor/nodes.md +331 -0
  60. package/docs/low-code-editor/playbooks.md +262 -0
  61. package/docs/low-code-editor/tools.md +303 -0
  62. package/docs/low-code-editor/triggers.md +156 -0
  63. package/docs/platform/events.md +374 -0
  64. package/docs/platform/logging.md +72 -0
  65. package/docs/platform/memory.md +219 -0
  66. package/docs/platform/pii-masking.md +220 -0
  67. package/docs/platform/secrets.md +99 -0
  68. package/docs/resources/your-first-eval.md +108 -0
  69. package/docs-structure.md +141 -0
  70. package/package.json +5 -3
  71. package/src/agent.ts +36 -8
  72. package/src/events/AgentEvents.ts +5 -0
  73. package/src/index.ts +0 -1
  74. package/src/nodes/addAppToolNode.ts +3 -3
  75. package/src/nodes/addJumpToNode.ts +3 -3
  76. package/src/nodes/addJunctionNode.ts +19 -0
  77. package/src/nodes/addPromptNode.ts +3 -3
  78. package/src/nodes/addToolNode.ts +2 -3
  79. package/src/nodes/addToolRunNode.ts +3 -4
  80. package/src/nodes/addTriggerNode.ts +3 -3
  81. package/src/nodes/nodeFactory.ts +1 -5
  82. package/src/platform/mindedConnectionTypes.ts +6 -0
  83. package/src/types/Agent.types.ts +11 -5
package/src/agent.ts CHANGED
@@ -25,7 +25,6 @@ import {
25
25
  AgentInvokeParams,
26
26
  AppTriggerHistoryStep,
27
27
  TriggerHistoryStep,
28
- HistoryStepType,
29
28
  MindedSDKConfig,
30
29
  SessionType,
31
30
  HistoryStep,
@@ -378,12 +377,12 @@ export class Agent {
378
377
  return appName
379
378
  ? createHistoryStep<AppTriggerHistoryStep>(currentHistory, {
380
379
  ...baseStep,
381
- type: HistoryStepType.APP_TRIGGER_NODE,
380
+ type: NodeType.TRIGGER,
382
381
  appName,
383
382
  })
384
383
  : createHistoryStep<TriggerHistoryStep>(currentHistory, {
385
384
  ...baseStep,
386
- type: HistoryStepType.TRIGGER_NODE,
385
+ type: NodeType.TRIGGER,
387
386
  });
388
387
  }
389
388
 
@@ -456,7 +455,7 @@ export class Agent {
456
455
  }
457
456
  }
458
457
 
459
- logger.info(`Invoking trigger ${triggerName} with session ${sessionId}`);
458
+ logger.info({ message: 'Invoking trigger', triggerName, sessionId, triggerBody });
460
459
  const langraphConfig = this.getLangraphConfig(sessionId || uuidv4());
461
460
  const state = await this.compiledGraph.getState(langraphConfig);
462
461
  const suffixes = Object.values(internalNodesSuffix);
@@ -487,8 +486,8 @@ export class Agent {
487
486
  );
488
487
  }
489
488
  return res;
490
- } catch (error) {
491
- logger.error({ message: 'Invoke error', error, sessionId });
489
+ } catch (error: any) {
490
+ logger.error({ message: 'Invoke error', errorMessage: error.message, sessionId });
492
491
  const state = await this.compiledGraph.getState(this.getLangraphConfig(sessionId));
493
492
  this.emit(AgentEvents.ERROR, { error: error instanceof Error ? error : new Error(JSON.stringify(error)), state: state.values });
494
493
  throw error;
@@ -813,23 +812,45 @@ export class Agent {
813
812
  if (voiceSession) {
814
813
  voiceSession.sendAudio(audioMessage.audioData);
815
814
  } else {
816
- logger.warn({ message: 'Audio received; voice session not found for sessionId', sessionId: audioMessage.sessionId });
815
+ logger.trace({
816
+ message: 'Audio received; voice session not found for sessionId',
817
+ sessionId: audioMessage.sessionId,
818
+ activeSessions: Array.from(this.voiceSessions.keys()),
819
+ });
817
820
  }
818
821
  });
819
822
 
820
823
  // Hangup / end session handler
821
824
  connection.on(MindedConnectionSocketMessageType.DASHBOARD_VOICE_SESSION_END, (message) => {
822
825
  const hangup = message as BaseVoiceMessage;
826
+ logger.debug({ message: 'Dashboard eneded voice session', sessionId: hangup.sessionId });
823
827
  const voiceSession = this.voiceSessions.get(hangup.sessionId);
824
828
  if (voiceSession) {
825
829
  voiceSession.hangup();
826
830
  } else {
827
- logger.warn({ message: 'Session ended; voice session not found for sessionId', sessionId: hangup.sessionId });
831
+ logger.trace({
832
+ message: 'Session ended; voice session not found for sessionId',
833
+ sessionId: hangup.sessionId,
834
+ activeSessions: this.voiceSessions.keys(),
835
+ });
828
836
  }
829
837
  });
830
838
  }
831
839
  }
832
840
 
841
+ public async sendPlaceholderMessage({ sessionId, message }: { sessionId: string; message: string }): Promise<void> {
842
+ if (!this.mindedConnection) {
843
+ throw new Error('Minded connection is not established when trying to send placeholder message');
844
+ }
845
+ const connection = this.mindedConnection;
846
+ connection.emit(MindedConnectionSocketMessageType.DASHBOARD_VOICE_PLACEHOLDER_MESSAGES, {
847
+ sessionId,
848
+ message,
849
+ timestamp: Date.now(),
850
+ type: MindedConnectionSocketMessageType.DASHBOARD_VOICE_PLACEHOLDER_MESSAGES,
851
+ });
852
+ }
853
+
833
854
  public async startVoiceSession(params: { sessionId: string }): Promise<VoiceSession> {
834
855
  await this.waitForInitialization();
835
856
  const voiceTrigger = this.flows
@@ -845,7 +866,14 @@ export class Agent {
845
866
  voiceId: voiceTrigger.voiceId,
846
867
  });
847
868
  await voiceSession.init();
869
+ logger.debug({ message: 'Voice session initialized', sessionId: params.sessionId });
848
870
  this.voiceSessions.set(params.sessionId, voiceSession);
871
+
872
+ // Emit voice session start event
873
+ await this.emit(AgentEvents.VOICE_SESSION_START, {
874
+ sessionId: params.sessionId,
875
+ });
876
+
849
877
  return voiceSession;
850
878
  }
851
879
 
@@ -6,6 +6,7 @@ export enum AgentEvents {
6
6
  INIT = 'INIT',
7
7
  AI_MESSAGE = 'AI_MESSAGE',
8
8
  TRIGGER_EVENT = 'TRIGGER_EVENT',
9
+ VOICE_SESSION_START = 'VOICE_SESSION_START',
9
10
  ERROR = 'ERROR',
10
11
  TIMER_TRIGGER = 'TIMER_TRIGGER',
11
12
  }
@@ -23,6 +24,9 @@ export type AgentEventRequestPayloads<Memory> = {
23
24
  triggerBody: any;
24
25
  sessionId?: string;
25
26
  };
27
+ [AgentEvents.VOICE_SESSION_START]: {
28
+ sessionId: string;
29
+ };
26
30
  [AgentEvents.ERROR]: {
27
31
  error: Error;
28
32
  state?: State<Memory>;
@@ -44,6 +48,7 @@ export type AgentEventResponsePayloads<Memory> = {
44
48
  history?: HistoryStep[];
45
49
  sessionId?: string;
46
50
  };
51
+ [AgentEvents.VOICE_SESSION_START]: void;
47
52
  [AgentEvents.ERROR]: void;
48
53
  [AgentEvents.TIMER_TRIGGER]: void;
49
54
  };
package/src/index.ts CHANGED
@@ -36,7 +36,6 @@ export {
36
36
  } from './types/Flows.types';
37
37
  export type { Tool, ToolExecuteInput } from './types/Tools.types';
38
38
  export {
39
- HistoryStepType,
40
39
  HistoryStep,
41
40
  TriggerHistoryStep,
42
41
  AppActionInvocationHistoryStep,
@@ -1,4 +1,4 @@
1
- import { AppToolNode } from '../types/Flows.types';
1
+ import { AppToolNode, NodeType } from '../types/Flows.types';
2
2
  import { tool as langchainTool } from '@langchain/core/tools';
3
3
  import { PreCompiledGraph, stateAnnotation } from '../types/LangGraph.types';
4
4
  import { SystemMessage } from '@langchain/core/messages';
@@ -6,7 +6,7 @@ import { RunnableLike } from '@langchain/core/runnables';
6
6
  import { z } from 'zod';
7
7
  import { LLMProviders } from '../types/LLM.types';
8
8
  import { getAppActionRunnerTool } from '../internalTools/appActionRunnerTool';
9
- import { AppActionInvocationHistoryStep, HistoryStepType } from '../types/Agent.types';
9
+ import { AppActionInvocationHistoryStep } from '../types/Agent.types';
10
10
  import { Agent } from '../agent';
11
11
  import { logger } from '../utils/logger';
12
12
  import { compilePlaybooks } from '../playbooks/playbooks';
@@ -82,7 +82,7 @@ export const addAppToolNode = async ({
82
82
  return {
83
83
  messages: [AIToolCallMessage, toolCallMessage],
84
84
  history: createHistoryStep<AppActionInvocationHistoryStep>(state.history, {
85
- type: HistoryStepType.APP_ACTION_NODE,
85
+ type: NodeType.APP_TOOL,
86
86
  nodeId: node.name,
87
87
  nodeDisplayName: node.displayName!,
88
88
  raw: AIToolCallMessage.tool_calls[0],
@@ -1,8 +1,8 @@
1
1
  import { RunnableLike } from '@langchain/core/runnables';
2
2
  import { PreCompiledGraph, stateAnnotation } from '../types/LangGraph.types';
3
- import { JumpToNode } from '../types/Flows.types';
3
+ import { JumpToNode, NodeType } from '../types/Flows.types';
4
4
  import { logger } from '../utils/logger';
5
- import { HistoryStepType, HistoryStep } from '../types/Agent.types';
5
+ import { HistoryStep } from '../types/Agent.types';
6
6
  import { createHistoryStep } from '../utils/history';
7
7
 
8
8
  export const addJumpToNode = async ({ graph, node }: { graph: PreCompiledGraph; node: JumpToNode }) => {
@@ -11,7 +11,7 @@ export const addJumpToNode = async ({ graph, node }: { graph: PreCompiledGraph;
11
11
  // No state modifications are necessary; control flow is handled via edges.
12
12
  return {
13
13
  history: createHistoryStep<HistoryStep>(state.history, {
14
- type: HistoryStepType.JUMP_TO_NODE,
14
+ type: NodeType.JUMP_TO_NODE,
15
15
  nodeId: node.name,
16
16
  nodeDisplayName: node.displayName,
17
17
  raw: '',
@@ -0,0 +1,19 @@
1
+ import { JunctionNode, NodeType } from '../types/Flows.types';
2
+ import { PreCompiledGraph, stateAnnotation } from '../types/LangGraph.types';
3
+ import { RunnableLike } from '@langchain/core/runnables';
4
+ import { createHistoryStep } from '../utils/history';
5
+ import { HistoryStep } from '../types/Agent.types';
6
+
7
+ export const addJunctionNode = ({ graph, node }: { graph: PreCompiledGraph; node: JunctionNode }) => {
8
+ const callback: RunnableLike = async (state: typeof stateAnnotation.State) => {
9
+ return {
10
+ history: createHistoryStep<HistoryStep>(state.history, {
11
+ type: NodeType.JUNCTION,
12
+ nodeId: node.name,
13
+ nodeDisplayName: node.displayName,
14
+ raw: '',
15
+ }),
16
+ };
17
+ };
18
+ graph.addNode(node.name, callback);
19
+ };
@@ -1,5 +1,5 @@
1
1
  import { RunnableLike } from '@langchain/core/runnables';
2
- import { PromptNode } from '../types/Flows.types';
2
+ import { NodeType, PromptNode } from '../types/Flows.types';
3
3
  import { PreCompiledGraph, stateAnnotation } from '../types/LangGraph.types';
4
4
  import { z } from 'zod';
5
5
  import { BaseLanguageModel } from '@langchain/core/language_models/base';
@@ -7,7 +7,7 @@ import { SystemMessage, AIMessage, ToolMessage } from '@langchain/core/messages'
7
7
  import { Tool } from '../types/Tools.types';
8
8
  import { tool as langchainTool } from '@langchain/core/tools';
9
9
  import { AgentEventRequestPayloads, AgentEvents } from '../events/AgentEvents';
10
- import { EmitSignature, HistoryStepType, HistoryStep } from '../types/Agent.types';
10
+ import { EmitSignature, HistoryStep } from '../types/Agent.types';
11
11
  import { createLlmInstance } from '../llm/createLlmInstance';
12
12
  import extractToolStateResponse from '../utils/extractStateMemoryResponse';
13
13
  import { Agent } from '../agent';
@@ -104,7 +104,7 @@ export const addPromptNode = async ({ graph, node, llm, tools, emit, agent }: Ad
104
104
 
105
105
  return {
106
106
  history: createHistoryStep<HistoryStep>(state.history, {
107
- type: HistoryStepType.PROMPT_NODE,
107
+ type: NodeType.PROMPT_NODE,
108
108
  nodeId: node.name,
109
109
  nodeDisplayName: node.displayName,
110
110
  raw: result.content,
@@ -1,4 +1,4 @@
1
- import { ToolNode } from '../types/Flows.types';
1
+ import { NodeType, ToolNode } from '../types/Flows.types';
2
2
  import { Tool } from '../types/Tools.types';
3
3
  import { tool as langchainTool } from '@langchain/core/tools';
4
4
  import { PreCompiledGraph, stateAnnotation } from '../types/LangGraph.types';
@@ -10,7 +10,6 @@ import { Agent } from '../agent';
10
10
  import { compilePlaybooks } from '../playbooks/playbooks';
11
11
  import { createHistoryStep } from '../utils/history';
12
12
  import { HistoryStep } from '../types/Agent.types';
13
- import { HistoryStepType } from '../types/Agent.types';
14
13
 
15
14
  export const addToolNode = async ({
16
15
  graph,
@@ -60,7 +59,7 @@ export const addToolNode = async ({
60
59
  return {
61
60
  messages: [AIToolCallMessage],
62
61
  history: createHistoryStep<HistoryStep>(state.history, {
63
- type: HistoryStepType.CUSTOM_ACTION_NODE,
62
+ type: NodeType.TOOL,
64
63
  nodeId: node.name,
65
64
  nodeDisplayName: node.displayName,
66
65
  raw: AIToolCallMessage.tool_calls?.[0] || '',
@@ -2,7 +2,7 @@ import { PreCompiledGraph, stateAnnotation } from '../types/LangGraph.types';
2
2
  import { RunnableLike } from '@langchain/core/runnables';
3
3
  import { Tool } from '../types/Tools.types';
4
4
  import { LLMProviders } from '../types/LLM.types';
5
- import { internalNodesSuffix, ToolNode } from '../types/Flows.types';
5
+ import { internalNodesSuffix, NodeType, ToolNode } from '../types/Flows.types';
6
6
  import { tool as langchainTool } from '@langchain/core/tools';
7
7
  import { ToolMessage } from '@langchain/core/messages';
8
8
  import { z } from 'zod';
@@ -11,7 +11,6 @@ import { Agent } from '../agent';
11
11
  import { logger } from '../utils/logger';
12
12
  import { createHistoryStep } from '../utils/history';
13
13
  import { HistoryStep } from '../types/Agent.types';
14
- import { HistoryStepType } from '../types/Agent.types';
15
14
 
16
15
  type AddToolRunNodeParams = {
17
16
  graph: PreCompiledGraph;
@@ -54,14 +53,14 @@ export const addToolRunNode = async ({ graph, tools, toolNode, attachedToNodeNam
54
53
  const toolStateUpdate = extractToolStateResponse(toolCallMessage as ToolMessage);
55
54
 
56
55
  // Push the toolCallMessage into the messages array from toolStateUpdate
57
- const updatedMessages = [...((toolStateUpdate as any).messages || []), toolCallMessage];
56
+ const updatedMessages = [toolCallMessage, ...((toolStateUpdate as any).messages || [])];
58
57
 
59
58
  // Return the full state update from the tool with the updated messages
60
59
  return {
61
60
  ...toolStateUpdate,
62
61
  messages: updatedMessages,
63
62
  history: createHistoryStep<HistoryStep>(state.history, {
64
- type: HistoryStepType.CUSTOM_ACTION_NODE,
63
+ type: NodeType.TOOL,
65
64
  nodeId: toolNode.name,
66
65
  nodeDisplayName: toolNode.displayName,
67
66
  raw: toolCallMessage,
@@ -1,8 +1,8 @@
1
1
  import { RunnableLike } from '@langchain/core/runnables';
2
- import { TriggerNode, TriggerType } from '../types/Flows.types';
2
+ import { NodeType, TriggerNode, TriggerType } from '../types/Flows.types';
3
3
  import { PreCompiledGraph, stateAnnotation } from '../types/LangGraph.types';
4
4
  import { logger } from '../utils/logger';
5
- import { HistoryStep, HistoryStepType } from '../types/Agent.types';
5
+ import { HistoryStep } from '../types/Agent.types';
6
6
  import { createHistoryStep } from '../utils/history';
7
7
 
8
8
  export const addTriggerNode = async ({ graph, node }: { graph: PreCompiledGraph; node: TriggerNode }) => {
@@ -11,7 +11,7 @@ export const addTriggerNode = async ({ graph, node }: { graph: PreCompiledGraph;
11
11
  if (node.triggerType === TriggerType.MANUAL) {
12
12
  return {
13
13
  history: createHistoryStep<HistoryStep>(state.history, {
14
- type: HistoryStepType.TRIGGER_NODE,
14
+ type: NodeType.TRIGGER,
15
15
  nodeId: node.name,
16
16
  nodeDisplayName: node.displayName,
17
17
  raw: '',
@@ -11,11 +11,7 @@ import { addTriggerNode } from './addTriggerNode';
11
11
  import { LLMProviders } from '../types/LLM.types';
12
12
  import { Agent } from '../agent';
13
13
  import { addJumpToNode } from './addJumpToNode';
14
-
15
- const addJunctionNode = ({ graph, node }: { graph: PreCompiledGraph; node: JunctionNode }) => {
16
- const callback: RunnableLike = async () => { };
17
- graph.addNode(node.name, callback);
18
- };
14
+ import { addJunctionNode } from './addJunctionNode';
19
15
 
20
16
  export const nodeFactory = ({
21
17
  graph,
@@ -27,6 +27,7 @@ export enum MindedConnectionSocketMessageType {
27
27
  DASHBOARD_VOICE_SESSION_START = 'dashboard-voice-session-start',
28
28
  DASHBOARD_VOICE_SESSION_END = 'dashboard-voice-session-end',
29
29
  DASHBOARD_VOICE_INTERRUPTION = 'dashboard-voice-interruption',
30
+ DASHBOARD_VOICE_PLACEHOLDER_MESSAGES = 'dashboard-voice-placeholder-messages',
30
31
  INTERFACE_FUNCTION_CALL = 'interface-function-call',
31
32
  TIMER_RESET = 'timer-reset',
32
33
  TIMER_CANCEL = 'timer-cancel',
@@ -48,6 +49,7 @@ export type MindedConnectionSocketMessageTypeMap = {
48
49
  [MindedConnectionSocketMessageType.DASHBOARD_VOICE_SESSION_START]: BaseVoiceMessage;
49
50
  [MindedConnectionSocketMessageType.DASHBOARD_VOICE_SESSION_END]: OnVoiceSessionEnd;
50
51
  [MindedConnectionSocketMessageType.DASHBOARD_VOICE_INTERRUPTION]: OnVoiceInterruption;
52
+ [MindedConnectionSocketMessageType.DASHBOARD_VOICE_PLACEHOLDER_MESSAGES]: VoicePlaceholderMessage;
51
53
  [MindedConnectionSocketMessageType.PII_HTTP_REQUEST]: OnPiiHttpRequest;
52
54
  [MindedConnectionSocketMessageType.INTERFACE_FUNCTION_CALL]: InterfaceFunctionCall;
53
55
  [MindedConnectionSocketMessageType.TIMER_RESET]: TimerResetRequest;
@@ -110,6 +112,10 @@ export interface OnVoiceAudioOut extends BaseVoiceMessage {
110
112
  audioData: string; // base64 encoded audio data
111
113
  }
112
114
 
115
+ export interface VoicePlaceholderMessage extends BaseVoiceMessage {
116
+ message: string;
117
+ }
118
+
113
119
  export interface OnVoiceInterruption extends BaseMindedConnectionSocketMessage {
114
120
  sessionId: string;
115
121
  timestamp: number;
@@ -1,5 +1,6 @@
1
1
  import { AgentEventRequestPayloads, AgentEventResponsePayloads } from '../events/AgentEvents';
2
2
  import { LLMConfig } from './LLM.types';
3
+ import { NodeType } from './Flows.types';
3
4
 
4
5
  export type EmitSignature<Memory, E extends keyof AgentEventRequestPayloads<Memory>> = (
5
6
  event: E,
@@ -37,10 +38,11 @@ export enum HistoryStepType {
37
38
  CUSTOM_ACTION_NODE = 'customActionNode',
38
39
  PROMPT_NODE = 'promptNode',
39
40
  JUMP_TO_NODE = 'jumpToNode',
41
+ JUNCTION_NODE = 'junctionNode',
40
42
  }
41
43
 
42
44
  export interface HistoryStep {
43
- type: HistoryStepType;
45
+ type: NodeType;
44
46
  step: number;
45
47
  raw: any;
46
48
  nodeId: string;
@@ -49,21 +51,25 @@ export interface HistoryStep {
49
51
  }
50
52
 
51
53
  export interface AppTriggerHistoryStep extends HistoryStep {
52
- type: HistoryStepType.APP_TRIGGER_NODE;
54
+ type: NodeType.TRIGGER;
53
55
  appName: string;
54
56
  }
55
57
 
56
58
  export interface TriggerHistoryStep extends HistoryStep {
57
- type: HistoryStepType.TRIGGER_NODE;
59
+ type: NodeType.TRIGGER;
58
60
  }
59
61
 
60
62
  export interface AppActionInvocationHistoryStep extends HistoryStep {
61
- type: HistoryStepType.APP_ACTION_NODE;
63
+ type: NodeType.APP_TOOL;
62
64
  appName: string;
63
65
  }
64
66
 
65
67
  export interface CustomActionInvocationHistoryStep extends HistoryStep {
66
- type: HistoryStepType.CUSTOM_ACTION_NODE;
68
+ type: NodeType.TOOL;
69
+ }
70
+
71
+ export interface JunctionHistoryStep extends HistoryStep {
72
+ type: NodeType.JUNCTION;
67
73
  }
68
74
 
69
75
  export enum SessionType {