@eko-ai/eko-nodejs 2.2.0 → 3.0.0-alpha.1

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.
@@ -0,0 +1,48 @@
1
+ import { AgentContext, BaseBrowserLabelsAgent } from "@eko-ai/eko";
2
+ import { Browser, Page, BrowserContext } from "playwright";
3
+ export default class BrowserAgent extends BaseBrowserLabelsAgent {
4
+ private cdpWsEndpoint?;
5
+ private userDataDir?;
6
+ private options?;
7
+ protected browser: Browser | null;
8
+ private browser_context;
9
+ private current_page;
10
+ private headless;
11
+ setHeadless(headless: boolean): void;
12
+ setCdpWsEndpoint(cdpWsEndpoint: string): void;
13
+ setOptions(options?: Record<string, any>): void;
14
+ protected screenshot(agentContext: AgentContext): Promise<{
15
+ imageBase64: string;
16
+ imageType: "image/jpeg" | "image/png";
17
+ }>;
18
+ protected navigate_to(agentContext: AgentContext, url: string): Promise<{
19
+ url: string;
20
+ title?: string;
21
+ tabId?: number;
22
+ }>;
23
+ protected get_all_tabs(agentContext: AgentContext): Promise<Array<{
24
+ tabId: number;
25
+ url: string;
26
+ title: string;
27
+ }>>;
28
+ protected switch_tab(agentContext: AgentContext, tabId: number): Promise<{
29
+ tabId: number;
30
+ url: string;
31
+ title: string;
32
+ }>;
33
+ protected input_text(agentContext: AgentContext, index: number, text: string, enter: boolean): Promise<any>;
34
+ protected click_element(agentContext: AgentContext, index: number, num_clicks: number, button: "left" | "right" | "middle"): Promise<any>;
35
+ protected hover_to_element(agentContext: AgentContext, index: number): Promise<void>;
36
+ protected execute_script(agentContext: AgentContext, func: (...args: any[]) => void, args: any[]): Promise<any>;
37
+ private open_url;
38
+ protected currentPage(): Promise<Page>;
39
+ private get_element;
40
+ private sleep;
41
+ protected getBrowserContext(): Promise<BrowserContext>;
42
+ protected initScript(): Promise<{
43
+ path?: string;
44
+ content?: string;
45
+ }>;
46
+ }
47
+ export { BrowserAgent };
48
+ //# sourceMappingURL=browser.d.ts.map
@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1B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;cAiBzC,UAAU,CACxB,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,GAAG,CAAC;cAcC,aAAa,CAC3B,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAClC,OAAO,CAAC,GAAG,CAAC;cAaC,gBAAgB,CAC9B,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC;cASA,cAAc,CAC5B,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,EAC9B,IAAI,EAAE,GAAG,EAAE,GACV,OAAO,CAAC,GAAG,CAAC;YAKD,QAAQ;cAuBN,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;YAW9B,WAAW;IA0BzB,OAAO,CAAC,KAAK;cAIG,iBAAiB;cA6BjB,UAAU,IAAI,OAAO,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAqC3E;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { AgentContext, BaseFileAgent } from "@eko-ai/eko";
2
+ export default class FileAgent extends BaseFileAgent {
3
+ protected file_list(agentContext: AgentContext, directoryPath: string): Promise<Array<{
4
+ path: string;
5
+ name?: string;
6
+ isDirectory?: boolean;
7
+ size?: string;
8
+ modified?: string;
9
+ }>>;
10
+ protected file_read(agentContext: AgentContext, filePath: string): Promise<string>;
11
+ protected file_write(agentContext: AgentContext, filePath: string, content: string, append: boolean): Promise<any>;
12
+ protected file_str_replace(agentContext: AgentContext, filePath: string, oldStr: string, newStr: string): Promise<any>;
13
+ protected file_find_by_name(agentContext: AgentContext, directoryPath: string, globPattern: string): Promise<Array<{
14
+ path: string;
15
+ name?: string;
16
+ isDirectory?: boolean;
17
+ size?: string;
18
+ modified?: string;
19
+ }>>;
20
+ protected formatFileSize(size: number): string;
21
+ }
22
+ export { FileAgent };
23
+ //# sourceMappingURL=file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/file.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE1D,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,aAAa;cAClC,SAAS,CACvB,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,MAAM,GACpB,OAAO,CACR,KAAK,CAAC;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC,CACH;cAkBe,SAAS,CACvB,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC;cAIF,UAAU,CACxB,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,GAAG,CAAC;cAUC,gBAAgB,CAC9B,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,GAAG,CAAC;cAUC,iBAAiB,CAC/B,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,GAClB,OAAO,CACR,KAAK,CAAC;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC,CACH;IAkBD,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAS/C;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { getCdpWsEndpoint } from "./utils";
2
+ export { getCdpWsEndpoint };
3
+ export { BrowserAgent } from "./browser";
4
+ export { FileAgent } from "./file";
5
+ export { SimpleStdioMcpClient } from "./mcp/stdio";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { IMcpClient, McpCallToolParam, McpListToolParam, McpListToolResult, ToolResult } from "@eko-ai/eko/types";
2
+ import { SpawnOptionsWithoutStdio } from "child_process";
3
+ export declare class SimpleStdioMcpClient implements IMcpClient {
4
+ private command;
5
+ private args?;
6
+ private options?;
7
+ private process;
8
+ private requestMap;
9
+ constructor(command: string, args?: string[], options?: SpawnOptionsWithoutStdio);
10
+ connect(signal?: AbortSignal): Promise<void>;
11
+ sendMessage(method: string, params?: Record<string, any>, signal?: AbortSignal): Promise<any>;
12
+ listTools(param: McpListToolParam, signal?: AbortSignal): Promise<McpListToolResult>;
13
+ callTool(param: McpCallToolParam, signal?: AbortSignal): Promise<ToolResult>;
14
+ isConnected(): boolean;
15
+ close(): Promise<void>;
16
+ }
17
+ //# sourceMappingURL=stdio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../../src/mcp/stdio.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,wBAAwB,EAEzB,MAAM,eAAe,CAAC;AAEvB,qBAAa,oBAAqB,YAAW,UAAU;IACrD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,IAAI,CAAC,CAAW;IACxB,OAAO,CAAC,OAAO,CAAC,CAA2B;IAC3C,OAAO,CAAC,OAAO,CAA+C;IAC9D,OAAO,CAAC,UAAU,CAA0C;gBAG1D,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,OAAO,CAAC,EAAE,wBAAwB;IAU9B,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA2B5C,WAAW,CACf,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAChC,MAAM,CAAC,EAAE,WAAW;IAqChB,SAAS,CACb,KAAK,EAAE,gBAAgB,EACvB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,iBAAiB,CAAC;IAevB,QAAQ,CACZ,KAAK,EAAE,gBAAgB,EACvB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC;IAetB,WAAW,IAAI,OAAO;IAMhB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
@@ -0,0 +1,2 @@
1
+ export declare function getCdpWsEndpoint(port: number): Promise<string>;
2
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAEA,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMpE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=mcp.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.test.d.ts","sourceRoot":"","sources":["../../test/mcp.test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eko-ai/eko-nodejs",
3
- "version": "2.2.0",
3
+ "version": "3.0.0-alpha.1",
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",
@@ -37,21 +37,25 @@
37
37
  "chromium-bidi": "^0.12.0",
38
38
  "glob": "^11.0.2",
39
39
  "playwright": "^1.52.0",
40
- "@eko-ai/eko": "2.2.0"
40
+ "@eko-ai/eko": "3.0.0-alpha.1"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@rollup/plugin-commonjs": "^28.0.3",
44
44
  "@rollup/plugin-json": "^6.1.0",
45
45
  "@rollup/plugin-node-resolve": "^16.0.1",
46
46
  "@rollup/plugin-typescript": "^12.1.2",
47
+ "@types/jest": "^29.5.14",
47
48
  "@types/node": "^22.15.19",
48
49
  "dotenv": "^16.5.0",
50
+ "jest": "^29.7.0",
49
51
  "rollup": "^4.40.0",
50
52
  "rollup-plugin-copy": "^3.5.0",
53
+ "ts-jest": "^29.3.2",
51
54
  "tslib": "^2.8.1",
52
55
  "typescript": "^5.8.3"
53
56
  },
54
57
  "scripts": {
55
- "build": "rollup -c"
58
+ "build": "rollup -c",
59
+ "test": "jest"
56
60
  }
57
61
  }