@eko-ai/eko 4.0.8 → 4.0.9
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/base.d.ts.map +1 -1
- package/dist/chat/chat-agent.d.ts.map +1 -1
- package/dist/chat/tools/agent-wrap-tool.d.ts +24 -0
- package/dist/chat/tools/agent-wrap-tool.d.ts.map +1 -0
- package/dist/chat/tools/deep-action.d.ts +1 -1
- package/dist/common/xml.d.ts.map +1 -1
- package/dist/index.cjs.js +84 -54
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +84 -54
- package/dist/index.esm.js.map +1 -1
- package/dist/llm/react.d.ts +2 -1
- package/dist/llm/react.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/llm.types.d.ts +5 -1
- package/dist/types/llm.types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/agent/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/agent/base.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAa,MAAM,SAAS,CAAC;AAQhD,OAAO,EACL,IAAI,EAEJ,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,aAAa,EACb,aAAa,EACb,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,6BAA6B,EAC9B,MAAM,kBAAkB,CAAC;AAS1B,OAAO,WAAW,EAAE,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAK5D,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,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ageModelV2ToolCallPart } from "../../types";
|
|
3
|
+
import { Agent } from "../../agent";
|
|
4
|
+
import { ChatContext } from "../chat-context";
|
|
5
|
+
import TaskContext from "../../agent/agent-context";
|
|
6
|
+
import { AgentChain } from "../../agent/chain";
|
|
7
|
+
export default class AgentWrapTool implements DialogueTool {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly description: string;
|
|
10
|
+
readonly parameters: JSONSchema7;
|
|
11
|
+
private chatContext;
|
|
12
|
+
private params;
|
|
13
|
+
private agent;
|
|
14
|
+
constructor(chatContext: ChatContext, params: DialogueParams, agent: Agent, extra?: {
|
|
15
|
+
name?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
parameters?: JSONSchema7;
|
|
18
|
+
});
|
|
19
|
+
execute(args: Record<string, unknown>, toolCall: LanguageModelV2ToolCallPart, messageId: string): Promise<ToolResult>;
|
|
20
|
+
protected runAgent(context: TaskContext, agent: Agent, agentNode: NormalAgentNode, agentChain: AgentChain): Promise<string>;
|
|
21
|
+
protected getTaskWebsite(tabIds: string[]): Promise<any[]>;
|
|
22
|
+
}
|
|
23
|
+
export { AgentWrapTool };
|
|
24
|
+
//# sourceMappingURL=agent-wrap-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-wrap-tool.d.ts","sourceRoot":"","sources":["../../../src/chat/tools/agent-wrap-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACL,UAAU,EACV,YAAY,EACZ,cAAc,EACd,eAAe,EACf,2BAA2B,EAC5B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,WAAW,MAAM,2BAA2B,CAAC;AACpD,OAAc,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGtD,MAAM,CAAC,OAAO,OAAO,aAAc,YAAW,YAAY;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;IAEjC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,KAAK,CAAQ;gBAGnB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,KAAK,EACZ,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,WAAW,CAAC;KAC1B;IA2CG,OAAO,CACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,QAAQ,EAAE,2BAA2B,EACrC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,UAAU,CAAC;cA8EN,QAAQ,CACtB,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,eAAe,EAC1B,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,MAAM,CAAC;cAsDF,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;CAgBjE;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -10,7 +10,7 @@ export default class DeepActionTool implements DialogueTool {
|
|
|
10
10
|
private params;
|
|
11
11
|
constructor(chatContext: ChatContext, params: DialogueParams);
|
|
12
12
|
execute(args: Record<string, unknown>, toolCall: LanguageModelV2ToolCallPart, messageId: string): Promise<ToolResult>;
|
|
13
|
-
private
|
|
13
|
+
private getTaskWebsite;
|
|
14
14
|
}
|
|
15
15
|
export { DeepActionTool };
|
|
16
16
|
//# sourceMappingURL=deep-action.d.ts.map
|
package/dist/common/xml.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xml.d.ts","sourceRoot":"","sources":["../../src/common/xml.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"xml.d.ts","sourceRoot":"","sources":["../../src/common/xml.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAMT,MAAM,sBAAsB,CAAC;AAK9B,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,OAAO,EACb,QAAQ,CAAC,EAAE,MAAM,GAChB,QAAQ,GAAG,IAAI,CAgGjB;AA6DD,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,UAiCtD;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,GAAG,IAAI,CAqBhB;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAOjD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAGjD;AAED,wBAAgB,wBAAwB,CAAC,EACvC,MAAM,EACN,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,SAAS,GACV,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,GAAG,QAAQ,CA8BX;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,QA4DlD"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -36706,7 +36706,7 @@ function parseWorkflow(taskId, xml, done, thinking) {
|
|
|
36706
36706
|
}
|
|
36707
36707
|
const parser = new libExports.DOMParser();
|
|
36708
36708
|
const doc = parser.parseFromString(xml, "text/xml");
|
|
36709
|
-
|
|
36709
|
+
const root = doc.documentElement;
|
|
36710
36710
|
if (root.tagName !== "root") {
|
|
36711
36711
|
return _workflow;
|
|
36712
36712
|
}
|
|
@@ -36719,11 +36719,11 @@ function parseWorkflow(taskId, xml, done, thinking) {
|
|
|
36719
36719
|
agents: agents,
|
|
36720
36720
|
xml: xml,
|
|
36721
36721
|
};
|
|
36722
|
-
|
|
36723
|
-
|
|
36722
|
+
const agentsNode = root.getElementsByTagName("agents");
|
|
36723
|
+
const agentsNodes = agentsNode.length > 0 ? agentsNode[0].getElementsByTagName("agent") : [];
|
|
36724
36724
|
for (let i = 0; i < agentsNodes.length; i++) {
|
|
36725
|
-
|
|
36726
|
-
|
|
36725
|
+
const agentNode = agentsNodes[i];
|
|
36726
|
+
const name = agentNode.getAttribute("name");
|
|
36727
36727
|
if (!name) {
|
|
36728
36728
|
break;
|
|
36729
36729
|
}
|
|
@@ -36733,12 +36733,15 @@ function parseWorkflow(taskId, xml, done, thinking) {
|
|
|
36733
36733
|
let agent = {
|
|
36734
36734
|
name: name,
|
|
36735
36735
|
id: getAgentId(taskId, index),
|
|
36736
|
-
dependsOn: dependsOn
|
|
36736
|
+
dependsOn: dependsOn
|
|
36737
|
+
.split(",")
|
|
36738
|
+
.filter((idx) => idx.trim() != "")
|
|
36739
|
+
.map((idx) => getAgentId(taskId, idx)),
|
|
36737
36740
|
task: agentNode.getElementsByTagName("task")[0]?.textContent || "",
|
|
36738
36741
|
nodes: nodes,
|
|
36739
36742
|
status: "init",
|
|
36740
36743
|
parallel: undefined,
|
|
36741
|
-
xml: agentNode.toString(),
|
|
36744
|
+
xml: " " + agentNode.toString(),
|
|
36742
36745
|
};
|
|
36743
36746
|
let xmlNodes = agentNode.getElementsByTagName("nodes");
|
|
36744
36747
|
if (xmlNodes.length > 0) {
|
|
@@ -36784,7 +36787,7 @@ function parseWorkflowNodes(nodes, xmlNodes) {
|
|
|
36784
36787
|
if (xmlNodes[i].nodeType !== 1) {
|
|
36785
36788
|
continue;
|
|
36786
36789
|
}
|
|
36787
|
-
|
|
36790
|
+
const xmlNode = xmlNodes[i];
|
|
36788
36791
|
switch (xmlNode.tagName) {
|
|
36789
36792
|
case "node": {
|
|
36790
36793
|
let node = {
|
|
@@ -36832,10 +36835,10 @@ function parseWorkflowNodes(nodes, xmlNodes) {
|
|
|
36832
36835
|
function buildAgentRootXml(agentXml, mainTaskPrompt, nodeCallback) {
|
|
36833
36836
|
const parser = new libExports.DOMParser();
|
|
36834
36837
|
const doc = parser.parseFromString(agentXml, "text/xml");
|
|
36835
|
-
|
|
36836
|
-
|
|
36838
|
+
const agentNode = doc.getElementsByTagName("agent");
|
|
36839
|
+
const nodesNode = doc.getElementsByTagName("nodes");
|
|
36837
36840
|
if (nodesNode.length > 0) {
|
|
36838
|
-
|
|
36841
|
+
const nodes = nodesNode[0].childNodes;
|
|
36839
36842
|
let nodeId = 0;
|
|
36840
36843
|
for (let i = 0; i < nodes.length; i++) {
|
|
36841
36844
|
let node = nodes[i];
|
|
@@ -36846,21 +36849,27 @@ function buildAgentRootXml(agentXml, mainTaskPrompt, nodeCallback) {
|
|
|
36846
36849
|
}
|
|
36847
36850
|
}
|
|
36848
36851
|
}
|
|
36849
|
-
// <root><mainTask></mainTask><currentTask></currentTask><nodes><node id="0"></node></nodes></root>
|
|
36850
36852
|
let agentInnerHTML = getInnerXML(agentNode[0]);
|
|
36851
|
-
|
|
36853
|
+
const prefix = agentInnerHTML.substring(0, agentInnerHTML.indexOf("<task>"));
|
|
36852
36854
|
agentInnerHTML = agentInnerHTML
|
|
36853
36855
|
.replace("<task>", "<currentTask>")
|
|
36854
36856
|
.replace("</task>", "</currentTask>");
|
|
36855
|
-
|
|
36857
|
+
let xmlPrompt;
|
|
36858
|
+
if (agentInnerHTML.indexOf(`<currentTask>${mainTaskPrompt}</currentTask>`) > -1) {
|
|
36859
|
+
xmlPrompt = `<root>${agentInnerHTML}</root>`;
|
|
36860
|
+
}
|
|
36861
|
+
else {
|
|
36862
|
+
// <root><mainTask></mainTask><currentTask></currentTask><nodes><node id="0"></node></nodes></root>
|
|
36863
|
+
xmlPrompt = `<root>${prefix}<mainTask>${mainTaskPrompt}</mainTask>${agentInnerHTML}</root>`;
|
|
36864
|
+
}
|
|
36856
36865
|
return xmlPrompt.replace(/ /g, " ").replace(" </root>", "</root>");
|
|
36857
36866
|
}
|
|
36858
36867
|
function extractAgentXmlNode(agentXml, nodeId) {
|
|
36859
36868
|
const parser = new libExports.DOMParser();
|
|
36860
36869
|
const doc = parser.parseFromString(agentXml, "text/xml");
|
|
36861
|
-
|
|
36870
|
+
const nodesNode = doc.getElementsByTagName("nodes");
|
|
36862
36871
|
if (nodesNode.length > 0) {
|
|
36863
|
-
|
|
36872
|
+
const nodes = nodesNode[0].childNodes;
|
|
36864
36873
|
let _nodeId = 0;
|
|
36865
36874
|
for (let i = 0; i < nodes.length; i++) {
|
|
36866
36875
|
let node = nodes[i];
|
|
@@ -36886,8 +36895,8 @@ function getInnerXML(node) {
|
|
|
36886
36895
|
return result;
|
|
36887
36896
|
}
|
|
36888
36897
|
function buildSimpleAgentWorkflow({ taskId, name, agentName, task, taskNodes, }) {
|
|
36889
|
-
if (!taskNodes
|
|
36890
|
-
taskNodes = [
|
|
36898
|
+
if (!taskNodes) {
|
|
36899
|
+
taskNodes = [];
|
|
36891
36900
|
}
|
|
36892
36901
|
const workflow = {
|
|
36893
36902
|
taskId: taskId,
|
|
@@ -36920,7 +36929,9 @@ function resetWorkflowXml(workflow) {
|
|
|
36920
36929
|
const agents = [];
|
|
36921
36930
|
for (let i = 0; i < workflow.agents.length; i++) {
|
|
36922
36931
|
const agent = workflow.agents[i];
|
|
36923
|
-
const agentDependsAttr = ` id="${i}" dependsOn="${(agent.dependsOn || [])
|
|
36932
|
+
const agentDependsAttr = ` id="${i}" dependsOn="${(agent.dependsOn || [])
|
|
36933
|
+
.filter((s) => parseInt(s.split("-")[s.split("-").length - 1]))
|
|
36934
|
+
.join(",")}"`;
|
|
36924
36935
|
const nodes = agent.nodes
|
|
36925
36936
|
.map((node) => {
|
|
36926
36937
|
if (node.type == "forEach") {
|
|
@@ -36931,9 +36942,8 @@ function resetWorkflowXml(workflow) {
|
|
|
36931
36942
|
const output = _node.output ? ` output="${_node.output}"` : "";
|
|
36932
36943
|
forEachNodes.push(` <node${input}${output}>${_node.text}</node>`);
|
|
36933
36944
|
}
|
|
36934
|
-
|
|
36935
|
-
${forEachNodes.join("\n")}
|
|
36936
|
-
</forEach>`;
|
|
36945
|
+
const items = node.items || "";
|
|
36946
|
+
return ` <forEach items="${items}">\n${forEachNodes.join("\n")}\n </forEach>`;
|
|
36937
36947
|
}
|
|
36938
36948
|
else if (node.type == "watch") {
|
|
36939
36949
|
const watchNodes = [];
|
|
@@ -36943,12 +36953,9 @@ ${forEachNodes.join("\n")}
|
|
|
36943
36953
|
const output = _node.output ? ` output="${_node.output}"` : "";
|
|
36944
36954
|
watchNodes.push(` <node${input}${output}>${_node.text}</node>`);
|
|
36945
36955
|
}
|
|
36946
|
-
|
|
36947
|
-
|
|
36948
|
-
<trigger
|
|
36949
|
-
${watchNodes.join("\n")}
|
|
36950
|
-
</trigger>
|
|
36951
|
-
</watch>`;
|
|
36956
|
+
const event = node.event || "dom";
|
|
36957
|
+
const loop = node.loop ? "true" : "false";
|
|
36958
|
+
return ` <watch event="${event}" loop="${loop}">\n <description>${node.description}</description>\n <trigger>\n${watchNodes.join("\n")}\n </trigger>\n </watch>`;
|
|
36952
36959
|
}
|
|
36953
36960
|
else {
|
|
36954
36961
|
const input = node.input ? ` input="${node.input}"` : "";
|
|
@@ -36957,22 +36964,17 @@ ${watchNodes.join("\n")}
|
|
|
36957
36964
|
}
|
|
36958
36965
|
})
|
|
36959
36966
|
.join("\n");
|
|
36960
|
-
|
|
36961
|
-
|
|
36962
|
-
<nodes
|
|
36963
|
-
|
|
36964
|
-
|
|
36965
|
-
</agent>`;
|
|
36967
|
+
let agentXml;
|
|
36968
|
+
if (nodes.trim()) {
|
|
36969
|
+
agentXml = ` <agent name="${agent.name}"${agentDependsAttr}>\n <task>${agent.task}</task>\n <nodes>\n${nodes}\n </nodes>\n </agent>`;
|
|
36970
|
+
}
|
|
36971
|
+
else {
|
|
36972
|
+
agentXml = ` <agent name="${agent.name}"${agentDependsAttr}>\n <task>${agent.task}</task>\n </agent>`;
|
|
36973
|
+
}
|
|
36966
36974
|
agent.xml = agentXml;
|
|
36967
36975
|
agents.push(agentXml);
|
|
36968
36976
|
}
|
|
36969
|
-
const xml = `<root
|
|
36970
|
-
<name>${workflow.name}</name>
|
|
36971
|
-
<thought>${workflow.thought}</thought>
|
|
36972
|
-
<agents>
|
|
36973
|
-
${agents.join("\n")}
|
|
36974
|
-
</agents>
|
|
36975
|
-
</root>`;
|
|
36977
|
+
const xml = `<root>\n <name>${workflow.name}</name>\n <thought>${workflow.thought}</thought>\n <agents>\n${agents.join("\n")}\n </agents>\n</root>`;
|
|
36976
36978
|
workflow.xml = xml;
|
|
36977
36979
|
}
|
|
36978
36980
|
|
|
@@ -38047,7 +38049,9 @@ async function callWithReAct(rlm, request, toolCallsOrCallback, streamCallback,
|
|
|
38047
38049
|
};
|
|
38048
38050
|
}
|
|
38049
38051
|
if (typeof toolCallsOrCallback !== "function") {
|
|
38050
|
-
request.tools =
|
|
38052
|
+
request.tools = (Array.isArray(toolCallsOrCallback)
|
|
38053
|
+
? toolCallsOrCallback
|
|
38054
|
+
: toolCallsOrCallback.tools).map((tool) => ({
|
|
38051
38055
|
type: "function",
|
|
38052
38056
|
name: tool.name,
|
|
38053
38057
|
description: tool.description,
|
|
@@ -38085,16 +38089,33 @@ async function callWithReAct(rlm, request, toolCallsOrCallback, streamCallback,
|
|
|
38085
38089
|
toolResults = await toolCallsOrCallback(request, toolUses);
|
|
38086
38090
|
}
|
|
38087
38091
|
else {
|
|
38088
|
-
|
|
38089
|
-
|
|
38090
|
-
|
|
38091
|
-
|
|
38092
|
-
|
|
38093
|
-
|
|
38094
|
-
|
|
38095
|
-
|
|
38096
|
-
|
|
38097
|
-
|
|
38092
|
+
const tools = Array.isArray(toolCallsOrCallback)
|
|
38093
|
+
? toolCallsOrCallback
|
|
38094
|
+
: toolCallsOrCallback.tools;
|
|
38095
|
+
if (!Array.isArray(toolCallsOrCallback) && toolCallsOrCallback.callback) {
|
|
38096
|
+
toolResults = await toolCallsOrCallback.callback(request, toolUses, tools);
|
|
38097
|
+
}
|
|
38098
|
+
else {
|
|
38099
|
+
toolResults = await Promise.all(toolUses.map(async (toolUse) => {
|
|
38100
|
+
const tool = tools.find((t) => t.name === toolUse.toolName);
|
|
38101
|
+
if (!tool) {
|
|
38102
|
+
throw new Error(`Tool ${toolUse.toolName} not found`);
|
|
38103
|
+
}
|
|
38104
|
+
const args = typeof toolUse.input === "string"
|
|
38105
|
+
? JSON.parse(toolUse.input || "{}")
|
|
38106
|
+
: toolUse.input || {};
|
|
38107
|
+
try {
|
|
38108
|
+
return tool.execute(args, toolUse);
|
|
38109
|
+
}
|
|
38110
|
+
catch (e) {
|
|
38111
|
+
Log.error("tool call error: ", toolUse.toolName, toolUse.input, e);
|
|
38112
|
+
return {
|
|
38113
|
+
type: "error-text",
|
|
38114
|
+
value: "Error: " + (e + "") || "Unknown error",
|
|
38115
|
+
};
|
|
38116
|
+
}
|
|
38117
|
+
}));
|
|
38118
|
+
}
|
|
38098
38119
|
}
|
|
38099
38120
|
if (toolResults.length > 0) {
|
|
38100
38121
|
request.messages.push({
|
|
@@ -40601,6 +40622,12 @@ class Agent {
|
|
|
40601
40622
|
if (hasVariable) {
|
|
40602
40623
|
tools.push(new VariableStorageTool());
|
|
40603
40624
|
}
|
|
40625
|
+
else {
|
|
40626
|
+
const dependentVariables = agentContext.context.variables.get("dependentVariables");
|
|
40627
|
+
if (dependentVariables && dependentVariables.length > 0) {
|
|
40628
|
+
tools.push(new VariableStorageTool());
|
|
40629
|
+
}
|
|
40630
|
+
}
|
|
40604
40631
|
const hasForeach = agentNodeXml.indexOf("</forEach>") > -1;
|
|
40605
40632
|
if (hasForeach) {
|
|
40606
40633
|
tools.push(new ForeachTaskTool());
|
|
@@ -44298,7 +44325,7 @@ class DeepActionTool {
|
|
|
44298
44325
|
file_url: part.data,
|
|
44299
44326
|
};
|
|
44300
44327
|
});
|
|
44301
|
-
const taskWebsite = await this.
|
|
44328
|
+
const taskWebsite = await this.getTaskWebsite(tabIds);
|
|
44302
44329
|
const workflow = await eko.generate(taskDescription, messageId, {
|
|
44303
44330
|
...(this.params.extra || {}),
|
|
44304
44331
|
...globalVariables,
|
|
@@ -44347,7 +44374,7 @@ class DeepActionTool {
|
|
|
44347
44374
|
],
|
|
44348
44375
|
};
|
|
44349
44376
|
}
|
|
44350
|
-
async
|
|
44377
|
+
async getTaskWebsite(tabIds) {
|
|
44351
44378
|
if (!global.browserService) {
|
|
44352
44379
|
return [];
|
|
44353
44380
|
}
|
|
@@ -44647,6 +44674,9 @@ class ChatAgent {
|
|
|
44647
44674
|
}
|
|
44648
44675
|
tools.push(new WebSearchTool(this.chatContext, params));
|
|
44649
44676
|
tools.push(new TaskVariableStorageTool(this.chatContext, params));
|
|
44677
|
+
// this.chatContext.getConfig().agents?.forEach((agent) => {
|
|
44678
|
+
// tools.push(new AgentWrapTool(this.chatContext, params, agent));
|
|
44679
|
+
// });
|
|
44650
44680
|
return tools;
|
|
44651
44681
|
}
|
|
44652
44682
|
getMemory() {
|