@eko-ai/eko 1.2.3 → 1.2.4

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.
@@ -7,5 +7,6 @@ import { Screenshot } from './screenshot';
7
7
  import { TabManagement } from './tab_management';
8
8
  import { WebSearch } from './web_search';
9
9
  import { RequestLogin } from './request_login';
10
+ import { SwitchTab } from './switch_tab';
10
11
  export * from '../../common/tools';
11
- export { BrowserUse, ExportFile, ExtractContent, OpenUrl, GetAllTabs, Screenshot, TabManagement, WebSearch, RequestLogin, };
12
+ export { BrowserUse, ExportFile, ExtractContent, OpenUrl, GetAllTabs, Screenshot, TabManagement, WebSearch, RequestLogin, SwitchTab, };
@@ -0,0 +1,8 @@
1
+ import { ExecutionContext, InputSchema, SwitchTabParam, TabManagementResult, Tool } from '@/types';
2
+ export declare class SwitchTab implements Tool<SwitchTabParam, TabManagementResult> {
3
+ description: string;
4
+ input_schema: InputSchema;
5
+ name: string;
6
+ constructor();
7
+ execute(context: ExecutionContext, params: SwitchTabParam): Promise<TabManagementResult>;
8
+ }
@@ -695,7 +695,13 @@ async function getTabId(context) {
695
695
  logger.debug("getCurrentTabId(context.ekoConfig.chromeProxy) #2 returns " + tabId);
696
696
  }
697
697
  if (!tabId) {
698
- throw new Error('Could not find a valid tab');
698
+ const fellouTabId = window.__FELLOU_TAB_ID__;
699
+ if (tabId) {
700
+ tabId = fellouTabId;
701
+ }
702
+ else {
703
+ throw new Error('Could not find a valid tab');
704
+ }
699
705
  }
700
706
  context.variables.set('tabId', tabId);
701
707
  }
@@ -1392,6 +1398,7 @@ class ToolReturnsScreenshot {
1392
1398
  const realResult = await this.realExecute(context, params);
1393
1399
  logger.debug("debug realResult...");
1394
1400
  logger.debug(realResult);
1401
+ await sleep(3000); // wait for page loding
1395
1402
  let instance = new BrowserUse();
1396
1403
  const image = await instance.realExecute(context, { action: "screenshot_extract_element" });
1397
1404
  return image;
@@ -1582,6 +1589,7 @@ class BrowserUse extends ToolReturnsScreenshot {
1582
1589
  result = { image: screenshot$1.image, text: element_result.element_str };
1583
1590
  }
1584
1591
  finally {
1592
+ await sleep(500);
1585
1593
  logger.debug("executeScript #2...");
1586
1594
  await executeScript(context.ekoConfig.chromeProxy, tabId, () => {
1587
1595
  return window.remove_highlight();
@@ -1930,7 +1938,9 @@ class Screenshot {
1930
1938
  class TabManagement {
1931
1939
  constructor() {
1932
1940
  this.name = 'tab_management';
1933
- this.description = 'Browser tab management, view and operate tabs';
1941
+ this.description = 'Browser tab management, view and operate tabs.You can use this tool to' +
1942
+ 'View all tabs with the tabId and title.Get current tab information (tabId, url, title).' +
1943
+ 'Go back to the previous page in the current tab. And Close the current tab.';
1934
1944
  this.input_schema = {
1935
1945
  type: 'object',
1936
1946
  properties: {
@@ -1940,9 +1950,8 @@ class TabManagement {
1940
1950
  * \`tab_all\`: View all tabs and return the tabId and title.
1941
1951
  * \`current_tab\`: Get current tab information (tabId, url, title).
1942
1952
  * \`go_back\`: Go back to the previous page in the current tab.
1943
- * \`close_tab\`: Close the current tab.
1944
- * \`switch_tab [tabId]\`: Switch to the specified tab using tabId, eg: \`switch_tab 1000\`.
1945
- * \`new_tab [url]\`: Open a new tab window and open the URL, eg: \`new_tab https://www.google.com\``,
1953
+ * \`close_tab\`: Close the current tab.`,
1954
+ enum: ['tab_all', 'current_tab', 'go_back', 'close_tab'],
1946
1955
  },
1947
1956
  },
1948
1957
  required: ['command'],
@@ -1955,7 +1964,6 @@ class TabManagement {
1955
1964
  * @returns > { result, success: true }
1956
1965
  */
1957
1966
  async execute(context, params) {
1958
- var _a, _b, _c;
1959
1967
  if (params === null || !params.command) {
1960
1968
  throw new Error('Invalid parameters. Expected an object with a "command" property.');
1961
1969
  }
@@ -2016,30 +2024,6 @@ class TabManagement {
2016
2024
  let closeTabInfo = { closedTabId, newTabId, newTabTitle: tab.title };
2017
2025
  result = closeTabInfo;
2018
2026
  }
2019
- else if (command.startsWith('switch_tab')) {
2020
- let tabId = parseInt(command.replace('switch_tab', '').replace('[', '').replace(']', ''));
2021
- let tab = await context.ekoConfig.chromeProxy.tabs.update(tabId, { active: true });
2022
- context.variables.set('tabId', tab.id);
2023
- context.variables.set('windowId', tab.windowId);
2024
- let tabInfo = { tabId, windowId: tab.windowId, title: tab.title, url: tab.url };
2025
- result = tabInfo;
2026
- }
2027
- else if (command.startsWith('new_tab')) {
2028
- let url = command.replace('new_tab', '').replace('[', '').replace(']', '').replace(/"/g, '').trim();
2029
- let windowId = await getWindowId(context);
2030
- let tab = await open_new_tab(context.ekoConfig.chromeProxy, url, windowId);
2031
- (_c = (_b = (_a = context.callback) === null || _a === void 0 ? void 0 : _a.hooks) === null || _b === void 0 ? void 0 : _b.onTabCreated) === null || _c === void 0 ? void 0 : _c.call(_b, tab.id);
2032
- let tabId = tab.id;
2033
- context.variables.set('windowId', windowId);
2034
- context.variables.set('tabId', tabId);
2035
- let tabInfo = {
2036
- tabId: tab.id,
2037
- windowId: tab.windowId,
2038
- title: tab.title,
2039
- url: tab.url,
2040
- };
2041
- result = tabInfo;
2042
- }
2043
2027
  else {
2044
2028
  throw Error('Unknown command: ' + command);
2045
2029
  }
@@ -2449,6 +2433,36 @@ class RequestLogin {
2449
2433
  }
2450
2434
  }
2451
2435
 
2436
+ class SwitchTab {
2437
+ constructor() {
2438
+ this.name = 'switch_tab';
2439
+ this.description = 'Switch to the specified tab using tabId';
2440
+ this.input_schema = {
2441
+ type: 'object',
2442
+ properties: {
2443
+ tabId: {
2444
+ type: 'integer',
2445
+ description: 'The tabId to switch to',
2446
+ },
2447
+ },
2448
+ required: ['tabId'],
2449
+ };
2450
+ }
2451
+ async execute(context, params) {
2452
+ if (params === null || !params.tabId) {
2453
+ throw new Error('Invalid parameters. Expected an object with a "tabId" property.');
2454
+ }
2455
+ let result;
2456
+ let tabId = parseInt(String(params.tabId));
2457
+ let tab = await context.ekoConfig.chromeProxy.tabs.update(tabId, { active: true });
2458
+ context.variables.set('tabId', tab.id);
2459
+ context.variables.set('windowId', tab.windowId);
2460
+ let tabInfo = { tabId, windowId: tab.windowId, title: tab.title, url: tab.url };
2461
+ result = tabInfo;
2462
+ return result;
2463
+ }
2464
+ }
2465
+
2452
2466
  class CancelWorkflow {
2453
2467
  constructor() {
2454
2468
  this.name = 'cancel_workflow';
@@ -2748,6 +2762,7 @@ var tools = /*#__PURE__*/Object.freeze({
2748
2762
  OpenUrl: OpenUrl,
2749
2763
  RequestLogin: RequestLogin,
2750
2764
  Screenshot: Screenshot,
2765
+ SwitchTab: SwitchTab,
2751
2766
  TabManagement: TabManagement,
2752
2767
  WebSearch: WebSearch
2753
2768
  });
@@ -693,7 +693,13 @@ async function getTabId(context) {
693
693
  logger.debug("getCurrentTabId(context.ekoConfig.chromeProxy) #2 returns " + tabId);
694
694
  }
695
695
  if (!tabId) {
696
- throw new Error('Could not find a valid tab');
696
+ const fellouTabId = window.__FELLOU_TAB_ID__;
697
+ if (tabId) {
698
+ tabId = fellouTabId;
699
+ }
700
+ else {
701
+ throw new Error('Could not find a valid tab');
702
+ }
697
703
  }
698
704
  context.variables.set('tabId', tabId);
699
705
  }
@@ -1390,6 +1396,7 @@ class ToolReturnsScreenshot {
1390
1396
  const realResult = await this.realExecute(context, params);
1391
1397
  logger.debug("debug realResult...");
1392
1398
  logger.debug(realResult);
1399
+ await sleep(3000); // wait for page loding
1393
1400
  let instance = new BrowserUse();
1394
1401
  const image = await instance.realExecute(context, { action: "screenshot_extract_element" });
1395
1402
  return image;
@@ -1580,6 +1587,7 @@ class BrowserUse extends ToolReturnsScreenshot {
1580
1587
  result = { image: screenshot$1.image, text: element_result.element_str };
1581
1588
  }
1582
1589
  finally {
1590
+ await sleep(500);
1583
1591
  logger.debug("executeScript #2...");
1584
1592
  await executeScript(context.ekoConfig.chromeProxy, tabId, () => {
1585
1593
  return window.remove_highlight();
@@ -1928,7 +1936,9 @@ class Screenshot {
1928
1936
  class TabManagement {
1929
1937
  constructor() {
1930
1938
  this.name = 'tab_management';
1931
- this.description = 'Browser tab management, view and operate tabs';
1939
+ this.description = 'Browser tab management, view and operate tabs.You can use this tool to' +
1940
+ 'View all tabs with the tabId and title.Get current tab information (tabId, url, title).' +
1941
+ 'Go back to the previous page in the current tab. And Close the current tab.';
1932
1942
  this.input_schema = {
1933
1943
  type: 'object',
1934
1944
  properties: {
@@ -1938,9 +1948,8 @@ class TabManagement {
1938
1948
  * \`tab_all\`: View all tabs and return the tabId and title.
1939
1949
  * \`current_tab\`: Get current tab information (tabId, url, title).
1940
1950
  * \`go_back\`: Go back to the previous page in the current tab.
1941
- * \`close_tab\`: Close the current tab.
1942
- * \`switch_tab [tabId]\`: Switch to the specified tab using tabId, eg: \`switch_tab 1000\`.
1943
- * \`new_tab [url]\`: Open a new tab window and open the URL, eg: \`new_tab https://www.google.com\``,
1951
+ * \`close_tab\`: Close the current tab.`,
1952
+ enum: ['tab_all', 'current_tab', 'go_back', 'close_tab'],
1944
1953
  },
1945
1954
  },
1946
1955
  required: ['command'],
@@ -1953,7 +1962,6 @@ class TabManagement {
1953
1962
  * @returns > { result, success: true }
1954
1963
  */
1955
1964
  async execute(context, params) {
1956
- var _a, _b, _c;
1957
1965
  if (params === null || !params.command) {
1958
1966
  throw new Error('Invalid parameters. Expected an object with a "command" property.');
1959
1967
  }
@@ -2014,30 +2022,6 @@ class TabManagement {
2014
2022
  let closeTabInfo = { closedTabId, newTabId, newTabTitle: tab.title };
2015
2023
  result = closeTabInfo;
2016
2024
  }
2017
- else if (command.startsWith('switch_tab')) {
2018
- let tabId = parseInt(command.replace('switch_tab', '').replace('[', '').replace(']', ''));
2019
- let tab = await context.ekoConfig.chromeProxy.tabs.update(tabId, { active: true });
2020
- context.variables.set('tabId', tab.id);
2021
- context.variables.set('windowId', tab.windowId);
2022
- let tabInfo = { tabId, windowId: tab.windowId, title: tab.title, url: tab.url };
2023
- result = tabInfo;
2024
- }
2025
- else if (command.startsWith('new_tab')) {
2026
- let url = command.replace('new_tab', '').replace('[', '').replace(']', '').replace(/"/g, '').trim();
2027
- let windowId = await getWindowId(context);
2028
- let tab = await open_new_tab(context.ekoConfig.chromeProxy, url, windowId);
2029
- (_c = (_b = (_a = context.callback) === null || _a === void 0 ? void 0 : _a.hooks) === null || _b === void 0 ? void 0 : _b.onTabCreated) === null || _c === void 0 ? void 0 : _c.call(_b, tab.id);
2030
- let tabId = tab.id;
2031
- context.variables.set('windowId', windowId);
2032
- context.variables.set('tabId', tabId);
2033
- let tabInfo = {
2034
- tabId: tab.id,
2035
- windowId: tab.windowId,
2036
- title: tab.title,
2037
- url: tab.url,
2038
- };
2039
- result = tabInfo;
2040
- }
2041
2025
  else {
2042
2026
  throw Error('Unknown command: ' + command);
2043
2027
  }
@@ -2447,6 +2431,36 @@ class RequestLogin {
2447
2431
  }
2448
2432
  }
2449
2433
 
2434
+ class SwitchTab {
2435
+ constructor() {
2436
+ this.name = 'switch_tab';
2437
+ this.description = 'Switch to the specified tab using tabId';
2438
+ this.input_schema = {
2439
+ type: 'object',
2440
+ properties: {
2441
+ tabId: {
2442
+ type: 'integer',
2443
+ description: 'The tabId to switch to',
2444
+ },
2445
+ },
2446
+ required: ['tabId'],
2447
+ };
2448
+ }
2449
+ async execute(context, params) {
2450
+ if (params === null || !params.tabId) {
2451
+ throw new Error('Invalid parameters. Expected an object with a "tabId" property.');
2452
+ }
2453
+ let result;
2454
+ let tabId = parseInt(String(params.tabId));
2455
+ let tab = await context.ekoConfig.chromeProxy.tabs.update(tabId, { active: true });
2456
+ context.variables.set('tabId', tab.id);
2457
+ context.variables.set('windowId', tab.windowId);
2458
+ let tabInfo = { tabId, windowId: tab.windowId, title: tab.title, url: tab.url };
2459
+ result = tabInfo;
2460
+ return result;
2461
+ }
2462
+ }
2463
+
2450
2464
  class CancelWorkflow {
2451
2465
  constructor() {
2452
2466
  this.name = 'cancel_workflow';
@@ -2746,6 +2760,7 @@ var tools = /*#__PURE__*/Object.freeze({
2746
2760
  OpenUrl: OpenUrl,
2747
2761
  RequestLogin: RequestLogin,
2748
2762
  Screenshot: Screenshot,
2763
+ SwitchTab: SwitchTab,
2749
2764
  TabManagement: TabManagement,
2750
2765
  WebSearch: WebSearch
2751
2766
  });
package/dist/index.cjs.js CHANGED
@@ -9990,7 +9990,7 @@ ${JSON.stringify(nodeOutputs)}
9990
9990
  `,
9991
9991
  },
9992
9992
  ];
9993
- logger.debug(messages);
9993
+ logger.debug(JSON.stringify(messages));
9994
9994
  const params = {
9995
9995
  temperature: 0.7,
9996
9996
  maxTokens: 8192,
@@ -10323,13 +10323,13 @@ class ActionImpl {
10323
10323
  }
10324
10324
  },
10325
10325
  onToolUse: async (toolCall) => {
10326
- logger.info("toolCall start", {
10326
+ logger.info("toolCall start", JSON.stringify({
10327
10327
  assistant: assistantTextMessage,
10328
10328
  toolCall: {
10329
10329
  name: toolCall.name,
10330
10330
  input: toolCall.input,
10331
10331
  },
10332
- });
10332
+ }));
10333
10333
  hasToolUse = true;
10334
10334
  const tool = toolMap.get(toolCall.name);
10335
10335
  if (!tool) {
@@ -10454,12 +10454,12 @@ class ActionImpl {
10454
10454
  return s.slice(0, maxLength) + "...(truncated)";
10455
10455
  }
10456
10456
  };
10457
- logger.info("toolCall done", {
10457
+ logger.info("toolCall done", JSON.stringify({
10458
10458
  toolCall: {
10459
10459
  name: tool.name,
10460
10460
  result: truncate(result),
10461
10461
  },
10462
- });
10462
+ }));
10463
10463
  // Store tool results except for the return_output tool
10464
10464
  if (tool.name !== 'return_output') {
10465
10465
  this.toolResults.set(toolCall.id, resultContentText);
@@ -10593,6 +10593,7 @@ class ActionImpl {
10593
10593
  if (context.ekoConfig.patchServerUrl) {
10594
10594
  patchs = await this.getPatchs(this.name, context.ekoConfig.patchServerUrl);
10595
10595
  }
10596
+ logger.debug("patchs:", patchs);
10596
10597
  // Prepare initial messages
10597
10598
  const messages = [
10598
10599
  { role: 'system', content: this.formatSystemPrompt() },
@@ -10835,7 +10836,7 @@ Navigation Bar or Menu Changes: After logging in, the navigation bar will includ
10835
10836
  },
10836
10837
  userSidePrompt: {
10837
10838
  "type": "string",
10838
- "description": 'The user-side prompt, showing why calling this tool. Should start with "I\'m calling the ...(tool) to ...(target)". Rememeber to keep the same language of the ultimate task.',
10839
+ "description": 'The user-side prompt, showing what you are doing. e.g. "Openning x.com." or "Writing the post."',
10839
10840
  },
10840
10841
  toolCall: definition.input_schema,
10841
10842
  },
@@ -11139,13 +11140,14 @@ class Eko {
11139
11140
  constructor(llmConfig, ekoConfig) {
11140
11141
  this.toolRegistry = new ToolRegistry();
11141
11142
  this.workflowGeneratorMap = new Map();
11142
- this.prompt = "";
11143
+ this.prompt = '';
11143
11144
  this.tabs = [];
11144
11145
  this.workflow = undefined;
11145
11146
  this.llmProvider = LLMProviderFactory.buildLLMProvider(llmConfig);
11146
11147
  this.ekoConfig = this.buildEkoConfig(ekoConfig);
11147
11148
  this.registerTools();
11148
- logger.info("using Eko@" + "0fbae27efeeb93942eb22d3594375674b23788cb");
11149
+ logger.info("using Eko@" + "0b8135fc46d59eb59eb56c57564e2db06526249b");
11150
+ logger.debug("caller's ekoConfig:", ekoConfig);
11149
11151
  }
11150
11152
  static getLogger() {
11151
11153
  return logger;
@@ -11173,10 +11175,10 @@ class Eko {
11173
11175
  const hooks = callback.hooks;
11174
11176
  // these tools could not work without corresponding hook
11175
11177
  const tool2isHookExists = {
11176
- "human_input_text": Boolean(hooks.onHumanInputText),
11177
- "human_input_single_choice": Boolean(hooks.onHumanInputSingleChoice),
11178
- "human_input_multiple_choice": Boolean(hooks.onHumanInputMultipleChoice),
11179
- "human_operate": Boolean(hooks.onHumanOperate),
11178
+ 'human_input_text': Boolean(hooks.onHumanInputText),
11179
+ 'human_input_single_choice': Boolean(hooks.onHumanInputSingleChoice),
11180
+ 'human_input_multiple_choice': Boolean(hooks.onHumanInputMultipleChoice),
11181
+ 'human_operate': Boolean(hooks.onHumanOperate),
11180
11182
  };
11181
11183
  tools = tools.filter(tool => {
11182
11184
  if (tool.name in tool2isHookExists) {
@@ -11194,7 +11196,7 @@ class Eko {
11194
11196
  tools.forEach(tool => this.toolRegistry.registerTool(tool));
11195
11197
  }
11196
11198
  async generate(prompt, tabs = [], param) {
11197
- logger.info("workflow generating...");
11199
+ logger.info("workflow generating...", prompt);
11198
11200
  this.prompt = prompt;
11199
11201
  this.tabs = tabs;
11200
11202
  let toolRegistry = this.toolRegistry;
@@ -11220,37 +11222,38 @@ class Eko {
11220
11222
  async execute(workflow) {
11221
11223
  logger.info("workflow executing...");
11222
11224
  let prompt = this.prompt;
11223
- let description = "";
11225
+ let description = '';
11224
11226
  workflow.nodes.forEach(node => {
11225
- description += node.name + "\n";
11227
+ description += node.name + '\n';
11226
11228
  });
11227
11229
  const json = {
11228
- "id": "workflow_id",
11229
- "name": prompt,
11230
- "description": prompt,
11231
- "nodes": [
11230
+ 'id': 'workflow_id',
11231
+ 'name': prompt,
11232
+ 'description': prompt,
11233
+ 'nodes': [
11232
11234
  {
11233
- "id": "sub_task_id",
11234
- "type": "action",
11235
- "action": {
11236
- "type": "prompt",
11237
- "name": prompt,
11238
- "description": description,
11239
- "tools": [
11240
- "browser_use",
11241
- "document_agent",
11242
- "export_file",
11243
- "extract_content",
11244
- "open_url",
11245
- "tab_management",
11246
- "web_search",
11247
- "human_input_text",
11248
- "human_input_single_choice",
11249
- "human_input_multiple_choice",
11250
- "human_operate",
11235
+ 'id': 'sub_task_id',
11236
+ 'type': 'action',
11237
+ 'action': {
11238
+ 'type': 'prompt',
11239
+ 'name': prompt,
11240
+ 'description': description,
11241
+ 'tools': [
11242
+ 'browser_use',
11243
+ 'document_agent',
11244
+ 'export_file',
11245
+ 'extract_content',
11246
+ 'open_url',
11247
+ 'tab_management',
11248
+ 'switch_tab',
11249
+ 'web_search',
11250
+ 'human_input_text',
11251
+ 'human_input_single_choice',
11252
+ 'human_input_multiple_choice',
11253
+ 'human_operate',
11251
11254
  ],
11252
11255
  },
11253
- "dependencies": []
11256
+ 'dependencies': [],
11254
11257
  },
11255
11258
  ],
11256
11259
  };
@@ -11288,7 +11291,7 @@ class Eko {
11288
11291
  return await this.workflow.cancel();
11289
11292
  }
11290
11293
  else {
11291
- throw Error("`Eko` instance do not have a `workflow` member");
11294
+ throw Error('`Eko` instance do not have a `workflow` member');
11292
11295
  }
11293
11296
  }
11294
11297
  async modify(workflow, prompt) {
package/dist/index.esm.js CHANGED
@@ -9986,7 +9986,7 @@ ${JSON.stringify(nodeOutputs)}
9986
9986
  `,
9987
9987
  },
9988
9988
  ];
9989
- logger.debug(messages);
9989
+ logger.debug(JSON.stringify(messages));
9990
9990
  const params = {
9991
9991
  temperature: 0.7,
9992
9992
  maxTokens: 8192,
@@ -10319,13 +10319,13 @@ class ActionImpl {
10319
10319
  }
10320
10320
  },
10321
10321
  onToolUse: async (toolCall) => {
10322
- logger.info("toolCall start", {
10322
+ logger.info("toolCall start", JSON.stringify({
10323
10323
  assistant: assistantTextMessage,
10324
10324
  toolCall: {
10325
10325
  name: toolCall.name,
10326
10326
  input: toolCall.input,
10327
10327
  },
10328
- });
10328
+ }));
10329
10329
  hasToolUse = true;
10330
10330
  const tool = toolMap.get(toolCall.name);
10331
10331
  if (!tool) {
@@ -10450,12 +10450,12 @@ class ActionImpl {
10450
10450
  return s.slice(0, maxLength) + "...(truncated)";
10451
10451
  }
10452
10452
  };
10453
- logger.info("toolCall done", {
10453
+ logger.info("toolCall done", JSON.stringify({
10454
10454
  toolCall: {
10455
10455
  name: tool.name,
10456
10456
  result: truncate(result),
10457
10457
  },
10458
- });
10458
+ }));
10459
10459
  // Store tool results except for the return_output tool
10460
10460
  if (tool.name !== 'return_output') {
10461
10461
  this.toolResults.set(toolCall.id, resultContentText);
@@ -10589,6 +10589,7 @@ class ActionImpl {
10589
10589
  if (context.ekoConfig.patchServerUrl) {
10590
10590
  patchs = await this.getPatchs(this.name, context.ekoConfig.patchServerUrl);
10591
10591
  }
10592
+ logger.debug("patchs:", patchs);
10592
10593
  // Prepare initial messages
10593
10594
  const messages = [
10594
10595
  { role: 'system', content: this.formatSystemPrompt() },
@@ -10831,7 +10832,7 @@ Navigation Bar or Menu Changes: After logging in, the navigation bar will includ
10831
10832
  },
10832
10833
  userSidePrompt: {
10833
10834
  "type": "string",
10834
- "description": 'The user-side prompt, showing why calling this tool. Should start with "I\'m calling the ...(tool) to ...(target)". Rememeber to keep the same language of the ultimate task.',
10835
+ "description": 'The user-side prompt, showing what you are doing. e.g. "Openning x.com." or "Writing the post."',
10835
10836
  },
10836
10837
  toolCall: definition.input_schema,
10837
10838
  },
@@ -11135,13 +11136,14 @@ class Eko {
11135
11136
  constructor(llmConfig, ekoConfig) {
11136
11137
  this.toolRegistry = new ToolRegistry();
11137
11138
  this.workflowGeneratorMap = new Map();
11138
- this.prompt = "";
11139
+ this.prompt = '';
11139
11140
  this.tabs = [];
11140
11141
  this.workflow = undefined;
11141
11142
  this.llmProvider = LLMProviderFactory.buildLLMProvider(llmConfig);
11142
11143
  this.ekoConfig = this.buildEkoConfig(ekoConfig);
11143
11144
  this.registerTools();
11144
- logger.info("using Eko@" + "0fbae27efeeb93942eb22d3594375674b23788cb");
11145
+ logger.info("using Eko@" + "0b8135fc46d59eb59eb56c57564e2db06526249b");
11146
+ logger.debug("caller's ekoConfig:", ekoConfig);
11145
11147
  }
11146
11148
  static getLogger() {
11147
11149
  return logger;
@@ -11169,10 +11171,10 @@ class Eko {
11169
11171
  const hooks = callback.hooks;
11170
11172
  // these tools could not work without corresponding hook
11171
11173
  const tool2isHookExists = {
11172
- "human_input_text": Boolean(hooks.onHumanInputText),
11173
- "human_input_single_choice": Boolean(hooks.onHumanInputSingleChoice),
11174
- "human_input_multiple_choice": Boolean(hooks.onHumanInputMultipleChoice),
11175
- "human_operate": Boolean(hooks.onHumanOperate),
11174
+ 'human_input_text': Boolean(hooks.onHumanInputText),
11175
+ 'human_input_single_choice': Boolean(hooks.onHumanInputSingleChoice),
11176
+ 'human_input_multiple_choice': Boolean(hooks.onHumanInputMultipleChoice),
11177
+ 'human_operate': Boolean(hooks.onHumanOperate),
11176
11178
  };
11177
11179
  tools = tools.filter(tool => {
11178
11180
  if (tool.name in tool2isHookExists) {
@@ -11190,7 +11192,7 @@ class Eko {
11190
11192
  tools.forEach(tool => this.toolRegistry.registerTool(tool));
11191
11193
  }
11192
11194
  async generate(prompt, tabs = [], param) {
11193
- logger.info("workflow generating...");
11195
+ logger.info("workflow generating...", prompt);
11194
11196
  this.prompt = prompt;
11195
11197
  this.tabs = tabs;
11196
11198
  let toolRegistry = this.toolRegistry;
@@ -11216,37 +11218,38 @@ class Eko {
11216
11218
  async execute(workflow) {
11217
11219
  logger.info("workflow executing...");
11218
11220
  let prompt = this.prompt;
11219
- let description = "";
11221
+ let description = '';
11220
11222
  workflow.nodes.forEach(node => {
11221
- description += node.name + "\n";
11223
+ description += node.name + '\n';
11222
11224
  });
11223
11225
  const json = {
11224
- "id": "workflow_id",
11225
- "name": prompt,
11226
- "description": prompt,
11227
- "nodes": [
11226
+ 'id': 'workflow_id',
11227
+ 'name': prompt,
11228
+ 'description': prompt,
11229
+ 'nodes': [
11228
11230
  {
11229
- "id": "sub_task_id",
11230
- "type": "action",
11231
- "action": {
11232
- "type": "prompt",
11233
- "name": prompt,
11234
- "description": description,
11235
- "tools": [
11236
- "browser_use",
11237
- "document_agent",
11238
- "export_file",
11239
- "extract_content",
11240
- "open_url",
11241
- "tab_management",
11242
- "web_search",
11243
- "human_input_text",
11244
- "human_input_single_choice",
11245
- "human_input_multiple_choice",
11246
- "human_operate",
11231
+ 'id': 'sub_task_id',
11232
+ 'type': 'action',
11233
+ 'action': {
11234
+ 'type': 'prompt',
11235
+ 'name': prompt,
11236
+ 'description': description,
11237
+ 'tools': [
11238
+ 'browser_use',
11239
+ 'document_agent',
11240
+ 'export_file',
11241
+ 'extract_content',
11242
+ 'open_url',
11243
+ 'tab_management',
11244
+ 'switch_tab',
11245
+ 'web_search',
11246
+ 'human_input_text',
11247
+ 'human_input_single_choice',
11248
+ 'human_input_multiple_choice',
11249
+ 'human_operate',
11247
11250
  ],
11248
11251
  },
11249
- "dependencies": []
11252
+ 'dependencies': [],
11250
11253
  },
11251
11254
  ],
11252
11255
  };
@@ -11284,7 +11287,7 @@ class Eko {
11284
11287
  return await this.workflow.cancel();
11285
11288
  }
11286
11289
  else {
11287
- throw Error("`Eko` instance do not have a `workflow` member");
11290
+ throw Error('`Eko` instance do not have a `workflow` member');
11288
11291
  }
11289
11292
  }
11290
11293
  async modify(workflow, prompt) {
@@ -59,6 +59,9 @@ export interface ScreenshotImage {
59
59
  export interface TabManagementParam {
60
60
  command: string;
61
61
  }
62
+ export interface SwitchTabParam {
63
+ tabId: number;
64
+ }
62
65
  export type TabManagementResult = TabInfo | CloseTabInfo | TabInfo[];
63
66
  export interface TabInfo {
64
67
  tabId?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eko-ai/eko",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
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",