@eko-ai/eko 2.0.2-alpha.0 → 2.0.2-alpha.2

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,GAAG,IAAI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U,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"}
@@ -11,6 +11,16 @@ export default abstract class BaseBrowserAgent extends Agent {
11
11
  url: string;
12
12
  title?: string;
13
13
  }>;
14
+ protected abstract get_all_tabs(agentContext: AgentContext): Promise<Array<{
15
+ tabId: number;
16
+ url: string;
17
+ title: string;
18
+ }>>;
19
+ protected abstract switch_tab(agentContext: AgentContext, tabId: number): Promise<{
20
+ tabId: number;
21
+ url: string;
22
+ title: string;
23
+ }>;
14
24
  protected go_back(agentContext: AgentContext): Promise<void>;
15
25
  protected extract_content(agentContext: AgentContext): Promise<string>;
16
26
  protected controlMcpTools(agentContext: AgentContext, messages: LanguageModelV1Prompt, loopNum: number): Promise<{
@@ -21,9 +31,15 @@ export default abstract class BaseBrowserAgent extends Agent {
21
31
  protected get_current_page(agentContext: AgentContext): Promise<{
22
32
  url: string;
23
33
  title?: string;
24
- tabId?: string;
25
- windowId?: string;
34
+ tabId?: number;
26
35
  }>;
36
+ protected lastToolResult(messages: LanguageModelV1Prompt): {
37
+ id: string;
38
+ toolName: string;
39
+ args: unknown;
40
+ result: unknown;
41
+ isError?: boolean;
42
+ } | null;
27
43
  protected abstract execute_script(agentContext: AgentContext, func: (...args: any[]) => void, args: any[]): Promise<any>;
28
44
  protected execute_mcp_script(agentContext: AgentContext, script: string): Promise<string | number | Record<string, any> | undefined>;
29
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"browser_base.d.ts","sourceRoot":"","sources":["../../../src/agent/browser/browser_base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAA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AAE,EAAE,SAAS,CAAC,EAAE,UAAU;IA6BvE,SAAS,CAAC,QAAQ,CAAC,MAAM,CACvB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC;IAEhB,SAAS,CAAC,QAAQ,CAAC,KAAK,CACtB,YAAY,EAAE,YAAY,EAC1B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GACvC,OAAO,CAAC,IAAI,CAAC;IAEhB,SAAS,CAAC,QAAQ,CAAC,MAAM,CACvB,YAAY,EAAE,YAAY,EAC1B,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,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;cAoUN,cAAc,CAC5B,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC,IAAI,CAAC;CAuBjB"}
@@ -4,8 +4,7 @@ import { Tool, IMcpClient } from "../types";
4
4
  import { LanguageModelV1Prompt } from "@ai-sdk/provider";
5
5
  export declare const AGENT_NAME = "Computer";
6
6
  export default abstract class BaseComputerAgent extends Agent {
7
- readonly keyboardKeys: string[];
8
- constructor(llms?: string[], ext_tools?: Tool[], mcpClient?: IMcpClient);
7
+ constructor(llms?: string[], ext_tools?: Tool[], mcpClient?: IMcpClient, keyboardKeys?: string[]);
9
8
  protected abstract screenshot(agentContext: AgentContext): Promise<{
10
9
  imageBase64: string;
11
10
  imageType: "image/jpeg" | "image/png";
@@ -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;AAC/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;IAC3D,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,CAU7B;gBAEU,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS,CAAC,EAAE,UAAU;IAiBvE,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,MAAM,CACvB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC;IAEhB,SAAS,CAAC,QAAQ,CAAC,KAAK,CACtB,YAAY,EAAE,YAAY,EAC1B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,UAAU,EAAE,MAAM,EAClB,WAAW,EA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E,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC;IAEhB,OAAO,CAAC,cAAc;cAwON,cAAc,CAC5B,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC,IAAI,CAAC;CAuCjB"}
@@ -8,7 +8,7 @@ export default abstract class BaseShellAgent extends Agent {
8
8
  session_id: string;
9
9
  }>;
10
10
  protected abstract shell_exec(agentContext: AgentContext, session_id: string, command: string): Promise<string>;
11
- protected abstract close_session(agentContext: AgentContext, session_id: string): Promise<string>;
11
+ protected abstract close_session(agentContext: AgentContext, session_id: string): Promise<void>;
12
12
  private buildInitTools;
13
13
  }
14
14
  //# sourceMappingURL=shell.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/agent/shell.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,UAAU,CAAC;AAElC,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,cAAe,SAAQ,KAAK;gBAC5C,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS,CAAC,EAAE,UAAU;IAiBvE,SAAS,CAAC,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,MAAM,CAAC;IAElB,OAAO,CAAC,cAAc;CA+EvB"}
1
+ {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/agent/shell.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,UAAU,CAAC;AAElC,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,cAAe,SAAQ,KAAK;gBAC5C,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS,CAAC,EAAE,UAAU;IAiBvE,SAAS,CAAC,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"}
@@ -2,6 +2,7 @@ type GlobalConfig = {
2
2
  name: string;
3
3
  platform: "windows" | "mac" | "linux";
4
4
  maxReactNum: number;
5
+ maxTokens: number;
5
6
  };
6
7
  declare const config: GlobalConfig;
7
8
  export default config;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,GAAG,KAAK,GAAG,OAAO,CAAC;IACtC,WAAW,EAAE,MAAM,CAAC;CACrB,CAAA;AAED,QAAA,MAAM,MAAM,EAAE,YAIb,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,GAAG,KAAK,GAAG,OAAO,CAAC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,QAAA,MAAM,MAAM,EAAE,YAKb,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -12,6 +12,7 @@ export declare class Eko {
12
12
  initContext(workflow: Workflow, contextParams?: Record<string, any>): Promise<Context>;
13
13
  private doRunWorkflow;
14
14
  getTask(taskId: string): Context | undefined;
15
+ getAllTaskId(): string[];
15
16
  deleteTask(taskId: string): boolean;
16
17
  abortTask(taskId: string): boolean;
17
18
  addAgent(agent: Agent): void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKjC,qBAAa,GAAG;IACd,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,OAAO,CAAuB;gBAE1B,MAAM,EAAE,SAAS;IAKhB,QAAQ,CACnB,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,MAAiB,EAC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AAO,CAAC,QAAQ,CAAC;IAwBP,MAAM,CACjB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,QAAQ,CAAC;IAcP,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAkB3C,GAAG,CACd,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,MAAiB,EACzB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAClC,OAAO,CAAC,SAAS,CAAC;IAKR,WAAW,CACtB,QAAQ,EAAE,QAAQ,EAClB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAClC,OAAO,CAAC,OAAO,CAAC;YAoBL,aAAa;IA+BpB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAI5C,YAAY,IAAI,MAAM,EAAE;IAIxB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAInC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAUlC,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;CAIpC"}
package/dist/index.cjs.js CHANGED
@@ -7,7 +7,8 @@ var buffer = require('buffer');
7
7
  const config = {
8
8
  name: "Fellou",
9
9
  platform: "mac",
10
- maxReactNum: 100
10
+ maxReactNum: 100,
11
+ maxTokens: 16000
11
12
  };
12
13
 
13
14
  var LogLevel;
@@ -12763,7 +12764,7 @@ class RetryLanguageModel {
12763
12764
  constructor(llms, names, stream_first_timeout) {
12764
12765
  this.llms = llms;
12765
12766
  this.names = names || [];
12766
- this.stream_first_timeout = stream_first_timeout || 20000;
12767
+ this.stream_first_timeout = stream_first_timeout || 30000;
12767
12768
  if (this.names.indexOf("default") == -1) {
12768
12769
  this.names.push("default");
12769
12770
  }
@@ -12777,7 +12778,7 @@ class RetryLanguageModel {
12777
12778
  toolChoice: request.toolChoice,
12778
12779
  },
12779
12780
  prompt: request.messages,
12780
- maxTokens: request.maxTokens,
12781
+ maxTokens: request.maxTokens || config.maxTokens,
12781
12782
  temperature: request.temperature,
12782
12783
  topP: request.topP,
12783
12784
  topK: request.topK,
@@ -12800,6 +12801,9 @@ class RetryLanguageModel {
12800
12801
  return result;
12801
12802
  }
12802
12803
  catch (e) {
12804
+ if (e?.name === "AbortError") {
12805
+ throw e;
12806
+ }
12803
12807
  if (Log.isEnableInfo()) {
12804
12808
  Log.info(`LLM nonstream request, name: ${name} => `, {
12805
12809
  tools: options.mode?.tools,
@@ -12820,7 +12824,7 @@ class RetryLanguageModel {
12820
12824
  toolChoice: request.toolChoice,
12821
12825
  },
12822
12826
  prompt: request.messages,
12823
- maxTokens: request.maxTokens,
12827
+ maxTokens: request.maxTokens || config.maxTokens,
12824
12828
  temperature: request.temperature,
12825
12829
  topP: request.topP,
12826
12830
  topK: request.topK,
@@ -12861,6 +12865,9 @@ class RetryLanguageModel {
12861
12865
  return result;
12862
12866
  }
12863
12867
  catch (e) {
12868
+ if (e?.name === "AbortError") {
12869
+ throw e;
12870
+ }
12864
12871
  if (Log.isEnableInfo()) {
12865
12872
  Log.info(`LLM stream request, name: ${name} => `, {
12866
12873
  tools: options.mode?.tools,
@@ -16250,7 +16257,7 @@ class Agent {
16250
16257
  nodeId: agentContext.agentChain.agent.id,
16251
16258
  environment: config.platform,
16252
16259
  agent_name: agentContext.agent.Name,
16253
- }
16260
+ },
16254
16261
  });
16255
16262
  },
16256
16263
  };
@@ -16322,12 +16329,17 @@ class Agent {
16322
16329
  else if (!isError && text.length == 0) {
16323
16330
  text = "Successful";
16324
16331
  }
16325
- let result = { result: text };
16332
+ let contentText = {
16333
+ type: "text",
16334
+ text: text,
16335
+ };
16336
+ let result = text;
16326
16337
  if (text &&
16327
16338
  ((text.startsWith("{") && text.endsWith("}")) ||
16328
16339
  (text.startsWith("[") && text.endsWith("]")))) {
16329
16340
  try {
16330
16341
  result = JSON.parse(text);
16342
+ contentText = null;
16331
16343
  }
16332
16344
  catch (e) { }
16333
16345
  }
@@ -16336,6 +16348,7 @@ class Agent {
16336
16348
  toolCallId: toolUse.toolCallId,
16337
16349
  toolName: toolUse.toolName,
16338
16350
  result: result,
16351
+ content: contentText ? [contentText] : undefined,
16339
16352
  isError: isError,
16340
16353
  };
16341
16354
  }
@@ -16829,7 +16842,7 @@ class Planner {
16829
16842
  ];
16830
16843
  }
16831
16844
  let request = {
16832
- maxTokens: 1024,
16845
+ maxTokens: 4096,
16833
16846
  temperature: 0.7,
16834
16847
  messages: messages,
16835
16848
  abortSignal: this.context.controller.signal,
@@ -16933,7 +16946,7 @@ class Eko {
16933
16946
  throw new Error("The task does not exist");
16934
16947
  }
16935
16948
  try {
16936
- return this.doRunWorkflow(context);
16949
+ return await this.doRunWorkflow(context);
16937
16950
  }
16938
16951
  catch (e) {
16939
16952
  return {
@@ -16998,6 +17011,9 @@ class Eko {
16998
17011
  getTask(taskId) {
16999
17012
  return this.taskMap.get(taskId);
17000
17013
  }
17014
+ getAllTaskId() {
17015
+ return [...this.taskMap.keys()];
17016
+ }
17001
17017
  deleteTask(taskId) {
17002
17018
  return this.taskMap.delete(taskId);
17003
17019
  }
@@ -17457,34 +17473,55 @@ class BaseTimerAgent extends Agent {
17457
17473
 
17458
17474
  const AGENT_NAME$1 = "Computer";
17459
17475
  class BaseComputerAgent extends Agent {
17460
- constructor(llms, ext_tools, mcpClient) {
17476
+ constructor(llms, ext_tools, mcpClient, keyboardKeys) {
17461
17477
  const _tools_ = [];
17462
17478
  super({
17463
17479
  name: AGENT_NAME$1,
17464
- description: "You are a computer operation agent, who interacts with the computer using mouse and keyboard, completing specified tasks step by step based on the given tasks and screenshots. After each of your operations, you will receive the latest computer screenshot to evaluate the task execution status.",
17480
+ description: `You are a computer operation agent, who interacts with the computer using mouse and keyboard, completing specified tasks step by step based on the given tasks and screenshots. After each of your operations, you will receive the latest computer screenshot to evaluate the task execution status.
17481
+ This is a computer GUI interface, observe the execution through screenshots, and specify action sequences to complete designated tasks.
17482
+ * COMPUTER OPERATIONS:
17483
+ - You can operate the application using shortcuts.
17484
+ - If stuck, try alternative approaches`,
17465
17485
  tools: _tools_,
17466
17486
  llms: llms,
17467
17487
  mcpClient: mcpClient,
17468
- planDescription: "Computer operation agent, interact with the computer using the mouse and keyboard."
17488
+ planDescription: "Computer operation agent, interact with the computer using the mouse and keyboard, operation application."
17469
17489
  });
17470
- this.keyboardKeys = [
17471
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
17472
- 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
17473
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
17474
- 'enter', 'esc', 'backspace', 'tab', 'space', 'delete',
17475
- 'ctrl', 'alt', 'shift', 'win',
17476
- 'up', 'down', 'left', 'right',
17477
- 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12',
17478
- 'ctrl+c', 'ctrl+v', 'ctrl+x', 'ctrl+z', 'ctrl+a', 'ctrl+s',
17479
- 'alt+tab', 'alt+f4', 'ctrl+alt+delete'
17480
- ];
17481
- let init_tools = this.buildInitTools();
17490
+ if (!keyboardKeys) {
17491
+ if (config.platform == "windows") {
17492
+ keyboardKeys = [
17493
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
17494
+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
17495
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
17496
+ 'enter', 'esc', 'backspace', 'tab', 'space', 'delete',
17497
+ 'ctrl', 'alt', 'shift', 'win',
17498
+ 'up', 'down', 'left', 'right',
17499
+ 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12',
17500
+ 'ctrl+c', 'ctrl+v', 'ctrl+x', 'ctrl+z', 'ctrl+a', 'ctrl+s',
17501
+ 'alt+tab', 'alt+f4', 'ctrl+alt+delete'
17502
+ ];
17503
+ }
17504
+ else {
17505
+ keyboardKeys = [
17506
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
17507
+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
17508
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
17509
+ 'enter', 'esc', 'backspace', 'tab', 'space', 'delete',
17510
+ 'command', 'option', 'shift', 'control',
17511
+ 'up', 'down', 'left', 'right',
17512
+ 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12',
17513
+ 'command+c', 'command+v', 'command+x', 'command+z', 'command+a', 'command+s',
17514
+ 'command+tab', 'command+q', 'command+escape'
17515
+ ];
17516
+ }
17517
+ }
17518
+ let init_tools = this.buildInitTools(keyboardKeys);
17482
17519
  if (ext_tools && ext_tools.length > 0) {
17483
17520
  init_tools = mergeTools(init_tools, ext_tools);
17484
17521
  }
17485
17522
  init_tools.forEach((tool) => _tools_.push(tool));
17486
17523
  }
17487
- buildInitTools() {
17524
+ buildInitTools(keyboardKeys) {
17488
17525
  return [
17489
17526
  {
17490
17527
  name: "typing",
@@ -17585,7 +17622,7 @@ class BaseComputerAgent extends Agent {
17585
17622
  key: {
17586
17623
  type: "string",
17587
17624
  description: "Key to press",
17588
- enum: this.keyboardKeys,
17625
+ enum: keyboardKeys,
17589
17626
  },
17590
17627
  },
17591
17628
  required: ["key"],
@@ -17603,7 +17640,7 @@ class BaseComputerAgent extends Agent {
17603
17640
  keys: {
17604
17641
  type: "string",
17605
17642
  description: "Key combination to press",
17606
- enum: this.keyboardKeys,
17643
+ enum: keyboardKeys,
17607
17644
  },
17608
17645
  },
17609
17646
  required: ["keys"],
@@ -17649,14 +17686,16 @@ class BaseComputerAgent extends Agent {
17649
17686
  properties: {
17650
17687
  duration: {
17651
17688
  type: "number",
17652
- description: "Duration in seconds",
17653
- default: 0.5,
17689
+ description: "Duration in millisecond",
17690
+ default: 500,
17691
+ minimum: 200,
17692
+ maximum: 2000,
17654
17693
  },
17655
17694
  },
17656
17695
  required: ["duration"],
17657
17696
  },
17658
17697
  execute: async (args, agentContext) => {
17659
- return await this.callInnerTool(() => sleep((args.duration || 0.5) * 1000));
17698
+ return await this.callInnerTool(() => sleep((args.duration || 200)));
17660
17699
  },
17661
17700
  },
17662
17701
  ];
@@ -17700,10 +17739,13 @@ class BaseComputerAgent extends Agent {
17700
17739
 
17701
17740
  class BaseBrowserAgent extends Agent {
17702
17741
  async go_back(agentContext) {
17703
- await this.execute_script(agentContext, () => {
17704
- return window.navigation.back();
17705
- }, []);
17706
- await sleep(200);
17742
+ try {
17743
+ await this.execute_script(agentContext, () => {
17744
+ return window.navigation.back();
17745
+ }, []);
17746
+ await sleep(100);
17747
+ }
17748
+ catch (e) { }
17707
17749
  }
17708
17750
  async extract_content(agentContext) {
17709
17751
  let content = await this.execute_script(agentContext, () => {
@@ -17739,7 +17781,7 @@ class BaseBrowserAgent extends Agent {
17739
17781
  environment: "browser",
17740
17782
  agent_name: agentContext.agent.Name,
17741
17783
  browser_url: agentContext.variables.get("lastUrl"),
17742
- }
17784
+ },
17743
17785
  });
17744
17786
  if (result.extInfo &&
17745
17787
  result.extInfo["javascript"] &&
@@ -17779,6 +17821,42 @@ class BaseBrowserAgent extends Agent {
17779
17821
  };
17780
17822
  }, []);
17781
17823
  }
17824
+ lastToolResult(messages) {
17825
+ let lastMessage = messages[messages.length - 1];
17826
+ if (lastMessage.role != "tool") {
17827
+ return null;
17828
+ }
17829
+ let toolResult = lastMessage.content.filter((t) => t.type == "tool-result")[0];
17830
+ if (!toolResult) {
17831
+ return null;
17832
+ }
17833
+ let result = toolResult.result;
17834
+ let isError = toolResult.isError;
17835
+ for (let i = messages.length - 2; i > 0; i--) {
17836
+ if (messages[i].role !== "assistant" ||
17837
+ typeof messages[i].content == "string") {
17838
+ continue;
17839
+ }
17840
+ for (let j = 0; j < messages[i].content.length; j++) {
17841
+ let content = messages[i].content[j];
17842
+ if (typeof content !== "string" && content.type !== "tool-call") {
17843
+ continue;
17844
+ }
17845
+ let toolUse = content;
17846
+ if (toolResult.toolCallId != toolUse.toolCallId) {
17847
+ continue;
17848
+ }
17849
+ return {
17850
+ id: toolResult.toolCallId,
17851
+ toolName: toolUse.toolName,
17852
+ args: toolUse.args,
17853
+ result,
17854
+ isError,
17855
+ };
17856
+ }
17857
+ }
17858
+ return null;
17859
+ }
17782
17860
  async execute_mcp_script(agentContext, script) {
17783
17861
  return;
17784
17862
  }
@@ -17805,7 +17883,7 @@ function run_build_dom_tree() {
17805
17883
  return window.clickable_elements[highlightIndex];
17806
17884
  }
17807
17885
  function remove_highlight() {
17808
- let highlight = document.getElementById('playwright-highlight-container');
17886
+ let highlight = document.getElementById('eko-highlight-container');
17809
17887
  if (highlight) {
17810
17888
  highlight.remove();
17811
17889
  }
@@ -17943,10 +18021,10 @@ function run_build_dom_tree() {
17943
18021
  let highlightIndex = 0; // Reset highlight index
17944
18022
  function highlightElement(element, index, parentIframe = null) {
17945
18023
  // Create or get highlight container
17946
- let container = document.getElementById('playwright-highlight-container');
18024
+ let container = document.getElementById('eko-highlight-container');
17947
18025
  if (!container) {
17948
18026
  container = document.createElement('div');
17949
- container.id = 'playwright-highlight-container';
18027
+ container.id = 'eko-highlight-container';
17950
18028
  container.style.position = 'fixed';
17951
18029
  container.style.pointerEvents = 'none';
17952
18030
  container.style.top = '0';
@@ -17999,7 +18077,7 @@ function run_build_dom_tree() {
17999
18077
  overlay.style.height = `${rect.height}px`;
18000
18078
  // Create label
18001
18079
  const label = document.createElement('div');
18002
- label.className = 'playwright-highlight-label';
18080
+ label.className = 'eko-highlight-label';
18003
18081
  label.style.position = 'absolute';
18004
18082
  label.style.background = baseColor;
18005
18083
  label.style.color = 'white';
@@ -18033,7 +18111,7 @@ function run_build_dom_tree() {
18033
18111
  container.appendChild(overlay);
18034
18112
  container.appendChild(label);
18035
18113
  // Store reference for cleanup
18036
- element.setAttribute('browser-user-highlight-id', `playwright-highlight-${index}`);
18114
+ element.setAttribute('eko-user-highlight-id', `eko-highlight-${index}`);
18037
18115
  return index + 1;
18038
18116
  }
18039
18117
  // Helper function to generate XPath as a tree
@@ -18404,6 +18482,9 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18404
18482
  }
18405
18483
  async input_text(agentContext, index, text, enter) {
18406
18484
  await this.execute_script(agentContext, typing, [{ index, text, enter }]);
18485
+ if (enter) {
18486
+ await sleep(200);
18487
+ }
18407
18488
  }
18408
18489
  async click_element(agentContext, index, num_clicks, button) {
18409
18490
  await this.execute_script(agentContext, do_click, [
@@ -18431,7 +18512,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18431
18512
  try {
18432
18513
  let element_result = null;
18433
18514
  for (let i = 0; i < 5; i++) {
18434
- await sleep(300);
18515
+ await sleep(200);
18435
18516
  await this.execute_script(agentContext, run_build_dom_tree, []);
18436
18517
  element_result = (await this.execute_script(agentContext, () => {
18437
18518
  return window.get_clickable_elements(true);
@@ -18578,15 +18659,22 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18578
18659
  properties: {
18579
18660
  amount: {
18580
18661
  type: "number",
18581
- description: "Scroll amount (positive for up, negative for down)",
18582
- minimum: -10,
18662
+ description: "Scroll amount (up / down)",
18663
+ minimum: 1,
18583
18664
  maximum: 10,
18584
18665
  },
18666
+ direction: {
18667
+ type: "string",
18668
+ enum: ["up", "down"],
18669
+ },
18585
18670
  },
18586
- required: ["amount"],
18671
+ required: ["amount", "direction"],
18587
18672
  },
18588
18673
  execute: async (args, agentContext) => {
18589
- return await this.callInnerTool(() => this.scroll_mouse_wheel(agentContext, args.amount));
18674
+ return await this.callInnerTool(async () => {
18675
+ let amount = args.amount;
18676
+ await this.scroll_mouse_wheel(agentContext, args.direction == "up" ? -amount : amount);
18677
+ });
18590
18678
  },
18591
18679
  },
18592
18680
  {
@@ -18617,6 +18705,34 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18617
18705
  return await this.callInnerTool(() => this.extract_content(agentContext));
18618
18706
  },
18619
18707
  },
18708
+ {
18709
+ name: "get_all_tabs",
18710
+ description: "Get all tabs of the current browser",
18711
+ parameters: {
18712
+ type: "object",
18713
+ properties: {},
18714
+ },
18715
+ execute: async (args, agentContext) => {
18716
+ return await this.callInnerTool(() => this.get_all_tabs(agentContext));
18717
+ },
18718
+ },
18719
+ {
18720
+ name: "switch_tab",
18721
+ description: "Switch to the specified tab page",
18722
+ parameters: {
18723
+ type: "object",
18724
+ properties: {
18725
+ tabId: {
18726
+ type: "number",
18727
+ description: "Tab ID, obtained through get_all_tabs",
18728
+ },
18729
+ },
18730
+ required: ["tabId"],
18731
+ },
18732
+ execute: async (args, agentContext) => {
18733
+ return await this.callInnerTool(() => this.switch_tab(agentContext, args.tabId));
18734
+ },
18735
+ },
18620
18736
  {
18621
18737
  name: "wait",
18622
18738
  description: "Wait for specified duration",
@@ -18625,22 +18741,23 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18625
18741
  properties: {
18626
18742
  duration: {
18627
18743
  type: "number",
18628
- description: "Duration in seconds",
18629
- default: 0.5,
18744
+ description: "Duration in millisecond",
18745
+ default: 500,
18746
+ minimum: 200,
18747
+ maximum: 2000,
18630
18748
  },
18631
18749
  },
18632
18750
  required: ["duration"],
18633
18751
  },
18634
18752
  execute: async (args, agentContext) => {
18635
- return await this.callInnerTool(() => sleep((args.duration || 0.5) * 1000));
18753
+ return await this.callInnerTool(() => sleep((args.duration || 200)));
18636
18754
  },
18637
18755
  },
18638
18756
  ];
18639
18757
  }
18640
18758
  async handleMessages(agentContext, messages) {
18641
- let lastMessage = messages[messages.length - 1];
18642
- if (lastMessage.role == "tool" &&
18643
- lastMessage.content.filter((t) => t.type == "tool-result").length > 0) {
18759
+ let lastTool = this.lastToolResult(messages);
18760
+ if (lastTool && lastTool.toolName !== "extract_content" && lastTool.toolName !== "get_all_tabs") {
18644
18761
  await sleep(200);
18645
18762
  let result = await this.screenshot_and_html(agentContext);
18646
18763
  let image = toImage(result.imageBase64);
@@ -18698,6 +18815,10 @@ function typing(params) {
18698
18815
  }
18699
18816
  else {
18700
18817
  input.value = text;
18818
+ if (input.__proto__) {
18819
+ let value_setter = Object.getOwnPropertyDescriptor(input.__proto__, "value")?.set;
18820
+ value_setter && value_setter.call(input, text);
18821
+ }
18701
18822
  }
18702
18823
  input.dispatchEvent(new Event("input", { bubbles: true }));
18703
18824
  if (enter) {
@@ -18778,7 +18899,7 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
18778
18899
  tools: _tools_,
18779
18900
  llms: llms,
18780
18901
  mcpClient: mcpClient,
18781
- planDescription: "Browser operation agent, interact with the browser using the mouse and keyboard."
18902
+ planDescription: "Browser operation agent, interact with the browser using the mouse and keyboard.",
18782
18903
  });
18783
18904
  let init_tools = this.buildInitTools();
18784
18905
  if (ext_tools && ext_tools.length > 0) {
@@ -18906,15 +19027,22 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
18906
19027
  properties: {
18907
19028
  amount: {
18908
19029
  type: "number",
18909
- description: "Scroll amount (positive for up, negative for down)",
18910
- minimum: -10,
19030
+ description: "Scroll amount (up / down)",
19031
+ minimum: 1,
18911
19032
  maximum: 10,
18912
19033
  },
19034
+ direction: {
19035
+ type: "string",
19036
+ enum: ["up", "down"],
19037
+ },
18913
19038
  },
18914
- required: ["amount"],
19039
+ required: ["amount", "direction"],
18915
19040
  },
18916
19041
  execute: async (args, agentContext) => {
18917
- return await this.callInnerTool(() => this.scroll(agentContext, args.amount));
19042
+ return await this.callInnerTool(async () => {
19043
+ let amount = args.amount;
19044
+ await this.scroll(agentContext, args.direction == "up" ? -amount : amount);
19045
+ });
18918
19046
  },
18919
19047
  },
18920
19048
  {
@@ -18975,6 +19103,34 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
18975
19103
  return await this.callInnerTool(() => this.drag_and_drop(agentContext, args.x1, args.y1, args.x2, args.y2));
18976
19104
  },
18977
19105
  },
19106
+ {
19107
+ name: "get_all_tabs",
19108
+ description: "Get all tabs of the current browser",
19109
+ parameters: {
19110
+ type: "object",
19111
+ properties: {},
19112
+ },
19113
+ execute: async (args, agentContext) => {
19114
+ return await this.callInnerTool(() => this.get_all_tabs(agentContext));
19115
+ },
19116
+ },
19117
+ {
19118
+ name: "switch_tab",
19119
+ description: "Switch to the specified tab page",
19120
+ parameters: {
19121
+ type: "object",
19122
+ properties: {
19123
+ tabId: {
19124
+ type: "number",
19125
+ description: "Tab ID, obtained through get_all_tabs",
19126
+ },
19127
+ },
19128
+ required: ["tabId"],
19129
+ },
19130
+ execute: async (args, agentContext) => {
19131
+ return await this.callInnerTool(() => this.switch_tab(agentContext, args.tabId));
19132
+ },
19133
+ },
18978
19134
  {
18979
19135
  name: "wait",
18980
19136
  description: "Wait for specified duration",
@@ -18983,22 +19139,23 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
18983
19139
  properties: {
18984
19140
  duration: {
18985
19141
  type: "number",
18986
- description: "Duration in seconds",
18987
- default: 0.5,
19142
+ description: "Duration in millisecond",
19143
+ default: 500,
19144
+ minimum: 200,
19145
+ maximum: 2000,
18988
19146
  },
18989
19147
  },
18990
19148
  required: ["duration"],
18991
19149
  },
18992
19150
  execute: async (args, agentContext) => {
18993
- return await this.callInnerTool(() => sleep((args.duration || 0.5) * 1000));
19151
+ return await this.callInnerTool(() => sleep((args.duration || 200)));
18994
19152
  },
18995
19153
  },
18996
19154
  ];
18997
19155
  }
18998
19156
  async handleMessages(agentContext, messages) {
18999
- let lastMessage = messages[messages.length - 1];
19000
- if (lastMessage.role == "tool" &&
19001
- lastMessage.content.filter((t) => t.type == "tool-result").length > 0) {
19157
+ let lastTool = this.lastToolResult(messages);
19158
+ if (lastTool && lastTool.toolName !== "extract_content" && lastTool.toolName !== "get_all_tabs") {
19002
19159
  await sleep(200);
19003
19160
  let result = await this.screenshot(agentContext);
19004
19161
  let image = toImage(result.imageBase64);
package/dist/index.esm.js CHANGED
@@ -1,7 +1,8 @@
1
1
  const config = {
2
2
  name: "Fellou",
3
3
  platform: "mac",
4
- maxReactNum: 100
4
+ maxReactNum: 100,
5
+ maxTokens: 16000
5
6
  };
6
7
 
7
8
  var LogLevel;
@@ -12728,7 +12729,7 @@ class RetryLanguageModel {
12728
12729
  constructor(llms, names, stream_first_timeout) {
12729
12730
  this.llms = llms;
12730
12731
  this.names = names || [];
12731
- this.stream_first_timeout = stream_first_timeout || 20000;
12732
+ this.stream_first_timeout = stream_first_timeout || 30000;
12732
12733
  if (this.names.indexOf("default") == -1) {
12733
12734
  this.names.push("default");
12734
12735
  }
@@ -12742,7 +12743,7 @@ class RetryLanguageModel {
12742
12743
  toolChoice: request.toolChoice,
12743
12744
  },
12744
12745
  prompt: request.messages,
12745
- maxTokens: request.maxTokens,
12746
+ maxTokens: request.maxTokens || config.maxTokens,
12746
12747
  temperature: request.temperature,
12747
12748
  topP: request.topP,
12748
12749
  topK: request.topK,
@@ -12765,6 +12766,9 @@ class RetryLanguageModel {
12765
12766
  return result;
12766
12767
  }
12767
12768
  catch (e) {
12769
+ if (e?.name === "AbortError") {
12770
+ throw e;
12771
+ }
12768
12772
  if (Log.isEnableInfo()) {
12769
12773
  Log.info(`LLM nonstream request, name: ${name} => `, {
12770
12774
  tools: options.mode?.tools,
@@ -12785,7 +12789,7 @@ class RetryLanguageModel {
12785
12789
  toolChoice: request.toolChoice,
12786
12790
  },
12787
12791
  prompt: request.messages,
12788
- maxTokens: request.maxTokens,
12792
+ maxTokens: request.maxTokens || config.maxTokens,
12789
12793
  temperature: request.temperature,
12790
12794
  topP: request.topP,
12791
12795
  topK: request.topK,
@@ -12826,6 +12830,9 @@ class RetryLanguageModel {
12826
12830
  return result;
12827
12831
  }
12828
12832
  catch (e) {
12833
+ if (e?.name === "AbortError") {
12834
+ throw e;
12835
+ }
12829
12836
  if (Log.isEnableInfo()) {
12830
12837
  Log.info(`LLM stream request, name: ${name} => `, {
12831
12838
  tools: options.mode?.tools,
@@ -16215,7 +16222,7 @@ class Agent {
16215
16222
  nodeId: agentContext.agentChain.agent.id,
16216
16223
  environment: config.platform,
16217
16224
  agent_name: agentContext.agent.Name,
16218
- }
16225
+ },
16219
16226
  });
16220
16227
  },
16221
16228
  };
@@ -16287,12 +16294,17 @@ class Agent {
16287
16294
  else if (!isError && text.length == 0) {
16288
16295
  text = "Successful";
16289
16296
  }
16290
- let result = { result: text };
16297
+ let contentText = {
16298
+ type: "text",
16299
+ text: text,
16300
+ };
16301
+ let result = text;
16291
16302
  if (text &&
16292
16303
  ((text.startsWith("{") && text.endsWith("}")) ||
16293
16304
  (text.startsWith("[") && text.endsWith("]")))) {
16294
16305
  try {
16295
16306
  result = JSON.parse(text);
16307
+ contentText = null;
16296
16308
  }
16297
16309
  catch (e) { }
16298
16310
  }
@@ -16301,6 +16313,7 @@ class Agent {
16301
16313
  toolCallId: toolUse.toolCallId,
16302
16314
  toolName: toolUse.toolName,
16303
16315
  result: result,
16316
+ content: contentText ? [contentText] : undefined,
16304
16317
  isError: isError,
16305
16318
  };
16306
16319
  }
@@ -16794,7 +16807,7 @@ class Planner {
16794
16807
  ];
16795
16808
  }
16796
16809
  let request = {
16797
- maxTokens: 1024,
16810
+ maxTokens: 4096,
16798
16811
  temperature: 0.7,
16799
16812
  messages: messages,
16800
16813
  abortSignal: this.context.controller.signal,
@@ -16898,7 +16911,7 @@ class Eko {
16898
16911
  throw new Error("The task does not exist");
16899
16912
  }
16900
16913
  try {
16901
- return this.doRunWorkflow(context);
16914
+ return await this.doRunWorkflow(context);
16902
16915
  }
16903
16916
  catch (e) {
16904
16917
  return {
@@ -16963,6 +16976,9 @@ class Eko {
16963
16976
  getTask(taskId) {
16964
16977
  return this.taskMap.get(taskId);
16965
16978
  }
16979
+ getAllTaskId() {
16980
+ return [...this.taskMap.keys()];
16981
+ }
16966
16982
  deleteTask(taskId) {
16967
16983
  return this.taskMap.delete(taskId);
16968
16984
  }
@@ -17422,34 +17438,55 @@ class BaseTimerAgent extends Agent {
17422
17438
 
17423
17439
  const AGENT_NAME$1 = "Computer";
17424
17440
  class BaseComputerAgent extends Agent {
17425
- constructor(llms, ext_tools, mcpClient) {
17441
+ constructor(llms, ext_tools, mcpClient, keyboardKeys) {
17426
17442
  const _tools_ = [];
17427
17443
  super({
17428
17444
  name: AGENT_NAME$1,
17429
- description: "You are a computer operation agent, who interacts with the computer using mouse and keyboard, completing specified tasks step by step based on the given tasks and screenshots. After each of your operations, you will receive the latest computer screenshot to evaluate the task execution status.",
17445
+ description: `You are a computer operation agent, who interacts with the computer using mouse and keyboard, completing specified tasks step by step based on the given tasks and screenshots. After each of your operations, you will receive the latest computer screenshot to evaluate the task execution status.
17446
+ This is a computer GUI interface, observe the execution through screenshots, and specify action sequences to complete designated tasks.
17447
+ * COMPUTER OPERATIONS:
17448
+ - You can operate the application using shortcuts.
17449
+ - If stuck, try alternative approaches`,
17430
17450
  tools: _tools_,
17431
17451
  llms: llms,
17432
17452
  mcpClient: mcpClient,
17433
- planDescription: "Computer operation agent, interact with the computer using the mouse and keyboard."
17453
+ planDescription: "Computer operation agent, interact with the computer using the mouse and keyboard, operation application."
17434
17454
  });
17435
- this.keyboardKeys = [
17436
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
17437
- 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
17438
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
17439
- 'enter', 'esc', 'backspace', 'tab', 'space', 'delete',
17440
- 'ctrl', 'alt', 'shift', 'win',
17441
- 'up', 'down', 'left', 'right',
17442
- 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12',
17443
- 'ctrl+c', 'ctrl+v', 'ctrl+x', 'ctrl+z', 'ctrl+a', 'ctrl+s',
17444
- 'alt+tab', 'alt+f4', 'ctrl+alt+delete'
17445
- ];
17446
- let init_tools = this.buildInitTools();
17455
+ if (!keyboardKeys) {
17456
+ if (config.platform == "windows") {
17457
+ keyboardKeys = [
17458
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
17459
+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
17460
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
17461
+ 'enter', 'esc', 'backspace', 'tab', 'space', 'delete',
17462
+ 'ctrl', 'alt', 'shift', 'win',
17463
+ 'up', 'down', 'left', 'right',
17464
+ 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12',
17465
+ 'ctrl+c', 'ctrl+v', 'ctrl+x', 'ctrl+z', 'ctrl+a', 'ctrl+s',
17466
+ 'alt+tab', 'alt+f4', 'ctrl+alt+delete'
17467
+ ];
17468
+ }
17469
+ else {
17470
+ keyboardKeys = [
17471
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
17472
+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
17473
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
17474
+ 'enter', 'esc', 'backspace', 'tab', 'space', 'delete',
17475
+ 'command', 'option', 'shift', 'control',
17476
+ 'up', 'down', 'left', 'right',
17477
+ 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12',
17478
+ 'command+c', 'command+v', 'command+x', 'command+z', 'command+a', 'command+s',
17479
+ 'command+tab', 'command+q', 'command+escape'
17480
+ ];
17481
+ }
17482
+ }
17483
+ let init_tools = this.buildInitTools(keyboardKeys);
17447
17484
  if (ext_tools && ext_tools.length > 0) {
17448
17485
  init_tools = mergeTools(init_tools, ext_tools);
17449
17486
  }
17450
17487
  init_tools.forEach((tool) => _tools_.push(tool));
17451
17488
  }
17452
- buildInitTools() {
17489
+ buildInitTools(keyboardKeys) {
17453
17490
  return [
17454
17491
  {
17455
17492
  name: "typing",
@@ -17550,7 +17587,7 @@ class BaseComputerAgent extends Agent {
17550
17587
  key: {
17551
17588
  type: "string",
17552
17589
  description: "Key to press",
17553
- enum: this.keyboardKeys,
17590
+ enum: keyboardKeys,
17554
17591
  },
17555
17592
  },
17556
17593
  required: ["key"],
@@ -17568,7 +17605,7 @@ class BaseComputerAgent extends Agent {
17568
17605
  keys: {
17569
17606
  type: "string",
17570
17607
  description: "Key combination to press",
17571
- enum: this.keyboardKeys,
17608
+ enum: keyboardKeys,
17572
17609
  },
17573
17610
  },
17574
17611
  required: ["keys"],
@@ -17614,14 +17651,16 @@ class BaseComputerAgent extends Agent {
17614
17651
  properties: {
17615
17652
  duration: {
17616
17653
  type: "number",
17617
- description: "Duration in seconds",
17618
- default: 0.5,
17654
+ description: "Duration in millisecond",
17655
+ default: 500,
17656
+ minimum: 200,
17657
+ maximum: 2000,
17619
17658
  },
17620
17659
  },
17621
17660
  required: ["duration"],
17622
17661
  },
17623
17662
  execute: async (args, agentContext) => {
17624
- return await this.callInnerTool(() => sleep((args.duration || 0.5) * 1000));
17663
+ return await this.callInnerTool(() => sleep((args.duration || 200)));
17625
17664
  },
17626
17665
  },
17627
17666
  ];
@@ -17665,10 +17704,13 @@ class BaseComputerAgent extends Agent {
17665
17704
 
17666
17705
  class BaseBrowserAgent extends Agent {
17667
17706
  async go_back(agentContext) {
17668
- await this.execute_script(agentContext, () => {
17669
- return window.navigation.back();
17670
- }, []);
17671
- await sleep(200);
17707
+ try {
17708
+ await this.execute_script(agentContext, () => {
17709
+ return window.navigation.back();
17710
+ }, []);
17711
+ await sleep(100);
17712
+ }
17713
+ catch (e) { }
17672
17714
  }
17673
17715
  async extract_content(agentContext) {
17674
17716
  let content = await this.execute_script(agentContext, () => {
@@ -17704,7 +17746,7 @@ class BaseBrowserAgent extends Agent {
17704
17746
  environment: "browser",
17705
17747
  agent_name: agentContext.agent.Name,
17706
17748
  browser_url: agentContext.variables.get("lastUrl"),
17707
- }
17749
+ },
17708
17750
  });
17709
17751
  if (result.extInfo &&
17710
17752
  result.extInfo["javascript"] &&
@@ -17744,6 +17786,42 @@ class BaseBrowserAgent extends Agent {
17744
17786
  };
17745
17787
  }, []);
17746
17788
  }
17789
+ lastToolResult(messages) {
17790
+ let lastMessage = messages[messages.length - 1];
17791
+ if (lastMessage.role != "tool") {
17792
+ return null;
17793
+ }
17794
+ let toolResult = lastMessage.content.filter((t) => t.type == "tool-result")[0];
17795
+ if (!toolResult) {
17796
+ return null;
17797
+ }
17798
+ let result = toolResult.result;
17799
+ let isError = toolResult.isError;
17800
+ for (let i = messages.length - 2; i > 0; i--) {
17801
+ if (messages[i].role !== "assistant" ||
17802
+ typeof messages[i].content == "string") {
17803
+ continue;
17804
+ }
17805
+ for (let j = 0; j < messages[i].content.length; j++) {
17806
+ let content = messages[i].content[j];
17807
+ if (typeof content !== "string" && content.type !== "tool-call") {
17808
+ continue;
17809
+ }
17810
+ let toolUse = content;
17811
+ if (toolResult.toolCallId != toolUse.toolCallId) {
17812
+ continue;
17813
+ }
17814
+ return {
17815
+ id: toolResult.toolCallId,
17816
+ toolName: toolUse.toolName,
17817
+ args: toolUse.args,
17818
+ result,
17819
+ isError,
17820
+ };
17821
+ }
17822
+ }
17823
+ return null;
17824
+ }
17747
17825
  async execute_mcp_script(agentContext, script) {
17748
17826
  return;
17749
17827
  }
@@ -17770,7 +17848,7 @@ function run_build_dom_tree() {
17770
17848
  return window.clickable_elements[highlightIndex];
17771
17849
  }
17772
17850
  function remove_highlight() {
17773
- let highlight = document.getElementById('playwright-highlight-container');
17851
+ let highlight = document.getElementById('eko-highlight-container');
17774
17852
  if (highlight) {
17775
17853
  highlight.remove();
17776
17854
  }
@@ -17908,10 +17986,10 @@ function run_build_dom_tree() {
17908
17986
  let highlightIndex = 0; // Reset highlight index
17909
17987
  function highlightElement(element, index, parentIframe = null) {
17910
17988
  // Create or get highlight container
17911
- let container = document.getElementById('playwright-highlight-container');
17989
+ let container = document.getElementById('eko-highlight-container');
17912
17990
  if (!container) {
17913
17991
  container = document.createElement('div');
17914
- container.id = 'playwright-highlight-container';
17992
+ container.id = 'eko-highlight-container';
17915
17993
  container.style.position = 'fixed';
17916
17994
  container.style.pointerEvents = 'none';
17917
17995
  container.style.top = '0';
@@ -17964,7 +18042,7 @@ function run_build_dom_tree() {
17964
18042
  overlay.style.height = `${rect.height}px`;
17965
18043
  // Create label
17966
18044
  const label = document.createElement('div');
17967
- label.className = 'playwright-highlight-label';
18045
+ label.className = 'eko-highlight-label';
17968
18046
  label.style.position = 'absolute';
17969
18047
  label.style.background = baseColor;
17970
18048
  label.style.color = 'white';
@@ -17998,7 +18076,7 @@ function run_build_dom_tree() {
17998
18076
  container.appendChild(overlay);
17999
18077
  container.appendChild(label);
18000
18078
  // Store reference for cleanup
18001
- element.setAttribute('browser-user-highlight-id', `playwright-highlight-${index}`);
18079
+ element.setAttribute('eko-user-highlight-id', `eko-highlight-${index}`);
18002
18080
  return index + 1;
18003
18081
  }
18004
18082
  // Helper function to generate XPath as a tree
@@ -18369,6 +18447,9 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18369
18447
  }
18370
18448
  async input_text(agentContext, index, text, enter) {
18371
18449
  await this.execute_script(agentContext, typing, [{ index, text, enter }]);
18450
+ if (enter) {
18451
+ await sleep(200);
18452
+ }
18372
18453
  }
18373
18454
  async click_element(agentContext, index, num_clicks, button) {
18374
18455
  await this.execute_script(agentContext, do_click, [
@@ -18396,7 +18477,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18396
18477
  try {
18397
18478
  let element_result = null;
18398
18479
  for (let i = 0; i < 5; i++) {
18399
- await sleep(300);
18480
+ await sleep(200);
18400
18481
  await this.execute_script(agentContext, run_build_dom_tree, []);
18401
18482
  element_result = (await this.execute_script(agentContext, () => {
18402
18483
  return window.get_clickable_elements(true);
@@ -18543,15 +18624,22 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18543
18624
  properties: {
18544
18625
  amount: {
18545
18626
  type: "number",
18546
- description: "Scroll amount (positive for up, negative for down)",
18547
- minimum: -10,
18627
+ description: "Scroll amount (up / down)",
18628
+ minimum: 1,
18548
18629
  maximum: 10,
18549
18630
  },
18631
+ direction: {
18632
+ type: "string",
18633
+ enum: ["up", "down"],
18634
+ },
18550
18635
  },
18551
- required: ["amount"],
18636
+ required: ["amount", "direction"],
18552
18637
  },
18553
18638
  execute: async (args, agentContext) => {
18554
- return await this.callInnerTool(() => this.scroll_mouse_wheel(agentContext, args.amount));
18639
+ return await this.callInnerTool(async () => {
18640
+ let amount = args.amount;
18641
+ await this.scroll_mouse_wheel(agentContext, args.direction == "up" ? -amount : amount);
18642
+ });
18555
18643
  },
18556
18644
  },
18557
18645
  {
@@ -18582,6 +18670,34 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18582
18670
  return await this.callInnerTool(() => this.extract_content(agentContext));
18583
18671
  },
18584
18672
  },
18673
+ {
18674
+ name: "get_all_tabs",
18675
+ description: "Get all tabs of the current browser",
18676
+ parameters: {
18677
+ type: "object",
18678
+ properties: {},
18679
+ },
18680
+ execute: async (args, agentContext) => {
18681
+ return await this.callInnerTool(() => this.get_all_tabs(agentContext));
18682
+ },
18683
+ },
18684
+ {
18685
+ name: "switch_tab",
18686
+ description: "Switch to the specified tab page",
18687
+ parameters: {
18688
+ type: "object",
18689
+ properties: {
18690
+ tabId: {
18691
+ type: "number",
18692
+ description: "Tab ID, obtained through get_all_tabs",
18693
+ },
18694
+ },
18695
+ required: ["tabId"],
18696
+ },
18697
+ execute: async (args, agentContext) => {
18698
+ return await this.callInnerTool(() => this.switch_tab(agentContext, args.tabId));
18699
+ },
18700
+ },
18585
18701
  {
18586
18702
  name: "wait",
18587
18703
  description: "Wait for specified duration",
@@ -18590,22 +18706,23 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
18590
18706
  properties: {
18591
18707
  duration: {
18592
18708
  type: "number",
18593
- description: "Duration in seconds",
18594
- default: 0.5,
18709
+ description: "Duration in millisecond",
18710
+ default: 500,
18711
+ minimum: 200,
18712
+ maximum: 2000,
18595
18713
  },
18596
18714
  },
18597
18715
  required: ["duration"],
18598
18716
  },
18599
18717
  execute: async (args, agentContext) => {
18600
- return await this.callInnerTool(() => sleep((args.duration || 0.5) * 1000));
18718
+ return await this.callInnerTool(() => sleep((args.duration || 200)));
18601
18719
  },
18602
18720
  },
18603
18721
  ];
18604
18722
  }
18605
18723
  async handleMessages(agentContext, messages) {
18606
- let lastMessage = messages[messages.length - 1];
18607
- if (lastMessage.role == "tool" &&
18608
- lastMessage.content.filter((t) => t.type == "tool-result").length > 0) {
18724
+ let lastTool = this.lastToolResult(messages);
18725
+ if (lastTool && lastTool.toolName !== "extract_content" && lastTool.toolName !== "get_all_tabs") {
18609
18726
  await sleep(200);
18610
18727
  let result = await this.screenshot_and_html(agentContext);
18611
18728
  let image = toImage(result.imageBase64);
@@ -18663,6 +18780,10 @@ function typing(params) {
18663
18780
  }
18664
18781
  else {
18665
18782
  input.value = text;
18783
+ if (input.__proto__) {
18784
+ let value_setter = Object.getOwnPropertyDescriptor(input.__proto__, "value")?.set;
18785
+ value_setter && value_setter.call(input, text);
18786
+ }
18666
18787
  }
18667
18788
  input.dispatchEvent(new Event("input", { bubbles: true }));
18668
18789
  if (enter) {
@@ -18743,7 +18864,7 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
18743
18864
  tools: _tools_,
18744
18865
  llms: llms,
18745
18866
  mcpClient: mcpClient,
18746
- planDescription: "Browser operation agent, interact with the browser using the mouse and keyboard."
18867
+ planDescription: "Browser operation agent, interact with the browser using the mouse and keyboard.",
18747
18868
  });
18748
18869
  let init_tools = this.buildInitTools();
18749
18870
  if (ext_tools && ext_tools.length > 0) {
@@ -18871,15 +18992,22 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
18871
18992
  properties: {
18872
18993
  amount: {
18873
18994
  type: "number",
18874
- description: "Scroll amount (positive for up, negative for down)",
18875
- minimum: -10,
18995
+ description: "Scroll amount (up / down)",
18996
+ minimum: 1,
18876
18997
  maximum: 10,
18877
18998
  },
18999
+ direction: {
19000
+ type: "string",
19001
+ enum: ["up", "down"],
19002
+ },
18878
19003
  },
18879
- required: ["amount"],
19004
+ required: ["amount", "direction"],
18880
19005
  },
18881
19006
  execute: async (args, agentContext) => {
18882
- return await this.callInnerTool(() => this.scroll(agentContext, args.amount));
19007
+ return await this.callInnerTool(async () => {
19008
+ let amount = args.amount;
19009
+ await this.scroll(agentContext, args.direction == "up" ? -amount : amount);
19010
+ });
18883
19011
  },
18884
19012
  },
18885
19013
  {
@@ -18940,6 +19068,34 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
18940
19068
  return await this.callInnerTool(() => this.drag_and_drop(agentContext, args.x1, args.y1, args.x2, args.y2));
18941
19069
  },
18942
19070
  },
19071
+ {
19072
+ name: "get_all_tabs",
19073
+ description: "Get all tabs of the current browser",
19074
+ parameters: {
19075
+ type: "object",
19076
+ properties: {},
19077
+ },
19078
+ execute: async (args, agentContext) => {
19079
+ return await this.callInnerTool(() => this.get_all_tabs(agentContext));
19080
+ },
19081
+ },
19082
+ {
19083
+ name: "switch_tab",
19084
+ description: "Switch to the specified tab page",
19085
+ parameters: {
19086
+ type: "object",
19087
+ properties: {
19088
+ tabId: {
19089
+ type: "number",
19090
+ description: "Tab ID, obtained through get_all_tabs",
19091
+ },
19092
+ },
19093
+ required: ["tabId"],
19094
+ },
19095
+ execute: async (args, agentContext) => {
19096
+ return await this.callInnerTool(() => this.switch_tab(agentContext, args.tabId));
19097
+ },
19098
+ },
18943
19099
  {
18944
19100
  name: "wait",
18945
19101
  description: "Wait for specified duration",
@@ -18948,22 +19104,23 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
18948
19104
  properties: {
18949
19105
  duration: {
18950
19106
  type: "number",
18951
- description: "Duration in seconds",
18952
- default: 0.5,
19107
+ description: "Duration in millisecond",
19108
+ default: 500,
19109
+ minimum: 200,
19110
+ maximum: 2000,
18953
19111
  },
18954
19112
  },
18955
19113
  required: ["duration"],
18956
19114
  },
18957
19115
  execute: async (args, agentContext) => {
18958
- return await this.callInnerTool(() => sleep((args.duration || 0.5) * 1000));
19116
+ return await this.callInnerTool(() => sleep((args.duration || 200)));
18959
19117
  },
18960
19118
  },
18961
19119
  ];
18962
19120
  }
18963
19121
  async handleMessages(agentContext, messages) {
18964
- let lastMessage = messages[messages.length - 1];
18965
- if (lastMessage.role == "tool" &&
18966
- lastMessage.content.filter((t) => t.type == "tool-result").length > 0) {
19122
+ let lastTool = this.lastToolResult(messages);
19123
+ if (lastTool && lastTool.toolName !== "extract_content" && lastTool.toolName !== "get_all_tabs") {
18967
19124
  await sleep(200);
18968
19125
  let result = await this.screenshot(agentContext);
18969
19126
  let image = toImage(result.imageBase64);
@@ -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;AAO1B,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;IA6BpB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;IAkBtD,QAAQ,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,YAAY,CAAC;IAmD1E,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;IAsD1E,OAAO,CAAC,MAAM;IAoCd,OAAO,CAAC,aAAa;CA0BtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eko-ai/eko",
3
- "version": "2.0.2-alpha.0",
3
+ "version": "2.0.2-alpha.2",
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",