@minded-ai/mindedjs 1.0.43 → 1.0.44

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/cli/index.js CHANGED
File without changes
@@ -1 +1 @@
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"}
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;IACD,KAAK,EAAE,gBAAgB,CAAC;IACxB,IAAI,EAAE,WAAW,CAAC;IAClB,GAAG,EAAE,CAAC,OAAO,YAAY,EAAE,MAAM,OAAO,YAAY,CAAC,CAAC;CACvD,kBA4CA,CAAC"}
@@ -32,11 +32,21 @@ const addAppToolNode = async ({ graph, node, llm, }) => {
32
32
  if (Object.keys(state.memory).length !== 0) {
33
33
  messages.push(new messages_1.SystemMessage(prompt));
34
34
  }
35
- const AIToolCallMessage = await llm.bindTools([tool], {
35
+ const AIToolCallMessage = await llm
36
+ .bindTools([tool], {
36
37
  tool_choice: tool.name,
37
- }).invoke(messages);
38
+ })
39
+ .invoke(messages);
38
40
  const toolCallMessage = await tool.invoke(AIToolCallMessage.tool_calls[0]);
39
- return { messages: [AIToolCallMessage, toolCallMessage], history: [{ type: Agent_types_1.FlowHistoryType.APP_ACTION_INVOCATION, nodeTitle: node.name }] };
41
+ AIToolCallMessage.additional_kwargs = {
42
+ appActionInvocation: {
43
+ nodeTitle: node.name,
44
+ },
45
+ };
46
+ return {
47
+ messages: [AIToolCallMessage, toolCallMessage],
48
+ history: [{ type: Agent_types_1.FlowHistoryType.APP_ACTION_INVOCATION, nodeTitle: node.name }],
49
+ };
40
50
  };
41
51
  graph.addNode(node.name, callback);
42
52
  };
@@ -1 +1 @@
1
- {"version":3,"file":"addAppToolNode.js","sourceRoot":"","sources":["../../src/nodes/addAppToolNode.ts"],"names":[],"mappings":";;;AACA,iDAA8D;AAE9D,uDAAyD;AAIzD,8EAA8E;AAC9E,sDAAuD;AAEhD,MAAM,cAAc,GAAG,KAAK,EAAE,EACjC,KAAK,EACL,IAAI,EACJ,GAAG,GAKN,EAAE,EAAE;IACD,MAAM,aAAa,GAAG,IAAA,4CAAsB,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxD,MAAM,QAAQ,GAAiB,KAAK,EAAE,KAAmC,EAAE,EAAE;QACzE,OAAO,CAAC,GAAG,CAAC,uBAAuB,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;QAEzD,MAAM,cAAc,GAAG,KAAK,EAAE,KAA0C,EAAE,EAAE;YACxE,IAAI,CAAC;gBACD,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC;gBAC5H,OAAO,QAAQ,IAAI,EAAE,CAAC;YAC1B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,OAAO,CAAC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C,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3C,QAAQ,CAAC,IAAI,CAAC,IAAI,wBAAa,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3C,CAAC;QACD,MAAM,iBAAiB,GAAG,MAAM,GAAG;aAChC,SAAS,CAAC,CAAC,IAAI,CAAC,EAAE;YACjB,WAAW,EAAE,IAAI,CAAC,IAAI;SACvB,CAAC;aACD,MAAM,CAAC,QAAQ,CAAC,CAAC;QACpB,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3E,iBAAiB,CAAC,iBAAiB,GAAG;YACpC,mBAAmB,EAAE;gBACnB,SAAS,EAAE,IAAI,CAAC,IAAI;aACrB;SACF,CAAC;QACF,OAAO;YACL,QAAQ,EAAE,CAAC,iBAAiB,EAAE,eAAe,CAAC;YAC9C,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,6BAAe,CAAC,qBAAqB,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;SACjF,CAAC;IACJ,CAAC,CAAC;IACF,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACrC,CAAC,CAAC;AApDW,QAAA,cAAc,kBAoDzB"}
@@ -0,0 +1,6 @@
1
+ export declare const analyticsFactory: ({ token, sessionId }: {
2
+ token: string;
3
+ sessionId: string;
4
+ }) => {
5
+ track: <T>(event: string, data: T) => Promise<void>;
6
+ };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.analyticsFactory = void 0;
4
+ const mindedRequest_1 = require("./mindedRequest");
5
+ const track = async ({ event, data, token, sessionId }) => {
6
+ await (0, mindedRequest_1.mindedRequest)({
7
+ path: '/analytics/events',
8
+ method: 'POST',
9
+ body: { event, data, sessionId },
10
+ token,
11
+ });
12
+ };
13
+ const analyticsFactory = ({ token, sessionId }) => {
14
+ return {
15
+ track: (event, data) => track({ event, data, token, sessionId }),
16
+ };
17
+ };
18
+ exports.analyticsFactory = analyticsFactory;
19
+ //# sourceMappingURL=analytics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../src/platform/analytics.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAEhD,MAAM,KAAK,GAAG,KAAK,EAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAgE,EAAE,EAAE;IACzH,MAAM,IAAA,6BAAa,EAAC;QAClB,IAAI,EAAE,mBAAmB;QACzB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE;QAChC,KAAK;KACN,CAAC,CAAC;AACL,CAAC,CAAC;AAEK,MAAM,gBAAgB,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAwC,EAAE,EAAE;IAC7F,OAAO;QACL,KAAK,EAAE,CAAI,KAAa,EAAE,IAAO,EAAE,EAAE,CAAC,KAAK,CAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;KAClF,CAAC;AACJ,CAAC,CAAC;AAJW,QAAA,gBAAgB,oBAI3B"}
@@ -0,0 +1,8 @@
1
+ type Method = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
2
+ export declare const mindedRequest: <Response, Request = object>({ path, method, body, token, }: {
3
+ path: string;
4
+ method: Method;
5
+ body: Request;
6
+ token: string;
7
+ }) => Promise<Response>;
8
+ export {};
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.mindedRequest = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const mindedRequest = async ({ path, method, body, token, }) => {
9
+ const baseUrl = process.env.MINDED_SERVER || 'https://api.minded.com/sdk';
10
+ const response = await (0, axios_1.default)({
11
+ method,
12
+ url: `${baseUrl}${path}`,
13
+ data: body,
14
+ headers: {
15
+ 'Content-Type': 'application/json',
16
+ Authorization: `Bearer ${token}`,
17
+ },
18
+ });
19
+ return response.data;
20
+ };
21
+ exports.mindedRequest = mindedRequest;
22
+ //# sourceMappingURL=mindedRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mindedRequest.js","sourceRoot":"","sources":["../../src/platform/mindedRequest.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAInB,MAAM,aAAa,GAAG,KAAK,EAA8B,EAC9D,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,GAMN,EAAqB,EAAE;IACtB,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,4BAA4B,CAAC;IAE1E,MAAM,QAAQ,GAAG,MAAM,IAAA,eAAK,EAAC;QAC3B,MAAM;QACN,GAAG,EAAE,GAAG,OAAO,GAAG,IAAI,EAAE;QACxB,IAAI,EAAE,IAAI;QACV,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,KAAK,EAAE;SACjC;KACF,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC,CAAC;AAxBW,QAAA,aAAa,iBAwBxB"}
@@ -0,0 +1 @@
1
+ export type TriggerBody = any;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Triggers.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Triggers.types.js","sourceRoot":"","sources":["../../src/types/Triggers.types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minded-ai/mindedjs",
3
- "version": "1.0.43",
3
+ "version": "1.0.44",
4
4
  "description": "MindedJS is a TypeScript library for building agents.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -53,4 +53,4 @@
53
53
  "uuid": "^11.1.0",
54
54
  "zod": "^3.24.4"
55
55
  }
56
- }
56
+ }
@@ -9,45 +9,55 @@ import { getAppActionRunnerTool } from '../internalTools/appActionRunnerTool';
9
9
  import { FlowHistoryType } from '../types/Agent.types';
10
10
 
11
11
  export const addAppToolNode = async ({
12
- graph,
13
- node,
14
- llm,
12
+ graph,
13
+ node,
14
+ llm,
15
15
  }: {
16
- graph: PreCompiledGraph;
17
- node: AppToolNode;
18
- llm: typeof LLMProviders[keyof typeof LLMProviders];
16
+ graph: PreCompiledGraph;
17
+ node: AppToolNode;
18
+ llm: (typeof LLMProviders)[keyof typeof LLMProviders];
19
19
  }) => {
20
- const appRunnerTool = getAppActionRunnerTool(node.name);
21
- const callback: RunnableLike = async (state: typeof stateAnnotation.State) => {
22
- console.log(`Executing tool node ${appRunnerTool.name}`);
20
+ const appRunnerTool = getAppActionRunnerTool(node.name);
21
+ const callback: RunnableLike = async (state: typeof stateAnnotation.State) => {
22
+ console.log(`Executing tool node ${appRunnerTool.name}`);
23
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 = `
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
39
  Additional context:
40
40
  workflow memory: ${JSON.stringify(state.memory)}
41
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 }] };
42
+ const messages = state.messages || [];
43
+ if (Object.keys(state.memory).length !== 0) {
44
+ messages.push(new SystemMessage(prompt));
51
45
  }
52
- graph.addNode(node.name, callback);
53
- };
46
+ const AIToolCallMessage = await llm
47
+ .bindTools([tool], {
48
+ tool_choice: tool.name,
49
+ })
50
+ .invoke(messages);
51
+ const toolCallMessage = await tool.invoke(AIToolCallMessage.tool_calls[0]);
52
+ AIToolCallMessage.additional_kwargs = {
53
+ appActionInvocation: {
54
+ nodeTitle: node.name,
55
+ },
56
+ };
57
+ return {
58
+ messages: [AIToolCallMessage, toolCallMessage],
59
+ history: [{ type: FlowHistoryType.APP_ACTION_INVOCATION, nodeTitle: node.name }],
60
+ };
61
+ };
62
+ graph.addNode(node.name, callback);
63
+ };