@eko-ai/eko 2.0.2-alpha.4 → 2.0.2-alpha.6
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 +1 -1
- package/dist/agent/base.d.ts.map +1 -1
- package/dist/agent/browser/browser_labels.d.ts.map +1 -1
- package/dist/index.cjs.js +58 -76
- package/dist/index.esm.js +58 -76
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/prompt/agent.d.ts +3 -2
- package/dist/prompt/agent.d.ts.map +1 -1
- package/dist/tools/human_interact.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/agent/base.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare class Agent {
|
|
|
24
24
|
protected handleResult(agentContext: AgentContext, messages: LanguageModelV1Prompt, agentTools: Tool[], results: Array<LanguageModelV1TextPart | LanguageModelV1ToolCallPart>): Promise<string | null>;
|
|
25
25
|
protected system_auto_tools(agentNode: WorkflowAgent): Tool[];
|
|
26
26
|
private removeDuplicateToolUse;
|
|
27
|
-
protected initMessages(agentContext: AgentContext): LanguageModelV1Prompt;
|
|
27
|
+
protected initMessages(agentContext: AgentContext, tools?: Tool[]): LanguageModelV1Prompt;
|
|
28
28
|
private listTools;
|
|
29
29
|
protected controlMcpTools(agentContext: AgentContext, messages: LanguageModelV1Prompt, loopNum: number): Promise<{
|
|
30
30
|
mcpTools: boolean;
|
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":"AAIA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,UAAU,EAAa,MAAM,eAAe,CAAC;AACtD,OAAO,OAAO,EAAE,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAEL,qBAAqB,EAErB,uBAAuB,EACvB,2BAA2B,EA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,UAAU,CACxB,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,IAAI,CAAC;cAOA,aAAa,CAC3B,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAClC,OAAO,CAAC,IAAI,CAAC;cAMA,iBAAiB,CAC/B,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC;cAaA,kBAAkB,CAChC,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;cAgBA,gBAAgB,CAC9B,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC;cAIA,mBAAmB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC;QACvE,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,YAAY,GAAG,WAAW,CAAC;QACtC,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IAqCF,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAInD,OAAO,CAAC,cAAc;cA4RN,cAAc,CAC5B,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC,IAAI,CAAC;CA6BjB"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -12840,12 +12840,19 @@ class RetryLanguageModel {
|
|
|
12840
12840
|
continue;
|
|
12841
12841
|
}
|
|
12842
12842
|
try {
|
|
12843
|
-
const
|
|
12843
|
+
const controller = new AbortController();
|
|
12844
|
+
const signal = options.abortSignal
|
|
12845
|
+
? AbortSignal.any([options.abortSignal, controller.signal])
|
|
12846
|
+
: controller.signal;
|
|
12847
|
+
const result = await call_timeout(async () => await llm.doStream({ ...options, abortSignal: signal }), this.stream_first_timeout, (e) => {
|
|
12848
|
+
controller.abort();
|
|
12849
|
+
});
|
|
12844
12850
|
const stream = result.stream;
|
|
12845
12851
|
const reader = stream.getReader();
|
|
12846
12852
|
const { done, value } = await call_timeout(async () => await reader.read(), this.stream_first_timeout, (e) => {
|
|
12847
12853
|
reader.cancel();
|
|
12848
12854
|
reader.releaseLock();
|
|
12855
|
+
controller.abort();
|
|
12849
12856
|
});
|
|
12850
12857
|
if (done) {
|
|
12851
12858
|
Log.warn(`LLM stream done, name: ${name} => `, { done, value });
|
|
@@ -15681,93 +15688,57 @@ request_help: Request assistance from the user; for instance, when an operation
|
|
|
15681
15688
|
description: "The type of interaction with users.",
|
|
15682
15689
|
enum: ["confirm", "input", "select", "request_help"],
|
|
15683
15690
|
},
|
|
15684
|
-
|
|
15685
|
-
type: "
|
|
15686
|
-
|
|
15687
|
-
prompt: {
|
|
15688
|
-
type: "string",
|
|
15689
|
-
description: "Display prompts to users",
|
|
15690
|
-
},
|
|
15691
|
-
},
|
|
15692
|
-
required: ["prompt"],
|
|
15691
|
+
prompt: {
|
|
15692
|
+
type: "string",
|
|
15693
|
+
description: "Display prompts to users",
|
|
15693
15694
|
},
|
|
15694
|
-
|
|
15695
|
-
type: "
|
|
15696
|
-
|
|
15697
|
-
|
|
15698
|
-
|
|
15699
|
-
description: "Display prompts to users",
|
|
15700
|
-
},
|
|
15695
|
+
selectOptions: {
|
|
15696
|
+
type: "array",
|
|
15697
|
+
description: "Options provided to users, this parameter is required when interactType is select.",
|
|
15698
|
+
items: {
|
|
15699
|
+
type: "string",
|
|
15701
15700
|
},
|
|
15702
|
-
required: ["prompt"],
|
|
15703
15701
|
},
|
|
15704
|
-
|
|
15705
|
-
type: "
|
|
15706
|
-
|
|
15707
|
-
prompt: {
|
|
15708
|
-
type: "string",
|
|
15709
|
-
description: "Display prompts to users",
|
|
15710
|
-
},
|
|
15711
|
-
options: {
|
|
15712
|
-
type: "array",
|
|
15713
|
-
description: "Options provided to the user",
|
|
15714
|
-
items: {
|
|
15715
|
-
type: "string",
|
|
15716
|
-
},
|
|
15717
|
-
},
|
|
15718
|
-
multiple: {
|
|
15719
|
-
type: "boolean",
|
|
15720
|
-
},
|
|
15721
|
-
},
|
|
15722
|
-
required: ["prompt", "options"],
|
|
15702
|
+
selectMultiple: {
|
|
15703
|
+
type: "boolean",
|
|
15704
|
+
description: "isMultiple, used when interactType is select",
|
|
15723
15705
|
},
|
|
15724
|
-
|
|
15725
|
-
type: "
|
|
15726
|
-
|
|
15727
|
-
|
|
15728
|
-
type: "string",
|
|
15729
|
-
description: "Display prompts to users",
|
|
15730
|
-
enum: ["request_login", "request_assistance"],
|
|
15731
|
-
},
|
|
15732
|
-
prompt: {
|
|
15733
|
-
type: "string",
|
|
15734
|
-
description: "Display prompts to users",
|
|
15735
|
-
},
|
|
15736
|
-
},
|
|
15737
|
-
required: ["helpType", "prompt"],
|
|
15706
|
+
helpType: {
|
|
15707
|
+
type: "string",
|
|
15708
|
+
description: "Help type, required when interactType is request_help.",
|
|
15709
|
+
enum: ["request_login", "request_assistance"],
|
|
15738
15710
|
},
|
|
15739
15711
|
},
|
|
15740
|
-
required: ["interactType"],
|
|
15712
|
+
required: ["interactType", "prompt"],
|
|
15741
15713
|
};
|
|
15742
15714
|
}
|
|
15743
15715
|
async execute(args, agentContext) {
|
|
15744
15716
|
let interactType = args.interactType;
|
|
15745
|
-
let interact = args[interactType];
|
|
15746
15717
|
let callback = agentContext.context.config.callback;
|
|
15747
15718
|
let resultText = "";
|
|
15748
15719
|
if (callback) {
|
|
15749
15720
|
switch (interactType) {
|
|
15750
15721
|
case "confirm":
|
|
15751
15722
|
if (callback.onHumanConfirm) {
|
|
15752
|
-
let result = await callback.onHumanConfirm(agentContext,
|
|
15723
|
+
let result = await callback.onHumanConfirm(agentContext, args.prompt);
|
|
15753
15724
|
resultText = `confirm result: ${result ? "Yes" : "No"}`;
|
|
15754
15725
|
}
|
|
15755
15726
|
break;
|
|
15756
15727
|
case "input":
|
|
15757
15728
|
if (callback.onHumanInput) {
|
|
15758
|
-
let result = await callback.onHumanInput(agentContext,
|
|
15729
|
+
let result = await callback.onHumanInput(agentContext, args.prompt);
|
|
15759
15730
|
resultText = `input result: ${result}`;
|
|
15760
15731
|
}
|
|
15761
15732
|
break;
|
|
15762
15733
|
case "select":
|
|
15763
15734
|
if (callback.onHumanSelect) {
|
|
15764
|
-
let result = await callback.onHumanSelect(agentContext,
|
|
15735
|
+
let result = await callback.onHumanSelect(agentContext, args.prompt, (args.selectOptions || []), (args.selectMultiple || false));
|
|
15765
15736
|
resultText = `select result: ${JSON.stringify(result)}`;
|
|
15766
15737
|
}
|
|
15767
15738
|
break;
|
|
15768
15739
|
case "request_help":
|
|
15769
15740
|
if (callback.onHumanHelp) {
|
|
15770
|
-
let result = await callback.onHumanHelp(agentContext,
|
|
15741
|
+
let result = await callback.onHumanHelp(agentContext, (args.helpType || "request_assistance"), args.prompt);
|
|
15771
15742
|
resultText = `request_help result: ${result ? "Solved" : "Unresolved"}`;
|
|
15772
15743
|
}
|
|
15773
15744
|
break;
|
|
@@ -15980,9 +15951,10 @@ UTC datetime: {datetime}
|
|
|
15980
15951
|
</root>
|
|
15981
15952
|
`;
|
|
15982
15953
|
const HUMAN_PROMPT = `
|
|
15983
|
-
During the task execution process, you can use the \`${TOOL_NAME$3}\` tool to interact with humans
|
|
15954
|
+
During the task execution process, you can use the \`${TOOL_NAME$3}\` tool to interact with humans, please call it in the following situations:
|
|
15984
15955
|
- When performing dangerous operations such as deleting files, confirmation from humans is required
|
|
15985
15956
|
- When encountering obstacles while accessing websites, such as requiring user login, you need to request human assistance
|
|
15957
|
+
- Try not to use the \`${TOOL_NAME$3}\` tool
|
|
15986
15958
|
`;
|
|
15987
15959
|
const VARIABLE_PROMPT = `
|
|
15988
15960
|
If you need to read and write the input/output variables in the node, require the use of the \`${TOOL_NAME$1}\` tool.
|
|
@@ -16009,14 +15981,16 @@ const WATCH_NODE = `
|
|
|
16009
15981
|
const WATCH_PROMPT = `
|
|
16010
15982
|
\`watch\`: monitor changes in webpage DOM or file content, when executing to the watch node, require the use of the \`${TOOL_NAME}\` tool.
|
|
16011
15983
|
`;
|
|
16012
|
-
function getAgentSystemPrompt(agent, agentNode, context, systemPrompt) {
|
|
15984
|
+
function getAgentSystemPrompt(agent, agentNode, context, tools, systemPrompt) {
|
|
16013
15985
|
let prompt = "";
|
|
16014
15986
|
let nodePrompt = "";
|
|
16015
15987
|
let agentNodeXml = agentNode.xml;
|
|
16016
|
-
let hasForEach = agentNodeXml.indexOf("</forEach>") > -1;
|
|
16017
15988
|
let hasWatch = agentNodeXml.indexOf("</watch>") > -1;
|
|
16018
|
-
let
|
|
16019
|
-
let hasHumanTool = agent.Tools.filter((tool) => tool.name == TOOL_NAME$3).length > 0;
|
|
15989
|
+
let hasForEach = agentNodeXml.indexOf("</forEach>") > -1;
|
|
15990
|
+
let hasHumanTool = (tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$3).length > 0;
|
|
15991
|
+
let hasVariable = agentNodeXml.indexOf("input=") > -1 ||
|
|
15992
|
+
agentNodeXml.indexOf("output=") > -1 ||
|
|
15993
|
+
(tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$1).length > 0;
|
|
16020
15994
|
if (hasHumanTool) {
|
|
16021
15995
|
prompt += HUMAN_PROMPT;
|
|
16022
15996
|
}
|
|
@@ -16040,8 +16014,9 @@ function getAgentSystemPrompt(agent, agentNode, context, systemPrompt) {
|
|
|
16040
16014
|
.replace("{nodePrompt}", nodePrompt)
|
|
16041
16015
|
.trim();
|
|
16042
16016
|
}
|
|
16043
|
-
function getAgentUserPrompt(agent, agentNode, context) {
|
|
16044
|
-
let hasTaskNodeStatusTool = agent.Tools.filter((tool) => tool.name == TOOL_NAME$2)
|
|
16017
|
+
function getAgentUserPrompt(agent, agentNode, context, tools) {
|
|
16018
|
+
let hasTaskNodeStatusTool = (tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$2)
|
|
16019
|
+
.length > 0;
|
|
16045
16020
|
return buildAgentRootXml(agentNode.xml, context.chain.taskPrompt, (nodeId, node) => {
|
|
16046
16021
|
if (hasTaskNodeStatusTool) {
|
|
16047
16022
|
node.setAttribute("status", "todo");
|
|
@@ -16074,9 +16049,10 @@ class Agent {
|
|
|
16074
16049
|
let loopNum = 0;
|
|
16075
16050
|
let context = agentContext.context;
|
|
16076
16051
|
let agentNode = agentContext.agentChain.agent;
|
|
16077
|
-
|
|
16052
|
+
const tools = [...this.tools, ...this.system_auto_tools(agentNode)];
|
|
16053
|
+
let messages = this.initMessages(agentContext, tools);
|
|
16078
16054
|
let rlm = new RetryLanguageModel(context.config.llms, this.llms);
|
|
16079
|
-
let agentTools =
|
|
16055
|
+
let agentTools = tools;
|
|
16080
16056
|
while (loopNum < maxReactNum) {
|
|
16081
16057
|
context.checkAborted();
|
|
16082
16058
|
if (mcpClient) {
|
|
@@ -16084,7 +16060,7 @@ class Agent {
|
|
|
16084
16060
|
if (controlMcp.mcpTools) {
|
|
16085
16061
|
let mcpTools = await this.listTools(agentNode, context, mcpClient, controlMcp.mcpParams);
|
|
16086
16062
|
let usedTools = this.extractUsedTool(messages, agentTools);
|
|
16087
|
-
let _agentTools = mergeTools(
|
|
16063
|
+
let _agentTools = mergeTools(tools, usedTools);
|
|
16088
16064
|
agentTools = mergeTools(_agentTools, mcpTools);
|
|
16089
16065
|
}
|
|
16090
16066
|
}
|
|
@@ -16176,8 +16152,8 @@ class Agent {
|
|
|
16176
16152
|
system_auto_tools(agentNode) {
|
|
16177
16153
|
let tools = [];
|
|
16178
16154
|
let agentNodeXml = agentNode.xml;
|
|
16179
|
-
let hasVariable = agentNodeXml.indexOf("
|
|
16180
|
-
agentNodeXml.indexOf("
|
|
16155
|
+
let hasVariable = agentNodeXml.indexOf("input=") > -1 ||
|
|
16156
|
+
agentNodeXml.indexOf("output=") > -1;
|
|
16181
16157
|
if (hasVariable) {
|
|
16182
16158
|
tools.push(new VariableStorageTool());
|
|
16183
16159
|
}
|
|
@@ -16206,18 +16182,18 @@ class Agent {
|
|
|
16206
16182
|
}
|
|
16207
16183
|
return _results;
|
|
16208
16184
|
}
|
|
16209
|
-
initMessages(agentContext) {
|
|
16185
|
+
initMessages(agentContext, tools) {
|
|
16210
16186
|
let messages = [
|
|
16211
16187
|
{
|
|
16212
16188
|
role: "system",
|
|
16213
|
-
content: getAgentSystemPrompt(this, agentContext.agentChain.agent, agentContext.context),
|
|
16189
|
+
content: getAgentSystemPrompt(this, agentContext.agentChain.agent, agentContext.context, tools),
|
|
16214
16190
|
},
|
|
16215
16191
|
{
|
|
16216
16192
|
role: "user",
|
|
16217
16193
|
content: [
|
|
16218
16194
|
{
|
|
16219
16195
|
type: "text",
|
|
16220
|
-
text: getAgentUserPrompt(this, agentContext.agentChain.agent, agentContext.context),
|
|
16196
|
+
text: getAgentUserPrompt(this, agentContext.agentChain.agent, agentContext.context, tools),
|
|
16221
16197
|
},
|
|
16222
16198
|
],
|
|
16223
16199
|
},
|
|
@@ -17287,7 +17263,7 @@ class BaseFileAgent extends Agent {
|
|
|
17287
17263
|
tools: _tools_,
|
|
17288
17264
|
llms: llms,
|
|
17289
17265
|
mcpClient: mcpClient,
|
|
17290
|
-
planDescription: "File operation agent, handling file-related tasks such as creating, finding, reading, modifying files, etc.",
|
|
17266
|
+
planDescription: "File operation agent, handling file-related tasks such as creating, finding, reading, modifying files, etc, only text file writing is supported.",
|
|
17291
17267
|
});
|
|
17292
17268
|
let init_tools = this.buildInitTools();
|
|
17293
17269
|
if (ext_tools && ext_tools.length > 0) {
|
|
@@ -17333,7 +17309,7 @@ class BaseFileAgent extends Agent {
|
|
|
17333
17309
|
},
|
|
17334
17310
|
{
|
|
17335
17311
|
name: "file_write",
|
|
17336
|
-
description: "Overwrite or append content to a file. Use for creating new files, appending content, or modifying existing files.",
|
|
17312
|
+
description: "Overwrite or append content to a file. Use for creating new files, appending content, or modifying existing files, only supports txt/md/csv or other text formats.",
|
|
17337
17313
|
parameters: {
|
|
17338
17314
|
type: "object",
|
|
17339
17315
|
properties: {
|
|
@@ -18533,7 +18509,11 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
18533
18509
|
}
|
|
18534
18510
|
async scroll_mouse_wheel(agentContext, amount) {
|
|
18535
18511
|
await this.execute_script(agentContext, (amount) => {
|
|
18536
|
-
window.
|
|
18512
|
+
let viewportHeight = window.innerHeight ||
|
|
18513
|
+
document.documentElement.clientHeight ||
|
|
18514
|
+
document.body.clientHeight;
|
|
18515
|
+
let y = Math.max(20, Math.min(viewportHeight / 10, 200));
|
|
18516
|
+
window.scrollBy(0, y * amount);
|
|
18537
18517
|
}, [amount]);
|
|
18538
18518
|
await sleep(200);
|
|
18539
18519
|
}
|
|
@@ -18789,7 +18769,9 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
18789
18769
|
}
|
|
18790
18770
|
async handleMessages(agentContext, messages) {
|
|
18791
18771
|
let lastTool = this.lastToolResult(messages);
|
|
18792
|
-
if (lastTool &&
|
|
18772
|
+
if (lastTool &&
|
|
18773
|
+
lastTool.toolName !== "extract_content" &&
|
|
18774
|
+
lastTool.toolName !== "get_all_tabs") {
|
|
18793
18775
|
await sleep(200);
|
|
18794
18776
|
let result = await this.screenshot_and_html(agentContext);
|
|
18795
18777
|
let image = toImage(result.imageBase64);
|
package/dist/index.esm.js
CHANGED
|
@@ -12805,12 +12805,19 @@ class RetryLanguageModel {
|
|
|
12805
12805
|
continue;
|
|
12806
12806
|
}
|
|
12807
12807
|
try {
|
|
12808
|
-
const
|
|
12808
|
+
const controller = new AbortController();
|
|
12809
|
+
const signal = options.abortSignal
|
|
12810
|
+
? AbortSignal.any([options.abortSignal, controller.signal])
|
|
12811
|
+
: controller.signal;
|
|
12812
|
+
const result = await call_timeout(async () => await llm.doStream({ ...options, abortSignal: signal }), this.stream_first_timeout, (e) => {
|
|
12813
|
+
controller.abort();
|
|
12814
|
+
});
|
|
12809
12815
|
const stream = result.stream;
|
|
12810
12816
|
const reader = stream.getReader();
|
|
12811
12817
|
const { done, value } = await call_timeout(async () => await reader.read(), this.stream_first_timeout, (e) => {
|
|
12812
12818
|
reader.cancel();
|
|
12813
12819
|
reader.releaseLock();
|
|
12820
|
+
controller.abort();
|
|
12814
12821
|
});
|
|
12815
12822
|
if (done) {
|
|
12816
12823
|
Log.warn(`LLM stream done, name: ${name} => `, { done, value });
|
|
@@ -15646,93 +15653,57 @@ request_help: Request assistance from the user; for instance, when an operation
|
|
|
15646
15653
|
description: "The type of interaction with users.",
|
|
15647
15654
|
enum: ["confirm", "input", "select", "request_help"],
|
|
15648
15655
|
},
|
|
15649
|
-
|
|
15650
|
-
type: "
|
|
15651
|
-
|
|
15652
|
-
prompt: {
|
|
15653
|
-
type: "string",
|
|
15654
|
-
description: "Display prompts to users",
|
|
15655
|
-
},
|
|
15656
|
-
},
|
|
15657
|
-
required: ["prompt"],
|
|
15656
|
+
prompt: {
|
|
15657
|
+
type: "string",
|
|
15658
|
+
description: "Display prompts to users",
|
|
15658
15659
|
},
|
|
15659
|
-
|
|
15660
|
-
type: "
|
|
15661
|
-
|
|
15662
|
-
|
|
15663
|
-
|
|
15664
|
-
description: "Display prompts to users",
|
|
15665
|
-
},
|
|
15660
|
+
selectOptions: {
|
|
15661
|
+
type: "array",
|
|
15662
|
+
description: "Options provided to users, this parameter is required when interactType is select.",
|
|
15663
|
+
items: {
|
|
15664
|
+
type: "string",
|
|
15666
15665
|
},
|
|
15667
|
-
required: ["prompt"],
|
|
15668
15666
|
},
|
|
15669
|
-
|
|
15670
|
-
type: "
|
|
15671
|
-
|
|
15672
|
-
prompt: {
|
|
15673
|
-
type: "string",
|
|
15674
|
-
description: "Display prompts to users",
|
|
15675
|
-
},
|
|
15676
|
-
options: {
|
|
15677
|
-
type: "array",
|
|
15678
|
-
description: "Options provided to the user",
|
|
15679
|
-
items: {
|
|
15680
|
-
type: "string",
|
|
15681
|
-
},
|
|
15682
|
-
},
|
|
15683
|
-
multiple: {
|
|
15684
|
-
type: "boolean",
|
|
15685
|
-
},
|
|
15686
|
-
},
|
|
15687
|
-
required: ["prompt", "options"],
|
|
15667
|
+
selectMultiple: {
|
|
15668
|
+
type: "boolean",
|
|
15669
|
+
description: "isMultiple, used when interactType is select",
|
|
15688
15670
|
},
|
|
15689
|
-
|
|
15690
|
-
type: "
|
|
15691
|
-
|
|
15692
|
-
|
|
15693
|
-
type: "string",
|
|
15694
|
-
description: "Display prompts to users",
|
|
15695
|
-
enum: ["request_login", "request_assistance"],
|
|
15696
|
-
},
|
|
15697
|
-
prompt: {
|
|
15698
|
-
type: "string",
|
|
15699
|
-
description: "Display prompts to users",
|
|
15700
|
-
},
|
|
15701
|
-
},
|
|
15702
|
-
required: ["helpType", "prompt"],
|
|
15671
|
+
helpType: {
|
|
15672
|
+
type: "string",
|
|
15673
|
+
description: "Help type, required when interactType is request_help.",
|
|
15674
|
+
enum: ["request_login", "request_assistance"],
|
|
15703
15675
|
},
|
|
15704
15676
|
},
|
|
15705
|
-
required: ["interactType"],
|
|
15677
|
+
required: ["interactType", "prompt"],
|
|
15706
15678
|
};
|
|
15707
15679
|
}
|
|
15708
15680
|
async execute(args, agentContext) {
|
|
15709
15681
|
let interactType = args.interactType;
|
|
15710
|
-
let interact = args[interactType];
|
|
15711
15682
|
let callback = agentContext.context.config.callback;
|
|
15712
15683
|
let resultText = "";
|
|
15713
15684
|
if (callback) {
|
|
15714
15685
|
switch (interactType) {
|
|
15715
15686
|
case "confirm":
|
|
15716
15687
|
if (callback.onHumanConfirm) {
|
|
15717
|
-
let result = await callback.onHumanConfirm(agentContext,
|
|
15688
|
+
let result = await callback.onHumanConfirm(agentContext, args.prompt);
|
|
15718
15689
|
resultText = `confirm result: ${result ? "Yes" : "No"}`;
|
|
15719
15690
|
}
|
|
15720
15691
|
break;
|
|
15721
15692
|
case "input":
|
|
15722
15693
|
if (callback.onHumanInput) {
|
|
15723
|
-
let result = await callback.onHumanInput(agentContext,
|
|
15694
|
+
let result = await callback.onHumanInput(agentContext, args.prompt);
|
|
15724
15695
|
resultText = `input result: ${result}`;
|
|
15725
15696
|
}
|
|
15726
15697
|
break;
|
|
15727
15698
|
case "select":
|
|
15728
15699
|
if (callback.onHumanSelect) {
|
|
15729
|
-
let result = await callback.onHumanSelect(agentContext,
|
|
15700
|
+
let result = await callback.onHumanSelect(agentContext, args.prompt, (args.selectOptions || []), (args.selectMultiple || false));
|
|
15730
15701
|
resultText = `select result: ${JSON.stringify(result)}`;
|
|
15731
15702
|
}
|
|
15732
15703
|
break;
|
|
15733
15704
|
case "request_help":
|
|
15734
15705
|
if (callback.onHumanHelp) {
|
|
15735
|
-
let result = await callback.onHumanHelp(agentContext,
|
|
15706
|
+
let result = await callback.onHumanHelp(agentContext, (args.helpType || "request_assistance"), args.prompt);
|
|
15736
15707
|
resultText = `request_help result: ${result ? "Solved" : "Unresolved"}`;
|
|
15737
15708
|
}
|
|
15738
15709
|
break;
|
|
@@ -15945,9 +15916,10 @@ UTC datetime: {datetime}
|
|
|
15945
15916
|
</root>
|
|
15946
15917
|
`;
|
|
15947
15918
|
const HUMAN_PROMPT = `
|
|
15948
|
-
During the task execution process, you can use the \`${TOOL_NAME$3}\` tool to interact with humans
|
|
15919
|
+
During the task execution process, you can use the \`${TOOL_NAME$3}\` tool to interact with humans, please call it in the following situations:
|
|
15949
15920
|
- When performing dangerous operations such as deleting files, confirmation from humans is required
|
|
15950
15921
|
- When encountering obstacles while accessing websites, such as requiring user login, you need to request human assistance
|
|
15922
|
+
- Try not to use the \`${TOOL_NAME$3}\` tool
|
|
15951
15923
|
`;
|
|
15952
15924
|
const VARIABLE_PROMPT = `
|
|
15953
15925
|
If you need to read and write the input/output variables in the node, require the use of the \`${TOOL_NAME$1}\` tool.
|
|
@@ -15974,14 +15946,16 @@ const WATCH_NODE = `
|
|
|
15974
15946
|
const WATCH_PROMPT = `
|
|
15975
15947
|
\`watch\`: monitor changes in webpage DOM or file content, when executing to the watch node, require the use of the \`${TOOL_NAME}\` tool.
|
|
15976
15948
|
`;
|
|
15977
|
-
function getAgentSystemPrompt(agent, agentNode, context, systemPrompt) {
|
|
15949
|
+
function getAgentSystemPrompt(agent, agentNode, context, tools, systemPrompt) {
|
|
15978
15950
|
let prompt = "";
|
|
15979
15951
|
let nodePrompt = "";
|
|
15980
15952
|
let agentNodeXml = agentNode.xml;
|
|
15981
|
-
let hasForEach = agentNodeXml.indexOf("</forEach>") > -1;
|
|
15982
15953
|
let hasWatch = agentNodeXml.indexOf("</watch>") > -1;
|
|
15983
|
-
let
|
|
15984
|
-
let hasHumanTool = agent.Tools.filter((tool) => tool.name == TOOL_NAME$3).length > 0;
|
|
15954
|
+
let hasForEach = agentNodeXml.indexOf("</forEach>") > -1;
|
|
15955
|
+
let hasHumanTool = (tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$3).length > 0;
|
|
15956
|
+
let hasVariable = agentNodeXml.indexOf("input=") > -1 ||
|
|
15957
|
+
agentNodeXml.indexOf("output=") > -1 ||
|
|
15958
|
+
(tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$1).length > 0;
|
|
15985
15959
|
if (hasHumanTool) {
|
|
15986
15960
|
prompt += HUMAN_PROMPT;
|
|
15987
15961
|
}
|
|
@@ -16005,8 +15979,9 @@ function getAgentSystemPrompt(agent, agentNode, context, systemPrompt) {
|
|
|
16005
15979
|
.replace("{nodePrompt}", nodePrompt)
|
|
16006
15980
|
.trim();
|
|
16007
15981
|
}
|
|
16008
|
-
function getAgentUserPrompt(agent, agentNode, context) {
|
|
16009
|
-
let hasTaskNodeStatusTool = agent.Tools.filter((tool) => tool.name == TOOL_NAME$2)
|
|
15982
|
+
function getAgentUserPrompt(agent, agentNode, context, tools) {
|
|
15983
|
+
let hasTaskNodeStatusTool = (tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$2)
|
|
15984
|
+
.length > 0;
|
|
16010
15985
|
return buildAgentRootXml(agentNode.xml, context.chain.taskPrompt, (nodeId, node) => {
|
|
16011
15986
|
if (hasTaskNodeStatusTool) {
|
|
16012
15987
|
node.setAttribute("status", "todo");
|
|
@@ -16039,9 +16014,10 @@ class Agent {
|
|
|
16039
16014
|
let loopNum = 0;
|
|
16040
16015
|
let context = agentContext.context;
|
|
16041
16016
|
let agentNode = agentContext.agentChain.agent;
|
|
16042
|
-
|
|
16017
|
+
const tools = [...this.tools, ...this.system_auto_tools(agentNode)];
|
|
16018
|
+
let messages = this.initMessages(agentContext, tools);
|
|
16043
16019
|
let rlm = new RetryLanguageModel(context.config.llms, this.llms);
|
|
16044
|
-
let agentTools =
|
|
16020
|
+
let agentTools = tools;
|
|
16045
16021
|
while (loopNum < maxReactNum) {
|
|
16046
16022
|
context.checkAborted();
|
|
16047
16023
|
if (mcpClient) {
|
|
@@ -16049,7 +16025,7 @@ class Agent {
|
|
|
16049
16025
|
if (controlMcp.mcpTools) {
|
|
16050
16026
|
let mcpTools = await this.listTools(agentNode, context, mcpClient, controlMcp.mcpParams);
|
|
16051
16027
|
let usedTools = this.extractUsedTool(messages, agentTools);
|
|
16052
|
-
let _agentTools = mergeTools(
|
|
16028
|
+
let _agentTools = mergeTools(tools, usedTools);
|
|
16053
16029
|
agentTools = mergeTools(_agentTools, mcpTools);
|
|
16054
16030
|
}
|
|
16055
16031
|
}
|
|
@@ -16141,8 +16117,8 @@ class Agent {
|
|
|
16141
16117
|
system_auto_tools(agentNode) {
|
|
16142
16118
|
let tools = [];
|
|
16143
16119
|
let agentNodeXml = agentNode.xml;
|
|
16144
|
-
let hasVariable = agentNodeXml.indexOf("
|
|
16145
|
-
agentNodeXml.indexOf("
|
|
16120
|
+
let hasVariable = agentNodeXml.indexOf("input=") > -1 ||
|
|
16121
|
+
agentNodeXml.indexOf("output=") > -1;
|
|
16146
16122
|
if (hasVariable) {
|
|
16147
16123
|
tools.push(new VariableStorageTool());
|
|
16148
16124
|
}
|
|
@@ -16171,18 +16147,18 @@ class Agent {
|
|
|
16171
16147
|
}
|
|
16172
16148
|
return _results;
|
|
16173
16149
|
}
|
|
16174
|
-
initMessages(agentContext) {
|
|
16150
|
+
initMessages(agentContext, tools) {
|
|
16175
16151
|
let messages = [
|
|
16176
16152
|
{
|
|
16177
16153
|
role: "system",
|
|
16178
|
-
content: getAgentSystemPrompt(this, agentContext.agentChain.agent, agentContext.context),
|
|
16154
|
+
content: getAgentSystemPrompt(this, agentContext.agentChain.agent, agentContext.context, tools),
|
|
16179
16155
|
},
|
|
16180
16156
|
{
|
|
16181
16157
|
role: "user",
|
|
16182
16158
|
content: [
|
|
16183
16159
|
{
|
|
16184
16160
|
type: "text",
|
|
16185
|
-
text: getAgentUserPrompt(this, agentContext.agentChain.agent, agentContext.context),
|
|
16161
|
+
text: getAgentUserPrompt(this, agentContext.agentChain.agent, agentContext.context, tools),
|
|
16186
16162
|
},
|
|
16187
16163
|
],
|
|
16188
16164
|
},
|
|
@@ -17252,7 +17228,7 @@ class BaseFileAgent extends Agent {
|
|
|
17252
17228
|
tools: _tools_,
|
|
17253
17229
|
llms: llms,
|
|
17254
17230
|
mcpClient: mcpClient,
|
|
17255
|
-
planDescription: "File operation agent, handling file-related tasks such as creating, finding, reading, modifying files, etc.",
|
|
17231
|
+
planDescription: "File operation agent, handling file-related tasks such as creating, finding, reading, modifying files, etc, only text file writing is supported.",
|
|
17256
17232
|
});
|
|
17257
17233
|
let init_tools = this.buildInitTools();
|
|
17258
17234
|
if (ext_tools && ext_tools.length > 0) {
|
|
@@ -17298,7 +17274,7 @@ class BaseFileAgent extends Agent {
|
|
|
17298
17274
|
},
|
|
17299
17275
|
{
|
|
17300
17276
|
name: "file_write",
|
|
17301
|
-
description: "Overwrite or append content to a file. Use for creating new files, appending content, or modifying existing files.",
|
|
17277
|
+
description: "Overwrite or append content to a file. Use for creating new files, appending content, or modifying existing files, only supports txt/md/csv or other text formats.",
|
|
17302
17278
|
parameters: {
|
|
17303
17279
|
type: "object",
|
|
17304
17280
|
properties: {
|
|
@@ -18498,7 +18474,11 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
18498
18474
|
}
|
|
18499
18475
|
async scroll_mouse_wheel(agentContext, amount) {
|
|
18500
18476
|
await this.execute_script(agentContext, (amount) => {
|
|
18501
|
-
window.
|
|
18477
|
+
let viewportHeight = window.innerHeight ||
|
|
18478
|
+
document.documentElement.clientHeight ||
|
|
18479
|
+
document.body.clientHeight;
|
|
18480
|
+
let y = Math.max(20, Math.min(viewportHeight / 10, 200));
|
|
18481
|
+
window.scrollBy(0, y * amount);
|
|
18502
18482
|
}, [amount]);
|
|
18503
18483
|
await sleep(200);
|
|
18504
18484
|
}
|
|
@@ -18754,7 +18734,9 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
18754
18734
|
}
|
|
18755
18735
|
async handleMessages(agentContext, messages) {
|
|
18756
18736
|
let lastTool = this.lastToolResult(messages);
|
|
18757
|
-
if (lastTool &&
|
|
18737
|
+
if (lastTool &&
|
|
18738
|
+
lastTool.toolName !== "extract_content" &&
|
|
18739
|
+
lastTool.toolName !== "get_all_tabs") {
|
|
18758
18740
|
await sleep(200);
|
|
18759
18741
|
let result = await this.screenshot_and_html(agentContext);
|
|
18760
18742
|
let image = toImage(result.imageBase64);
|
package/dist/llm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/llm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,0BAA0B,EAE3B,MAAM,kBAAkB,CAAC;AAQ1B,OAAO,EACL,cAAc,EACd,UAAU,EACV,IAAI,EACJ,YAAY,EACb,MAAM,oBAAoB,CAAC;AAE5B,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,IAAI,CAAO;IACnB,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,oBAAoB,CAAS;gBAEzB,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,oBAAoB,CAAC,EAAE,MAAM;IASjE,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC;IAkBlD,UAAU,CACd,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,cAAc,CAAC;IAgCpB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;IAkBtD,QAAQ,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/llm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,0BAA0B,EAE3B,MAAM,kBAAkB,CAAC;AAQ1B,OAAO,EACL,cAAc,EACd,UAAU,EACV,IAAI,EACJ,YAAY,EACb,MAAM,oBAAoB,CAAC;AAE5B,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,IAAI,CAAO;IACnB,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,oBAAoB,CAAS;gBAEzB,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,oBAAoB,CAAC,EAAE,MAAM;IASjE,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC;IAkBlD,UAAU,CACd,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,cAAc,CAAC;IAgCpB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;IAkBtD,QAAQ,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,YAAY,CAAC;IA8D1E,OAAO,CAAC,MAAM;IAoCd,OAAO,CAAC,aAAa;CA0BtB"}
|
package/dist/prompt/agent.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Agent } from "../agent";
|
|
2
2
|
import Context from "../core/context";
|
|
3
3
|
import { WorkflowAgent } from "../types/core.types";
|
|
4
|
-
|
|
5
|
-
export declare function
|
|
4
|
+
import { Tool } from "../types";
|
|
5
|
+
export declare function getAgentSystemPrompt(agent: Agent, agentNode: WorkflowAgent, context: Context, tools?: Tool[], systemPrompt?: string): string;
|
|
6
|
+
export declare function getAgentUserPrompt(agent: Agent, agentNode: WorkflowAgent, context: Context, tools?: Tool[]): string;
|
|
6
7
|
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/prompt/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,OAAO,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/prompt/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,OAAO,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMpD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AA6DhC,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,OAAO,EAChB,KAAK,CAAC,EAAE,IAAI,EAAE,EACd,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAkCR;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,OAAO,EAChB,KAAK,CAAC,EAAE,IAAI,EAAE,GACb,MAAM,CAaR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"human_interact.d.ts","sourceRoot":"","sources":["../../src/tools/human_interact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAExD,eAAO,MAAM,SAAS,mBAAmB,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,iBAAkB,YAAW,IAAI;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAa;IAClC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;;
|
|
1
|
+
{"version":3,"file":"human_interact.d.ts","sourceRoot":"","sources":["../../src/tools/human_interact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAExD,eAAO,MAAM,SAAS,mBAAmB,CAAC;AAE1C,MAAM,CAAC,OAAO,OAAO,iBAAkB,YAAW,IAAI;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAa;IAClC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;;IA4C3B,OAAO,CACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,UAAU,CAAC;CAsEvB"}
|