@eko-ai/eko 2.0.2-alpha.5 → 2.0.2-alpha.7

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.
@@ -24,7 +24,8 @@ 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
+ protected extSysPrompt(): string;
28
29
  private listTools;
29
30
  protected controlMcpTools(agentContext: AgentContext, messages: LanguageModelV1Prompt, loopNum: number): Promise<{
30
31
  mcpTools: boolean;
@@ -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,EAC3B,6BAA6B,EAC9B,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,UAAU,EAEX,MAAM,sBAAsB,CAAC;AAE9B,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,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;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,CAAC,CAAC;KACrC,CAAC;IAMF,SAAS,CAAC,YAAY,CAAC,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY;IAiBzE,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,OAAO;IASf,OAAO,CAAC,eAAe;IAyBvB,SAAS,CAAC,iBAAiB,CACzB,OAAO,EAAE,2BAA2B,EACpC,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,qBAAqB,GACnC,6BAA6B;cAwDhB,cAAc,CAC5B,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC,IAAI,CAAC;YAsDF,OAAO;cAqKL,aAAa,CAAC,GAAG,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;IAgB3E,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,IAAI,KAAK,IAAI,IAAI,EAAE,CAElB;IAED,IAAI,eAAe,uBAElB;IAED,IAAI,SAAS,2BAEZ;CACF"}
@@ -22,7 +22,7 @@ export default abstract class BaseBrowserAgent extends Agent {
22
22
  title: string;
23
23
  }>;
24
24
  protected go_back(agentContext: AgentContext): Promise<void>;
25
- protected extract_content(agentContext: AgentContext): Promise<string>;
25
+ protected extract_content(agentContext: AgentContext, variable_name?: string): Promise<string>;
26
26
  protected controlMcpTools(agentContext: AgentContext, messages: LanguageModelV1Prompt, loopNum: number): Promise<{
27
27
  mcpTools: boolean;
28
28
  mcpParams?: Record<string, unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"browser_base.d.ts","sourceRoot":"","sources":["../../../src/agent/browser/browser_base.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAEtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACl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I,CAAC;IAEhB,SAAS,CAAC,QAAQ,CAAC,KAAK,CACtB,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,WAAW,GAAG,QAAQ,GACtD,OAAO,CAAC,IAAI,CAAC;IAEhB,SAAS,CAAC,QAAQ,CAAC,aAAa,CAC9B,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC;IAEhB,OAAO,CAAC,cAAc;cAsUN,cAAc,CAC5B,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC,IAAI,CAAC;CA4BjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"build_dom_tree.d.ts","sourceRoot":"","sources":["../../../src/agent/browser/build_dom_tree.ts"],"names":[],"mappings":"AACA,wBAAgB,kBAAkB,SAupBjC"}
1
+ {"version":3,"file":"build_dom_tree.d.ts","sourceRoot":"","sources":["../../../src/agent/browser/build_dom_tree.ts"],"names":[],"mappings":"AACA,wBAAgB,kBAAkB,SA2pBjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"computer.d.ts","sourceRoot":"","sources":["../../src/agent/computer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAc,UAAU,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,eAAO,MAAM,UAAU,aAAa,CAAC;AAErC,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,iBAAkB,SAAQ,KAAK;gBAE/C,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,SAAS,CAAC,EAAE,IAAI,EAAE,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,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC;IAEhB,SAAS,CAAC,QAAQ,CAAC,OAAO,CACxB,YAAY,EAAE,YAAY,EAC1B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR,OAAO,CAAC,IAAI,CAAC;IAEhB,SAAS,CAAC,QAAQ,CAAC,KAAK,CACtB,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC;IAEhB,SAAS,CAAC,QAAQ,CAAC,MAAM,CACvB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC;IAEhB,SAAS,CAAC,QAAQ,CAAC,aAAa,CAC9B,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC;IAEhB,OAAO,CAAC,cAAc;cAyON,cAAc,CAC5B,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC,IAAI,CAAC;CAuCjB"}
package/dist/index.cjs.js CHANGED
@@ -12840,12 +12840,19 @@ class RetryLanguageModel {
12840
12840
  continue;
12841
12841
  }
12842
12842
  try {
12843
- const result = await call_timeout(async () => await llm.doStream(options), this.stream_first_timeout);
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 });
@@ -15666,13 +15673,12 @@ const TOOL_NAME$3 = "human_interact";
15666
15673
  class HumanInteractTool {
15667
15674
  constructor() {
15668
15675
  this.name = TOOL_NAME$3;
15676
+ this.noPlan = true;
15669
15677
  this.description = `AI interacts with humans:
15670
15678
  confirm: Ask the user to confirm whether to execute an operation, especially when performing dangerous actions such as deleting system files.
15671
15679
  input: Prompt the user to enter text; for example, when a task is ambiguous, the AI can choose to ask the user for details, and the user can respond by inputting.
15672
15680
  select: Allow the user to make a choice; in situations that require selection, the AI can ask the user to make a decision.
15673
15681
  request_help: Request assistance from the user; for instance, when an operation is blocked, the AI can ask the user for help, such as needing to log into a website or solve a CAPTCHA.`;
15674
- this.planDescription =
15675
- "AI interacts with humans, when performing dangerous operations such as deleting files, you can request confirmation from humans";
15676
15682
  this.parameters = {
15677
15683
  type: "object",
15678
15684
  properties: {
@@ -15944,12 +15950,15 @@ UTC datetime: {datetime}
15944
15950
  </root>
15945
15951
  `;
15946
15952
  const HUMAN_PROMPT = `
15953
+ * HUMAN INTERACT
15947
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:
15948
15955
  - When performing dangerous operations such as deleting files, confirmation from humans is required
15949
15956
  - When encountering obstacles while accessing websites, such as requiring user login, you need to request human assistance
15957
+ - When requesting login, please only call the function when a login dialog box is clearly displayed.
15950
15958
  - Try not to use the \`${TOOL_NAME$3}\` tool
15951
15959
  `;
15952
15960
  const VARIABLE_PROMPT = `
15961
+ * VARIABLE STORAGE
15953
15962
  If you need to read and write the input/output variables in the node, require the use of the \`${TOOL_NAME$1}\` tool.
15954
15963
  `;
15955
15964
  const FOR_EACH_NODE = `
@@ -15974,14 +15983,16 @@ const WATCH_NODE = `
15974
15983
  const WATCH_PROMPT = `
15975
15984
  \`watch\`: monitor changes in webpage DOM or file content, when executing to the watch node, require the use of the \`${TOOL_NAME}\` tool.
15976
15985
  `;
15977
- function getAgentSystemPrompt(agent, agentNode, context, systemPrompt) {
15978
- let prompt = "";
15986
+ function getAgentSystemPrompt(agent, agentNode, context, tools, extSysPrompt) {
15987
+ let prompt = extSysPrompt || "";
15979
15988
  let nodePrompt = "";
15980
15989
  let agentNodeXml = agentNode.xml;
15981
- let hasForEach = agentNodeXml.indexOf("</forEach>") > -1;
15982
15990
  let hasWatch = agentNodeXml.indexOf("</watch>") > -1;
15983
- let hasVariable = agentNodeXml.indexOf(" input=") > -1 || agentNodeXml.indexOf(" output=") > -1;
15984
- let hasHumanTool = agent.Tools.filter((tool) => tool.name == TOOL_NAME$3).length > 0;
15991
+ let hasForEach = agentNodeXml.indexOf("</forEach>") > -1;
15992
+ let hasHumanTool = (tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$3).length > 0;
15993
+ let hasVariable = agentNodeXml.indexOf("input=") > -1 ||
15994
+ agentNodeXml.indexOf("output=") > -1 ||
15995
+ (tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$1).length > 0;
15985
15996
  if (hasHumanTool) {
15986
15997
  prompt += HUMAN_PROMPT;
15987
15998
  }
@@ -15996,7 +16007,7 @@ function getAgentSystemPrompt(agent, agentNode, context, systemPrompt) {
15996
16007
  prompt += WATCH_PROMPT;
15997
16008
  nodePrompt += WATCH_NODE;
15998
16009
  }
15999
- return (systemPrompt || AGENT_SYSTEM_TEMPLATE)
16010
+ return AGENT_SYSTEM_TEMPLATE
16000
16011
  .replace("{name}", config.name)
16001
16012
  .replace("{agent}", agent.Name)
16002
16013
  .replace("{description}", agent.Description)
@@ -16005,8 +16016,9 @@ function getAgentSystemPrompt(agent, agentNode, context, systemPrompt) {
16005
16016
  .replace("{nodePrompt}", nodePrompt)
16006
16017
  .trim();
16007
16018
  }
16008
- function getAgentUserPrompt(agent, agentNode, context) {
16009
- let hasTaskNodeStatusTool = agent.Tools.filter((tool) => tool.name == TOOL_NAME$2).length > 0;
16019
+ function getAgentUserPrompt(agent, agentNode, context, tools) {
16020
+ let hasTaskNodeStatusTool = (tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$2)
16021
+ .length > 0;
16010
16022
  return buildAgentRootXml(agentNode.xml, context.chain.taskPrompt, (nodeId, node) => {
16011
16023
  if (hasTaskNodeStatusTool) {
16012
16024
  node.setAttribute("status", "todo");
@@ -16039,9 +16051,10 @@ class Agent {
16039
16051
  let loopNum = 0;
16040
16052
  let context = agentContext.context;
16041
16053
  let agentNode = agentContext.agentChain.agent;
16042
- let messages = this.initMessages(agentContext);
16054
+ const tools = [...this.tools, ...this.system_auto_tools(agentNode)];
16055
+ let messages = this.initMessages(agentContext, tools);
16043
16056
  let rlm = new RetryLanguageModel(context.config.llms, this.llms);
16044
- let agentTools = [...this.tools, ...this.system_auto_tools(agentNode)];
16057
+ let agentTools = tools;
16045
16058
  while (loopNum < maxReactNum) {
16046
16059
  context.checkAborted();
16047
16060
  if (mcpClient) {
@@ -16049,7 +16062,7 @@ class Agent {
16049
16062
  if (controlMcp.mcpTools) {
16050
16063
  let mcpTools = await this.listTools(agentNode, context, mcpClient, controlMcp.mcpParams);
16051
16064
  let usedTools = this.extractUsedTool(messages, agentTools);
16052
- let _agentTools = mergeTools(this.tools, usedTools);
16065
+ let _agentTools = mergeTools(tools, usedTools);
16053
16066
  agentTools = mergeTools(_agentTools, mcpTools);
16054
16067
  }
16055
16068
  }
@@ -16141,8 +16154,8 @@ class Agent {
16141
16154
  system_auto_tools(agentNode) {
16142
16155
  let tools = [];
16143
16156
  let agentNodeXml = agentNode.xml;
16144
- let hasVariable = agentNodeXml.indexOf(" input=") > -1 ||
16145
- agentNodeXml.indexOf(" output=") > -1;
16157
+ let hasVariable = agentNodeXml.indexOf("input=") > -1 ||
16158
+ agentNodeXml.indexOf("output=") > -1;
16146
16159
  if (hasVariable) {
16147
16160
  tools.push(new VariableStorageTool());
16148
16161
  }
@@ -16171,24 +16184,27 @@ class Agent {
16171
16184
  }
16172
16185
  return _results;
16173
16186
  }
16174
- initMessages(agentContext) {
16187
+ initMessages(agentContext, tools) {
16175
16188
  let messages = [
16176
16189
  {
16177
16190
  role: "system",
16178
- content: getAgentSystemPrompt(this, agentContext.agentChain.agent, agentContext.context),
16191
+ content: getAgentSystemPrompt(this, agentContext.agentChain.agent, agentContext.context, tools, this.extSysPrompt()),
16179
16192
  },
16180
16193
  {
16181
16194
  role: "user",
16182
16195
  content: [
16183
16196
  {
16184
16197
  type: "text",
16185
- text: getAgentUserPrompt(this, agentContext.agentChain.agent, agentContext.context),
16198
+ text: getAgentUserPrompt(this, agentContext.agentChain.agent, agentContext.context, tools),
16186
16199
  },
16187
16200
  ],
16188
16201
  },
16189
16202
  ];
16190
16203
  return messages;
16191
16204
  }
16205
+ extSysPrompt() {
16206
+ return "";
16207
+ }
16192
16208
  async listTools(agentNode, context, mcpClient, mcpParams) {
16193
16209
  let list = await mcpClient.listTools({
16194
16210
  taskId: context.taskId,
@@ -16751,7 +16767,9 @@ function getPlanSystemPrompt(agents) {
16751
16767
  .map((agent) => {
16752
16768
  return (`<agent name="${agent.Name}">\n` +
16753
16769
  `Description: ${agent.PlanDescription || agent.Description}\nTools:\n` +
16754
- agent.Tools.map((tool) => `- ${tool.name}: ${tool.planDescription || tool.description || ""}`).join("\n") +
16770
+ agent.Tools.filter((tool) => !tool.noPlan)
16771
+ .map((tool) => `- ${tool.name}: ${tool.planDescription || tool.description || ""}`)
16772
+ .join("\n") +
16755
16773
  `\n</agent>`);
16756
16774
  })
16757
16775
  .join("\n\n");
@@ -17252,7 +17270,7 @@ class BaseFileAgent extends Agent {
17252
17270
  tools: _tools_,
17253
17271
  llms: llms,
17254
17272
  mcpClient: mcpClient,
17255
- planDescription: "File operation agent, handling file-related tasks such as creating, finding, reading, modifying files, etc.",
17273
+ planDescription: "File operation agent, handling file-related tasks such as creating, finding, reading, modifying files, etc, only text file writing is supported.",
17256
17274
  });
17257
17275
  let init_tools = this.buildInitTools();
17258
17276
  if (ext_tools && ext_tools.length > 0) {
@@ -17298,7 +17316,7 @@ class BaseFileAgent extends Agent {
17298
17316
  },
17299
17317
  {
17300
17318
  name: "file_write",
17301
- description: "Overwrite or append content to a file. Use for creating new files, appending content, or modifying existing files.",
17319
+ 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
17320
  parameters: {
17303
17321
  type: "object",
17304
17322
  properties: {
@@ -17663,6 +17681,7 @@ This is a computer GUI interface, observe the execution through screenshots, and
17663
17681
  },
17664
17682
  {
17665
17683
  name: "wait",
17684
+ noPlan: true,
17666
17685
  description: "Wait for specified duration",
17667
17686
  parameters: {
17668
17687
  type: "object",
@@ -17687,7 +17706,7 @@ This is a computer GUI interface, observe the execution through screenshots, and
17687
17706
  let lastMessage = messages[messages.length - 1];
17688
17707
  if (lastMessage.role == "tool" &&
17689
17708
  lastMessage.content.filter((t) => t.type == "tool-result").length > 0) {
17690
- await sleep(200);
17709
+ await sleep(300);
17691
17710
  let result = await this.screenshot(agentContext);
17692
17711
  let image = toImage(result.imageBase64);
17693
17712
  messages.push({
@@ -17730,7 +17749,7 @@ class BaseBrowserAgent extends Agent {
17730
17749
  }
17731
17750
  catch (e) { }
17732
17751
  }
17733
- async extract_content(agentContext) {
17752
+ async extract_content(agentContext, variable_name) {
17734
17753
  let content = await this.execute_script(agentContext, () => {
17735
17754
  return window.document.body.innerText
17736
17755
  .replaceAll(/\n+/g, "\n")
@@ -17738,7 +17757,11 @@ class BaseBrowserAgent extends Agent {
17738
17757
  .trim();
17739
17758
  }, []);
17740
17759
  let pageInfo = await this.get_current_page(agentContext);
17741
- return `title: ${pageInfo.title}\npage_url: ${pageInfo.url}\npage_content: \n${content}`;
17760
+ let result = `title: ${pageInfo.title}\npage_url: ${pageInfo.url}\npage_content: \n${content}`;
17761
+ if (variable_name) {
17762
+ agentContext.context.variables.set(variable_name, result);
17763
+ }
17764
+ return result;
17742
17765
  }
17743
17766
  async controlMcpTools(agentContext, messages, loopNum) {
17744
17767
  if (loopNum > 0) {
@@ -17940,6 +17963,10 @@ function run_build_dom_tree() {
17940
17963
  for (let i = 0; i < includeAttributes.length; i++) {
17941
17964
  let key = includeAttributes[i];
17942
17965
  let value = node.attributes[key];
17966
+ if (key == "class" && value && value.length > 30) {
17967
+ let classList = value.split(" ").slice(0, 3);
17968
+ value = classList.join(" ");
17969
+ }
17943
17970
  if (key && value) {
17944
17971
  attributes_str += ` ${key}="${value}"`;
17945
17972
  }
@@ -18522,6 +18549,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18522
18549
  break;
18523
18550
  }
18524
18551
  }
18552
+ await sleep(50);
18525
18553
  let screenshot = await this.screenshot(agentContext);
18526
18554
  let pseudoHtml = element_result.element_str;
18527
18555
  return {
@@ -18697,7 +18725,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18697
18725
  },
18698
18726
  {
18699
18727
  name: "extract_content",
18700
- description: "Extract the text content of the current webpage.",
18728
+ description: "Extract the text content of the current webpage, obtain webpage data through this tool.",
18701
18729
  parameters: {
18702
18730
  type: "object",
18703
18731
  properties: {},
@@ -18736,6 +18764,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18736
18764
  },
18737
18765
  {
18738
18766
  name: "wait",
18767
+ noPlan: true,
18739
18768
  description: "Wait for specified duration",
18740
18769
  parameters: {
18741
18770
  type: "object",
@@ -18760,8 +18789,9 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18760
18789
  let lastTool = this.lastToolResult(messages);
18761
18790
  if (lastTool &&
18762
18791
  lastTool.toolName !== "extract_content" &&
18763
- lastTool.toolName !== "get_all_tabs") {
18764
- await sleep(200);
18792
+ lastTool.toolName !== "get_all_tabs" &&
18793
+ lastTool.toolName !== "variable_storage") {
18794
+ await sleep(300);
18765
18795
  let result = await this.screenshot_and_html(agentContext);
18766
18796
  let image = toImage(result.imageBase64);
18767
18797
  messages.push({
@@ -19050,7 +19080,7 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
19050
19080
  },
19051
19081
  {
19052
19082
  name: "extract_content",
19053
- description: "Extract the text content of the current webpage.",
19083
+ description: "Extract the text content of the current webpage, obtain webpage data through this tool.",
19054
19084
  parameters: {
19055
19085
  type: "object",
19056
19086
  properties: {},
@@ -19136,6 +19166,7 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
19136
19166
  },
19137
19167
  {
19138
19168
  name: "wait",
19169
+ noPlan: true,
19139
19170
  description: "Wait for specified duration",
19140
19171
  parameters: {
19141
19172
  type: "object",
@@ -19158,8 +19189,11 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
19158
19189
  }
19159
19190
  async handleMessages(agentContext, messages) {
19160
19191
  let lastTool = this.lastToolResult(messages);
19161
- if (lastTool && lastTool.toolName !== "extract_content" && lastTool.toolName !== "get_all_tabs") {
19162
- await sleep(200);
19192
+ if (lastTool &&
19193
+ lastTool.toolName !== "extract_content" &&
19194
+ lastTool.toolName !== "get_all_tabs" &&
19195
+ lastTool.toolName !== "variable_storage") {
19196
+ await sleep(300);
19163
19197
  let result = await this.screenshot(agentContext);
19164
19198
  let image = toImage(result.imageBase64);
19165
19199
  messages.push({
package/dist/index.esm.js CHANGED
@@ -12805,12 +12805,19 @@ class RetryLanguageModel {
12805
12805
  continue;
12806
12806
  }
12807
12807
  try {
12808
- const result = await call_timeout(async () => await llm.doStream(options), this.stream_first_timeout);
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 });
@@ -15631,13 +15638,12 @@ const TOOL_NAME$3 = "human_interact";
15631
15638
  class HumanInteractTool {
15632
15639
  constructor() {
15633
15640
  this.name = TOOL_NAME$3;
15641
+ this.noPlan = true;
15634
15642
  this.description = `AI interacts with humans:
15635
15643
  confirm: Ask the user to confirm whether to execute an operation, especially when performing dangerous actions such as deleting system files.
15636
15644
  input: Prompt the user to enter text; for example, when a task is ambiguous, the AI can choose to ask the user for details, and the user can respond by inputting.
15637
15645
  select: Allow the user to make a choice; in situations that require selection, the AI can ask the user to make a decision.
15638
15646
  request_help: Request assistance from the user; for instance, when an operation is blocked, the AI can ask the user for help, such as needing to log into a website or solve a CAPTCHA.`;
15639
- this.planDescription =
15640
- "AI interacts with humans, when performing dangerous operations such as deleting files, you can request confirmation from humans";
15641
15647
  this.parameters = {
15642
15648
  type: "object",
15643
15649
  properties: {
@@ -15909,12 +15915,15 @@ UTC datetime: {datetime}
15909
15915
  </root>
15910
15916
  `;
15911
15917
  const HUMAN_PROMPT = `
15918
+ * HUMAN INTERACT
15912
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:
15913
15920
  - When performing dangerous operations such as deleting files, confirmation from humans is required
15914
15921
  - When encountering obstacles while accessing websites, such as requiring user login, you need to request human assistance
15922
+ - When requesting login, please only call the function when a login dialog box is clearly displayed.
15915
15923
  - Try not to use the \`${TOOL_NAME$3}\` tool
15916
15924
  `;
15917
15925
  const VARIABLE_PROMPT = `
15926
+ * VARIABLE STORAGE
15918
15927
  If you need to read and write the input/output variables in the node, require the use of the \`${TOOL_NAME$1}\` tool.
15919
15928
  `;
15920
15929
  const FOR_EACH_NODE = `
@@ -15939,14 +15948,16 @@ const WATCH_NODE = `
15939
15948
  const WATCH_PROMPT = `
15940
15949
  \`watch\`: monitor changes in webpage DOM or file content, when executing to the watch node, require the use of the \`${TOOL_NAME}\` tool.
15941
15950
  `;
15942
- function getAgentSystemPrompt(agent, agentNode, context, systemPrompt) {
15943
- let prompt = "";
15951
+ function getAgentSystemPrompt(agent, agentNode, context, tools, extSysPrompt) {
15952
+ let prompt = extSysPrompt || "";
15944
15953
  let nodePrompt = "";
15945
15954
  let agentNodeXml = agentNode.xml;
15946
- let hasForEach = agentNodeXml.indexOf("</forEach>") > -1;
15947
15955
  let hasWatch = agentNodeXml.indexOf("</watch>") > -1;
15948
- let hasVariable = agentNodeXml.indexOf(" input=") > -1 || agentNodeXml.indexOf(" output=") > -1;
15949
- let hasHumanTool = agent.Tools.filter((tool) => tool.name == TOOL_NAME$3).length > 0;
15956
+ let hasForEach = agentNodeXml.indexOf("</forEach>") > -1;
15957
+ let hasHumanTool = (tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$3).length > 0;
15958
+ let hasVariable = agentNodeXml.indexOf("input=") > -1 ||
15959
+ agentNodeXml.indexOf("output=") > -1 ||
15960
+ (tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$1).length > 0;
15950
15961
  if (hasHumanTool) {
15951
15962
  prompt += HUMAN_PROMPT;
15952
15963
  }
@@ -15961,7 +15972,7 @@ function getAgentSystemPrompt(agent, agentNode, context, systemPrompt) {
15961
15972
  prompt += WATCH_PROMPT;
15962
15973
  nodePrompt += WATCH_NODE;
15963
15974
  }
15964
- return (systemPrompt || AGENT_SYSTEM_TEMPLATE)
15975
+ return AGENT_SYSTEM_TEMPLATE
15965
15976
  .replace("{name}", config.name)
15966
15977
  .replace("{agent}", agent.Name)
15967
15978
  .replace("{description}", agent.Description)
@@ -15970,8 +15981,9 @@ function getAgentSystemPrompt(agent, agentNode, context, systemPrompt) {
15970
15981
  .replace("{nodePrompt}", nodePrompt)
15971
15982
  .trim();
15972
15983
  }
15973
- function getAgentUserPrompt(agent, agentNode, context) {
15974
- let hasTaskNodeStatusTool = agent.Tools.filter((tool) => tool.name == TOOL_NAME$2).length > 0;
15984
+ function getAgentUserPrompt(agent, agentNode, context, tools) {
15985
+ let hasTaskNodeStatusTool = (tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$2)
15986
+ .length > 0;
15975
15987
  return buildAgentRootXml(agentNode.xml, context.chain.taskPrompt, (nodeId, node) => {
15976
15988
  if (hasTaskNodeStatusTool) {
15977
15989
  node.setAttribute("status", "todo");
@@ -16004,9 +16016,10 @@ class Agent {
16004
16016
  let loopNum = 0;
16005
16017
  let context = agentContext.context;
16006
16018
  let agentNode = agentContext.agentChain.agent;
16007
- let messages = this.initMessages(agentContext);
16019
+ const tools = [...this.tools, ...this.system_auto_tools(agentNode)];
16020
+ let messages = this.initMessages(agentContext, tools);
16008
16021
  let rlm = new RetryLanguageModel(context.config.llms, this.llms);
16009
- let agentTools = [...this.tools, ...this.system_auto_tools(agentNode)];
16022
+ let agentTools = tools;
16010
16023
  while (loopNum < maxReactNum) {
16011
16024
  context.checkAborted();
16012
16025
  if (mcpClient) {
@@ -16014,7 +16027,7 @@ class Agent {
16014
16027
  if (controlMcp.mcpTools) {
16015
16028
  let mcpTools = await this.listTools(agentNode, context, mcpClient, controlMcp.mcpParams);
16016
16029
  let usedTools = this.extractUsedTool(messages, agentTools);
16017
- let _agentTools = mergeTools(this.tools, usedTools);
16030
+ let _agentTools = mergeTools(tools, usedTools);
16018
16031
  agentTools = mergeTools(_agentTools, mcpTools);
16019
16032
  }
16020
16033
  }
@@ -16106,8 +16119,8 @@ class Agent {
16106
16119
  system_auto_tools(agentNode) {
16107
16120
  let tools = [];
16108
16121
  let agentNodeXml = agentNode.xml;
16109
- let hasVariable = agentNodeXml.indexOf(" input=") > -1 ||
16110
- agentNodeXml.indexOf(" output=") > -1;
16122
+ let hasVariable = agentNodeXml.indexOf("input=") > -1 ||
16123
+ agentNodeXml.indexOf("output=") > -1;
16111
16124
  if (hasVariable) {
16112
16125
  tools.push(new VariableStorageTool());
16113
16126
  }
@@ -16136,24 +16149,27 @@ class Agent {
16136
16149
  }
16137
16150
  return _results;
16138
16151
  }
16139
- initMessages(agentContext) {
16152
+ initMessages(agentContext, tools) {
16140
16153
  let messages = [
16141
16154
  {
16142
16155
  role: "system",
16143
- content: getAgentSystemPrompt(this, agentContext.agentChain.agent, agentContext.context),
16156
+ content: getAgentSystemPrompt(this, agentContext.agentChain.agent, agentContext.context, tools, this.extSysPrompt()),
16144
16157
  },
16145
16158
  {
16146
16159
  role: "user",
16147
16160
  content: [
16148
16161
  {
16149
16162
  type: "text",
16150
- text: getAgentUserPrompt(this, agentContext.agentChain.agent, agentContext.context),
16163
+ text: getAgentUserPrompt(this, agentContext.agentChain.agent, agentContext.context, tools),
16151
16164
  },
16152
16165
  ],
16153
16166
  },
16154
16167
  ];
16155
16168
  return messages;
16156
16169
  }
16170
+ extSysPrompt() {
16171
+ return "";
16172
+ }
16157
16173
  async listTools(agentNode, context, mcpClient, mcpParams) {
16158
16174
  let list = await mcpClient.listTools({
16159
16175
  taskId: context.taskId,
@@ -16716,7 +16732,9 @@ function getPlanSystemPrompt(agents) {
16716
16732
  .map((agent) => {
16717
16733
  return (`<agent name="${agent.Name}">\n` +
16718
16734
  `Description: ${agent.PlanDescription || agent.Description}\nTools:\n` +
16719
- agent.Tools.map((tool) => `- ${tool.name}: ${tool.planDescription || tool.description || ""}`).join("\n") +
16735
+ agent.Tools.filter((tool) => !tool.noPlan)
16736
+ .map((tool) => `- ${tool.name}: ${tool.planDescription || tool.description || ""}`)
16737
+ .join("\n") +
16720
16738
  `\n</agent>`);
16721
16739
  })
16722
16740
  .join("\n\n");
@@ -17217,7 +17235,7 @@ class BaseFileAgent extends Agent {
17217
17235
  tools: _tools_,
17218
17236
  llms: llms,
17219
17237
  mcpClient: mcpClient,
17220
- planDescription: "File operation agent, handling file-related tasks such as creating, finding, reading, modifying files, etc.",
17238
+ planDescription: "File operation agent, handling file-related tasks such as creating, finding, reading, modifying files, etc, only text file writing is supported.",
17221
17239
  });
17222
17240
  let init_tools = this.buildInitTools();
17223
17241
  if (ext_tools && ext_tools.length > 0) {
@@ -17263,7 +17281,7 @@ class BaseFileAgent extends Agent {
17263
17281
  },
17264
17282
  {
17265
17283
  name: "file_write",
17266
- description: "Overwrite or append content to a file. Use for creating new files, appending content, or modifying existing files.",
17284
+ 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.",
17267
17285
  parameters: {
17268
17286
  type: "object",
17269
17287
  properties: {
@@ -17628,6 +17646,7 @@ This is a computer GUI interface, observe the execution through screenshots, and
17628
17646
  },
17629
17647
  {
17630
17648
  name: "wait",
17649
+ noPlan: true,
17631
17650
  description: "Wait for specified duration",
17632
17651
  parameters: {
17633
17652
  type: "object",
@@ -17652,7 +17671,7 @@ This is a computer GUI interface, observe the execution through screenshots, and
17652
17671
  let lastMessage = messages[messages.length - 1];
17653
17672
  if (lastMessage.role == "tool" &&
17654
17673
  lastMessage.content.filter((t) => t.type == "tool-result").length > 0) {
17655
- await sleep(200);
17674
+ await sleep(300);
17656
17675
  let result = await this.screenshot(agentContext);
17657
17676
  let image = toImage(result.imageBase64);
17658
17677
  messages.push({
@@ -17695,7 +17714,7 @@ class BaseBrowserAgent extends Agent {
17695
17714
  }
17696
17715
  catch (e) { }
17697
17716
  }
17698
- async extract_content(agentContext) {
17717
+ async extract_content(agentContext, variable_name) {
17699
17718
  let content = await this.execute_script(agentContext, () => {
17700
17719
  return window.document.body.innerText
17701
17720
  .replaceAll(/\n+/g, "\n")
@@ -17703,7 +17722,11 @@ class BaseBrowserAgent extends Agent {
17703
17722
  .trim();
17704
17723
  }, []);
17705
17724
  let pageInfo = await this.get_current_page(agentContext);
17706
- return `title: ${pageInfo.title}\npage_url: ${pageInfo.url}\npage_content: \n${content}`;
17725
+ let result = `title: ${pageInfo.title}\npage_url: ${pageInfo.url}\npage_content: \n${content}`;
17726
+ if (variable_name) {
17727
+ agentContext.context.variables.set(variable_name, result);
17728
+ }
17729
+ return result;
17707
17730
  }
17708
17731
  async controlMcpTools(agentContext, messages, loopNum) {
17709
17732
  if (loopNum > 0) {
@@ -17905,6 +17928,10 @@ function run_build_dom_tree() {
17905
17928
  for (let i = 0; i < includeAttributes.length; i++) {
17906
17929
  let key = includeAttributes[i];
17907
17930
  let value = node.attributes[key];
17931
+ if (key == "class" && value && value.length > 30) {
17932
+ let classList = value.split(" ").slice(0, 3);
17933
+ value = classList.join(" ");
17934
+ }
17908
17935
  if (key && value) {
17909
17936
  attributes_str += ` ${key}="${value}"`;
17910
17937
  }
@@ -18487,6 +18514,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18487
18514
  break;
18488
18515
  }
18489
18516
  }
18517
+ await sleep(50);
18490
18518
  let screenshot = await this.screenshot(agentContext);
18491
18519
  let pseudoHtml = element_result.element_str;
18492
18520
  return {
@@ -18662,7 +18690,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18662
18690
  },
18663
18691
  {
18664
18692
  name: "extract_content",
18665
- description: "Extract the text content of the current webpage.",
18693
+ description: "Extract the text content of the current webpage, obtain webpage data through this tool.",
18666
18694
  parameters: {
18667
18695
  type: "object",
18668
18696
  properties: {},
@@ -18701,6 +18729,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18701
18729
  },
18702
18730
  {
18703
18731
  name: "wait",
18732
+ noPlan: true,
18704
18733
  description: "Wait for specified duration",
18705
18734
  parameters: {
18706
18735
  type: "object",
@@ -18725,8 +18754,9 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18725
18754
  let lastTool = this.lastToolResult(messages);
18726
18755
  if (lastTool &&
18727
18756
  lastTool.toolName !== "extract_content" &&
18728
- lastTool.toolName !== "get_all_tabs") {
18729
- await sleep(200);
18757
+ lastTool.toolName !== "get_all_tabs" &&
18758
+ lastTool.toolName !== "variable_storage") {
18759
+ await sleep(300);
18730
18760
  let result = await this.screenshot_and_html(agentContext);
18731
18761
  let image = toImage(result.imageBase64);
18732
18762
  messages.push({
@@ -19015,7 +19045,7 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
19015
19045
  },
19016
19046
  {
19017
19047
  name: "extract_content",
19018
- description: "Extract the text content of the current webpage.",
19048
+ description: "Extract the text content of the current webpage, obtain webpage data through this tool.",
19019
19049
  parameters: {
19020
19050
  type: "object",
19021
19051
  properties: {},
@@ -19101,6 +19131,7 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
19101
19131
  },
19102
19132
  {
19103
19133
  name: "wait",
19134
+ noPlan: true,
19104
19135
  description: "Wait for specified duration",
19105
19136
  parameters: {
19106
19137
  type: "object",
@@ -19123,8 +19154,11 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
19123
19154
  }
19124
19155
  async handleMessages(agentContext, messages) {
19125
19156
  let lastTool = this.lastToolResult(messages);
19126
- if (lastTool && lastTool.toolName !== "extract_content" && lastTool.toolName !== "get_all_tabs") {
19127
- await sleep(200);
19157
+ if (lastTool &&
19158
+ lastTool.toolName !== "extract_content" &&
19159
+ lastTool.toolName !== "get_all_tabs" &&
19160
+ lastTool.toolName !== "variable_storage") {
19161
+ await sleep(300);
19128
19162
  let result = await this.screenshot(agentContext);
19129
19163
  let image = toImage(result.imageBase64);
19130
19164
  messages.push({
@@ -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;IAsD1E,OAAO,CAAC,MAAM;IAoCd,OAAO,CAAC,aAAa;CA0BtB"}
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"}
@@ -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
- export declare function getAgentSystemPrompt(agent: Agent, agentNode: WorkflowAgent, context: Context, systemPrompt?: string): string;
5
- export declare function getAgentUserPrompt(agent: Agent, agentNode: WorkflowAgent, context: Context): string;
4
+ import { Tool } from "../types";
5
+ export declare function getAgentSystemPrompt(agent: Agent, agentNode: WorkflowAgent, context: Context, tools?: Tool[], extSysPrompt?: 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;AAmEpD,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,OAAO,EAChB,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CA8BR;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,OAAO,GACf,MAAM,CAOR"}
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;AAgEhC,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":"plan.d.ts","sourceRoot":"","sources":["../../src/prompt/plan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AA8KjC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CA0B3D;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAWR"}
1
+ {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/prompt/plan.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AA8KjC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CA+B3D;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAWR"}
@@ -5,7 +5,7 @@ export declare const TOOL_NAME = "human_interact";
5
5
  export default class HumanInteractTool implements Tool {
6
6
  readonly name: string;
7
7
  readonly description: string;
8
- readonly planDescription: string;
8
+ readonly noPlan: boolean;
9
9
  readonly parameters: JSONSchema7;
10
10
  constructor();
11
11
  execute(args: Record<string, unknown>, agentContext: AgentContext): Promise<ToolResult>;
@@ -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;;IA4C3B,OAAO,CACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,UAAU,CAAC;CAsEvB"}
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,MAAM,EAAE,OAAO,CAAQ;IAChC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;;IA0C3B,OAAO,CACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,UAAU,CAAC;CAsEvB"}
@@ -52,7 +52,8 @@ export interface ToolExecuter {
52
52
  export interface Tool extends ToolExecuter {
53
53
  readonly name: string;
54
54
  readonly description?: string;
55
- readonly planDescription?: string;
56
55
  readonly parameters: JSONSchema7;
56
+ readonly noPlan?: boolean;
57
+ readonly planDescription?: string;
57
58
  }
58
59
  //# sourceMappingURL=tools.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tools.types.d.ts","sourceRoot":"","sources":["../../src/types/tools.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,W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,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;SACd;QACD;YACE,IAAI,EAAE,OAAO,CAAC;YACd,IAAI,EAAE,MAAM,CAAC;YACb,QAAQ,CAAC,EAAE,MAAM,CAAC;SACnB;KACF,CAAC;IACN,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,CACP,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,YAAY,EAAE,YAAY,KACvB,OAAO,CAAC,UAAU,CAAC,CAAC;CAC1B;AAED,MAAM,WAAW,IAAK,SAAQ,YAAY;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eko-ai/eko",
3
- "version": "2.0.2-alpha.5",
3
+ "version": "2.0.2-alpha.7",
4
4
  "description": "Empowering language to transform human words into action.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",