@eko-ai/eko 2.0.3-alpha.0 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"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;AAEF,qBAAa,KAAK;IAChB,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;IAC9B,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAM;IAC7B,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,SAAS,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC;IACjC,SAAS,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;gBAEvB,MAAM,EAAE,WAAW;IASlB,GAAG,CACd,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,MAAM,CAAC;IAWL,cAAc,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AAY,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_page_content(agentContext: AgentContext, variable_name?: string): 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;AAClD,OAAO,EAAE,YAAY,EAAc,UAAU,EAAE,MAAM,aAAa,CAAC;AAEnE,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,gBAAiB,SAAQ,KAAK;IAC1D,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC;QACjE,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,YAAY,GAAG,WAAW,CAAC;KACvC,CAAC;IAEF,SAAS,CAAC,QAAQ,CAAC,WAAW,C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,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,GAAG,IAAI;IAyCR,SAAS,CAAC,QAAQ,CAAC,cAAc,CAC/B,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,EAC9B,IAAI,EAAE,GAAG,EAAE,GACV,OAAO,CAAC,GAAG,CAAC;cAEC,kBAAkB,CAChC,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;CAG9D"}
package/dist/index.cjs.js CHANGED
@@ -15993,10 +15993,7 @@ const WATCH_PROMPT = `
15993
15993
  \`watch\`: monitor changes in webpage DOM or file content, when executing to the watch node, require the use of the \`${TOOL_NAME}\` tool.
15994
15994
  `;
15995
15995
  function getAgentSystemPrompt(agent, agentNode, context, tools, extSysPrompt) {
15996
- let prompt = "";
15997
- if (extSysPrompt) {
15998
- prompt += "\n" + extSysPrompt.trim() + "\n";
15999
- }
15996
+ let prompt = extSysPrompt || "";
16000
15997
  let nodePrompt = "";
16001
15998
  let agentNodeXml = agentNode.xml;
16002
15999
  let hasWatch = agentNodeXml.indexOf("</watch>") > -1;
@@ -16105,9 +16102,6 @@ class Agent {
16105
16102
  let user_messages = [];
16106
16103
  let toolResults = [];
16107
16104
  results = this.removeDuplicateToolUse(results);
16108
- if (results.length == 0) {
16109
- return null;
16110
- }
16111
16105
  for (let i = 0; i < results.length; i++) {
16112
16106
  let result = results[i];
16113
16107
  if (result.type == "text") {
@@ -17781,7 +17775,7 @@ class BaseBrowserAgent extends Agent {
17781
17775
  }
17782
17776
  catch (e) { }
17783
17777
  }
17784
- async extract_page_content(agentContext, variable_name) {
17778
+ async extract_content(agentContext, variable_name) {
17785
17779
  let content = await this.execute_script(agentContext, () => {
17786
17780
  return window.document.body.innerText
17787
17781
  .replaceAll(/\n+/g, "\n")
@@ -18511,7 +18505,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18511
18505
  - Screenshot are used to understand page layouts, with labeled bounding boxes corresponding to element indexes. Each bounding box and its label share the same color, with labels typically positioned in the top-right corner of the box.
18512
18506
  - Screenshot help verify element positions and relationships. Labels may sometimes overlap, so extracted elements are used to verify the correct elements.
18513
18507
  - In addition to screenshot, simplified information about interactive elements is returned, with element indexes corresponding to those in the screenshot.
18514
- - This tool can ONLY screenshot the VISIBLE content. If a complete content is required, use 'extract_page_content' instead.
18508
+ - This tool can ONLY screenshot the VISIBLE content. If a complete content is required, use 'extract_content' instead.
18515
18509
  - If the webpage content hasn't loaded, please use the \`wait\` tool to allow time for the content to load.
18516
18510
  * ELEMENT INTERACTION:
18517
18511
  - Only use indexes that exist in the provided element list
@@ -18521,8 +18515,8 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18521
18515
  - If no suitable elements exist, use other functions to complete the task
18522
18516
  - If stuck, try alternative approaches, don't refuse tasks
18523
18517
  - Handle popups/cookies by accepting or closing them
18524
- * BROWSER OPERATION:
18525
- - Use scroll to find elements you are looking for, When extracting content, prioritize using extract_page_content, only scroll when you need to load more content`;
18518
+ - Use scroll to find elements you are looking for
18519
+ - When extracting content, prioritize using extract_content, only scroll when you need to load more content`;
18526
18520
  const _tools_ = [];
18527
18521
  super({
18528
18522
  name: AGENT_NAME,
@@ -18636,7 +18630,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18636
18630
  },
18637
18631
  {
18638
18632
  name: "current_page",
18639
- description: "Get the information of the current webpage (url, title)",
18633
+ description: "Get the information of the current webpage",
18640
18634
  parameters: {
18641
18635
  type: "object",
18642
18636
  properties: {},
@@ -18727,7 +18721,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18727
18721
  },
18728
18722
  {
18729
18723
  name: "scroll_mouse_wheel",
18730
- description: "Scroll the mouse wheel at current position, prioritize using extract_page_content, only scroll when you need to load more content",
18724
+ description: "Scroll the mouse wheel at current position",
18731
18725
  parameters: {
18732
18726
  type: "object",
18733
18727
  properties: {
@@ -18769,14 +18763,14 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18769
18763
  },
18770
18764
  },
18771
18765
  {
18772
- name: "extract_page_content",
18773
- description: "Extract the text content of the current webpage, please use this tool to obtain webpage data.",
18766
+ name: "extract_content",
18767
+ description: "Extract the text content of the current webpage, obtain webpage data through this tool.",
18774
18768
  parameters: {
18775
18769
  type: "object",
18776
18770
  properties: {},
18777
18771
  },
18778
18772
  execute: async (args, agentContext) => {
18779
- return await this.callInnerTool(() => this.extract_page_content(agentContext));
18773
+ return await this.callInnerTool(() => this.extract_content(agentContext));
18780
18774
  },
18781
18775
  },
18782
18776
  {
@@ -18871,7 +18865,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18871
18865
  async handleMessages(agentContext, messages) {
18872
18866
  let lastTool = this.lastToolResult(messages);
18873
18867
  if (lastTool &&
18874
- lastTool.toolName !== "extract_page_content" &&
18868
+ lastTool.toolName !== "extract_content" &&
18875
18869
  lastTool.toolName !== "get_all_tabs" &&
18876
18870
  lastTool.toolName !== "variable_storage") {
18877
18871
  await sleep(300);
@@ -19083,7 +19077,7 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
19083
19077
  },
19084
19078
  {
19085
19079
  name: "current_page",
19086
- description: "Get the information of the current webpage (url, title)",
19080
+ description: "Get the information of the current webpage",
19087
19081
  parameters: {
19088
19082
  type: "object",
19089
19083
  properties: {},
@@ -19201,14 +19195,14 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
19201
19195
  },
19202
19196
  },
19203
19197
  {
19204
- name: "extract_page_content",
19205
- description: "Extract the text content of the current webpage, please use this tool to obtain webpage data.",
19198
+ name: "extract_content",
19199
+ description: "Extract the text content of the current webpage, obtain webpage data through this tool.",
19206
19200
  parameters: {
19207
19201
  type: "object",
19208
19202
  properties: {},
19209
19203
  },
19210
19204
  execute: async (args, agentContext) => {
19211
- return await this.callInnerTool(() => this.extract_page_content(agentContext));
19205
+ return await this.callInnerTool(() => this.extract_content(agentContext));
19212
19206
  },
19213
19207
  },
19214
19208
  {
@@ -19312,7 +19306,7 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
19312
19306
  async handleMessages(agentContext, messages) {
19313
19307
  let lastTool = this.lastToolResult(messages);
19314
19308
  if (lastTool &&
19315
- lastTool.toolName !== "extract_page_content" &&
19309
+ lastTool.toolName !== "extract_content" &&
19316
19310
  lastTool.toolName !== "get_all_tabs" &&
19317
19311
  lastTool.toolName !== "variable_storage") {
19318
19312
  await sleep(300);
package/dist/index.esm.js CHANGED
@@ -15958,10 +15958,7 @@ const WATCH_PROMPT = `
15958
15958
  \`watch\`: monitor changes in webpage DOM or file content, when executing to the watch node, require the use of the \`${TOOL_NAME}\` tool.
15959
15959
  `;
15960
15960
  function getAgentSystemPrompt(agent, agentNode, context, tools, extSysPrompt) {
15961
- let prompt = "";
15962
- if (extSysPrompt) {
15963
- prompt += "\n" + extSysPrompt.trim() + "\n";
15964
- }
15961
+ let prompt = extSysPrompt || "";
15965
15962
  let nodePrompt = "";
15966
15963
  let agentNodeXml = agentNode.xml;
15967
15964
  let hasWatch = agentNodeXml.indexOf("</watch>") > -1;
@@ -16070,9 +16067,6 @@ class Agent {
16070
16067
  let user_messages = [];
16071
16068
  let toolResults = [];
16072
16069
  results = this.removeDuplicateToolUse(results);
16073
- if (results.length == 0) {
16074
- return null;
16075
- }
16076
16070
  for (let i = 0; i < results.length; i++) {
16077
16071
  let result = results[i];
16078
16072
  if (result.type == "text") {
@@ -17746,7 +17740,7 @@ class BaseBrowserAgent extends Agent {
17746
17740
  }
17747
17741
  catch (e) { }
17748
17742
  }
17749
- async extract_page_content(agentContext, variable_name) {
17743
+ async extract_content(agentContext, variable_name) {
17750
17744
  let content = await this.execute_script(agentContext, () => {
17751
17745
  return window.document.body.innerText
17752
17746
  .replaceAll(/\n+/g, "\n")
@@ -18476,7 +18470,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18476
18470
  - Screenshot are used to understand page layouts, with labeled bounding boxes corresponding to element indexes. Each bounding box and its label share the same color, with labels typically positioned in the top-right corner of the box.
18477
18471
  - Screenshot help verify element positions and relationships. Labels may sometimes overlap, so extracted elements are used to verify the correct elements.
18478
18472
  - In addition to screenshot, simplified information about interactive elements is returned, with element indexes corresponding to those in the screenshot.
18479
- - This tool can ONLY screenshot the VISIBLE content. If a complete content is required, use 'extract_page_content' instead.
18473
+ - This tool can ONLY screenshot the VISIBLE content. If a complete content is required, use 'extract_content' instead.
18480
18474
  - If the webpage content hasn't loaded, please use the \`wait\` tool to allow time for the content to load.
18481
18475
  * ELEMENT INTERACTION:
18482
18476
  - Only use indexes that exist in the provided element list
@@ -18486,8 +18480,8 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18486
18480
  - If no suitable elements exist, use other functions to complete the task
18487
18481
  - If stuck, try alternative approaches, don't refuse tasks
18488
18482
  - Handle popups/cookies by accepting or closing them
18489
- * BROWSER OPERATION:
18490
- - Use scroll to find elements you are looking for, When extracting content, prioritize using extract_page_content, only scroll when you need to load more content`;
18483
+ - Use scroll to find elements you are looking for
18484
+ - When extracting content, prioritize using extract_content, only scroll when you need to load more content`;
18491
18485
  const _tools_ = [];
18492
18486
  super({
18493
18487
  name: AGENT_NAME,
@@ -18601,7 +18595,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18601
18595
  },
18602
18596
  {
18603
18597
  name: "current_page",
18604
- description: "Get the information of the current webpage (url, title)",
18598
+ description: "Get the information of the current webpage",
18605
18599
  parameters: {
18606
18600
  type: "object",
18607
18601
  properties: {},
@@ -18692,7 +18686,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18692
18686
  },
18693
18687
  {
18694
18688
  name: "scroll_mouse_wheel",
18695
- description: "Scroll the mouse wheel at current position, prioritize using extract_page_content, only scroll when you need to load more content",
18689
+ description: "Scroll the mouse wheel at current position",
18696
18690
  parameters: {
18697
18691
  type: "object",
18698
18692
  properties: {
@@ -18734,14 +18728,14 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18734
18728
  },
18735
18729
  },
18736
18730
  {
18737
- name: "extract_page_content",
18738
- description: "Extract the text content of the current webpage, please use this tool to obtain webpage data.",
18731
+ name: "extract_content",
18732
+ description: "Extract the text content of the current webpage, obtain webpage data through this tool.",
18739
18733
  parameters: {
18740
18734
  type: "object",
18741
18735
  properties: {},
18742
18736
  },
18743
18737
  execute: async (args, agentContext) => {
18744
- return await this.callInnerTool(() => this.extract_page_content(agentContext));
18738
+ return await this.callInnerTool(() => this.extract_content(agentContext));
18745
18739
  },
18746
18740
  },
18747
18741
  {
@@ -18836,7 +18830,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18836
18830
  async handleMessages(agentContext, messages) {
18837
18831
  let lastTool = this.lastToolResult(messages);
18838
18832
  if (lastTool &&
18839
- lastTool.toolName !== "extract_page_content" &&
18833
+ lastTool.toolName !== "extract_content" &&
18840
18834
  lastTool.toolName !== "get_all_tabs" &&
18841
18835
  lastTool.toolName !== "variable_storage") {
18842
18836
  await sleep(300);
@@ -19048,7 +19042,7 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
19048
19042
  },
19049
19043
  {
19050
19044
  name: "current_page",
19051
- description: "Get the information of the current webpage (url, title)",
19045
+ description: "Get the information of the current webpage",
19052
19046
  parameters: {
19053
19047
  type: "object",
19054
19048
  properties: {},
@@ -19166,14 +19160,14 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
19166
19160
  },
19167
19161
  },
19168
19162
  {
19169
- name: "extract_page_content",
19170
- description: "Extract the text content of the current webpage, please use this tool to obtain webpage data.",
19163
+ name: "extract_content",
19164
+ description: "Extract the text content of the current webpage, obtain webpage data through this tool.",
19171
19165
  parameters: {
19172
19166
  type: "object",
19173
19167
  properties: {},
19174
19168
  },
19175
19169
  execute: async (args, agentContext) => {
19176
- return await this.callInnerTool(() => this.extract_page_content(agentContext));
19170
+ return await this.callInnerTool(() => this.extract_content(agentContext));
19177
19171
  },
19178
19172
  },
19179
19173
  {
@@ -19277,7 +19271,7 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
19277
19271
  async handleMessages(agentContext, messages) {
19278
19272
  let lastTool = this.lastToolResult(messages);
19279
19273
  if (lastTool &&
19280
- lastTool.toolName !== "extract_page_content" &&
19274
+ lastTool.toolName !== "extract_content" &&
19281
19275
  lastTool.toolName !== "get_all_tabs" &&
19282
19276
  lastTool.toolName !== "variable_storage") {
19283
19277
  await sleep(300);
@@ -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,IAAI,EAAE,MAAM,UAAU,CAAC;AAsE/C,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,CAkDR;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
+ {"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,IAAI,EAAE,MAAM,UAAU,CAAC;AAsE/C,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,CA+CR;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,OAAO,EAChB,KAAK,CAAC,EAAE,IAAI,EAAE,GACb,MAAM,CAaR"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eko-ai/eko",
3
- "version": "2.0.3-alpha.0",
3
+ "version": "2.0.3",
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",