@eko-ai/eko 4.0.1 → 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/chat/chat-agent.d.ts +2 -0
- package/dist/chat/chat-agent.d.ts.map +1 -1
- package/dist/index.cjs.js +52 -38
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +52 -38
- package/dist/index.esm.js.map +1 -1
- package/dist/types/index.d.ts +9 -8
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -34892,47 +34892,55 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
34892
34892
|
return config$1.mode == "expert";
|
|
34893
34893
|
}
|
|
34894
34894
|
async handleMessages(agentContext, messages, tools) {
|
|
34895
|
-
|
|
34896
|
-
|
|
34897
|
-
|
|
34898
|
-
lastTool
|
|
34899
|
-
|
|
34900
|
-
|
|
34901
|
-
|
|
34902
|
-
|
|
34903
|
-
|
|
34904
|
-
|
|
34905
|
-
|
|
34906
|
-
|
|
34907
|
-
|
|
34908
|
-
|
|
34909
|
-
|
|
34910
|
-
|
|
34911
|
-
|
|
34912
|
-
|
|
34913
|
-
|
|
34914
|
-
|
|
34915
|
-
|
|
34916
|
-
|
|
34917
|
-
|
|
34918
|
-
|
|
34919
|
-
|
|
34920
|
-
|
|
34895
|
+
try {
|
|
34896
|
+
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";
|
|
34897
|
+
let lastTool = this.lastToolResult(messages);
|
|
34898
|
+
if (lastTool &&
|
|
34899
|
+
lastTool.toolName !== "extract_page_content" &&
|
|
34900
|
+
lastTool.toolName !== "get_all_tabs" &&
|
|
34901
|
+
lastTool.toolName !== "variable_storage") {
|
|
34902
|
+
await sleep(300);
|
|
34903
|
+
const image_contents = [];
|
|
34904
|
+
const result = await this.screenshot_and_html(agentContext);
|
|
34905
|
+
if (await this.double_screenshots(agentContext, messages, tools)) {
|
|
34906
|
+
const imageResult = result.double_screenshots
|
|
34907
|
+
? result.double_screenshots
|
|
34908
|
+
: await this.screenshot_and_compress(agentContext, result.client_rect);
|
|
34909
|
+
const image = toImage(imageResult.imageBase64);
|
|
34910
|
+
image_contents.push({
|
|
34911
|
+
type: "file",
|
|
34912
|
+
data: image,
|
|
34913
|
+
mediaType: imageResult.imageType,
|
|
34914
|
+
});
|
|
34915
|
+
}
|
|
34916
|
+
if (result.imageBase64) {
|
|
34917
|
+
const image = toImage(result.imageBase64);
|
|
34918
|
+
image_contents.push({
|
|
34919
|
+
type: "file",
|
|
34920
|
+
data: image,
|
|
34921
|
+
mediaType: result.imageType || "image/png",
|
|
34922
|
+
});
|
|
34923
|
+
}
|
|
34924
|
+
messages.push({
|
|
34925
|
+
role: "user",
|
|
34926
|
+
content: [
|
|
34927
|
+
...image_contents,
|
|
34928
|
+
{
|
|
34929
|
+
type: "text",
|
|
34930
|
+
text: pseudoHtmlDescription +
|
|
34931
|
+
"```html\n" +
|
|
34932
|
+
result.pseudoHtml +
|
|
34933
|
+
"\n```",
|
|
34934
|
+
},
|
|
34935
|
+
],
|
|
34921
34936
|
});
|
|
34922
34937
|
}
|
|
34923
|
-
|
|
34924
|
-
|
|
34925
|
-
|
|
34926
|
-
|
|
34927
|
-
|
|
34928
|
-
type: "text",
|
|
34929
|
-
text: pseudoHtmlDescription + "```html\n" + result.pseudoHtml + "\n```",
|
|
34930
|
-
},
|
|
34931
|
-
],
|
|
34932
|
-
});
|
|
34938
|
+
super.handleMessages(agentContext, messages, tools);
|
|
34939
|
+
this.handlePseudoHtmlText(messages, pseudoHtmlDescription);
|
|
34940
|
+
}
|
|
34941
|
+
catch (error) {
|
|
34942
|
+
Log.error("browser handleMessages error: ", error);
|
|
34933
34943
|
}
|
|
34934
|
-
super.handleMessages(agentContext, messages, tools);
|
|
34935
|
-
this.handlePseudoHtmlText(messages, pseudoHtmlDescription);
|
|
34936
34944
|
}
|
|
34937
34945
|
handlePseudoHtmlText(messages, pseudoHtmlDescription) {
|
|
34938
34946
|
for (let i = 0; i < messages.length; i++) {
|
|
@@ -37239,6 +37247,12 @@ class ChatAgent {
|
|
|
37239
37247
|
tools.push(new TaskVariableStorageTool(this.chatContext, params));
|
|
37240
37248
|
return tools;
|
|
37241
37249
|
}
|
|
37250
|
+
getMemory() {
|
|
37251
|
+
return this.memory;
|
|
37252
|
+
}
|
|
37253
|
+
getTools() {
|
|
37254
|
+
return this.tools;
|
|
37255
|
+
}
|
|
37242
37256
|
getChatContext() {
|
|
37243
37257
|
return this.chatContext;
|
|
37244
37258
|
}
|