@minded-ai/mindedjs 1.0.34 → 1.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.d.ts +2 -1
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +17 -4
- package/dist/agent.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/internalTools/appActionRunnerTool.d.ts +2 -2
- package/dist/internalTools/appActionRunnerTool.d.ts.map +1 -1
- package/dist/internalTools/appActionRunnerTool.js +15 -6
- package/dist/internalTools/appActionRunnerTool.js.map +1 -1
- package/dist/nodes/addAppToolNode.d.ts.map +1 -1
- package/dist/nodes/addAppToolNode.js +5 -1
- package/dist/nodes/addAppToolNode.js.map +1 -1
- package/dist/nodes/addToolNode.d.ts.map +1 -1
- package/dist/nodes/addToolNode.js +6 -4
- package/dist/nodes/addToolNode.js.map +1 -1
- package/dist/nodes/nodeFactory.d.ts.map +1 -1
- package/dist/nodes/nodeFactory.js +2 -7
- package/dist/nodes/nodeFactory.js.map +1 -1
- package/dist/platform/mindedConnectionTypes.d.ts +1 -0
- package/dist/platform/mindedConnectionTypes.d.ts.map +1 -1
- package/dist/platform/mindedConnectionTypes.js +1 -0
- package/dist/platform/mindedConnectionTypes.js.map +1 -1
- package/dist/types/Agent.types.d.ts +6 -1
- package/dist/types/Agent.types.d.ts.map +1 -1
- package/dist/types/Agent.types.js +2 -0
- package/dist/types/Agent.types.js.map +1 -1
- package/dist/types/Flows.types.d.ts +37 -2
- package/dist/types/Flows.types.d.ts.map +1 -1
- package/dist/types/Flows.types.js +18 -1
- package/dist/types/Flows.types.js.map +1 -1
- package/dist/types/Tools.types.d.ts +5 -0
- package/dist/types/Tools.types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/agent.ts +19 -8
- package/src/index.ts +2 -2
- package/src/internalTools/appActionRunnerTool.ts +70 -0
- package/src/nodes/addAppToolNode.ts +53 -0
- package/src/nodes/addPromptNode.ts +1 -1
- package/src/nodes/addToolNode.ts +8 -6
- package/src/nodes/nodeFactory.ts +3 -18
- package/src/platform/mindedConnectionTypes.ts +1 -0
- package/src/types/Agent.types.ts +6 -0
- package/src/types/Flows.types.ts +41 -2
- package/src/types/Tools.types.ts +7 -0
package/dist/agent.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ type CreateAgentParams<Memory> = {
|
|
|
13
13
|
export declare class Agent {
|
|
14
14
|
private memorySchema;
|
|
15
15
|
private flows;
|
|
16
|
-
|
|
16
|
+
tools: Tool<any, any>[];
|
|
17
17
|
private platformToken?;
|
|
18
18
|
private llm;
|
|
19
19
|
private mindedConnection;
|
|
@@ -34,6 +34,7 @@ export declare class Agent {
|
|
|
34
34
|
}): Promise<import("@langchain/langgraph").StateType<import("@langchain/langgraph").StateDefinition>>;
|
|
35
35
|
on<E extends keyof AgentEventRequestPayloads<z.infer<typeof this.memorySchema>>>(event: E, handler: (payload: AgentEventRequestPayloads<z.infer<typeof this.memorySchema>>[E]) => Promise<AgentEventResponsePayloads<z.infer<typeof this.memorySchema>>[E] | void>): void;
|
|
36
36
|
private emit;
|
|
37
|
+
private initAppActionsRunnerTools;
|
|
37
38
|
getSecrets(): Promise<Record<string, string>>;
|
|
38
39
|
}
|
|
39
40
|
export {};
|
package/dist/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAI3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAI3D,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAe,MAAM,sBAAsB,CAAC;AAC1G,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,
|
|
1
|
+
{"version":3,"file":"agent.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R,EAAE;QACD,WAAW,EAAE,GAAG,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB;IA8CM,EAAE,CAAC,CAAC,SAAS,MAAM,yBAAyB,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,EACpF,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,CACP,OAAO,EAAE,yBAAyB,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,KACrE,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GACpF,IAAI;YASO,IAAI;IAWlB,OAAO,CAAC,yBAAyB;IAQpB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CA6B3D"}
|
package/dist/agent.js
CHANGED
|
@@ -49,12 +49,15 @@ const mindedConnectionTypes_1 = require("./platform/mindedConnectionTypes");
|
|
|
49
49
|
const fs = __importStar(require("fs"));
|
|
50
50
|
const path = __importStar(require("path"));
|
|
51
51
|
const yaml = __importStar(require("js-yaml"));
|
|
52
|
+
const Agent_types_1 = require("./types/Agent.types");
|
|
52
53
|
const createLlmInstance_1 = require("./llm/createLlmInstance");
|
|
53
54
|
const dotenv_1 = require("dotenv");
|
|
54
55
|
const path_1 = require("path");
|
|
55
56
|
const checkpointSaverFactory_1 = require("./checkpointer/checkpointSaverFactory");
|
|
56
57
|
const config_1 = require("./platform/config");
|
|
58
|
+
const messages_1 = require("@langchain/core/messages");
|
|
57
59
|
const triggerTypeToDefaultMessage_1 = __importDefault(require("./triggers/triggerTypeToDefaultMessage"));
|
|
60
|
+
const appActionRunnerTool_1 = __importDefault(require("./internalTools/appActionRunnerTool"));
|
|
58
61
|
(0, dotenv_1.config)({ path: (0, path_1.resolve)(__dirname, '../.env') });
|
|
59
62
|
class Agent {
|
|
60
63
|
constructor(params) {
|
|
@@ -66,7 +69,8 @@ class Agent {
|
|
|
66
69
|
const { config, tools, platformToken, memorySaver, memorySchema } = params;
|
|
67
70
|
this.memorySchema = memorySchema;
|
|
68
71
|
this.flows = this.loadFlowsFromDirectory(config.flows);
|
|
69
|
-
|
|
72
|
+
const appActionsRunnerTools = this.initAppActionsRunnerTools();
|
|
73
|
+
this.tools = [...tools, ...appActionsRunnerTools];
|
|
70
74
|
this.platformToken = platformToken;
|
|
71
75
|
this.llm = (0, createLlmInstance_1.createLlmInstance)(config.llm);
|
|
72
76
|
this.validate();
|
|
@@ -169,10 +173,13 @@ class Agent {
|
|
|
169
173
|
triggerName,
|
|
170
174
|
triggerBody,
|
|
171
175
|
});
|
|
176
|
+
let messages = [];
|
|
172
177
|
const handlerResult = results.find((r) => r !== undefined);
|
|
173
178
|
let memoryUpdate = {};
|
|
174
|
-
|
|
175
|
-
|
|
179
|
+
if (triggerName === Flows_types_1.KnownTriggerNames.MINDED_MESSAGE_IN_CONVERSATION) {
|
|
180
|
+
messages.push(new messages_1.HumanMessage(triggerBody));
|
|
181
|
+
}
|
|
182
|
+
else if (handlerResult) {
|
|
176
183
|
memoryUpdate = handlerResult.memory || {};
|
|
177
184
|
messages = (_a = handlerResult.messages) !== null && _a !== void 0 ? _a : [];
|
|
178
185
|
}
|
|
@@ -182,7 +189,7 @@ class Agent {
|
|
|
182
189
|
const triggerInvocation = { appName, triggerName, triggerBody };
|
|
183
190
|
const history = [
|
|
184
191
|
{
|
|
185
|
-
type:
|
|
192
|
+
type: Agent_types_1.FlowHistoryType.TRIGGER_INVOCATION,
|
|
186
193
|
...triggerInvocation,
|
|
187
194
|
},
|
|
188
195
|
];
|
|
@@ -217,6 +224,12 @@ class Agent {
|
|
|
217
224
|
const results = await Promise.all(this.eventHandlers[event].map(async (handler) => handler(payload)));
|
|
218
225
|
return results;
|
|
219
226
|
}
|
|
227
|
+
initAppActionsRunnerTools() {
|
|
228
|
+
if (!this.mindedConnection && process.env.NODE_ENV !== 'test') {
|
|
229
|
+
throw new Error('Minded connection is mandatory to use run app action tools');
|
|
230
|
+
}
|
|
231
|
+
return this.flows.flatMap((flow) => flow.nodes.filter((node) => node.type === Flows_types_1.NodeType.APP_TOOL)).map((node) => (0, appActionRunnerTool_1.default)(node.metadata.schema, node.name, this.mindedConnection));
|
|
232
|
+
}
|
|
220
233
|
// Public method to get secrets from the backend service with caching
|
|
221
234
|
async getSecrets() {
|
|
222
235
|
// Return cached secrets if available
|
package/dist/agent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA8E;AAE9E,+BAAoC;AAEpC,oDAA2D;AAE3D,qDAAkD;AAClD,6DAA2F;AAC3F,qDAAkD;AAClD,sDAA0G;AAE1G,kEAA+D;AAC/D,4EAAsI;AACtI,uCAAyB;AACzB,2CAA6B;AAC7B,8CAAgC;AAChC,qDAAiG;AACjG,+DAA4D;AAC5D,mCAAgC;AAChC,+BAA+B;AAC/B,kFAA8E;AAC9E,8CAA8C;AAC9C,uDAAqE;AACrE,yGAAiF;AACjF,8FAA6E;AAE7E,IAAA,eAAM,EAAC,EAAE,IAAI,EAAE,IAAA,cAAO,EAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;AAShD,MAAa,KAAK;IAqBhB,YAAY,MAA4D;QAfhE,qBAAgB,GAA4B,IAAI,CAAC;QAKzD,gDAAgD;QACxC,iBAAY,GAAkC,IAAI,CAAC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,KAAK,CAAC,4BAA4B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;QAC1G,CAAC;IACH,CAAC;CACF;AA/PD,sBA+PC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Agent } from './agent';
|
|
|
2
2
|
import events from './events';
|
|
3
3
|
export { Agent, events };
|
|
4
4
|
export type { Flow, Node, Edge, TriggerNode, AppTriggerNode, PromptNode, PromptConditionEdge, LogicalConditionEdge, StepForwardEdge, ManualTriggerNode, JunctionNode, ToolNode, AppToolNode, } from './types/Flows.types';
|
|
5
|
-
export { NodeType, TriggerType, EdgeType } from './types/Flows.types';
|
|
5
|
+
export { NodeType, TriggerType, EdgeType, AppNodeMetadata, AppNodeMetadataType, NodeMetadata, KnownTriggerNames } from './types/Flows.types';
|
|
6
6
|
export type { Tool } from './types/Tools.types';
|
|
7
|
-
export { FlowHistoryType, FlowHistory, TriggerInvocationHistory } from './types/Agent.types';
|
|
7
|
+
export { FlowHistoryType, FlowHistory, TriggerInvocationHistory, AppActionInvocationHistory } from './types/Agent.types';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAEzB,YAAY,EACV,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,QAAQ,EACR,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAEzB,YAAY,EACV,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,QAAQ,EACR,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,mBAAmB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7I,YAAY,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FlowHistoryType = exports.EdgeType = exports.TriggerType = exports.NodeType = exports.events = exports.Agent = void 0;
|
|
6
|
+
exports.FlowHistoryType = exports.KnownTriggerNames = exports.AppNodeMetadataType = exports.EdgeType = exports.TriggerType = exports.NodeType = exports.events = exports.Agent = void 0;
|
|
7
7
|
const agent_1 = require("./agent");
|
|
8
8
|
Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return agent_1.Agent; } });
|
|
9
9
|
const events_1 = __importDefault(require("./events"));
|
|
@@ -12,6 +12,8 @@ var Flows_types_1 = require("./types/Flows.types");
|
|
|
12
12
|
Object.defineProperty(exports, "NodeType", { enumerable: true, get: function () { return Flows_types_1.NodeType; } });
|
|
13
13
|
Object.defineProperty(exports, "TriggerType", { enumerable: true, get: function () { return Flows_types_1.TriggerType; } });
|
|
14
14
|
Object.defineProperty(exports, "EdgeType", { enumerable: true, get: function () { return Flows_types_1.EdgeType; } });
|
|
15
|
+
Object.defineProperty(exports, "AppNodeMetadataType", { enumerable: true, get: function () { return Flows_types_1.AppNodeMetadataType; } });
|
|
16
|
+
Object.defineProperty(exports, "KnownTriggerNames", { enumerable: true, get: function () { return Flows_types_1.KnownTriggerNames; } });
|
|
15
17
|
var Agent_types_1 = require("./types/Agent.types");
|
|
16
18
|
Object.defineProperty(exports, "FlowHistoryType", { enumerable: true, get: function () { return Agent_types_1.FlowHistoryType; } });
|
|
17
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAgC;AAGvB,sFAHA,aAAK,OAGA;AAFd,sDAA8B;AAEd,iBAFT,gBAAM,CAES;AAiBtB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAgC;AAGvB,sFAHA,aAAK,OAGA;AAFd,sDAA8B;AAEd,iBAFT,gBAAM,CAES;AAiBtB,mDAA6I;AAApI,uGAAA,QAAQ,OAAA;AAAE,0GAAA,WAAW,OAAA;AAAE,uGAAA,QAAQ,OAAA;AAAmB,kHAAA,mBAAmB,OAAA;AAAgB,gHAAA,iBAAiB,OAAA;AAE/G,mDAAyH;AAAhH,8GAAA,eAAe,OAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MindedConnection } from '../platform/mindedConnection';
|
|
2
2
|
import { ActionInputParam } from '../types/Flows.types';
|
|
3
3
|
import { Tool } from '../types/Tools.types';
|
|
4
|
-
declare const appActionRunnerToolCreator: (schema: ActionInputParam[], nodeTitle: string,
|
|
4
|
+
declare const appActionRunnerToolCreator: (schema: ActionInputParam[], nodeTitle: string, mindedConnection: MindedConnection) => Tool<any, any>;
|
|
5
5
|
export declare const getAppActionRunnerTool: (nodeTitle: string) => Tool<any, any>;
|
|
6
6
|
export default appActionRunnerToolCreator;
|
|
7
7
|
//# sourceMappingURL=appActionRunnerTool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appActionRunnerTool.d.ts","sourceRoot":"","sources":["../../src/internalTools/appActionRunnerTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"appActionRunnerTool.d.ts","sourceRoot":"","sources":["../../src/internalTools/appActionRunnerTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAuB5C,QAAA,MAAM,0BAA0B,GAAI,QAAQ,gBAAgB,EAAE,EAAE,WAAW,MAAM,EAAE,kBAAkB,gBAAgB,KAAG,IAAI,CAAC,GAAG,EAAE,GAAG,CAqCpI,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,WAAW,MAAM,mBAEvD,CAAA;AAED,eAAe,0BAA0B,CAAC"}
|
|
@@ -14,27 +14,36 @@ const typeToZodMap = {
|
|
|
14
14
|
const convertToZodSchema = (schema) => {
|
|
15
15
|
var _a;
|
|
16
16
|
const zodSchema = {};
|
|
17
|
-
for (const [key, type] of Object.entries(schema)) {
|
|
17
|
+
for (const [key, { type }] of Object.entries(schema)) {
|
|
18
18
|
const zodType = (_a = typeToZodMap[type.toLowerCase()]) !== null && _a !== void 0 ? _a : zod_1.z.string();
|
|
19
19
|
zodSchema[key] = zodType;
|
|
20
20
|
}
|
|
21
21
|
return zod_1.z.object(zodSchema);
|
|
22
22
|
};
|
|
23
23
|
const createdTools = {};
|
|
24
|
-
const appActionRunnerToolCreator = (schema, nodeTitle,
|
|
24
|
+
const appActionRunnerToolCreator = (schema, nodeTitle, mindedConnection) => {
|
|
25
25
|
const zodSchema = convertToZodSchema(schema.reduce((acc, param) => {
|
|
26
|
-
|
|
26
|
+
if (param.required) {
|
|
27
|
+
acc[param.name] = { type: param.type, example: param.example };
|
|
28
|
+
}
|
|
27
29
|
return acc;
|
|
28
30
|
}, {}));
|
|
31
|
+
// Create a description that includes examples
|
|
32
|
+
const description = `Run ${nodeTitle} action. Example input: ${JSON.stringify(schema.reduce((acc, param) => {
|
|
33
|
+
if (param.example !== undefined) {
|
|
34
|
+
acc[param.name] = param.example;
|
|
35
|
+
}
|
|
36
|
+
return acc;
|
|
37
|
+
}, {}), null, 2)}`;
|
|
29
38
|
const tool = {
|
|
30
39
|
name: nodeTitle,
|
|
31
|
-
description
|
|
40
|
+
description,
|
|
32
41
|
input: zodSchema,
|
|
33
42
|
execute: async ({ input }) => {
|
|
34
|
-
const response = await awaitEmit(mindedConnectionTypes_1.MindedConnectionSocketMessageType.OnAppAction, {
|
|
43
|
+
const response = await mindedConnection.awaitEmit(mindedConnectionTypes_1.MindedConnectionSocketMessageType.OnAppAction, {
|
|
35
44
|
nodeTitle,
|
|
36
45
|
actionInput: input,
|
|
37
|
-
});
|
|
46
|
+
}, 20000);
|
|
38
47
|
return response;
|
|
39
48
|
},
|
|
40
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appActionRunnerTool.js","sourceRoot":"","sources":["../../src/internalTools/appActionRunnerTool.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"appActionRunnerTool.js","sourceRoot":"","sources":["../../src/internalTools/appActionRunnerTool.ts"],"names":[],"mappings":";;;AACA,6EAAsF;AA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AAM,0BAA0B,CAAC;AAI7E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIlD,eAAO,MAAM,cAAc,GAAU,uBAIlC;IACC,KAAK,EAAE,gBAAgB,CAAC;IACxB,IAAI,EAAE,WAAW,CAAC;IAClB,GAAG,EAAE,CAAA,OAAO,YAAY,EAAC,MAAM,OAAO,YAAY,CAAC,CAAC;CACvD,
|
|
1
|
+
{"version":3,"file":"addAppToolNode.d.ts","sourceRoot":"","sources":["../../src/nodes/addAppToolNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAmB,MAAM,0BAA0B,CAAC;AAI7E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIlD,eAAO,MAAM,cAAc,GAAU,uBAIlC;IACC,KAAK,EAAE,gBAAgB,CAAC;IACxB,IAAI,EAAE,WAAW,CAAC;IAClB,GAAG,EAAE,CAAA,OAAO,YAAY,EAAC,MAAM,OAAO,YAAY,CAAC,CAAC;CACvD,kBAkCA,CAAC"}
|
|
@@ -28,9 +28,13 @@ const addAppToolNode = async ({ graph, node, llm, }) => {
|
|
|
28
28
|
Additional context:
|
|
29
29
|
workflow memory: ${JSON.stringify(state.memory)}
|
|
30
30
|
`;
|
|
31
|
+
const messages = state.messages || [];
|
|
32
|
+
if (Object.keys(state.memory).length !== 0) {
|
|
33
|
+
messages.push(new messages_1.SystemMessage(prompt));
|
|
34
|
+
}
|
|
31
35
|
const AIToolCallMessage = await llm.bindTools([tool], {
|
|
32
36
|
tool_choice: tool.name,
|
|
33
|
-
}).invoke(
|
|
37
|
+
}).invoke(messages);
|
|
34
38
|
const toolCallMessage = await tool.invoke(AIToolCallMessage.tool_calls[0]);
|
|
35
39
|
return { messages: [AIToolCallMessage, toolCallMessage], history: [{ type: Agent_types_1.FlowHistoryType.APP_ACTION_INVOCATION, nodeTitle: node.name }] };
|
|
36
40
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IACxB,GAAG,EAAE,CAAC,OAAO,YAAY,EAAE,MAAM,OAAO,YAAY,CAAC,CAAC;CACvD,
|
|
1
|
+
{"version":3,"file":"addToolNode.d.ts","sourceRoot":"","sources":["../../src/nodes/addToolNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAmB,MAAM,0BAA0B,CAAC;AAI7E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,eAAO,MAAM,WAAW,GAAU,MAAM,EAAE,8BAKvC;IACD,KAAK,EAAE,gBAAgB,CAAC;IACxB,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IACxB,GAAG,EAAE,CAAC,OAAO,YAAY,EAAE,MAAM,OAAO,YAAY,CAAC,CAAC;CACvD,kBAuCA,CAAC"}
|
|
@@ -34,11 +34,13 @@ const addToolNode = async ({ graph, node, tools, llm, }) => {
|
|
|
34
34
|
Additional context:
|
|
35
35
|
workflow memory: ${JSON.stringify(state.memory)}
|
|
36
36
|
`;
|
|
37
|
-
const
|
|
38
|
-
|
|
37
|
+
const messages = state.messages || [];
|
|
38
|
+
if (Object.keys(state.memory).length !== 0) {
|
|
39
|
+
messages.push(new messages_1.SystemMessage(prompt));
|
|
40
|
+
}
|
|
41
|
+
const AIToolCallMessage = await llm.bindTools([tool], {
|
|
39
42
|
tool_choice: tool.name,
|
|
40
|
-
})
|
|
41
|
-
.invoke([...state.messages, new messages_1.SystemMessage(prompt)]);
|
|
43
|
+
}).invoke(messages);
|
|
42
44
|
const toolCallMessage = await tool.invoke(AIToolCallMessage.tool_calls[0]);
|
|
43
45
|
const toolMemory = (0, extractToolMemoryResponse_1.default)(toolCallMessage);
|
|
44
46
|
return { memory: toolMemory, messages: [AITool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"","sources":["../../src/nodes/nodeFactory.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"nodeFactory.d.ts","sourceRoot":"","sources":["../../src/nodes/nodeFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,IAAI,EAAY,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAG5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAOlD,eAAO,MAAM,WAAW,GAAI,oCAMzB;IACD,KAAK,EAAE,gBAAgB,CAAC;IACxB,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IACxB,GAAG,EAAE,CAAA,OAAO,YAAY,EAAC,MAAM,OAAO,YAAY,CAAC,CAAC;IACpD,IAAI,EAAE,aAAa,CAAC,GAAG,EAAE,MAAM,yBAAyB,CAAC,GAAG,CAAC,CAAC,CAAC;CAChE,SAqBA,CAAC"}
|
|
@@ -4,17 +4,12 @@ exports.nodeFactory = void 0;
|
|
|
4
4
|
const Flows_types_1 = require("../types/Flows.types");
|
|
5
5
|
const addToolNode_1 = require("./addToolNode");
|
|
6
6
|
const addPromptNode_1 = require("./addPromptNode");
|
|
7
|
+
const addAppToolNode_1 = require("./addAppToolNode");
|
|
7
8
|
const addTriggerNode_1 = require("./addTriggerNode");
|
|
8
9
|
const addJunctionNode = ({ graph, node }) => {
|
|
9
10
|
const callback = async () => { };
|
|
10
11
|
graph.addNode(node.name, callback);
|
|
11
12
|
};
|
|
12
|
-
const addAppToolNode = ({ graph, node, }) => {
|
|
13
|
-
const callback = async () => {
|
|
14
|
-
throw new Error('Not implemented');
|
|
15
|
-
};
|
|
16
|
-
graph.addNode(node.name, callback);
|
|
17
|
-
};
|
|
18
13
|
const nodeFactory = ({ graph, node, tools, llm, emit, }) => {
|
|
19
14
|
const nodeType = node.type;
|
|
20
15
|
switch (nodeType) {
|
|
@@ -28,7 +23,7 @@ const nodeFactory = ({ graph, node, tools, llm, emit, }) => {
|
|
|
28
23
|
addJunctionNode({ graph, node });
|
|
29
24
|
break;
|
|
30
25
|
case Flows_types_1.NodeType.APP_TOOL:
|
|
31
|
-
addAppToolNode({ graph, node,
|
|
26
|
+
(0, addAppToolNode_1.addAppToolNode)({ graph, node, llm });
|
|
32
27
|
break;
|
|
33
28
|
case Flows_types_1.NodeType.PROMPT_NODE:
|
|
34
29
|
(0, addPromptNode_1.addPromptNode)({ graph, node, tools, llm, emit });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeFactory.js","sourceRoot":"","sources":["../../src/nodes/nodeFactory.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"nodeFactory.js","sourceRoot":"","sources":["../../src/nodes/nodeFactory.ts"],"names":[],"mappings":";;;AACA,sDAAoE;AAGpE,+CAA4C;AAC5C,mDAAgD;AAGhD,qDAAkD;AAClD,qDAAkD;AAGlD,MAAM,eAAe,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAmD,EAAE,EAAE;IAC3F,MAAM,QAAQ,GAAiB,KAAK,IAAI,EAAE,GAAG,CAAC,CAAC;IAC/C,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACrC,CAAC,CAAC;AAEK,MAAM,WAAW,GAAG,CAAC,EAC1B,KAAK,EACL,IAAI,EACJ,KAAK,EACL,GAAG,EACH,IAAI,GAOL,EAAE,EAAE;IACH,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;IAC3B,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,sBAAQ,CAAC,OAAO;YACnB,IAAA,+BAAc,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAChC,MAAM;QACR,KAAK,sBAAQ,CAAC,IAAI;YAChB,IAAA,yBAAW,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YACzC,MAAM;QACR,KAAK,sBAAQ,CAAC,QAAQ;YACpB,eAAe,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACjC,MAAM;QACR,KAAK,sBAAQ,CAAC,QAAQ;YACpB,IAAA,+BAAc,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;YACrC,MAAM;QACR,KAAK,sBAAQ,CAAC,WAAW;YACvB,IAAA,6BAAa,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;YACjD,MAAM;QACR;YACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,QAAQ,EAAE,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC,CAAC;AAjCW,QAAA,WAAW,eAiCtB"}
|
|
@@ -2,6 +2,7 @@ import type { CheckpointListOptions, CheckpointMetadata, PendingWrite, Checkpoin
|
|
|
2
2
|
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
3
3
|
export declare enum MindedConnectionSocketMessageType {
|
|
4
4
|
OnAppTrigger = "on-app-trigger",
|
|
5
|
+
OnAppAction = "on-app-action",
|
|
5
6
|
CHECKPOINT_GET_TUPLE = "checkpoint-get-tuple",
|
|
6
7
|
CHECKPOINT_PUT = "checkpoint-put",
|
|
7
8
|
CHECKPOINT_LIST = "checkpoint-list",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mindedConnectionTypes.d.ts","sourceRoot":"","sources":["../../src/platform/mindedConnectionTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,kBAAkB,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AAc,CAAC;CACxB;AACD,MAAM,WAAW,qBAAsB,SAAQ,iCAAiC;IAC9E,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,4BAA6B,SAAQ,iDAAiD;IACrG,KAAK,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;CACrC;AAED,MAAM,WAAW,oBAAqB,SAAQ,iCAAiC;IAC7E,MAAM,EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,gBAAiB,SAAQ,iCAAiC;IACzE,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,CAAC,EAAE,qBAAqB,CAAC;CACjC;AAED,MAAM,WAAW,wBAAyB,SAAQ,iDAAiD;IACjG,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;CACjC"}
|
|
@@ -4,6 +4,7 @@ exports.MindedConnectionSocketMessageType = void 0;
|
|
|
4
4
|
var MindedConnectionSocketMessageType;
|
|
5
5
|
(function (MindedConnectionSocketMessageType) {
|
|
6
6
|
MindedConnectionSocketMessageType["OnAppTrigger"] = "on-app-trigger";
|
|
7
|
+
MindedConnectionSocketMessageType["OnAppAction"] = "on-app-action";
|
|
7
8
|
MindedConnectionSocketMessageType["CHECKPOINT_GET_TUPLE"] = "checkpoint-get-tuple";
|
|
8
9
|
MindedConnectionSocketMessageType["CHECKPOINT_PUT"] = "checkpoint-put";
|
|
9
10
|
MindedConnectionSocketMessageType["CHECKPOINT_LIST"] = "checkpoint-list";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mindedConnectionTypes.js","sourceRoot":"","sources":["../../src/platform/mindedConnectionTypes.ts"],"names":[],"mappings":";;;AAUA,IAAY,
|
|
1
|
+
{"version":3,"file":"mindedConnectionTypes.js","sourceRoot":"","sources":["../../src/platform/mindedConnectionTypes.ts"],"names":[],"mappings":";;;AAUA,IAAY,iCAQX;AARD,WAAY,iCAAiC;IAC3C,oEAA+B,CAAA;IAC/B,kEAA6B,CAAA;IAC7B,kFAA6C,CAAA;IAC7C,sEAAiC,CAAA;IACjC,wEAAmC,CAAA;IACnC,oFAA+C,CAAA;IAC/C,gEAA2B,CAAA;AAC7B,CAAC,EARW,iCAAiC,iDAAjC,iCAAiC,QAQ5C"}
|
|
@@ -7,7 +7,8 @@ export type MindedSDKConfig = {
|
|
|
7
7
|
tools: string[];
|
|
8
8
|
};
|
|
9
9
|
export declare enum FlowHistoryType {
|
|
10
|
-
TRIGGER_INVOCATION = "triggerInvocation"
|
|
10
|
+
TRIGGER_INVOCATION = "triggerInvocation",
|
|
11
|
+
APP_ACTION_INVOCATION = "appActionInvocation"
|
|
11
12
|
}
|
|
12
13
|
export interface FlowHistory {
|
|
13
14
|
type: FlowHistoryType;
|
|
@@ -18,4 +19,8 @@ export interface TriggerInvocationHistory extends FlowHistory {
|
|
|
18
19
|
triggerName: string;
|
|
19
20
|
triggerBody: any;
|
|
20
21
|
}
|
|
22
|
+
export interface AppActionInvocationHistory extends FlowHistory {
|
|
23
|
+
type: FlowHistoryType.APP_ACTION_INVOCATION;
|
|
24
|
+
nodeTitle: string;
|
|
25
|
+
}
|
|
21
26
|
//# sourceMappingURL=Agent.types.d.ts.map
|
|
@@ -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,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,0BAA0B,CAAC,MAAM,CAAC,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AAC,qBAAqB,CAAC;IAC5C,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -4,6 +4,8 @@ exports.FlowHistoryType = void 0;
|
|
|
4
4
|
var FlowHistoryType;
|
|
5
5
|
(function (FlowHistoryType) {
|
|
6
6
|
FlowHistoryType["TRIGGER_INVOCATION"] = "triggerInvocation";
|
|
7
|
+
FlowHistoryType["APP_ACTION_INVOCATION"] = "appActionInvocation";
|
|
7
8
|
})(FlowHistoryType || (exports.FlowHistoryType = FlowHistoryType = {}));
|
|
8
9
|
;
|
|
10
|
+
;
|
|
9
11
|
//# sourceMappingURL=Agent.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Agent.types.js","sourceRoot":"","sources":["../../src/types/Agent.types.ts"],"names":[],"mappings":";;;AAWA,IAAY,
|
|
1
|
+
{"version":3,"file":"Agent.types.js","sourceRoot":"","sources":["../../src/types/Agent.types.ts"],"names":[],"mappings":";;;AAWA,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,2DAAwC,CAAA;IACxC,gEAA6C,CAAA;AAC/C,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B;AAWA,CAAC;AAKD,CAAC"}
|
|
@@ -36,6 +36,7 @@ export interface BaseAppNode {
|
|
|
36
36
|
account?: string;
|
|
37
37
|
mockDataInstructions?: string;
|
|
38
38
|
textSentToModel?: string;
|
|
39
|
+
parameters?: Record<string, any>;
|
|
39
40
|
}
|
|
40
41
|
export interface AppTriggerNode extends BaseTriggerNode, BaseAppNode {
|
|
41
42
|
triggerType: TriggerType.APP;
|
|
@@ -65,10 +66,11 @@ export interface ToolNode extends BaseNode {
|
|
|
65
66
|
}
|
|
66
67
|
export interface AppToolNode extends BaseNode, BaseAppNode {
|
|
67
68
|
type: NodeType.APP_TOOL;
|
|
68
|
-
prompt
|
|
69
|
+
prompt: string;
|
|
70
|
+
appName: string;
|
|
69
71
|
actionName: string;
|
|
72
|
+
metadata: AppNodeMetadata;
|
|
70
73
|
actionKey: string;
|
|
71
|
-
parameters?: Record<string, 'string' | 'number' | 'boolean' | 'object' | 'array' | 'null'>;
|
|
72
74
|
}
|
|
73
75
|
export type Node = TriggerNode | JunctionNode | ToolNode | AppToolNode | PromptNode;
|
|
74
76
|
export interface BaseEdge {
|
|
@@ -88,9 +90,42 @@ export interface StepForwardEdge extends BaseEdge {
|
|
|
88
90
|
type: EdgeType.STEP_FORWARD;
|
|
89
91
|
}
|
|
90
92
|
export type Edge = LogicalConditionEdge | PromptConditionEdge | StepForwardEdge;
|
|
93
|
+
export declare enum AppNodeMetadataType {
|
|
94
|
+
APP_TOOL = "appTool"
|
|
95
|
+
}
|
|
96
|
+
export interface NodeMetadata {
|
|
97
|
+
type: AppNodeMetadataType;
|
|
98
|
+
}
|
|
99
|
+
export interface AppNodeMetadata extends NodeMetadata {
|
|
100
|
+
type: AppNodeMetadataType.APP_TOOL;
|
|
101
|
+
schema: ActionInputParam[];
|
|
102
|
+
}
|
|
103
|
+
export type ActionInputParam = {
|
|
104
|
+
name: string;
|
|
105
|
+
type: ActionInputParamType;
|
|
106
|
+
description: string;
|
|
107
|
+
example: string | null;
|
|
108
|
+
required: boolean;
|
|
109
|
+
enum?: string[];
|
|
110
|
+
items?: {
|
|
111
|
+
type: ActionInputParamType;
|
|
112
|
+
properties?: ActionInputParam[];
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
export declare enum ActionInputParamType {
|
|
116
|
+
String = "string",
|
|
117
|
+
Number = "number",
|
|
118
|
+
Boolean = "boolean",
|
|
119
|
+
Array = "array",
|
|
120
|
+
Object = "object",
|
|
121
|
+
Any = "any"
|
|
122
|
+
}
|
|
91
123
|
export interface Flow {
|
|
92
124
|
name: string;
|
|
93
125
|
nodes: Node[];
|
|
94
126
|
edges: Edge[];
|
|
95
127
|
}
|
|
128
|
+
export declare enum KnownTriggerNames {
|
|
129
|
+
MINDED_MESSAGE_IN_CONVERSATION = "minded_message_in_conversation"
|
|
130
|
+
}
|
|
96
131
|
//# sourceMappingURL=Flows.types.d.ts.map
|
|
@@ -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;CAC3B;AAED,oBAAY,QAAQ;IAClB,iBAAiB,qBAAqB;IACtC,gBAAgB,oBAAoB;IACpC,YAAY,gBAAgB;CAC7B;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,oBAAY,WAAW;IACrB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;
|
|
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,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AQ;IAC/C,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC;CAC7B;AAED,MAAM,MAAM,IAAI,GAAG,oBAAoB,GAAG,mBAAmB,GAAG,eAAe,CAAC;AAEhF,oBAAY,mBAAmB;IAC7B,QAAQ,YAAY;CACrB;AACD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,mBAAmB,CAAC;CAC3B;AACD,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,IAAI,EAAE,mBAAmB,CAAC,QAAQ,CAAC;IACnC,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B;AAED,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,8BAA8B,mCAAmC;CAClE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TriggerType = exports.EdgeType = exports.NodeType = void 0;
|
|
3
|
+
exports.KnownTriggerNames = exports.ActionInputParamType = exports.AppNodeMetadataType = exports.TriggerType = exports.EdgeType = exports.NodeType = void 0;
|
|
4
4
|
var NodeType;
|
|
5
5
|
(function (NodeType) {
|
|
6
6
|
NodeType["TRIGGER"] = "trigger";
|
|
@@ -21,4 +21,21 @@ var TriggerType;
|
|
|
21
21
|
TriggerType["WEBHOOK"] = "webhook";
|
|
22
22
|
TriggerType["MANUAL"] = "manual";
|
|
23
23
|
})(TriggerType || (exports.TriggerType = TriggerType = {}));
|
|
24
|
+
var AppNodeMetadataType;
|
|
25
|
+
(function (AppNodeMetadataType) {
|
|
26
|
+
AppNodeMetadataType["APP_TOOL"] = "appTool";
|
|
27
|
+
})(AppNodeMetadataType || (exports.AppNodeMetadataType = AppNodeMetadataType = {}));
|
|
28
|
+
var ActionInputParamType;
|
|
29
|
+
(function (ActionInputParamType) {
|
|
30
|
+
ActionInputParamType["String"] = "string";
|
|
31
|
+
ActionInputParamType["Number"] = "number";
|
|
32
|
+
ActionInputParamType["Boolean"] = "boolean";
|
|
33
|
+
ActionInputParamType["Array"] = "array";
|
|
34
|
+
ActionInputParamType["Object"] = "object";
|
|
35
|
+
ActionInputParamType["Any"] = "any";
|
|
36
|
+
})(ActionInputParamType || (exports.ActionInputParamType = ActionInputParamType = {}));
|
|
37
|
+
var KnownTriggerNames;
|
|
38
|
+
(function (KnownTriggerNames) {
|
|
39
|
+
KnownTriggerNames["MINDED_MESSAGE_IN_CONVERSATION"] = "minded_message_in_conversation";
|
|
40
|
+
})(KnownTriggerNames || (exports.KnownTriggerNames = KnownTriggerNames = {}));
|
|
24
41
|
//# sourceMappingURL=Flows.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flows.types.js","sourceRoot":"","sources":["../../src/types/Flows.types.ts"],"names":[],"mappings":";;;AAMA,IAAY,QAMX;AAND,WAAY,QAAQ;IAClB,+BAAmB,CAAA;IACnB,iCAAqB,CAAA;IACrB,yBAAa,CAAA;IACb,gCAAoB,CAAA;IACpB,sCAA0B,CA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,WAAY,iBAAiB;IAC3B,sFAAiE,CAAA;AACnE,CAAC,EAFW,iBAAiB,iCAAjB,iBAAiB,QAE5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tools.types.d.ts","sourceRoot":"","sources":["../../src/types/Tools.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,WAAW,IAAI,CAAC,KAAK,SAAS,CAAC,CAAC,SAAS,EAAE,MAAM;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE;QAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,kBAAkB,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAA;KAAE,KAAK,OAAO,CAAC;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAAC,MAAM,CAAC,EAAE,GAAG,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;CACpM"}
|
|
1
|
+
{"version":3,"file":"Tools.types.d.ts","sourceRoot":"","sources":["../../src/types/Tools.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,WAAW,IAAI,CAAC,KAAK,SAAS,CAAC,CAAC,SAAS,EAAE,MAAM;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE;QAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,kBAAkB,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAA;KAAE,KAAK,OAAO,CAAC;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAAC,MAAM,CAAC,EAAE,GAAG,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;CACpM;AAGD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
package/package.json
CHANGED
package/src/agent.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Flow, NodeType, Node } from './types/Flows.types';
|
|
1
|
+
import { Flow, NodeType, Node, KnownTriggerNames } from './types/Flows.types';
|
|
2
2
|
import { Tool } from './types/Tools.types';
|
|
3
3
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
4
|
import { BaseLanguageModel } from '@langchain/core/language_models/base';
|
|
@@ -14,14 +14,15 @@ import { BaseMindedConnectionSocketMessage, MindedConnectionSocketMessageType, O
|
|
|
14
14
|
import * as fs from 'fs';
|
|
15
15
|
import * as path from 'path';
|
|
16
16
|
import * as yaml from 'js-yaml';
|
|
17
|
-
import { MindedSDKConfig, TriggerInvocationHistory } from './types/Agent.types';
|
|
17
|
+
import { FlowHistoryType, MindedSDKConfig, TriggerInvocationHistory } from './types/Agent.types';
|
|
18
18
|
import { createLlmInstance } from './llm/createLlmInstance';
|
|
19
19
|
import { config } from 'dotenv';
|
|
20
20
|
import { resolve } from 'path';
|
|
21
21
|
import { createCheckpointSaver } from './checkpointer/checkpointSaverFactory';
|
|
22
22
|
import { getConfig } from './platform/config';
|
|
23
|
-
import { BaseMessage } from '@langchain/core/messages';
|
|
23
|
+
import { BaseMessage, HumanMessage } from '@langchain/core/messages';
|
|
24
24
|
import triggerTypeToDefaultMessage from './triggers/triggerTypeToDefaultMessage';
|
|
25
|
+
import appActionRunnerToolCreator from './internalTools/appActionRunnerTool';
|
|
25
26
|
|
|
26
27
|
config({ path: resolve(__dirname, '../.env') });
|
|
27
28
|
|
|
@@ -35,7 +36,7 @@ type CreateAgentParams<Memory> = {
|
|
|
35
36
|
export class Agent {
|
|
36
37
|
private memorySchema: z.ZodSchema;
|
|
37
38
|
private flows: Flow[];
|
|
38
|
-
|
|
39
|
+
public tools: Tool<any, any>[];
|
|
39
40
|
private platformToken?: string;
|
|
40
41
|
private llm: BaseLanguageModel;
|
|
41
42
|
private mindedConnection: MindedConnection | null = null;
|
|
@@ -57,7 +58,8 @@ export class Agent {
|
|
|
57
58
|
const { config, tools, platformToken, memorySaver, memorySchema } = params;
|
|
58
59
|
this.memorySchema = memorySchema;
|
|
59
60
|
this.flows = this.loadFlowsFromDirectory(config.flows);
|
|
60
|
-
|
|
61
|
+
const appActionsRunnerTools = this.initAppActionsRunnerTools();
|
|
62
|
+
this.tools = [...tools, ...appActionsRunnerTools];
|
|
61
63
|
this.platformToken = platformToken;
|
|
62
64
|
this.llm = createLlmInstance(config.llm);
|
|
63
65
|
this.validate();
|
|
@@ -184,10 +186,12 @@ export class Agent {
|
|
|
184
186
|
triggerName,
|
|
185
187
|
triggerBody,
|
|
186
188
|
});
|
|
189
|
+
let messages: Array<BaseMessage> = [];
|
|
187
190
|
const handlerResult = results.find((r) => r !== undefined);
|
|
188
191
|
let memoryUpdate = {};
|
|
189
|
-
|
|
190
|
-
|
|
192
|
+
if (triggerName === KnownTriggerNames.MINDED_MESSAGE_IN_CONVERSATION) {
|
|
193
|
+
messages.push(new HumanMessage(triggerBody));
|
|
194
|
+
} else if (handlerResult) {
|
|
191
195
|
memoryUpdate = handlerResult.memory || {};
|
|
192
196
|
messages = handlerResult.messages ?? [];
|
|
193
197
|
} else if (appName) {
|
|
@@ -196,7 +200,7 @@ export class Agent {
|
|
|
196
200
|
const triggerInvocation = { appName, triggerName, triggerBody };
|
|
197
201
|
const history = [
|
|
198
202
|
{
|
|
199
|
-
type:
|
|
203
|
+
type: FlowHistoryType.TRIGGER_INVOCATION,
|
|
200
204
|
...triggerInvocation,
|
|
201
205
|
},
|
|
202
206
|
];
|
|
@@ -247,6 +251,13 @@ export class Agent {
|
|
|
247
251
|
return results;
|
|
248
252
|
}
|
|
249
253
|
|
|
254
|
+
private initAppActionsRunnerTools() {
|
|
255
|
+
if (!this.mindedConnection && process.env.NODE_ENV !== 'test') {
|
|
256
|
+
throw new Error('Minded connection is mandatory to use run app action tools');
|
|
257
|
+
}
|
|
258
|
+
return this.flows.flatMap((flow) => flow.nodes.filter((node) => node.type === NodeType.APP_TOOL)).map((node) => appActionRunnerToolCreator(node.metadata.schema, node.name, this.mindedConnection as MindedConnection));
|
|
259
|
+
}
|
|
260
|
+
|
|
250
261
|
// Public method to get secrets from the backend service with caching
|
|
251
262
|
public async getSecrets(): Promise<Record<string, string>> {
|
|
252
263
|
// Return cached secrets if available
|
package/src/index.ts
CHANGED
|
@@ -18,6 +18,6 @@ export type {
|
|
|
18
18
|
ToolNode,
|
|
19
19
|
AppToolNode,
|
|
20
20
|
} from './types/Flows.types';
|
|
21
|
-
export { NodeType, TriggerType, EdgeType } from './types/Flows.types';
|
|
21
|
+
export { NodeType, TriggerType, EdgeType, AppNodeMetadata, AppNodeMetadataType, NodeMetadata, KnownTriggerNames } from './types/Flows.types';
|
|
22
22
|
export type { Tool } from './types/Tools.types';
|
|
23
|
-
export { FlowHistoryType, FlowHistory, TriggerInvocationHistory } from './types/Agent.types';
|
|
23
|
+
export { FlowHistoryType, FlowHistory, TriggerInvocationHistory, AppActionInvocationHistory } from './types/Agent.types';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { MindedConnection } from '../platform/mindedConnection';
|
|
2
|
+
import { MindedConnectionSocketMessageType } from '../platform/mindedConnectionTypes';
|
|
3
|
+
import { ActionInputParam } from '../types/Flows.types';
|
|
4
|
+
import { Tool } from '../types/Tools.types';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
|
|
7
|
+
const typeToZodMap = {
|
|
8
|
+
string: z.string(),
|
|
9
|
+
number: z.number(),
|
|
10
|
+
boolean: z.boolean(),
|
|
11
|
+
array: z.array(z.any()),
|
|
12
|
+
object: z.record(z.any()),
|
|
13
|
+
any: z.any()
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
const convertToZodSchema = (schema: Record<string, { type: string; example?: any }>) => {
|
|
17
|
+
const zodSchema: Record<string, z.ZodType> = {};
|
|
18
|
+
for (const [key, { type }] of Object.entries(schema)) {
|
|
19
|
+
const zodType = typeToZodMap[type.toLowerCase() as keyof typeof typeToZodMap] ?? z.string();
|
|
20
|
+
zodSchema[key] = zodType;
|
|
21
|
+
}
|
|
22
|
+
return z.object(zodSchema);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const createdTools: Record<string, Tool<any, any>> = {};
|
|
26
|
+
|
|
27
|
+
const appActionRunnerToolCreator = (schema: ActionInputParam[], nodeTitle: string, mindedConnection: MindedConnection): Tool<any, any> => {
|
|
28
|
+
const zodSchema = convertToZodSchema(schema.reduce(
|
|
29
|
+
(acc, param) => {
|
|
30
|
+
if (param.required) {
|
|
31
|
+
acc[param.name] = { type: param.type, example: param.example };
|
|
32
|
+
}
|
|
33
|
+
return acc;
|
|
34
|
+
},
|
|
35
|
+
{} as Record<string, { type: string; example?: any }>,
|
|
36
|
+
));
|
|
37
|
+
type InputType = z.infer<typeof zodSchema>;
|
|
38
|
+
// Create a description that includes examples
|
|
39
|
+
const description = `Run ${nodeTitle} action. Example input: ${JSON.stringify(
|
|
40
|
+
schema.reduce((acc, param) => {
|
|
41
|
+
if (param.example !== undefined) {
|
|
42
|
+
acc[param.name] = param.example;
|
|
43
|
+
}
|
|
44
|
+
return acc;
|
|
45
|
+
}, {} as Record<string, any>),
|
|
46
|
+
null,
|
|
47
|
+
2
|
|
48
|
+
)}`;
|
|
49
|
+
|
|
50
|
+
const tool = {
|
|
51
|
+
name: nodeTitle,
|
|
52
|
+
description,
|
|
53
|
+
input: zodSchema,
|
|
54
|
+
execute: async ({ input }: { input: InputType }) => {
|
|
55
|
+
const response = await mindedConnection.awaitEmit(MindedConnectionSocketMessageType.OnAppAction, {
|
|
56
|
+
nodeTitle,
|
|
57
|
+
actionInput: input,
|
|
58
|
+
}, 20000);
|
|
59
|
+
return response as { result?: any };
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
createdTools[nodeTitle] = tool;
|
|
63
|
+
return tool;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const getAppActionRunnerTool = (nodeTitle: string) => {
|
|
67
|
+
return createdTools[nodeTitle];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export default appActionRunnerToolCreator;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { AppToolNode } from '../types/Flows.types';
|
|
2
|
+
import { tool as langchainTool } from '@langchain/core/tools';
|
|
3
|
+
import { PreCompiledGraph, stateAnnotation } from '../types/LangGraph.types';
|
|
4
|
+
import { SystemMessage } from '@langchain/core/messages';
|
|
5
|
+
import { RunnableLike } from '@langchain/core/runnables';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { LLMProviders } from '../types/LLM.types';
|
|
8
|
+
import { getAppActionRunnerTool } from '../internalTools/appActionRunnerTool';
|
|
9
|
+
import { FlowHistoryType } from '../types/Agent.types';
|
|
10
|
+
|
|
11
|
+
export const addAppToolNode = async ({
|
|
12
|
+
graph,
|
|
13
|
+
node,
|
|
14
|
+
llm,
|
|
15
|
+
}: {
|
|
16
|
+
graph: PreCompiledGraph;
|
|
17
|
+
node: AppToolNode;
|
|
18
|
+
llm: typeof LLMProviders[keyof typeof LLMProviders];
|
|
19
|
+
}) => {
|
|
20
|
+
const appRunnerTool = getAppActionRunnerTool(node.name);
|
|
21
|
+
const callback: RunnableLike = async (state: typeof stateAnnotation.State) => {
|
|
22
|
+
console.log(`Executing tool node ${appRunnerTool.name}`);
|
|
23
|
+
|
|
24
|
+
const executeWrapper = async (input: z.infer<typeof appRunnerTool.input>) => {
|
|
25
|
+
try {
|
|
26
|
+
const response = await appRunnerTool.execute({ input, memory: state.memory, triggerInvocations: state.triggerInvocations });
|
|
27
|
+
return response || {};
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.error('Error executing tool', error);
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const tool = langchainTool(executeWrapper, {
|
|
34
|
+
name: appRunnerTool.name,
|
|
35
|
+
description: appRunnerTool.description,
|
|
36
|
+
schema: appRunnerTool.input,
|
|
37
|
+
});
|
|
38
|
+
const prompt = `
|
|
39
|
+
Additional context:
|
|
40
|
+
workflow memory: ${JSON.stringify(state.memory)}
|
|
41
|
+
`;
|
|
42
|
+
const messages = state.messages || [];
|
|
43
|
+
if (Object.keys(state.memory).length !== 0) {
|
|
44
|
+
messages.push(new SystemMessage(prompt));
|
|
45
|
+
}
|
|
46
|
+
const AIToolCallMessage = await llm.bindTools([tool], {
|
|
47
|
+
tool_choice: tool.name,
|
|
48
|
+
}).invoke(messages);
|
|
49
|
+
const toolCallMessage = await tool.invoke(AIToolCallMessage.tool_calls[0])
|
|
50
|
+
return { messages: [AIToolCallMessage, toolCallMessage], history: [{ type: FlowHistoryType.APP_ACTION_INVOCATION, nodeTitle: node.name }] };
|
|
51
|
+
}
|
|
52
|
+
graph.addNode(node.name, callback);
|
|
53
|
+
};
|
package/src/nodes/addToolNode.ts
CHANGED
|
@@ -45,12 +45,14 @@ export const addToolNode = async <Memory>({
|
|
|
45
45
|
Additional context:
|
|
46
46
|
workflow memory: ${JSON.stringify(state.memory)}
|
|
47
47
|
`;
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
const messages = state.messages || [];
|
|
49
|
+
if (Object.keys(state.memory).length !== 0) {
|
|
50
|
+
messages.push(new SystemMessage(prompt));
|
|
51
|
+
}
|
|
52
|
+
const AIToolCallMessage = await llm.bindTools([tool], {
|
|
53
|
+
tool_choice: tool.name,
|
|
54
|
+
}).invoke(messages);
|
|
55
|
+
const toolCallMessage = await tool.invoke(AIToolCallMessage.tool_calls[0])
|
|
54
56
|
const toolMemory = extractToolMemoryResponse<Memory>(toolCallMessage as ToolMessage);
|
|
55
57
|
return { memory: toolMemory, messages: [AIToolCallMessage, toolCallMessage] };
|
|
56
58
|
};
|
package/src/nodes/nodeFactory.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { RunnableLike } from '@langchain/core/runnables';
|
|
2
|
-
import {
|
|
2
|
+
import { JunctionNode, Node, NodeType } from '../types/Flows.types';
|
|
3
3
|
import { PreCompiledGraph } from '../types/LangGraph.types';
|
|
4
4
|
import { Tool } from '../types/Tools.types';
|
|
5
|
-
import { BaseLanguageModel } from '@langchain/core/language_models/base';
|
|
6
5
|
import { addToolNode } from './addToolNode';
|
|
7
6
|
import { addPromptNode } from './addPromptNode';
|
|
8
7
|
import { AgentEventRequestPayloads } from '../events/AgentEvents';
|
|
9
8
|
import { EmitSignature } from '../types/Agent.types';
|
|
9
|
+
import { addAppToolNode } from './addAppToolNode';
|
|
10
10
|
import { addTriggerNode } from './addTriggerNode';
|
|
11
11
|
import { LLMProviders } from '../types/LLM.types';
|
|
12
12
|
|
|
@@ -15,21 +15,6 @@ const addJunctionNode = ({ graph, node }: { graph: PreCompiledGraph; node: Junct
|
|
|
15
15
|
graph.addNode(node.name, callback);
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
const addAppToolNode = ({
|
|
19
|
-
graph,
|
|
20
|
-
node,
|
|
21
|
-
}: {
|
|
22
|
-
graph: PreCompiledGraph;
|
|
23
|
-
node: AppToolNode;
|
|
24
|
-
tools: Tool<any, any>[];
|
|
25
|
-
llm: BaseLanguageModel;
|
|
26
|
-
}) => {
|
|
27
|
-
const callback: RunnableLike = async () => {
|
|
28
|
-
throw new Error('Not implemented');
|
|
29
|
-
};
|
|
30
|
-
graph.addNode(node.name, callback);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
18
|
export const nodeFactory = ({
|
|
34
19
|
graph,
|
|
35
20
|
node,
|
|
@@ -55,7 +40,7 @@ export const nodeFactory = ({
|
|
|
55
40
|
addJunctionNode({ graph, node });
|
|
56
41
|
break;
|
|
57
42
|
case NodeType.APP_TOOL:
|
|
58
|
-
addAppToolNode({ graph, node,
|
|
43
|
+
addAppToolNode({ graph, node, llm });
|
|
59
44
|
break;
|
|
60
45
|
case NodeType.PROMPT_NODE:
|
|
61
46
|
addPromptNode({ graph, node, tools, llm, emit });
|
|
@@ -10,6 +10,7 @@ import type { RunnableConfig } from '@langchain/core/runnables';
|
|
|
10
10
|
|
|
11
11
|
export enum MindedConnectionSocketMessageType {
|
|
12
12
|
OnAppTrigger = 'on-app-trigger',
|
|
13
|
+
OnAppAction = 'on-app-action',
|
|
13
14
|
CHECKPOINT_GET_TUPLE = 'checkpoint-get-tuple',
|
|
14
15
|
CHECKPOINT_PUT = 'checkpoint-put',
|
|
15
16
|
CHECKPOINT_LIST = 'checkpoint-list',
|
package/src/types/Agent.types.ts
CHANGED
|
@@ -11,6 +11,7 @@ export type MindedSDKConfig = {
|
|
|
11
11
|
|
|
12
12
|
export enum FlowHistoryType {
|
|
13
13
|
TRIGGER_INVOCATION = 'triggerInvocation',
|
|
14
|
+
APP_ACTION_INVOCATION = 'appActionInvocation',
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export interface FlowHistory {
|
|
@@ -22,4 +23,9 @@ export interface TriggerInvocationHistory extends FlowHistory {
|
|
|
22
23
|
appName?: string;
|
|
23
24
|
triggerName: string;
|
|
24
25
|
triggerBody: any;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export interface AppActionInvocationHistory extends FlowHistory {
|
|
29
|
+
type: FlowHistoryType.APP_ACTION_INVOCATION;
|
|
30
|
+
nodeTitle: string;
|
|
25
31
|
};
|
package/src/types/Flows.types.ts
CHANGED
|
@@ -42,6 +42,7 @@ export interface BaseAppNode {
|
|
|
42
42
|
account?: string;
|
|
43
43
|
mockDataInstructions?: string;
|
|
44
44
|
textSentToModel?: string;
|
|
45
|
+
parameters?: Record<string, any>;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
export interface AppTriggerNode extends BaseTriggerNode, BaseAppNode {
|
|
@@ -79,10 +80,11 @@ export interface ToolNode extends BaseNode {
|
|
|
79
80
|
|
|
80
81
|
export interface AppToolNode extends BaseNode, BaseAppNode {
|
|
81
82
|
type: NodeType.APP_TOOL;
|
|
82
|
-
prompt
|
|
83
|
+
prompt: string;
|
|
84
|
+
appName: string;
|
|
83
85
|
actionName: string;
|
|
86
|
+
metadata: AppNodeMetadata;
|
|
84
87
|
actionKey: string;
|
|
85
|
-
parameters?: Record<string, 'string' | 'number' | 'boolean' | 'object' | 'array' | 'null'>;
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
export type Node = TriggerNode | JunctionNode | ToolNode | AppToolNode | PromptNode;
|
|
@@ -109,8 +111,45 @@ export interface StepForwardEdge extends BaseEdge {
|
|
|
109
111
|
|
|
110
112
|
export type Edge = LogicalConditionEdge | PromptConditionEdge | StepForwardEdge;
|
|
111
113
|
|
|
114
|
+
export enum AppNodeMetadataType {
|
|
115
|
+
APP_TOOL = 'appTool',
|
|
116
|
+
}
|
|
117
|
+
export interface NodeMetadata {
|
|
118
|
+
type: AppNodeMetadataType;
|
|
119
|
+
}
|
|
120
|
+
export interface AppNodeMetadata extends NodeMetadata {
|
|
121
|
+
type: AppNodeMetadataType.APP_TOOL;
|
|
122
|
+
schema: ActionInputParam[];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type ActionInputParam = {
|
|
126
|
+
name: string;
|
|
127
|
+
type: ActionInputParamType;
|
|
128
|
+
description: string;
|
|
129
|
+
example: string | null;
|
|
130
|
+
required: boolean;
|
|
131
|
+
enum?: string[];
|
|
132
|
+
items?: {
|
|
133
|
+
type: ActionInputParamType;
|
|
134
|
+
properties?: ActionInputParam[];
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export enum ActionInputParamType {
|
|
139
|
+
String = 'string',
|
|
140
|
+
Number = 'number',
|
|
141
|
+
Boolean = 'boolean',
|
|
142
|
+
Array = 'array',
|
|
143
|
+
Object = 'object',
|
|
144
|
+
Any = 'any',
|
|
145
|
+
}
|
|
146
|
+
|
|
112
147
|
export interface Flow {
|
|
113
148
|
name: string;
|
|
114
149
|
nodes: Node[];
|
|
115
150
|
edges: Edge[];
|
|
116
151
|
}
|
|
152
|
+
|
|
153
|
+
export enum KnownTriggerNames {
|
|
154
|
+
MINDED_MESSAGE_IN_CONVERSATION = 'minded_message_in_conversation',
|
|
155
|
+
}
|
package/src/types/Tools.types.ts
CHANGED
|
@@ -8,3 +8,10 @@ export interface Tool<Input extends z.ZodSchema, Memory> {
|
|
|
8
8
|
isGlobal?: boolean;
|
|
9
9
|
execute: ({ input, memory, triggerInvocations }: { input: z.infer<Input>; memory: Memory; triggerInvocations?: Array<FlowHistory> }) => Promise<{ memory?: Partial<Memory>, result?: any } | void>;
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export interface AppActionRunnerInput {
|
|
14
|
+
appName: string;
|
|
15
|
+
actionName: string;
|
|
16
|
+
actionInput: object;
|
|
17
|
+
}
|