@eko-ai/eko 4.0.2 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/agent/browser/browser-labels.d.ts +2 -2
- package/dist/agent/browser/browser-labels.d.ts.map +1 -1
- package/dist/index.cjs.js +46 -38
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +46 -38
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -147,7 +147,7 @@ Configure your API key in the extension options before running the automation ta
|
|
|
147
147
|
```bash
|
|
148
148
|
cd example/nodejs
|
|
149
149
|
pnpm install
|
|
150
|
-
pnpm
|
|
150
|
+
pnpm playwright install # first time only, installs browsers
|
|
151
151
|
pnpm run build
|
|
152
152
|
OPENAI_API_KEY=... ANTHROPIC_API_KEY=... pnpm run start
|
|
153
153
|
```
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AgentContext } from "../agent-context";
|
|
2
|
-
import { BaseBrowserAgent } from "./browser-base";
|
|
3
1
|
import { LanguageModelV2Prompt, LanguageModelV2ToolCallPart } from "@ai-sdk/provider";
|
|
2
|
+
import { AgentContext } from "../agent-context";
|
|
4
3
|
import { Tool, IMcpClient } from "../../types";
|
|
4
|
+
import { BaseBrowserAgent } from "./browser-base";
|
|
5
5
|
export default abstract class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
6
6
|
constructor(llms?: string[], ext_tools?: Tool[], mcpClient?: IMcpClient);
|
|
7
7
|
protected input_text(agentContext: AgentContext, index: number, text: string, enter: boolean): Promise<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-labels.d.ts","sourceRoot":"","sources":["../../../src/agent/browser/browser-labels.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"browser-labels.d.ts","sourceRoot":"","sources":["../../../src/agent/browser/browser-labels.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,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"expert";
|
|
34928
34928
|
}
|
|
34929
34929
|
async handleMessages(agentContext, messages, tools) {
|
|
34930
|
-
|
|
34931
|
-
|
|
34932
|
-
|
|
34933
|
-
lastTool
|
|
34934
|
-
|
|
34935
|
-
|
|
34936
|
-
|
|
34937
|
-
|
|
34938
|
-
|
|
34939
|
-
|
|
34940
|
-
|
|
34941
|
-
|
|
34942
|
-
|
|
34943
|
-
|
|
34944
|
-
|
|
34945
|
-
|
|
34946
|
-
|
|
34947
|
-
|
|
34948
|
-
|
|
34949
|
-
|
|
34950
|
-
|
|
34951
|
-
|
|
34952
|
-
|
|
34953
|
-
|
|
34954
|
-
|
|
34955
|
-
|
|
34930
|
+
try {
|
|
34931
|
+
const pseudoHtmlDescription = "This is the environmental information after the operation, including the latest browser screenshot and page elements. Please perform the next operation based on the environmental information. Do not output the following elements and index information in your response.\n\nIndex and elements:\n";
|
|
34932
|
+
let lastTool = this.lastToolResult(messages);
|
|
34933
|
+
if (lastTool &&
|
|
34934
|
+
lastTool.toolName !== "extract_page_content" &&
|
|
34935
|
+
lastTool.toolName !== "get_all_tabs" &&
|
|
34936
|
+
lastTool.toolName !== "variable_storage") {
|
|
34937
|
+
await sleep(300);
|
|
34938
|
+
const image_contents = [];
|
|
34939
|
+
const result = await this.screenshot_and_html(agentContext);
|
|
34940
|
+
if (await this.double_screenshots(agentContext, messages, tools)) {
|
|
34941
|
+
const imageResult = result.double_screenshots
|
|
34942
|
+
? result.double_screenshots
|
|
34943
|
+
: await this.screenshot_and_compress(agentContext, result.client_rect);
|
|
34944
|
+
const image = toImage(imageResult.imageBase64);
|
|
34945
|
+
image_contents.push({
|
|
34946
|
+
type: "file",
|
|
34947
|
+
data: image,
|
|
34948
|
+
mediaType: imageResult.imageType,
|
|
34949
|
+
});
|
|
34950
|
+
}
|
|
34951
|
+
if (result.imageBase64) {
|
|
34952
|
+
const image = toImage(result.imageBase64);
|
|
34953
|
+
image_contents.push({
|
|
34954
|
+
type: "file",
|
|
34955
|
+
data: image,
|
|
34956
|
+
mediaType: result.imageType || "image/png",
|
|
34957
|
+
});
|
|
34958
|
+
}
|
|
34959
|
+
messages.push({
|
|
34960
|
+
role: "user",
|
|
34961
|
+
content: [
|
|
34962
|
+
...image_contents,
|
|
34963
|
+
{
|
|
34964
|
+
type: "text",
|
|
34965
|
+
text: pseudoHtmlDescription +
|
|
34966
|
+
"```html\n" +
|
|
34967
|
+
result.pseudoHtml +
|
|
34968
|
+
"\n```",
|
|
34969
|
+
},
|
|
34970
|
+
],
|
|
34956
34971
|
});
|
|
34957
34972
|
}
|
|
34958
|
-
|
|
34959
|
-
|
|
34960
|
-
|
|
34961
|
-
|
|
34962
|
-
|
|
34963
|
-
type: "text",
|
|
34964
|
-
text: pseudoHtmlDescription + "```html\n" + result.pseudoHtml + "\n```",
|
|
34965
|
-
},
|
|
34966
|
-
],
|
|
34967
|
-
});
|
|
34973
|
+
super.handleMessages(agentContext, messages, tools);
|
|
34974
|
+
this.handlePseudoHtmlText(messages, pseudoHtmlDescription);
|
|
34975
|
+
}
|
|
34976
|
+
catch (error) {
|
|
34977
|
+
Log.error("browser handleMessages error: ", error);
|
|
34968
34978
|
}
|
|
34969
|
-
super.handleMessages(agentContext, messages, tools);
|
|
34970
|
-
this.handlePseudoHtmlText(messages, pseudoHtmlDescription);
|
|
34971
34979
|
}
|
|
34972
34980
|
handlePseudoHtmlText(messages, pseudoHtmlDescription) {
|
|
34973
34981
|
for (let i = 0; i < messages.length; i++) {
|