@eko-ai/eko 2.0.8 → 2.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.
@@ -37,11 +37,12 @@ export declare class Agent {
37
37
  protected convertToolResult(toolUse: LanguageModelV1ToolCallPart, toolResult: ToolResult, user_messages: LanguageModelV1Prompt): LanguageModelV1ToolResultPart;
38
38
  protected handleMessages(agentContext: AgentContext, messages: LanguageModelV1Prompt, tools: Tool[]): Promise<void>;
39
39
  protected callInnerTool(fun: () => Promise<any>): Promise<ToolResult>;
40
+ loadTools(context: Context): Promise<Tool[]>;
40
41
  get Name(): string;
41
42
  get Description(): string;
42
43
  get Tools(): Tool[];
43
44
  get PlanDescription(): string | undefined;
44
45
  get McpClient(): IMcpClient | undefined;
45
46
  }
46
- export declare function callLLM(agentContext: AgentContext, rlm: RetryLanguageModel, messages: LanguageModelV1Prompt, tools: LanguageModelV1FunctionTool[], noCompress?: boolean, toolChoice?: LanguageModelV1ToolChoice): Promise<Array<LanguageModelV1TextPart | LanguageModelV1ToolCallPart>>;
47
+ export declare function callLLM(agentContext: AgentContext, rlm: RetryLanguageModel, messages: LanguageModelV1Prompt, tools: LanguageModelV1FunctionTool[], noCompress?: boolean, toolChoice?: LanguageModelV1ToolChoice, retry?: boolean): Promise<Array<LanguageModelV1TextPart | LanguageModelV1ToolCallPart>>;
47
48
  //# sourceMappingURL=base.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/agent/base.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAa,MAAM,eAAe,CAAC;AACtD,OAAO,OAAO,EAAE,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAIxD,OAAO,EACL,aAAa,EACb,UAAU,EAEV,IAAI,EACJ,YAAY,EACZ,UAAU,EAGX,MAAM,UAAU,CAAC;AAClB,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BzE,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,OAAO;IASf,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,EAC/B,KAAK,EAAE,IAAI,EAAE,GACZ,OAAO,CAAC,IAAI,CAAC;cAKA,aAAa,CAAC,GAAG,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;IAgB9D,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAUzD,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;AAED,wBAAsB,OAAO,CAC3B,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,kBAAkB,EACvB,QAAQ,EAAE,qBAAqB,EAC/B,KAAK,EAAE,2BAA2B,EAAE,EACpC,UAAU,CAAC,EAAE,OAAO,EACpB,UAAU,CAAC,EAAE,yBAAyB,EACtC,KAAK,CAAC,EAAE,OAAO,GACd,OAAO,CAAC,KAAK,CAAC,uBAAuB,GAAG,2BAA2B,CAAC,CAAC,CAuKvE"}
@@ -4,11 +4,23 @@ import { Tool, IMcpClient } from "../types";
4
4
  export declare const AGENT_NAME = "File";
5
5
  export default abstract class BaseFileAgent extends Agent {
6
6
  constructor(work_path?: string, llms?: string[], ext_tools?: Tool[], mcpClient?: IMcpClient, planDescription?: string);
7
- protected abstract file_list(agentContext: AgentContext, path: string): Promise<string[]>;
7
+ protected abstract file_list(agentContext: AgentContext, path: string): Promise<Array<{
8
+ path: string;
9
+ name?: string;
10
+ isDirectory?: boolean;
11
+ size?: string;
12
+ modified?: string;
13
+ }>>;
8
14
  protected abstract file_read(agentContext: AgentContext, path: string): Promise<string>;
9
- protected abstract file_write(agentContext: AgentContext, path: string, content: string, append: boolean): Promise<void>;
10
- protected abstract file_str_replace(agentContext: AgentContext, path: string, old_str: string, new_str: string): Promise<void>;
11
- protected abstract file_find_by_name(agentContext: AgentContext, path: string, glob: string): Promise<string[]>;
15
+ protected abstract file_write(agentContext: AgentContext, path: string, content: string, append: boolean): Promise<any>;
16
+ protected abstract file_str_replace(agentContext: AgentContext, path: string, old_str: string, new_str: string): Promise<any>;
17
+ protected abstract file_find_by_name(agentContext: AgentContext, path: string, glob: string): Promise<Array<{
18
+ path: string;
19
+ name?: string;
20
+ isDirectory?: boolean;
21
+ size?: string;
22
+ modified?: string;
23
+ }>>;
12
24
  private buildInitTools;
13
25
  }
14
26
  export { BaseFileAgent };
@@ -1 +1 @@
1
- {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/agent/file.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;AAExD,eAAO,MAAM,UAAU,SAAS,CAAC;AAEjC,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,aAAc,SAAQ,KAAK;gBAErD,SAAS,CAAC,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,SAAS,CAAC,EAAE,IAAI,EAAE,EAClB,SAAS,CAAC,EAAE,UAAU,EACtB,eAAe,CAAC,EAAE,MAAM;IAqB1B,SAAS,CAAC,QAAQ,CAAC,SAAS,CAC1B,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,EAAE,CAAC;IAEpB,SAAS,CAAC,QAAQ,CAAC,SAAS,CAC1B,YAAY,EAAE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AAC,QAAQ,CAAC,cAAc,CAC/B,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;QACT,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IAEF,SAAS,CAAC,QAAQ,CAAC,UAAU,CAC3B,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC;IAElB,SAAS,CAAC,QAAQ,CAAC,aAAa,CAC9B,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC;IAEhB,OAAO,CAAC,cAAc;CA+EvB;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/core/plan.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,WAAW,CAAC;AAGhC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAQ/C,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAU;gBAEb,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;IAKtC,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAI3C,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;YAIrC,MAAM;CA6FrB"}
1
+ {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/core/plan.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,WAAW,CAAC;AAGhC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAK/C,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAU;gBAEb,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;IAKtC,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAI3C,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;YAIrC,MAAM;CAgGrB"}
package/dist/index.cjs.js CHANGED
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var buffer = require('buffer');
6
6
 
7
7
  const config = {
8
- name: "Fellou",
8
+ name: "Eko",
9
9
  platform: "mac",
10
10
  maxReactNum: 200,
11
11
  maxTokens: 16000,
@@ -18143,12 +18143,14 @@ UTC datetime: {datetime}
18143
18143
  <mainTask>main task</mainTask>
18144
18144
  <!-- The tasks that the current agent needs to complete, the current agent only needs to complete the currentTask -->
18145
18145
  <currentTask>specific task</currentTask>
18146
- <!-- Complete the corresponding step nodes of the task -->
18146
+ <!-- Complete the corresponding step nodes of the task, Only for reference -->
18147
18147
  <nodes>
18148
18148
  <!-- node supports input/output variables to pass dependencies -->
18149
18149
  <node input="variable name" output="variable name" status="todo / done">task step node</node>{nodePrompt}
18150
18150
  </nodes>
18151
18151
  </root>
18152
+
18153
+ The output language should follow the language corresponding to the user's task.
18152
18154
  `;
18153
18155
  const HUMAN_PROMPT = `
18154
18156
  * HUMAN INTERACT
@@ -18290,7 +18292,7 @@ class Agent {
18290
18292
  if (mcpClient) {
18291
18293
  let controlMcp = await this.controlMcpTools(agentContext, messages, loopNum);
18292
18294
  if (controlMcp.mcpTools) {
18293
- let mcpTools = await this.listTools(agentNode, context, mcpClient, controlMcp.mcpParams);
18295
+ let mcpTools = await this.listTools(context, mcpClient, agentNode, controlMcp.mcpParams);
18294
18296
  let usedTools = extractUsedTool(messages, agentTools);
18295
18297
  let _agentTools = mergeTools(tools, usedTools);
18296
18298
  agentTools = mergeTools(_agentTools, mcpTools);
@@ -18409,24 +18411,33 @@ class Agent {
18409
18411
  async extSysPrompt(agentContext, tools) {
18410
18412
  return "";
18411
18413
  }
18412
- async listTools(agentNode, context, mcpClient, mcpParams) {
18413
- let list = await mcpClient.listTools({
18414
- taskId: context.taskId,
18415
- nodeId: agentNode.id,
18416
- environment: config.platform,
18417
- agent_name: agentNode.name,
18418
- params: {},
18419
- prompt: agentNode.task,
18420
- ...(mcpParams || {}),
18421
- });
18422
- let mcpTools = [];
18423
- for (let i = 0; i < list.length; i++) {
18424
- let toolSchema = list[i];
18425
- let execute = this.toolExecuter(mcpClient, toolSchema.name);
18426
- let toolWrapper = new ToolWrapper(toolSchema, execute);
18427
- mcpTools.push(new McpTool(toolWrapper));
18414
+ async listTools(context, mcpClient, agentNode, mcpParams) {
18415
+ try {
18416
+ if (!mcpClient.isConnected()) {
18417
+ await mcpClient.connect();
18418
+ }
18419
+ let list = await mcpClient.listTools({
18420
+ taskId: context.taskId,
18421
+ nodeId: agentNode?.id,
18422
+ environment: config.platform,
18423
+ agent_name: agentNode?.name || this.name,
18424
+ params: {},
18425
+ prompt: agentNode?.task || context.chain.taskPrompt,
18426
+ ...(mcpParams || {}),
18427
+ });
18428
+ let mcpTools = [];
18429
+ for (let i = 0; i < list.length; i++) {
18430
+ let toolSchema = list[i];
18431
+ let execute = this.toolExecuter(mcpClient, toolSchema.name);
18432
+ let toolWrapper = new ToolWrapper(toolSchema, execute);
18433
+ mcpTools.push(new McpTool(toolWrapper));
18434
+ }
18435
+ return mcpTools;
18436
+ }
18437
+ catch (e) {
18438
+ Log.error("Mcp listTools error", e);
18439
+ return [];
18428
18440
  }
18429
- return mcpTools;
18430
18441
  }
18431
18442
  async controlMcpTools(agentContext, messages, loopNum) {
18432
18443
  return {
@@ -18537,6 +18548,15 @@ class Agent {
18537
18548
  ],
18538
18549
  };
18539
18550
  }
18551
+ async loadTools(context) {
18552
+ if (this.mcpClient) {
18553
+ let mcpTools = await this.listTools(context, this.mcpClient);
18554
+ if (mcpTools && mcpTools.length > 0) {
18555
+ return mergeTools(this.tools, mcpTools);
18556
+ }
18557
+ }
18558
+ return this.tools;
18559
+ }
18540
18560
  get Name() {
18541
18561
  return this.name;
18542
18562
  }
@@ -18553,7 +18573,7 @@ class Agent {
18553
18573
  return this.mcpClient;
18554
18574
  }
18555
18575
  }
18556
- async function callLLM(agentContext, rlm, messages, tools, noCompress, toolChoice) {
18576
+ async function callLLM(agentContext, rlm, messages, tools, noCompress, toolChoice, retry) {
18557
18577
  if (messages.length >= config.compressThreshold && !noCompress) {
18558
18578
  await compressAgentMessages(agentContext, rlm, messages, tools);
18559
18579
  }
@@ -18702,6 +18722,10 @@ async function callLLM(agentContext, rlm, messages, tools, noCompress, toolChoic
18702
18722
  finishReason: chunk.finishReason,
18703
18723
  usage: chunk.usage,
18704
18724
  });
18725
+ if (chunk.finishReason === "length" && messages.length >= 10 && !noCompress && !retry) {
18726
+ await compressAgentMessages(agentContext, rlm, messages, tools);
18727
+ return callLLM(agentContext, rlm, messages, tools, noCompress, toolChoice, true);
18728
+ }
18705
18729
  break;
18706
18730
  }
18707
18731
  }
@@ -18899,19 +18923,24 @@ User Platform: {platform}
18899
18923
  Task Website: {task_website}
18900
18924
  Task Description: {taskPrompt}
18901
18925
  `;
18902
- function getPlanSystemPrompt(agents) {
18903
- let agents_prompt = agents
18904
- .map((agent) => {
18905
- return (`<agent name="${agent.Name}">\n` +
18906
- `Description: ${agent.PlanDescription || agent.Description}\nTools:\n` +
18907
- agent.Tools.filter((tool) => !tool.noPlan)
18908
- .map((tool) => `- ${tool.name}: ${tool.planDescription || tool.description || ""}`)
18909
- .join("\n") +
18910
- `\n</agent>`);
18911
- })
18912
- .join("\n\n");
18926
+ async function getPlanSystemPrompt(context) {
18927
+ let agents_prompt = "";
18928
+ let agents = context.agents;
18929
+ for (let i = 0; i < agents.length; i++) {
18930
+ let agent = agents[i];
18931
+ let tools = await agent.loadTools(context);
18932
+ agents_prompt +=
18933
+ `<agent name="${agent.Name}">\n` +
18934
+ `Description: ${agent.PlanDescription || agent.Description}\n` +
18935
+ "Tools:\n" +
18936
+ tools
18937
+ .filter((tool) => !tool.noPlan)
18938
+ .map((tool) => ` - ${tool.name}: ${tool.planDescription || tool.description || ""}`)
18939
+ .join("\n") +
18940
+ "\n</agent>\n\n";
18941
+ }
18913
18942
  let example_prompt = "";
18914
- let hasChatAgent = agents.filter((a) => a.Name == AGENT_NAME$4).length > 0;
18943
+ let hasChatAgent = context.agents.filter((a) => a.Name == AGENT_NAME$4).length > 0;
18915
18944
  const example_list = hasChatAgent
18916
18945
  ? [PLAN_CHAT_EXAMPLE, ...PLAN_EXAMPLE_LIST]
18917
18946
  : [...PLAN_EXAMPLE_LIST];
@@ -18919,7 +18948,7 @@ function getPlanSystemPrompt(agents) {
18919
18948
  example_prompt += `## Example ${i + 1}\n${example_list[i]}\n\n`;
18920
18949
  }
18921
18950
  return PLAN_SYSTEM_TEMPLATE.replace("{name}", config.name)
18922
- .replace("{agents}", agents_prompt)
18951
+ .replace("{agents}", agents_prompt.trim())
18923
18952
  .replace("{datetime}", new Date().toISOString())
18924
18953
  .replace("{example_prompt}", example_prompt)
18925
18954
  .trim();
@@ -18969,7 +18998,10 @@ class Planner {
18969
18998
  }
18970
18999
  else {
18971
19000
  messages = [
18972
- { role: "system", content: getPlanSystemPrompt(this.context.agents) },
19001
+ {
19002
+ role: "system",
19003
+ content: await getPlanSystemPrompt(this.context),
19004
+ },
18973
19005
  {
18974
19006
  role: "user",
18975
19007
  content: [
@@ -19400,7 +19432,9 @@ const AGENT_NAME$3 = "File";
19400
19432
  class BaseFileAgent extends Agent {
19401
19433
  constructor(work_path, llms, ext_tools, mcpClient, planDescription) {
19402
19434
  const _tools_ = [];
19403
- const prompt = work_path ? `Your default working path is: ${work_path}` : "";
19435
+ const prompt = work_path
19436
+ ? `Your default working path is: ${work_path}`
19437
+ : "";
19404
19438
  super({
19405
19439
  name: AGENT_NAME$3,
19406
19440
  description: `You are a file agent, handling file-related tasks such as creating, finding, reading, modifying files, etc.${prompt}`,
@@ -19534,7 +19568,10 @@ class BaseShellAgent extends Agent {
19534
19568
  const _tools_ = [];
19535
19569
  super({
19536
19570
  name: AGENT_NAME$2,
19537
- description: "Shell command agent, use to execute shell commands.\nYou must first call create_session to create a new session when using it for the first time.",
19571
+ description: `Run commands in a bash shell,
19572
+ * You must first call create_session to create a new session when using it for the first time.
19573
+ * Please execute delete commands with caution, and never perform dangerous operations like \`rm -rf /\`.
19574
+ * Please avoid commands that may produce a very large amount of output.`,
19538
19575
  tools: _tools_,
19539
19576
  llms: llms,
19540
19577
  mcpClient: mcpClient,
@@ -19624,7 +19661,7 @@ This is a computer GUI interface, observe the execution through screenshots, and
19624
19661
  tools: _tools_,
19625
19662
  llms: llms,
19626
19663
  mcpClient: mcpClient,
19627
- planDescription: "Computer operation agent, interact with the computer using the mouse and keyboard, operation application."
19664
+ planDescription: "Computer operation agent, interact with the computer using the mouse and keyboard."
19628
19665
  });
19629
19666
  if (!keyboardKeys) {
19630
19667
  if (config.platform == "windows") {
@@ -20899,7 +20936,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
20899
20936
  },
20900
20937
  {
20901
20938
  name: "get_select_options",
20902
- description: "Get all options from a native dropdown element",
20939
+ description: "Get all options from a native dropdown element (<select>).",
20903
20940
  parameters: {
20904
20941
  type: "object",
20905
20942
  properties: {
@@ -20916,7 +20953,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
20916
20953
  },
20917
20954
  {
20918
20955
  name: "select_option",
20919
- description: "Select the native dropdown option",
20956
+ description: "Select the native dropdown option, Use this after get_select_options and when you need to select an option from a dropdown.",
20920
20957
  parameters: {
20921
20958
  type: "object",
20922
20959
  properties: {
@@ -21477,9 +21514,11 @@ exports.SimpleSseMcpClient = SimpleSseMcpClient;
21477
21514
  exports.TaskNodeStatusTool = TaskNodeStatusTool;
21478
21515
  exports.VariableStorageTool = VariableStorageTool;
21479
21516
  exports.WatchTriggerTool = WatchTriggerTool;
21517
+ exports.call_timeout = call_timeout;
21480
21518
  exports.config = config;
21481
21519
  exports.convertToolSchema = convertToolSchema;
21482
21520
  exports.default = Eko;
21483
21521
  exports.mergeTools = mergeTools;
21484
21522
  exports.toImage = toImage;
21523
+ exports.uuidv4 = uuidv4;
21485
21524
  //# sourceMappingURL=index.cjs.js.map