@eko-ai/eko 3.0.5 → 3.0.6-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.
- package/dist/agent/base.d.ts +1 -1
- package/dist/agent/base.d.ts.map +1 -1
- package/dist/agent/browser/browser_labels.d.ts +2 -1
- package/dist/agent/browser/browser_labels.d.ts.map +1 -1
- package/dist/index.cjs.js +50 -26
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +50 -26
- package/dist/index.esm.js.map +1 -1
- package/dist/prompt/agent.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/agent/base.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export declare class Agent {
|
|
|
41
41
|
loadTools(context: Context): Promise<Tool[]>;
|
|
42
42
|
addTool(tool: Tool): void;
|
|
43
43
|
protected onTaskStatus(status: "pause" | "abort" | "resume-pause", reason?: string): Promise<void>;
|
|
44
|
-
|
|
44
|
+
canParallelToolCalls(toolCalls?: LanguageModelV2ToolCallPart[]): boolean;
|
|
45
45
|
get Llms(): string[] | undefined;
|
|
46
46
|
get Name(): string;
|
|
47
47
|
get Description(): string;
|
package/dist/agent/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/agent/base.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAa,MAAM,eAAe,CAAC;AACtD,OAAO,OAAO,EAAE,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAOxD,OAAO,EACL,IAAI,EACJ,UAAU,EACV,UAAU,EACV,UAAU,EAEV,YAAY,EACZ,aAAa,EACb,aAAa,EACb,cAAc,EACf,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,6BAA6B,EAC9B,MAAM,kBAAkB,CAAC;AAY1B,MAAM,MAAM,WAAW,GAAG;IACxB,IA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,OAAO,CAAC;QACT,QAAQ,EAAE,OAAO,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACrC,CAAC;IAMF,SAAS,CAAC,YAAY,CAAC,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY;cAoBzD,cAAc,CAC5B,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,qBAAqB,EAC/B,KAAK,EAAE,IAAI,EAAE,GACZ,OAAO,CAAC,IAAI,CAAC;cAKA,aAAa,CAAC,GAAG,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;IAgB9D,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAUlD,OAAO,CAAC,IAAI,EAAE,IAAI;cAIT,YAAY,CAC1B,MAAM,EAAE,OAAO,GAAG,OAAO,GAAG,cAAc,EAC1C,MAAM,CAAC,EAAE,MAAM;IAOV,oBAAoB,CAAC,SAAS,CAAC,EAAE,2BAA2B,EAAE,GAAG,OAAO;IAI/E,IAAI,IAAI,IAAI,MAAM,EAAE,GAAG,SAAS,CAE/B;IAED,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;IAED,IAAI,YAAY,IAAI,YAAY,GAAG,SAAS,CAE3C;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AgentContext } from "../../core/context";
|
|
2
2
|
import { BaseBrowserAgent } from "./browser_base";
|
|
3
|
-
import { LanguageModelV2Prompt } from "@ai-sdk/provider";
|
|
3
|
+
import { LanguageModelV2Prompt, LanguageModelV2ToolCallPart } from "@ai-sdk/provider";
|
|
4
4
|
import { Tool, IMcpClient } from "../../types";
|
|
5
5
|
export default abstract class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
6
6
|
constructor(llms?: string[], ext_tools?: Tool[], mcpClient?: IMcpClient);
|
|
@@ -17,6 +17,7 @@ export default abstract class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
17
17
|
pseudoHtml: string;
|
|
18
18
|
}>;
|
|
19
19
|
protected get_element_script(index: number): string;
|
|
20
|
+
canParallelToolCalls(toolCalls?: LanguageModelV2ToolCallPart[]): boolean;
|
|
20
21
|
private buildInitTools;
|
|
21
22
|
protected double_screenshots(agentContext: AgentContext, messages: LanguageModelV2Prompt, tools: Tool[]): Promise<boolean>;
|
|
22
23
|
protected handleMessages(agentContext: AgentContext, messages: LanguageModelV2Prompt, tools: Tool[]): Promise<void>;
|
|
@@ -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":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAc,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EACL,qBAAqB,EAErB,2BAA2B,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAc,UAAU,EAAE,MAAM,aAAa,CAAC;AAG3D,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,sBAAuB,SAAQ,gBAAgB;gBAC/D,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS,CAAC,EAAE,UAAU;cAoDvD,UAAU,CACxB,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,GAAG,CAAC;cAOC,aAAa,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,OAAO,CAAC,IAAI,CAAC;IA2ChB,OAAO,CAAC,oBAAoB;IAkC5B,OAAO,CAAC,oBAAoB;CA0B7B;AA4SD,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -35325,9 +35325,6 @@ You are {name}, an autonomous AI agent for {agent} agent.
|
|
|
35325
35325
|
<node input="variable name" output="variable name" status="todo / done">task step node</node>{nodePrompt}
|
|
35326
35326
|
</nodes>
|
|
35327
35327
|
</root>
|
|
35328
|
-
|
|
35329
|
-
For maximum efficiency, whenever you need to perform multiple independent operations, invoke all relevant tools simultaneously rather than sequentially.
|
|
35330
|
-
The output language should follow the language corresponding to the user's task.
|
|
35331
35328
|
`;
|
|
35332
35329
|
const HUMAN_PROMPT = `
|
|
35333
35330
|
* HUMAN INTERACT
|
|
@@ -35339,6 +35336,7 @@ During the task execution process, you can use the \`${TOOL_NAME$5}\` tool to in
|
|
|
35339
35336
|
const VARIABLE_PROMPT = `
|
|
35340
35337
|
* VARIABLE STORAGE
|
|
35341
35338
|
When a step node has input/output variable attributes, use the \`${TOOL_NAME$3}\` tool to read from and write to these variables, these variables enable context sharing and coordination between multiple agents.
|
|
35339
|
+
The \`${TOOL_NAME$3}\` tool does not support parallel calls.
|
|
35342
35340
|
`;
|
|
35343
35341
|
const FOR_EACH_NODE = `
|
|
35344
35342
|
<!-- duplicate task node, items support list and variable -->
|
|
@@ -35399,19 +35397,25 @@ function getAgentSystemPrompt(agent, agentNode, context, tools, extSysPrompt) {
|
|
|
35399
35397
|
prompt += "\n Main task: " + context.chain.taskPrompt;
|
|
35400
35398
|
prompt += "\n\n# Pre-task execution results";
|
|
35401
35399
|
for (let i = 0; i < context.chain.agents.length; i++) {
|
|
35402
|
-
|
|
35400
|
+
const agentChain = context.chain.agents[i];
|
|
35403
35401
|
if (agentChain.agentResult) {
|
|
35404
|
-
prompt += `\n## ${agentChain.agent.task || agentChain.agent.name}\n${sub(agentChain.agentResult,
|
|
35402
|
+
prompt += `\n## ${agentChain.agent.task || agentChain.agent.name}\n<taskResult>\n${sub(agentChain.agentResult, 600, true)}\n</taskResult>`;
|
|
35405
35403
|
}
|
|
35406
35404
|
}
|
|
35407
35405
|
}
|
|
35408
|
-
|
|
35406
|
+
let sysPrompt = AGENT_SYSTEM_TEMPLATE.replace("{name}", config$1.name)
|
|
35409
35407
|
.replace("{agent}", agent.Name)
|
|
35410
35408
|
.replace("{description}", agent.Description)
|
|
35411
35409
|
.replace("{prompt}", "\n" + prompt.trim())
|
|
35412
35410
|
.replace("{nodePrompt}", nodePrompt)
|
|
35413
35411
|
.replace("{datetime}", new Date().toLocaleString())
|
|
35414
35412
|
.trim();
|
|
35413
|
+
sysPrompt += "\n";
|
|
35414
|
+
if (agent.canParallelToolCalls()) {
|
|
35415
|
+
sysPrompt += "\nFor maximum efficiency, when executing multiple independent operations that do not depend on each other or conflict with one another, these tools can be called in parallel simultaneously.";
|
|
35416
|
+
}
|
|
35417
|
+
sysPrompt += "\nThe output language should follow the language corresponding to the user's task.";
|
|
35418
|
+
return sysPrompt;
|
|
35415
35419
|
}
|
|
35416
35420
|
function getAgentUserPrompt(agent, agentNode, context, tools) {
|
|
35417
35421
|
const hasTaskNodeStatusTool = (tools || agent.Tools).filter((tool) => tool.name == TOOL_NAME$4)
|
|
@@ -36159,7 +36163,7 @@ This is a computer GUI interface, observe the execution through screenshots, and
|
|
|
36159
36163
|
key: {
|
|
36160
36164
|
type: "string",
|
|
36161
36165
|
description: "The keyboard key",
|
|
36162
|
-
enum: keyboardKeys,
|
|
36166
|
+
enum: keyboardKeys.filter((key) => key.indexOf("+") == -1),
|
|
36163
36167
|
},
|
|
36164
36168
|
},
|
|
36165
36169
|
required: ["key"],
|
|
@@ -37170,34 +37174,40 @@ function run_build_dom_tree() {
|
|
|
37170
37174
|
|
|
37171
37175
|
class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
37172
37176
|
constructor(llms, ext_tools, mcpClient) {
|
|
37173
|
-
|
|
37177
|
+
let description = `You are a browser operation agent, use structured commands to interact with the browser.
|
|
37174
37178
|
* This is a browser GUI interface where you need to analyze webpages by taking screenshot and page element structures, and specify action sequences to complete designated tasks.
|
|
37175
37179
|
* For your first visit, please start by calling either the \`navigate_to\` or \`current_page\` tool. After each action you perform, I will provide you with updated information about the current state, including page screenshots and structured element data that has been specially processed for easier analysis.
|
|
37180
|
+
* During execution, please output user-friendly step information. Do not output HTML-related element and index information to users, as this would cause user confusion.
|
|
37181
|
+
|
|
37176
37182
|
* Screenshot description:
|
|
37177
37183
|
- Screenshot are used to understand page layouts, with labeled bounding boxes corresponding to element indexes. Each bounding box and its label share the same color, with labels typically positioned in the top-right corner of the box.
|
|
37178
37184
|
- Screenshot help verify element positions and relationships. Labels may sometimes overlap, so extracted elements are used to verify the correct elements.
|
|
37179
37185
|
- In addition to screenshot, simplified information about interactive elements is returned, with element indexes corresponding to those in the screenshot.
|
|
37180
37186
|
- This tool can ONLY screenshot the VISIBLE content. If a complete content is required, use 'extract_page_content' instead.
|
|
37181
37187
|
- If the webpage content hasn't loaded, please use the \`wait\` tool to allow time for the content to load.
|
|
37182
|
-
*
|
|
37183
|
-
|
|
37184
|
-
|
|
37185
|
-
|
|
37186
|
-
|
|
37187
|
-
|
|
37188
|
-
|
|
37189
|
-
*
|
|
37190
|
-
|
|
37191
|
-
|
|
37192
|
-
|
|
37193
|
-
|
|
37194
|
-
*
|
|
37195
|
-
|
|
37196
|
-
|
|
37188
|
+
* Element interaction:
|
|
37189
|
+
- Only use indexes that exist in the provided element list
|
|
37190
|
+
- Browser tools only return elements in visible viewport by default
|
|
37191
|
+
- Each element has a unique index number (e.g., "[33]:<button>Submit</button>")
|
|
37192
|
+
- Elements marked with "[]:" are non-interactive (for context only, e.g., "[]: Google")
|
|
37193
|
+
- Use the latest element index, do not rely on historical outdated element indexes
|
|
37194
|
+
- Due to technical limitations, not all interactive elements may be identified; use coordinates to interact with unlisted elements
|
|
37195
|
+
* Error handling:
|
|
37196
|
+
- If no suitable elements exist, use other functions to complete the task
|
|
37197
|
+
- If stuck, try alternative approaches, don't refuse tasks
|
|
37198
|
+
- Handle popups/cookies by accepting or closing them
|
|
37199
|
+
- When encountering scenarios that require user assistance such as login, verification codes, QR code scanning, Payment, etc, you can request user help.
|
|
37200
|
+
* Browser operation:
|
|
37201
|
+
- Use scroll to find elements you are looking for, When extracting content, prioritize using extract_page_content, only scroll when you need to load more content
|
|
37202
|
+
- Please follow user instructions and don't be lazy until the task is completed. For example, if a user asks you to find 30 people, don't just find 10 - keep searching until you find all 30.`;
|
|
37203
|
+
if (config$1.parallelToolCalls) {
|
|
37204
|
+
description += `
|
|
37197
37205
|
* Parallelism:
|
|
37198
|
-
-
|
|
37199
|
-
|
|
37200
|
-
|
|
37206
|
+
- Do not call the navigate_to tool simultaneously
|
|
37207
|
+
- Operations that support parallelism generally only include clicking and input operations
|
|
37208
|
+
- When filling out a form, fields that are not dependent on each other should be filled simultaneously
|
|
37209
|
+
- Avoid parallel processing for dependent operations, such as those that need to wait for page loading, DOM changes, redirects, subsequent operations that depend on the results of previous operations, or operations that may interfere with each other and affect the same page elements. In these cases, please do not use parallelization.`;
|
|
37210
|
+
}
|
|
37201
37211
|
const _tools_ = [];
|
|
37202
37212
|
super({
|
|
37203
37213
|
name: AGENT_NAME,
|
|
@@ -37311,6 +37321,20 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
37311
37321
|
get_element_script(index) {
|
|
37312
37322
|
return `window.get_highlight_element(${index});`;
|
|
37313
37323
|
}
|
|
37324
|
+
canParallelToolCalls(toolCalls) {
|
|
37325
|
+
if (toolCalls) {
|
|
37326
|
+
for (let i = 0; i < toolCalls.length; i++) {
|
|
37327
|
+
const toolCall = toolCalls[i];
|
|
37328
|
+
if (toolCall.toolName == "wait" ||
|
|
37329
|
+
toolCall.toolName == "navigate_to" ||
|
|
37330
|
+
toolCall.toolName == "switch_tab" ||
|
|
37331
|
+
toolCall.toolName == "scroll_mouse_wheel") {
|
|
37332
|
+
return false;
|
|
37333
|
+
}
|
|
37334
|
+
}
|
|
37335
|
+
}
|
|
37336
|
+
return super.canParallelToolCalls(toolCalls);
|
|
37337
|
+
}
|
|
37314
37338
|
buildInitTools() {
|
|
37315
37339
|
return [
|
|
37316
37340
|
{
|