@minded-ai/mindedjs 1.0.78-beta-2 → 1.0.78

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 (50) hide show
  1. package/dist/agent.d.ts +136 -0
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +142 -4
  4. package/dist/agent.js.map +1 -1
  5. package/dist/events/AgentEvents.d.ts +2 -2
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +2 -2
  9. package/dist/index.js.map +1 -1
  10. package/dist/nodes/addAppToolNode.d.ts.map +1 -1
  11. package/dist/nodes/addAppToolNode.js +2 -9
  12. package/dist/nodes/addAppToolNode.js.map +1 -1
  13. package/dist/nodes/addJumpToNode.d.ts +1 -1
  14. package/dist/nodes/addJumpToNode.d.ts.map +1 -1
  15. package/dist/nodes/addJumpToNode.js +2 -2
  16. package/dist/nodes/addJumpToNode.js.map +1 -1
  17. package/dist/nodes/addPromptNode.d.ts.map +1 -1
  18. package/dist/nodes/addPromptNode.js +1 -10
  19. package/dist/nodes/addPromptNode.js.map +1 -1
  20. package/dist/nodes/addToolNode.js +1 -1
  21. package/dist/nodes/addToolNode.js.map +1 -1
  22. package/dist/nodes/addTriggerNode.js +1 -1
  23. package/dist/nodes/addTriggerNode.js.map +1 -1
  24. package/dist/types/Agent.types.d.ts +13 -22
  25. package/dist/types/Agent.types.d.ts.map +1 -1
  26. package/dist/types/Agent.types.js +7 -9
  27. package/dist/types/Agent.types.js.map +1 -1
  28. package/dist/types/Flows.types.d.ts +1 -1
  29. package/dist/types/Flows.types.d.ts.map +1 -1
  30. package/dist/types/LangGraph.types.d.ts +45 -3
  31. package/dist/types/LangGraph.types.d.ts.map +1 -1
  32. package/dist/types/LangGraph.types.js +5 -0
  33. package/dist/types/LangGraph.types.js.map +1 -1
  34. package/package.json +1 -1
  35. package/src/agent.ts +146 -5
  36. package/src/events/AgentEvents.ts +2 -2
  37. package/src/index.ts +1 -8
  38. package/src/nodes/addAppToolNode.ts +3 -10
  39. package/src/nodes/addJumpToNode.ts +9 -3
  40. package/src/nodes/addPromptNode.ts +2 -10
  41. package/src/nodes/addToolNode.ts +2 -2
  42. package/src/nodes/addTriggerNode.ts +1 -1
  43. package/src/types/Agent.types.ts +14 -24
  44. package/src/types/Flows.types.ts +2 -2
  45. package/src/types/LangGraph.types.ts +10 -2
  46. package/dist/utils/history.d.ts +0 -3
  47. package/dist/utils/history.d.ts.map +0 -1
  48. package/dist/utils/history.js +0 -12
  49. package/dist/utils/history.js.map +0 -1
  50. package/src/utils/history.ts +0 -9
@@ -4,7 +4,7 @@ exports.addTriggerNode = void 0;
4
4
  const logger_1 = require("../utils/logger");
5
5
  const addTriggerNode = async ({ graph, node }) => {
6
6
  const callback = async () => {
7
- logger_1.logger.info(`Executing trigger node ${node.displayName}`);
7
+ logger_1.logger.info(`Executing trigger node ${node.name}`);
8
8
  return;
9
9
  };
10
10
  graph.addNode(node.name, callback);
@@ -1 +1 @@
1
- {"version":3,"file":"addTriggerNode.js","sourceRoot":"","sources":["../../src/nodes/addTriggerNode.ts"],"names":[],"mappings":";;;AAGA,4CAAyC;AAElC,MAAM,cAAc,GAAG,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAkD,EAAE,EAAE;IACtG,MAAM,QAAQ,GAAiB,KAAK,IAAI,EAAE;QACxC,eAAM,CAAC,IAAI,CAAC,0BAA0B,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAC1D,OAAO;IACT,CAAC,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACrC,CAAC,CAAC;AAPW,QAAA,cAAc,kBAOzB"}
1
+ {"version":3,"file":"addTriggerNode.js","sourceRoot":"","sources":["../../src/nodes/addTriggerNode.ts"],"names":[],"mappings":";;;AAGA,4CAAyC;AAElC,MAAM,cAAc,GAAG,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAkD,EAAE,EAAE;IACtG,MAAM,QAAQ,GAAiB,KAAK,IAAI,EAAE;QACxC,eAAM,CAAC,IAAI,CAAC,0BAA0B,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QACnD,OAAO;IACT,CAAC,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACrC,CAAC,CAAC;AAPW,QAAA,cAAc,kBAOzB"}
@@ -23,31 +23,22 @@ export interface AgentInvokeParams {
23
23
  /** Optional name of the application triggering the agent in case of an app trigger */
24
24
  appName?: string;
25
25
  }
26
- export declare enum FlowHistoryStepType {
27
- APP_TRIGGER_NODE = "appTriggerNode",
28
- TRIGGER_NODE = "triggerNode",
29
- APP_ACTION_NODE = "appActionNode",
30
- CUSTOM_ACTION_NODE = "customActionNode",
31
- PROMPT_NODE = "promptNode"
26
+ export declare enum FlowHistoryType {
27
+ TRIGGER_INVOCATION = "triggerInvocation",
28
+ APP_ACTION_INVOCATION = "appActionInvocation"
32
29
  }
33
- export interface HistoryStep {
34
- type: FlowHistoryStepType;
35
- step: number;
36
- raw: any;
37
- nodeId: string;
38
- nodeDisplayName: string;
39
- messageId?: string;
30
+ export interface FlowHistory {
31
+ type: FlowHistoryType;
40
32
  }
41
- export interface TrigggerHistoryStep extends HistoryStep {
42
- type: FlowHistoryStepType.APP_TRIGGER_NODE;
43
- appName: string;
44
- }
45
- export interface AppActionInvocationHistoryStep extends HistoryStep {
46
- type: FlowHistoryStepType.APP_ACTION_NODE;
47
- appName: string;
33
+ export interface TriggerInvocationHistory extends FlowHistory {
34
+ type: FlowHistoryType.TRIGGER_INVOCATION;
35
+ appName?: string;
36
+ triggerName: string;
37
+ triggerBody: any;
48
38
  }
49
- export interface CustomActionInvocationHistoryStep extends HistoryStep {
50
- type: FlowHistoryStepType.CUSTOM_ACTION_NODE;
39
+ export interface AppActionInvocationHistory extends FlowHistory {
40
+ type: FlowHistoryType.APP_ACTION_INVOCATION;
41
+ nodeTitle: string;
51
42
  }
52
43
  export declare enum SessionType {
53
44
  VOICE = "voice",
@@ -1 +1 @@
1
- {"version":3,"file":"Agent.types.d.ts","sourceRoot":"","sources":["../../src/types/Agent.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,aAAa,CAAC,MAAM,EAAE,CAAC,SAAS,MAAM,yBAAyB,CAAC,MAAM,CAAC,IAAI,CACrF,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAC1C,OAAO,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAEtD,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,EAAE,SAAS,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,mDAAmD;IACnD,WAAW,EAAE,GAAG,CAAC;IACjB,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sFAAsF;IACtF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,oBAAY,mBAAmB;IAC7B,gBAAgB,mBAAmB;IACnC,YAAY,gBAAgB;IAC5B,eAAe,kBAAkB;IACjC,kBAAkB,qBAAqB;IACvC,WAAW,eAAe;CAC3B;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,GAAG,CAAC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C;IACjB,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sFAAsF;IACtF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,oBAAY,eAAe;IACzB,kBAAkB,sBAAsB;IACxC,qBAAqB,wBAAwB;CAC9C;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,eAAe,CAAC;CACvB;AAED,MAAM,WAAW,wBAAyB,SAAQ,WAAW;IAC3D,IAAI,EAAE,eAAe,CAAC,kBAAkB,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,GAAG,CAAC;CAClB;AAED,MAAM,WAAW,0BAA2B,SAAQ,WAAW;IAC7D,IAAI,EAAE,eAAe,CAAC,qBAAqB,CAAC;IAC5C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,IAAI,SAAS;CACd"}
@@ -1,14 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SessionType = exports.FlowHistoryStepType = void 0;
4
- var FlowHistoryStepType;
5
- (function (FlowHistoryStepType) {
6
- FlowHistoryStepType["APP_TRIGGER_NODE"] = "appTriggerNode";
7
- FlowHistoryStepType["TRIGGER_NODE"] = "triggerNode";
8
- FlowHistoryStepType["APP_ACTION_NODE"] = "appActionNode";
9
- FlowHistoryStepType["CUSTOM_ACTION_NODE"] = "customActionNode";
10
- FlowHistoryStepType["PROMPT_NODE"] = "promptNode";
11
- })(FlowHistoryStepType || (exports.FlowHistoryStepType = FlowHistoryStepType = {}));
3
+ exports.SessionType = exports.FlowHistoryType = void 0;
4
+ var FlowHistoryType;
5
+ (function (FlowHistoryType) {
6
+ FlowHistoryType["TRIGGER_INVOCATION"] = "triggerInvocation";
7
+ FlowHistoryType["APP_ACTION_INVOCATION"] = "appActionInvocation";
8
+ })(FlowHistoryType || (exports.FlowHistoryType = FlowHistoryType = {}));
9
+ ;
12
10
  var SessionType;
13
11
  (function (SessionType) {
14
12
  SessionType["VOICE"] = "voice";
@@ -1 +1 @@
1
- {"version":3,"file":"Agent.types.js","sourceRoot":"","sources":["../../src/types/Agent.types.ts"],"names":[],"mappings":";;;AAgCA,IAAY,mBAMX;AAND,WAAY,mBAAmB;IAC7B,0DAAmC,CAAA;IACnC,mDAA4B,CAAA;IAC5B,wDAAiC,CAAA;IACjC,8DAAuC,CAAA;IACvC,iDAA0B,CAAA;AAC5B,CAAC,EANW,mBAAmB,mCAAnB,mBAAmB,QAM9B;AAyBD,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,4BAAa,CAAA;AACf,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB"}
1
+ {"version":3,"file":"Agent.types.js","sourceRoot":"","sources":["../../src/types/Agent.types.ts"],"names":[],"mappings":";;;AAgCA,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,2DAAwC,CAAA;IACxC,gEAA6C,CAAA;AAC/C,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B;AAgBA,CAAC;AAEF,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,4BAAa,CAAA;AACf,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB"}
@@ -22,7 +22,7 @@ export interface BaseNode {
22
22
  position?: Position;
23
23
  humanInTheLoop?: boolean;
24
24
  canStayOnNode?: boolean;
25
- displayName: string;
25
+ displayName?: string;
26
26
  }
27
27
  export declare enum TriggerType {
28
28
  APP = "app",
@@ -1 +1 @@
1
- {"version":3,"file":"Flows.types.d.ts","sourceRoot":"","sources":["../../src/types/Flows.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,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,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,oBAAoB,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,oBAAoB,CAAC;QAC3B,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;KACjC,CAAC;CACH,CAAC;AAEF,oBAAY,oBAAoB;IAC9B,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,GAAG,QAAQ;CACZ;AAED,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AAED,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,iBAAiB,sBAAsB;IACvC,aAAa,kBAAkB;CAChC"}
@@ -1,17 +1,59 @@
1
1
  import { BaseMessage } from '@langchain/core/messages';
2
2
  import { CompiledStateGraph, StateGraph } from '@langchain/langgraph';
3
- import { HistoryStep, SessionType } from './Agent.types';
3
+ import { FlowHistory, SessionType, TriggerInvocationHistory } from './Agent.types';
4
4
  export declare const createStateAnnotation: <Memory = any>() => import("@langchain/langgraph").AnnotationRoot<{
5
5
  messages: import("@langchain/langgraph").BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
6
6
  memory: import("@langchain/langgraph").BinaryOperatorAggregate<Memory, Memory>;
7
- history: import("@langchain/langgraph").BinaryOperatorAggregate<HistoryStep[], HistoryStep[]>;
7
+ triggerInvocations: import("@langchain/langgraph").BinaryOperatorAggregate<TriggerInvocationHistory[], TriggerInvocationHistory[]>;
8
+ triggerMetadata: {
9
+ (): import("@langchain/langgraph").LastValue<{
10
+ name: string;
11
+ triggerBody: any;
12
+ } | null>;
13
+ (annotation: import("@langchain/langgraph").SingleReducer<{
14
+ name: string;
15
+ triggerBody: any;
16
+ } | null, {
17
+ name: string;
18
+ triggerBody: any;
19
+ } | null>): import("@langchain/langgraph").BinaryOperatorAggregate<{
20
+ name: string;
21
+ triggerBody: any;
22
+ } | null, {
23
+ name: string;
24
+ triggerBody: any;
25
+ } | null>;
26
+ Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
27
+ };
28
+ history: import("@langchain/langgraph").BinaryOperatorAggregate<FlowHistory[], FlowHistory[]>;
8
29
  sessionId: import("@langchain/langgraph").LastValue<string>;
9
30
  sessionType: import("@langchain/langgraph").BinaryOperatorAggregate<SessionType, SessionType>;
10
31
  }>;
11
32
  export declare const stateAnnotation: import("@langchain/langgraph").AnnotationRoot<{
12
33
  messages: import("@langchain/langgraph").BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
13
34
  memory: import("@langchain/langgraph").BinaryOperatorAggregate<any, any>;
14
- history: import("@langchain/langgraph").BinaryOperatorAggregate<HistoryStep[], HistoryStep[]>;
35
+ triggerInvocations: import("@langchain/langgraph").BinaryOperatorAggregate<TriggerInvocationHistory[], TriggerInvocationHistory[]>;
36
+ triggerMetadata: {
37
+ (): import("@langchain/langgraph").LastValue<{
38
+ name: string;
39
+ triggerBody: any;
40
+ } | null>;
41
+ (annotation: import("@langchain/langgraph").SingleReducer<{
42
+ name: string;
43
+ triggerBody: any;
44
+ } | null, {
45
+ name: string;
46
+ triggerBody: any;
47
+ } | null>): import("@langchain/langgraph").BinaryOperatorAggregate<{
48
+ name: string;
49
+ triggerBody: any;
50
+ } | null, {
51
+ name: string;
52
+ triggerBody: any;
53
+ } | null>;
54
+ Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
55
+ };
56
+ history: import("@langchain/langgraph").BinaryOperatorAggregate<FlowHistory[], FlowHistory[]>;
15
57
  sessionId: import("@langchain/langgraph").LastValue<string>;
16
58
  sessionType: import("@langchain/langgraph").BinaryOperatorAggregate<SessionType, SessionType>;
17
59
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"LangGraph.types.d.ts","sourceRoot":"","sources":["../../src/types/LangGraph.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAc,kBAAkB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEzD,eAAO,MAAM,qBAAqB,GAAI,MAAM,GAAG,GAAG;;;;;;EAgC9C,CAAC;AAGL,eAAO,MAAM,eAAe;;;;;;EAA0B,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AACjE,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AAC5D,MAAM,MAAM,KAAK,CAAC,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC"}
1
+ {"version":3,"file":"LangGraph.types.d.ts","sourceRoot":"","sources":["../../src/types/LangGraph.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAc,kBAAkB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAEnF,eAAO,MAAM,qBAAqB,GAAI,MAAM,GAAG,GAAG;;;;;;kBA4BtC,MAAM;yBACC,GAAG;;;kBADV,MAAM;yBACC,GAAG;;kBADV,MAAM;yBACC,GAAG;;kBADV,MAAM;yBACC,GAAG;;kBADV,MAAM;yBACC,GAAG;;;;;;;EAWlB,CAAC;AAGL,eAAO,MAAM,eAAe;;;;;;kBAfhB,MAAM;yBACC,GAAG;;;kBADV,MAAM;yBACC,GAAG;;kBADV,MAAM;yBACC,GAAG;;kBADV,MAAM;yBACC,GAAG;;kBADV,MAAM;yBACC,GAAG;;;;;;;EAcgC,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AACjE,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AAC5D,MAAM,MAAM,KAAK,CAAC,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC"}
@@ -27,6 +27,11 @@ const createStateAnnotation = () => langgraph_1.Annotation.Root({
27
27
  default: () => ({}),
28
28
  reducer: (a, b) => ({ ...a, ...b }),
29
29
  }),
30
+ triggerInvocations: (0, langgraph_1.Annotation)({
31
+ default: () => [],
32
+ reducer: (a, b) => a.concat(b),
33
+ }),
34
+ triggerMetadata: (langgraph_1.Annotation),
30
35
  history: (0, langgraph_1.Annotation)({
31
36
  default: () => [],
32
37
  reducer: (a, b) => a.concat(b),
@@ -1 +1 @@
1
- {"version":3,"file":"LangGraph.types.js","sourceRoot":"","sources":["../../src/types/LangGraph.types.ts"],"names":[],"mappings":";;;AACA,oDAAkF;AAClF,+CAAyD;AAElD,MAAM,qBAAqB,GAAG,GAAiB,EAAE,CACtD,sBAAU,CAAC,IAAI,CAAC;IACd,QAAQ,EAAE,IAAA,sBAAU,EAAqB;QACvC,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE;QACjB,OAAO,EAAE,CAAC,YAAY,EAAE,WAAW,EAAE,EAAE;;YACrC,MAAM,GAAG,GAAG,CAAC,GA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AAkB,EAAE,IAAA,sBAAU,EAAkC;QAC9D,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE;QACjB,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;KAC/B,CAAC;IACF,eAAe,EAAE,CAAA,sBAGR,CAAA;IACT,OAAO,EAAE,IAAA,sBAAU,EAAqB;QACtC,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE;QACjB,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;KAC/B,CAAC;IACF,SAAS,EAAE,IAAA,sBAAU,GAAU;IAC/B,WAAW,EAAE,IAAA,sBAAU,EAAc;QACnC,OAAO,EAAE,GAAG,EAAE,CAAC,yBAAW,CAAC,IAAI;QAC/B,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC;KAC1B,CAAC;CACH,CAAC,CAAC;AAxCQ,QAAA,qBAAqB,yBAwC7B;AAEL,gDAAgD;AACnC,QAAA,eAAe,GAAG,IAAA,6BAAqB,GAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minded-ai/mindedjs",
3
- "version": "1.0.78-beta-2",
3
+ "version": "1.0.78",
4
4
  "description": "MindedJS is a TypeScript library for building agents.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/agent.ts CHANGED
@@ -15,7 +15,7 @@ import { InvokeMessage, MindedConnectionSocketMessageType } from './platform/min
15
15
  import * as fs from 'fs';
16
16
  import * as path from 'path';
17
17
  import * as yaml from 'js-yaml';
18
- import { AgentInvokeParams, FlowHistoryStepType, MindedSDKConfig, SessionType } from './types/Agent.types';
18
+ import { AgentInvokeParams, FlowHistoryType, MindedSDKConfig, SessionType, TriggerInvocationHistory } from './types/Agent.types';
19
19
  import { createLlmInstance } from './llm/createLlmInstance';
20
20
  import { createCheckpointSaver } from './checkpointer/checkpointSaverFactory';
21
21
  import { getConfig } from './platform/config';
@@ -315,7 +315,9 @@ export class Agent {
315
315
  return {
316
316
  messages: [],
317
317
  memory: {} as z.infer<typeof this.memorySchema>,
318
+ triggerMetadata: null,
318
319
  history: [],
320
+ triggerInvocations: [] as Array<TriggerInvocationHistory>,
319
321
  sessionId: state.sessionId || uuidv4(), // Preserve existing sessionId or generate new one
320
322
  sessionType: state.sessionType || SessionType.TEXT,
321
323
  };
@@ -390,7 +392,7 @@ export class Agent {
390
392
  const triggerInvocation = { appName, triggerName, triggerBody };
391
393
  const history = [
392
394
  {
393
- type: FlowHistoryStepType.APP_TRIGGER_NODE,
395
+ type: FlowHistoryType.TRIGGER_INVOCATION,
394
396
  ...triggerInvocation,
395
397
  },
396
398
  ];
@@ -402,16 +404,155 @@ export class Agent {
402
404
  if (state.tasks?.[0]?.interrupts?.length > 0) {
403
405
  res = await this.compiledGraph.invoke(
404
406
  new Command({
405
- resume: { memory: memoryUpdate, messages, history, sessionId, sessionType },
407
+ resume: { memory: memoryUpdate, messages, history, triggerInvocations: [triggerInvocation], sessionId, sessionType },
406
408
  }),
407
409
  langraphConfig,
408
410
  );
409
411
  } else {
410
- res = await this.compiledGraph.invoke({ messages, memory: memoryUpdate, history, sessionId, sessionType }, langraphConfig);
412
+ res = await this.compiledGraph.invoke(
413
+ { messages, memory: memoryUpdate, history, triggerInvocations: [triggerInvocation], sessionId, sessionType },
414
+ langraphConfig,
415
+ );
411
416
  }
412
417
  return res;
413
418
  }
414
419
 
420
+ /**
421
+ * Register an event handler for specific agent events.
422
+ *
423
+ * This method allows you to listen for and respond to various events that occur during
424
+ * agent execution, such as trigger events, memory updates, or custom application events.
425
+ * Multiple handlers can be registered for the same event type and will be executed in the order they are registered.
426
+ *
427
+ * ## Available Event Types
428
+ *
429
+ * ### AI_MESSAGE
430
+ * Emitted when an AI generates a message that should be sent to the user.
431
+ *
432
+ * **Input Structure:**
433
+ * ```typescript
434
+ * {
435
+ * message: string; // The AI-generated message content
436
+ * state: { // Full agent state
437
+ * messages: BaseMessage[]; // Conversation messages
438
+ * memory: Memory; // Current memory state (your defined memory schema)
439
+ * triggerInvocations: Array<...>; // Trigger invocation history
440
+ * triggerMetadata: {...} | null; // Current trigger metadata
441
+ * history: FlowHistory[]; // Flow execution history
442
+ * sessionId: string; // Session identifier
443
+ * }
444
+ * }
445
+ * ```
446
+ *
447
+ * **Expected Output:** `void` - Handlers are used for side effects like sending messages to UI
448
+ *
449
+ * **Common Use Cases:**
450
+ * - Real-time chat UI updates with session context
451
+ * - Logging AI responses for analytics or debugging
452
+ * - Message formatting and transformation
453
+ * - Notifications and alerts based on AI responses
454
+ * - Session-based message routing
455
+ *
456
+ * ### TRIGGER_EVENT
457
+ * Emitted when a trigger node is executed. Allows you to qualify, transform, and provide
458
+ * initial state for trigger inputs before they're processed by the agent.
459
+ *
460
+ * **Input Structure:**
461
+ * ```typescript
462
+ * {
463
+ * triggerName: string; // Name of the trigger being executed
464
+ * triggerBody: any; // The trigger input data (type varies by trigger)
465
+ * }
466
+ * ```
467
+ *
468
+ * **Expected Output:** One of three possible return types:
469
+ *
470
+ * 1. **Provide Initial State:**
471
+ * ```typescript
472
+ * {
473
+ * messages?: BaseMessage[]; // Initial messages for the conversation
474
+ * memory?: Memory; // Initial memory state
475
+ * sessionId?: string; // Session ID for persistence (resumes existing sessions)
476
+ * }
477
+ * ```
478
+ *
479
+ * 2. **Disqualify the Trigger:**
480
+ * ```typescript
481
+ * false // Rejects/disqualifies the trigger from processing
482
+ * ```
483
+ *
484
+ * 3. **Qualify without Initial State:**
485
+ * ```typescript
486
+ * void // Qualifies the trigger but provides no initial state
487
+ * ```
488
+ *
489
+ * **Common Use Cases:**
490
+ * - Input validation and trigger qualification
491
+ * - Data transformation into standardized formats
492
+ * - Context setting with initial memory state
493
+ * - Access control and business rule enforcement
494
+ * - Routing logic for different trigger types
495
+ *
496
+ * @template E - The event type, constrained to known agent event types
497
+ * @param event - The name of the event to listen for
498
+ * @param handler - The function to call when the event is emitted
499
+ *
500
+ * @example
501
+ * ```typescript
502
+ * // AI_MESSAGE Event Handler
503
+ * agent.on('AI_MESSAGE', async ({ message, state }) => {
504
+ * logger.info({ msg: 'AI said:', output: message });
505
+ * logger.info({ msg: 'Current memory:', output: state.memory });
506
+ * logger.info({ msg: 'Session ID:', output: state.sessionId });
507
+ *
508
+ * // Send to user interface with session context
509
+ * await sendMessageToUser(message, state.sessionId);
510
+ *
511
+ * // Send via WebSocket
512
+ * await websocket.send(JSON.stringify({
513
+ * type: 'ai_message',
514
+ * content: message,
515
+ * sessionId: state.sessionId,
516
+ * memory: state.memory
517
+ * }));
518
+ * });
519
+ *
520
+ * // TRIGGER_EVENT Event Handler - Input Validation
521
+ * agent.on('TRIGGER_EVENT', async ({ triggerName, triggerBody }) => {
522
+ * // Validate trigger input
523
+ * if (!isValidInput(triggerBody)) {
524
+ * return false; // Disqualify the trigger
525
+ * }
526
+ *
527
+ * // Business hours check
528
+ * if (triggerName === 'supportRequest' && !isBusinessHours()) {
529
+ * return false;
530
+ * }
531
+ *
532
+ * return {
533
+ * memory: { validatedInput: triggerBody },
534
+ * messages: [new HumanMessage('Support request received')],
535
+ * sessionId: triggerBody.userId // Resume existing session
536
+ * };
537
+ * });
538
+ *
539
+ * // TRIGGER_EVENT Event Handler - Data Transformation
540
+ * agent.on('TRIGGER_EVENT', async ({ triggerName, triggerBody }) => {
541
+ * if (triggerName === 'emailTrigger') {
542
+ * // Transform email data into structured format
543
+ * const parsedEmail = parseEmailContent(triggerBody);
544
+ *
545
+ * return {
546
+ * memory: {
547
+ * emailSubject: parsedEmail.subject,
548
+ * senderEmail: parsedEmail.from
549
+ * },
550
+ * messages: [new HumanMessage(parsedEmail.content)],
551
+ * };
552
+ * }
553
+ * });
554
+ * ```
555
+ */
415
556
  // Public API for registering event listeners
416
557
  public on<E extends keyof AgentEventRequestPayloads<z.infer<typeof this.memorySchema>>>(
417
558
  event: E,
@@ -445,7 +586,7 @@ export class Agent {
445
586
  }
446
587
  return this.flows
447
588
  .flatMap((flow) => flow.nodes.filter((node) => node.type === NodeType.APP_TOOL))
448
- .map((node) => appActionRunnerToolCreator(node.metadata.schema, node.name, this.mindedConnection as MindedConnection));
589
+ .map((node) => appActionRunnerToolCreator(node.metadata.schema, node.displayName!, this.mindedConnection as MindedConnection));
449
590
  }
450
591
 
451
592
  // Private method to get secrets from the backend service and load them into environment variables
@@ -1,5 +1,5 @@
1
1
  import { BaseMessage } from '@langchain/core/messages';
2
- import { HistoryStep } from '../types/Agent.types';
2
+ import { FlowHistory } from '../types/Agent.types';
3
3
  import { createStateAnnotation } from '../types/LangGraph.types';
4
4
 
5
5
  export enum AgentEvents {
@@ -28,7 +28,7 @@ export type AgentEventResponsePayloads<Memory> = {
28
28
  isQualified: boolean;
29
29
  messages?: BaseMessage[];
30
30
  memory?: Memory;
31
- history?: HistoryStep[];
31
+ history?: FlowHistory[];
32
32
  sessionId?: string;
33
33
  };
34
34
  };
package/src/index.ts CHANGED
@@ -35,14 +35,7 @@ export {
35
35
  KnownTriggerNames,
36
36
  } from './types/Flows.types';
37
37
  export type { Tool, ToolExecuteInput } from './types/Tools.types';
38
- export {
39
- FlowHistoryStepType,
40
- HistoryStep,
41
- TrigggerHistoryStep,
42
- AppActionInvocationHistoryStep,
43
- CustomActionInvocationHistoryStep,
44
- SessionType,
45
- } from './types/Agent.types';
38
+ export { FlowHistoryType, FlowHistory, TriggerInvocationHistory, AppActionInvocationHistory, SessionType } from './types/Agent.types';
46
39
  export type { AgentInvokeParams, MindedSDKConfig } from './types/Agent.types';
47
40
  export type { Environment } from './types/Platform.types';
48
41
  export type { State } from './types/LangGraph.types';
@@ -6,11 +6,10 @@ 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, FlowHistoryStepType } from '../types/Agent.types';
9
+ import { FlowHistoryType } from '../types/Agent.types';
10
10
  import { Agent } from '../agent';
11
11
  import { logger } from '../utils/logger';
12
12
  import { compilePlaybooks } from '../playbooks/playbooks';
13
- import { createHistoryStep } from '../utils/history';
14
13
 
15
14
  export const addAppToolNode = async ({
16
15
  graph,
@@ -24,7 +23,7 @@ export const addAppToolNode = async ({
24
23
  agent: Agent;
25
24
  }) => {
26
25
  const cleanedParameters = Object.fromEntries(Object.entries(node.parameters || {}).filter(([, value]) => value !== ''));
27
- const appRunnerTool = getAppActionRunnerTool(node.name);
26
+ const appRunnerTool = getAppActionRunnerTool(node.displayName!);
28
27
  const callback: RunnableLike = async (state: typeof stateAnnotation.State) => {
29
28
  logger.info(`Executing tool node ${appRunnerTool.name}`);
30
29
 
@@ -77,13 +76,7 @@ export const addAppToolNode = async ({
77
76
  };
78
77
  return {
79
78
  messages: [AIToolCallMessage, toolCallMessage],
80
- history: createHistoryStep<AppActionInvocationHistoryStep>(state.history, {
81
- type: FlowHistoryStepType.APP_ACTION_NODE,
82
- nodeId: node.name,
83
- nodeDisplayName: node.displayName!,
84
- raw: AIToolCallMessage.tool_calls[0],
85
- appName: node.appName,
86
- }),
79
+ history: [{ type: FlowHistoryType.APP_ACTION_INVOCATION, nodeTitle: node.displayName }],
87
80
  };
88
81
  };
89
82
  graph.addNode(node.name, callback);
@@ -3,13 +3,19 @@ import { PreCompiledGraph } from '../types/LangGraph.types';
3
3
  import { JumpToNode } from '../types/Flows.types';
4
4
  import { logger } from '../utils/logger';
5
5
 
6
- export const addJumpToNode = async ({ graph, node }: { graph: PreCompiledGraph; node: JumpToNode }) => {
6
+ export const addJumpToNode = async ({
7
+ graph,
8
+ node,
9
+ }: {
10
+ graph: PreCompiledGraph;
11
+ node: JumpToNode;
12
+ }) => {
7
13
  const callback: RunnableLike = async () => {
8
- logger.info(`Executing jump node ${node.displayName} – jumping to ${node.targetNodeId}`);
14
+ logger.info(`Executing jump node ${node.name} – jumping to ${node.targetNodeId}`);
9
15
  // No state modifications are necessary; control flow is handled via edges.
10
16
  return;
11
17
  };
12
18
 
13
19
  graph.addNode(node.name, callback);
14
20
  graph.addEdge(node.name as any, node.targetNodeId as any);
15
- };
21
+ };
@@ -7,13 +7,12 @@ 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, FlowHistoryStepType, HistoryStep } from '../types/Agent.types';
10
+ import { EmitSignature } from '../types/Agent.types';
11
11
  import { createLlmInstance } from '../llm/createLlmInstance';
12
12
  import extractToolStateResponse from '../utils/extractStateMemoryResponse';
13
13
  import { Agent } from '../agent';
14
14
  import { logger } from '../utils/logger';
15
15
  import { compilePlaybooks } from '../playbooks/playbooks';
16
- import { createHistoryStep } from '../utils/history';
17
16
 
18
17
  type AddPromptNodeParams = {
19
18
  graph: PreCompiledGraph;
@@ -26,7 +25,7 @@ type AddPromptNodeParams = {
26
25
 
27
26
  export const addPromptNode = async ({ graph, node, llm, tools, emit, agent }: AddPromptNodeParams) => {
28
27
  const callback: RunnableLike = async (state: typeof stateAnnotation.State) => {
29
- logger.info(`Executing prompt node ${node.displayName}`);
28
+ logger.info(`Executing prompt node ${node.name}`);
30
29
  const llmToUse = node.llmConfig ? createLlmInstance(node.llmConfig) : llm;
31
30
 
32
31
  const globalTools = tools
@@ -99,13 +98,6 @@ export const addPromptNode = async ({ graph, node, llm, tools, emit, agent }: Ad
99
98
  }
100
99
 
101
100
  return {
102
- history: createHistoryStep<HistoryStep>(state.history, {
103
- type: FlowHistoryStepType.PROMPT_NODE,
104
- nodeId: node.name,
105
- nodeDisplayName: node.displayName,
106
- raw: result.content,
107
- messageId: result.id,
108
- }),
109
101
  messages: [result],
110
102
  };
111
103
  };
@@ -28,9 +28,9 @@ export const addToolNode = async ({
28
28
  throw new Error(`Tool not found: ${toolNode.toolName}`);
29
29
  }
30
30
  const callback: RunnableLike = async (state: typeof stateAnnotation.State) => {
31
- logger.info(`Executing tool node ${toolNode.displayName}`);
31
+ logger.info(`Executing tool node ${toolNode.name}`);
32
32
 
33
- const tool = langchainTool(() => {}, {
33
+ const tool = langchainTool(() => { }, {
34
34
  name: matchedTool.name,
35
35
  description: matchedTool.description,
36
36
  schema: matchedTool.input,
@@ -5,7 +5,7 @@ import { logger } from '../utils/logger';
5
5
 
6
6
  export const addTriggerNode = async ({ graph, node }: { graph: PreCompiledGraph; node: TriggerNode }) => {
7
7
  const callback: RunnableLike = async () => {
8
- logger.info(`Executing trigger node ${node.displayName}`);
8
+ logger.info(`Executing trigger node ${node.name}`);
9
9
  return;
10
10
  };
11
11
 
@@ -30,36 +30,26 @@ export interface AgentInvokeParams {
30
30
  appName?: string;
31
31
  }
32
32
 
33
- export enum FlowHistoryStepType {
34
- APP_TRIGGER_NODE = 'appTriggerNode',
35
- TRIGGER_NODE = 'triggerNode',
36
- APP_ACTION_NODE = 'appActionNode',
37
- CUSTOM_ACTION_NODE = 'customActionNode',
38
- PROMPT_NODE = 'promptNode',
33
+ export enum FlowHistoryType {
34
+ TRIGGER_INVOCATION = 'triggerInvocation',
35
+ APP_ACTION_INVOCATION = 'appActionInvocation',
39
36
  }
40
37
 
41
- export interface HistoryStep {
42
- type: FlowHistoryStepType;
43
- step: number;
44
- raw: any;
45
- nodeId: string;
46
- nodeDisplayName: string;
47
- messageId?: string;
38
+ export interface FlowHistory {
39
+ type: FlowHistoryType;
48
40
  }
49
41
 
50
- export interface TrigggerHistoryStep extends HistoryStep {
51
- type: FlowHistoryStepType.APP_TRIGGER_NODE;
52
- appName: string;
53
- }
54
-
55
- export interface AppActionInvocationHistoryStep extends HistoryStep {
56
- type: FlowHistoryStepType.APP_ACTION_NODE;
57
- appName: string;
42
+ export interface TriggerInvocationHistory extends FlowHistory {
43
+ type: FlowHistoryType.TRIGGER_INVOCATION;
44
+ appName?: string;
45
+ triggerName: string;
46
+ triggerBody: any;
58
47
  }
59
48
 
60
- export interface CustomActionInvocationHistoryStep extends HistoryStep {
61
- type: FlowHistoryStepType.CUSTOM_ACTION_NODE;
62
- }
49
+ export interface AppActionInvocationHistory extends FlowHistory {
50
+ type: FlowHistoryType.APP_ACTION_INVOCATION;
51
+ nodeTitle: string;
52
+ };
63
53
 
64
54
  export enum SessionType {
65
55
  VOICE = 'voice',