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

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 +0 -136
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +3 -141
  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 +8 -1
  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 +10 -1
  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 +22 -13
  25. package/dist/types/Agent.types.d.ts.map +1 -1
  26. package/dist/types/Agent.types.js +9 -7
  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 +3 -45
  31. package/dist/types/LangGraph.types.d.ts.map +1 -1
  32. package/dist/types/LangGraph.types.js +0 -5
  33. package/dist/types/LangGraph.types.js.map +1 -1
  34. package/dist/utils/history.d.ts +3 -0
  35. package/dist/utils/history.d.ts.map +1 -0
  36. package/dist/utils/history.js +12 -0
  37. package/dist/utils/history.js.map +1 -0
  38. package/package.json +1 -1
  39. package/src/agent.ts +4 -145
  40. package/src/events/AgentEvents.ts +2 -2
  41. package/src/index.ts +8 -1
  42. package/src/nodes/addAppToolNode.ts +9 -2
  43. package/src/nodes/addJumpToNode.ts +3 -9
  44. package/src/nodes/addPromptNode.ts +10 -2
  45. package/src/nodes/addToolNode.ts +2 -2
  46. package/src/nodes/addTriggerNode.ts +1 -1
  47. package/src/types/Agent.types.ts +24 -14
  48. package/src/types/Flows.types.ts +2 -2
  49. package/src/types/LangGraph.types.ts +2 -10
  50. package/src/utils/history.ts +9 -0
@@ -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,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"}
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"}
@@ -23,22 +23,31 @@ 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 FlowHistoryType {
27
- TRIGGER_INVOCATION = "triggerInvocation",
28
- APP_ACTION_INVOCATION = "appActionInvocation"
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"
29
32
  }
30
- export interface FlowHistory {
31
- type: FlowHistoryType;
33
+ export interface HistoryStep {
34
+ type: FlowHistoryStepType;
35
+ step: number;
36
+ raw: any;
37
+ nodeId: string;
38
+ nodeDisplayName: string;
39
+ messageId?: string;
32
40
  }
33
- export interface TriggerInvocationHistory extends FlowHistory {
34
- type: FlowHistoryType.TRIGGER_INVOCATION;
35
- appName?: string;
36
- triggerName: string;
37
- triggerBody: any;
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;
38
48
  }
39
- export interface AppActionInvocationHistory extends FlowHistory {
40
- type: FlowHistoryType.APP_ACTION_INVOCATION;
41
- nodeTitle: string;
49
+ export interface CustomActionInvocationHistoryStep extends HistoryStep {
50
+ type: FlowHistoryStepType.CUSTOM_ACTION_NODE;
42
51
  }
43
52
  export declare enum SessionType {
44
53
  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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,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,IAAI,EAAE,mBAAmB,CAAC,gBAAgB,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,8BAA+B,SAAQ,WAAW;IACjE,IAAI,EAAE,mBAAmB,CAAC,eAAe,CAAC;IAC1C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iCAAkC,SAAQ,WAAW;IACpE,IAAI,EAAE,mBAAmB,CAAC,kBAAkB,CAAC;CAC9C;AAED,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,IAAI,SAAS;CACd"}
@@ -1,12 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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
- ;
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 = {}));
10
12
  var SessionType;
11
13
  (function (SessionType) {
12
14
  SessionType["VOICE"] = "voice";
@@ -1 +1 @@
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"}
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"}
@@ -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,CAAC,EAAE,MAAM,CAAC;CACX;AAED,oBAAY,QAAQ;IAClB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,QAAQ,YAAY;IACpB,WAAW,eAAe;IAC1B,YAAY,eAAe;CAC5B;AAED,oBAAY,QAAQ;IAClB,iBAAiB,qBAAqB;IACtC,gBAA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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,59 +1,17 @@
1
1
  import { BaseMessage } from '@langchain/core/messages';
2
2
  import { CompiledStateGraph, StateGraph } from '@langchain/langgraph';
3
- import { FlowHistory, SessionType, TriggerInvocationHistory } from './Agent.types';
3
+ import { HistoryStep, SessionType } 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
- 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[]>;
7
+ history: import("@langchain/langgraph").BinaryOperatorAggregate<HistoryStep[], HistoryStep[]>;
29
8
  sessionId: import("@langchain/langgraph").LastValue<string>;
30
9
  sessionType: import("@langchain/langgraph").BinaryOperatorAggregate<SessionType, SessionType>;
31
10
  }>;
32
11
  export declare const stateAnnotation: import("@langchain/langgraph").AnnotationRoot<{
33
12
  messages: import("@langchain/langgraph").BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
34
13
  memory: import("@langchain/langgraph").BinaryOperatorAggregate<any, any>;
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[]>;
14
+ history: import("@langchain/langgraph").BinaryOperatorAggregate<HistoryStep[], HistoryStep[]>;
57
15
  sessionId: import("@langchain/langgraph").LastValue<string>;
58
16
  sessionType: import("@langchain/langgraph").BinaryOperatorAggregate<SessionType, SessionType>;
59
17
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"LangGraph.types.d.ts","sourceRoot":"","sources":["../../src/types/LangGraph.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,M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D,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,11 +27,6 @@ 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),
35
30
  history: (0, langgraph_1.Annotation)({
36
31
  default: () => [],
37
32
  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,+CAAmF;AAE5E,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,GAAG,YAAY,CAAC,CAAC;YAC9B,KAAK,MAAM,OAAO,IAAI,WAAW,EAAE,CAAC;gBAClC,IAAI,MAAA,OAAO,CAAC,iBAAiB,0CAAE,MAAM,EAAE,CAAC;oBACtC,MAAM,KAAK,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC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,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;AAhCQ,QAAA,qBAAqB,yBAgC7B;AAEL,gDAAgD;AACnC,QAAA,eAAe,GAAG,IAAA,6BAAqB,GAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { HistoryStep } from '../types/Agent.types';
2
+ export declare const createHistoryStep: <T extends HistoryStep>(currentHistory: HistoryStep[], stepPayload: Omit<T, "step">) => HistoryStep;
3
+ //# sourceMappingURL=history.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/utils/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,WAAW,EAAE,gBAAgB,WAAW,EAAE,EAAE,aAAa,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,KAAG,WAMtH,CAAC"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createHistoryStep = void 0;
4
+ const createHistoryStep = (currentHistory, stepPayload) => {
5
+ const lastHistoryStep = currentHistory[currentHistory.length - 1];
6
+ return {
7
+ ...stepPayload,
8
+ step: lastHistoryStep.step + 1,
9
+ };
10
+ };
11
+ exports.createHistoryStep = createHistoryStep;
12
+ //# sourceMappingURL=history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/utils/history.ts"],"names":[],"mappings":";;;AAEO,MAAM,iBAAiB,GAAG,CAAwB,cAA6B,EAAE,WAA4B,EAAe,EAAE;IACnI,MAAM,eAAe,GAAG,cAAc,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAClE,OAAO;QACL,GAAG,WAAW;QACd,IAAI,EAAE,eAAe,CAAC,IAAI,GAAG,CAAC;KAChB,CAAC;AACnB,CAAC,CAAC;AANW,QAAA,iBAAiB,qBAM5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minded-ai/mindedjs",
3
- "version": "1.0.77",
3
+ "version": "1.0.78-beta-2",
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, FlowHistoryType, MindedSDKConfig, SessionType, TriggerInvocationHistory } from './types/Agent.types';
18
+ import { AgentInvokeParams, FlowHistoryStepType, MindedSDKConfig, SessionType } 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,9 +315,7 @@ export class Agent {
315
315
  return {
316
316
  messages: [],
317
317
  memory: {} as z.infer<typeof this.memorySchema>,
318
- triggerMetadata: null,
319
318
  history: [],
320
- triggerInvocations: [] as Array<TriggerInvocationHistory>,
321
319
  sessionId: state.sessionId || uuidv4(), // Preserve existing sessionId or generate new one
322
320
  sessionType: state.sessionType || SessionType.TEXT,
323
321
  };
@@ -392,7 +390,7 @@ export class Agent {
392
390
  const triggerInvocation = { appName, triggerName, triggerBody };
393
391
  const history = [
394
392
  {
395
- type: FlowHistoryType.TRIGGER_INVOCATION,
393
+ type: FlowHistoryStepType.APP_TRIGGER_NODE,
396
394
  ...triggerInvocation,
397
395
  },
398
396
  ];
@@ -404,155 +402,16 @@ export class Agent {
404
402
  if (state.tasks?.[0]?.interrupts?.length > 0) {
405
403
  res = await this.compiledGraph.invoke(
406
404
  new Command({
407
- resume: { memory: memoryUpdate, messages, history, triggerInvocations: [triggerInvocation], sessionId, sessionType },
405
+ resume: { memory: memoryUpdate, messages, history, sessionId, sessionType },
408
406
  }),
409
407
  langraphConfig,
410
408
  );
411
409
  } else {
412
- res = await this.compiledGraph.invoke(
413
- { messages, memory: memoryUpdate, history, triggerInvocations: [triggerInvocation], sessionId, sessionType },
414
- langraphConfig,
415
- );
410
+ res = await this.compiledGraph.invoke({ messages, memory: memoryUpdate, history, sessionId, sessionType }, langraphConfig);
416
411
  }
417
412
  return res;
418
413
  }
419
414
 
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
- */
556
415
  // Public API for registering event listeners
557
416
  public on<E extends keyof AgentEventRequestPayloads<z.infer<typeof this.memorySchema>>>(
558
417
  event: E,
@@ -1,5 +1,5 @@
1
1
  import { BaseMessage } from '@langchain/core/messages';
2
- import { FlowHistory } from '../types/Agent.types';
2
+ import { HistoryStep } 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?: FlowHistory[];
31
+ history?: HistoryStep[];
32
32
  sessionId?: string;
33
33
  };
34
34
  };
package/src/index.ts CHANGED
@@ -35,7 +35,14 @@ export {
35
35
  KnownTriggerNames,
36
36
  } from './types/Flows.types';
37
37
  export type { Tool, ToolExecuteInput } from './types/Tools.types';
38
- export { FlowHistoryType, FlowHistory, TriggerInvocationHistory, AppActionInvocationHistory, SessionType } from './types/Agent.types';
38
+ export {
39
+ FlowHistoryStepType,
40
+ HistoryStep,
41
+ TrigggerHistoryStep,
42
+ AppActionInvocationHistoryStep,
43
+ CustomActionInvocationHistoryStep,
44
+ SessionType,
45
+ } from './types/Agent.types';
39
46
  export type { AgentInvokeParams, MindedSDKConfig } from './types/Agent.types';
40
47
  export type { Environment } from './types/Platform.types';
41
48
  export type { State } from './types/LangGraph.types';
@@ -6,10 +6,11 @@ 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 { FlowHistoryType } from '../types/Agent.types';
9
+ import { AppActionInvocationHistoryStep, FlowHistoryStepType } 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';
13
14
 
14
15
  export const addAppToolNode = async ({
15
16
  graph,
@@ -76,7 +77,13 @@ export const addAppToolNode = async ({
76
77
  };
77
78
  return {
78
79
  messages: [AIToolCallMessage, toolCallMessage],
79
- history: [{ type: FlowHistoryType.APP_ACTION_INVOCATION, nodeTitle: node.name }],
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
+ }),
80
87
  };
81
88
  };
82
89
  graph.addNode(node.name, callback);
@@ -3,19 +3,13 @@ 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 ({
7
- graph,
8
- node,
9
- }: {
10
- graph: PreCompiledGraph;
11
- node: JumpToNode;
12
- }) => {
6
+ export const addJumpToNode = async ({ graph, node }: { graph: PreCompiledGraph; node: JumpToNode }) => {
13
7
  const callback: RunnableLike = async () => {
14
- logger.info(`Executing jump node ${node.name} – jumping to ${node.targetNodeId}`);
8
+ logger.info(`Executing jump node ${node.displayName} – jumping to ${node.targetNodeId}`);
15
9
  // No state modifications are necessary; control flow is handled via edges.
16
10
  return;
17
11
  };
18
12
 
19
13
  graph.addNode(node.name, callback);
20
14
  graph.addEdge(node.name as any, node.targetNodeId as any);
21
- };
15
+ };
@@ -7,12 +7,13 @@ 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 } from '../types/Agent.types';
10
+ import { EmitSignature, FlowHistoryStepType, 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';
14
14
  import { logger } from '../utils/logger';
15
15
  import { compilePlaybooks } from '../playbooks/playbooks';
16
+ import { createHistoryStep } from '../utils/history';
16
17
 
17
18
  type AddPromptNodeParams = {
18
19
  graph: PreCompiledGraph;
@@ -25,7 +26,7 @@ type AddPromptNodeParams = {
25
26
 
26
27
  export const addPromptNode = async ({ graph, node, llm, tools, emit, agent }: AddPromptNodeParams) => {
27
28
  const callback: RunnableLike = async (state: typeof stateAnnotation.State) => {
28
- logger.info(`Executing prompt node ${node.name}`);
29
+ logger.info(`Executing prompt node ${node.displayName}`);
29
30
  const llmToUse = node.llmConfig ? createLlmInstance(node.llmConfig) : llm;
30
31
 
31
32
  const globalTools = tools
@@ -98,6 +99,13 @@ export const addPromptNode = async ({ graph, node, llm, tools, emit, agent }: Ad
98
99
  }
99
100
 
100
101
  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
+ }),
101
109
  messages: [result],
102
110
  };
103
111
  };
@@ -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.name}`);
31
+ logger.info(`Executing tool node ${toolNode.displayName}`);
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.name}`);
8
+ logger.info(`Executing trigger node ${node.displayName}`);
9
9
  return;
10
10
  };
11
11
 
@@ -30,26 +30,36 @@ export interface AgentInvokeParams {
30
30
  appName?: string;
31
31
  }
32
32
 
33
- export enum FlowHistoryType {
34
- TRIGGER_INVOCATION = 'triggerInvocation',
35
- APP_ACTION_INVOCATION = 'appActionInvocation',
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',
36
39
  }
37
40
 
38
- export interface FlowHistory {
39
- type: FlowHistoryType;
41
+ export interface HistoryStep {
42
+ type: FlowHistoryStepType;
43
+ step: number;
44
+ raw: any;
45
+ nodeId: string;
46
+ nodeDisplayName: string;
47
+ messageId?: string;
40
48
  }
41
49
 
42
- export interface TriggerInvocationHistory extends FlowHistory {
43
- type: FlowHistoryType.TRIGGER_INVOCATION;
44
- appName?: string;
45
- triggerName: string;
46
- triggerBody: any;
50
+ export interface TrigggerHistoryStep extends HistoryStep {
51
+ type: FlowHistoryStepType.APP_TRIGGER_NODE;
52
+ appName: string;
47
53
  }
48
54
 
49
- export interface AppActionInvocationHistory extends FlowHistory {
50
- type: FlowHistoryType.APP_ACTION_INVOCATION;
51
- nodeTitle: string;
52
- };
55
+ export interface AppActionInvocationHistoryStep extends HistoryStep {
56
+ type: FlowHistoryStepType.APP_ACTION_NODE;
57
+ appName: string;
58
+ }
59
+
60
+ export interface CustomActionInvocationHistoryStep extends HistoryStep {
61
+ type: FlowHistoryStepType.CUSTOM_ACTION_NODE;
62
+ }
53
63
 
54
64
  export enum SessionType {
55
65
  VOICE = 'voice',