@minded-ai/mindedjs 1.0.101-beta.1 → 1.0.101-beta.3
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addBrowserTaskNode.d.ts","sourceRoot":"","sources":["../../src/nodes/addBrowserTaskNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAY,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,0BAA0B,CAAC;AAM7E,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAIjC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"addBrowserTaskNode.d.ts","sourceRoot":"","sources":["../../src/nodes/addBrowserTaskNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAY,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,0BAA0B,CAAC;AAM7E,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAIjC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AA0ClD,KAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE,gBAAgB,CAAC;IACxB,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE,KAAK,CAAC;IACb,GAAG,EAAE,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;CACvD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAU,6BAA6B,wBAAwB,kBAuK7F,CAAC"}
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.addBrowserTaskNode = void 0;
|
|
4
37
|
const Flows_types_1 = require("../types/Flows.types");
|
|
@@ -10,6 +43,41 @@ const executeBrowserTask_1 = require("../browserTask/executeBrowserTask");
|
|
|
10
43
|
const tools_1 = require("@langchain/core/tools");
|
|
11
44
|
const zod_1 = require("zod");
|
|
12
45
|
const playbooks_1 = require("../playbooks/playbooks");
|
|
46
|
+
const ejs = __importStar(require("ejs"));
|
|
47
|
+
/**
|
|
48
|
+
* Compile prompt with parameters using EJS and placeholder replacement
|
|
49
|
+
*/
|
|
50
|
+
function compilePrompt(prompt, params = {}) {
|
|
51
|
+
try {
|
|
52
|
+
// First, render with EJS
|
|
53
|
+
let compiledPrompt = ejs.render(prompt, params);
|
|
54
|
+
// Then, replace placeholders in {} format
|
|
55
|
+
compiledPrompt = replacePlaceholders(compiledPrompt, params);
|
|
56
|
+
return compiledPrompt;
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
logger_1.logger.error({ message: 'Error compiling prompt', error });
|
|
60
|
+
return prompt; // Return uncompiled if there's an error
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Replace placeholders in {key} format
|
|
65
|
+
*/
|
|
66
|
+
function replacePlaceholders(text, params) {
|
|
67
|
+
return text.replace(/\{([^}]+)\}/g, (match, key) => {
|
|
68
|
+
const keys = key.split('.');
|
|
69
|
+
let value = params;
|
|
70
|
+
for (const k of keys) {
|
|
71
|
+
if (value && typeof value === 'object' && k in value) {
|
|
72
|
+
value = value[k];
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
return match; // Return original if key not found
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return String(value);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
13
81
|
const addBrowserTaskNode = async ({ graph, node, agent, llm }) => {
|
|
14
82
|
const callback = async (state) => {
|
|
15
83
|
logger_1.logger.info({ msg: `Executing browser task node ${node.displayName}`, prompt: node.prompt });
|
|
@@ -65,12 +133,20 @@ Additional context:
|
|
|
65
133
|
}
|
|
66
134
|
const toolCall = AIToolCallMessage.tool_calls[0];
|
|
67
135
|
const inputParams = toolCall.args || {};
|
|
68
|
-
//
|
|
136
|
+
// Prepare parameters for prompt compilation
|
|
137
|
+
const promptParams = {
|
|
138
|
+
input: inputParams,
|
|
139
|
+
state,
|
|
140
|
+
currentTime: new Date().toISOString(),
|
|
141
|
+
};
|
|
142
|
+
// Compile the prompt with parameters
|
|
143
|
+
const compiledPrompt = compilePrompt(node.prompt, promptParams);
|
|
144
|
+
// Build the full prompt with compiled content
|
|
69
145
|
const fullPrompt = `
|
|
70
146
|
Follow the instructions. Any retrieved data should be printed as string and not saved to a file.
|
|
71
147
|
|
|
72
148
|
# Task instructions:
|
|
73
|
-
${
|
|
149
|
+
${compiledPrompt}
|
|
74
150
|
|
|
75
151
|
${Object.keys(inputParams).length > 0 ? `# Input parameters:\n${JSON.stringify(inputParams, null, 2)}\n\n` : ''}
|
|
76
152
|
${state.memory ? `# Task context:\n${JSON.stringify(state.memory)}\n\n` : ''}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addBrowserTaskNode.js","sourceRoot":"","sources":["../../src/nodes/addBrowserTaskNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"addBrowserTaskNode.js","sourceRoot":"","sources":["../../src/nodes/addBrowserTaskNode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sDAAiE;AAGjE,4CAAyC;AACzC,8CAAqD;AACrD,uDAAoE;AACpE,+BAAoC;AAEpC,0EAAoF;AACpF,iDAA8D;AAC9D,6BAAwB;AAExB,sDAA0D;AAC1D,yCAA2B;AAE3B;;GAEG;AACH,SAAS,aAAa,CAAC,MAAc,EAAE,SAA8B,EAAE;IACrE,IAAI,CAAC;QACH,yBAAyB;QACzB,IAAI,cAAc,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAEhD,0CAA0C;QAC1C,cAAc,GAAG,mBAAmB,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;QAE7D,OAAO,cAAc,CAAC;IACxB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,eAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,wBAAwB,EAAE,KAAK,EAAE,CAAC,CAAC;QAC3D,OAAO,MAAM,CA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,OAAO,KAAU,EAAE,CAAC;YACpB,eAAM,CAAC,KAAK,CAAC,oCAAoC,IAAI,CAAC,WAAW,KAAK,KAAK,EAAE,CAAC,CAAC;YAE/E,MAAM,cAAc,GAAG,IAAA,SAAM,GAAE,CAAC;YAChC,MAAM,eAAe,GAAG,IAAA,SAAM,GAAE,CAAC;YAEjC,MAAM,kBAAkB,GAAG,IAAI,oBAAS,CAAC;gBACvC,EAAE,EAAE,cAAc;gBAClB,OAAO,EAAE,EAAE;gBACX,UAAU,EAAE;oBACV;wBACE,EAAE,EAAE,eAAe;wBACnB,IAAI,EAAE,cAAc;wBACpB,IAAI,EAAE;4BACJ,KAAK,EAAE,KAAK,CAAC,OAAO;yBACrB;qBACF;iBACF;gBACD,iBAAiB,EAAE;oBACjB,cAAc,EAAE;wBACd,QAAQ,EAAE,sBAAQ,CAAC,YAAY;wBAC/B,KAAK,EAAE,KAAK,CAAC,OAAO;qBACrB;iBACF;aACF,CAAC,CAAC;YAEH,OAAO;gBACL,OAAO,EAAE,IAAA,2BAAiB,EAAc,KAAK,CAAC,OAAO,EAAE;oBACrD,IAAI,EAAE,sBAAQ,CAAC,YAAY;oBAC3B,MAAM,EAAE,IAAI,CAAC,IAAI;oBACjB,eAAe,EAAE,IAAI,CAAC,WAAW;oBACjC,GAAG,EAAE,KAAK;oBACV,UAAU,EAAE,CAAC,cAAc,CAAC;iBAC7B,CAAC;gBACF,QAAQ,EAAE,CAAC,kBAAkB,CAAC;aAC/B,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;IACF,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACrC,CAAC,CAAC;AAvKW,QAAA,kBAAkB,sBAuK7B"}
|
package/package.json
CHANGED
|
@@ -12,6 +12,45 @@ import { tool as langchainTool } from '@langchain/core/tools';
|
|
|
12
12
|
import { z } from 'zod';
|
|
13
13
|
import { LLMProviders } from '../types/LLM.types';
|
|
14
14
|
import { compilePlaybooks } from '../playbooks/playbooks';
|
|
15
|
+
import * as ejs from 'ejs';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Compile prompt with parameters using EJS and placeholder replacement
|
|
19
|
+
*/
|
|
20
|
+
function compilePrompt(prompt: string, params: Record<string, any> = {}): string {
|
|
21
|
+
try {
|
|
22
|
+
// First, render with EJS
|
|
23
|
+
let compiledPrompt = ejs.render(prompt, params);
|
|
24
|
+
|
|
25
|
+
// Then, replace placeholders in {} format
|
|
26
|
+
compiledPrompt = replacePlaceholders(compiledPrompt, params);
|
|
27
|
+
|
|
28
|
+
return compiledPrompt;
|
|
29
|
+
} catch (error) {
|
|
30
|
+
logger.error({ message: 'Error compiling prompt', error });
|
|
31
|
+
return prompt; // Return uncompiled if there's an error
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Replace placeholders in {key} format
|
|
37
|
+
*/
|
|
38
|
+
function replacePlaceholders(text: string, params: Record<string, any>): string {
|
|
39
|
+
return text.replace(/\{([^}]+)\}/g, (match, key) => {
|
|
40
|
+
const keys = key.split('.');
|
|
41
|
+
let value: any = params;
|
|
42
|
+
|
|
43
|
+
for (const k of keys) {
|
|
44
|
+
if (value && typeof value === 'object' && k in value) {
|
|
45
|
+
value = value[k];
|
|
46
|
+
} else {
|
|
47
|
+
return match; // Return original if key not found
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return String(value);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
15
54
|
|
|
16
55
|
type AddBrowserTaskNodeParams = {
|
|
17
56
|
graph: PreCompiledGraph;
|
|
@@ -86,12 +125,22 @@ Additional context:
|
|
|
86
125
|
const toolCall = AIToolCallMessage.tool_calls[0];
|
|
87
126
|
const inputParams = toolCall.args || {};
|
|
88
127
|
|
|
89
|
-
//
|
|
128
|
+
// Prepare parameters for prompt compilation
|
|
129
|
+
const promptParams = {
|
|
130
|
+
input: inputParams,
|
|
131
|
+
state,
|
|
132
|
+
currentTime: new Date().toISOString(),
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// Compile the prompt with parameters
|
|
136
|
+
const compiledPrompt = compilePrompt(node.prompt, promptParams);
|
|
137
|
+
|
|
138
|
+
// Build the full prompt with compiled content
|
|
90
139
|
const fullPrompt = `
|
|
91
140
|
Follow the instructions. Any retrieved data should be printed as string and not saved to a file.
|
|
92
141
|
|
|
93
142
|
# Task instructions:
|
|
94
|
-
${
|
|
143
|
+
${compiledPrompt}
|
|
95
144
|
|
|
96
145
|
${Object.keys(inputParams).length > 0 ? `# Input parameters:\n${JSON.stringify(inputParams, null, 2)}\n\n` : ''}
|
|
97
146
|
${state.memory ? `# Task context:\n${JSON.stringify(state.memory)}\n\n` : ''}
|