@eko-ai/eko 3.0.3 → 3.0.4
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.map +1 -1
- package/dist/index.cjs.js +46 -79
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +46 -79
- package/dist/index.esm.js.map +1 -1
- package/dist/prompt/agent.d.ts.map +1 -1
- package/dist/prompt/plan.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -31361,28 +31361,6 @@ function extractUsedTool(messages, agentTools) {
|
|
|
31361
31361
|
}
|
|
31362
31362
|
return tools;
|
|
31363
31363
|
}
|
|
31364
|
-
function removeDuplicateToolUse(results) {
|
|
31365
|
-
if (results.length <= 1 ||
|
|
31366
|
-
results.filter((r) => r.type == "tool-call").length <= 1) {
|
|
31367
|
-
return results;
|
|
31368
|
-
}
|
|
31369
|
-
let _results = [];
|
|
31370
|
-
let tool_uniques = [];
|
|
31371
|
-
for (let i = 0; i < results.length; i++) {
|
|
31372
|
-
if (results[i].type === "tool-call") {
|
|
31373
|
-
let tool = results[i];
|
|
31374
|
-
let key = tool.toolName + tool.input;
|
|
31375
|
-
if (tool_uniques.indexOf(key) == -1) {
|
|
31376
|
-
_results.push(results[i]);
|
|
31377
|
-
tool_uniques.push(key);
|
|
31378
|
-
}
|
|
31379
|
-
}
|
|
31380
|
-
else {
|
|
31381
|
-
_results.push(results[i]);
|
|
31382
|
-
}
|
|
31383
|
-
}
|
|
31384
|
-
return _results;
|
|
31385
|
-
}
|
|
31386
31364
|
async function compressAgentMessages(agentContext, rlm, messages, tools) {
|
|
31387
31365
|
if (messages.length < 5) {
|
|
31388
31366
|
return;
|
|
@@ -32339,23 +32317,13 @@ You are {name}, an autonomous AI Agent Planner.
|
|
|
32339
32317
|
{example_prompt}
|
|
32340
32318
|
`;
|
|
32341
32319
|
const PLAN_TASK_DESCRIPTION = `Your task is to understand the user's requirements, dynamically plan the user's tasks based on the Agent list, and please follow the steps below:
|
|
32342
|
-
|
|
32343
|
-
|
|
32344
|
-
|
|
32345
|
-
|
|
32346
|
-
|
|
32347
|
-
|
|
32348
|
-
|
|
32349
|
-
const PLAN_CHAT_EXAMPLE = `User: hello.
|
|
32350
|
-
Output result:
|
|
32351
|
-
<root>
|
|
32352
|
-
<name>Chat</name>
|
|
32353
|
-
<thought>Alright, the user wrote "hello". That's pretty straightforward. I need to respond in a friendly and welcoming manner.</thought>
|
|
32354
|
-
<agents>
|
|
32355
|
-
<!-- Chat agents can exist without the <task> and <nodes> nodes. -->
|
|
32356
|
-
<agent name="Chat" id="0" dependsOn=""></agent>
|
|
32357
|
-
</agents>
|
|
32358
|
-
</root>`;
|
|
32320
|
+
- Analyze the Agents that need to be used based on the user's requirements.
|
|
32321
|
+
- Generate the Agent calling plan based on the analysis results.
|
|
32322
|
+
- About agent name, please do not arbitrarily fabricate non-existent agent names.
|
|
32323
|
+
- You only need to provide the steps to complete the user's task, key steps only, no need to be too detailed.
|
|
32324
|
+
- Try to break down tasks into independently completable subtasks, and for maximum efficiency, run multiple independent subtasks in parallel whenever possible.
|
|
32325
|
+
- Please strictly follow the output format and example output.
|
|
32326
|
+
- The output language should follow the language corresponding to the user's task.`;
|
|
32359
32327
|
const PLAN_EXAMPLE_LIST = [
|
|
32360
32328
|
`User: Open Boss Zhipin, find 10 operation positions in Chengdu, and send a personal introduction to the recruiters based on the page information.
|
|
32361
32329
|
Output result:
|
|
@@ -32536,13 +32504,9 @@ async function getPlanSystemPrompt(context, planTaskDescription, planExampleList
|
|
|
32536
32504
|
PLAN_TASK_DESCRIPTION;
|
|
32537
32505
|
const plan_example_list = context.variables.get("plan_example_list") ||
|
|
32538
32506
|
PLAN_EXAMPLE_LIST;
|
|
32539
|
-
const hasChatAgent = context.agents.filter((a) => a.Name == "Chat").length > 0;
|
|
32540
32507
|
let example_prompt = "";
|
|
32541
|
-
|
|
32542
|
-
|
|
32543
|
-
: [...plan_example_list];
|
|
32544
|
-
for (let i = 0; i < example_list.length; i++) {
|
|
32545
|
-
example_prompt += `## Example ${i + 1}\n${example_list[i]}\n\n`;
|
|
32508
|
+
for (let i = 0; i < plan_example_list.length; i++) {
|
|
32509
|
+
example_prompt += `## Example ${i + 1}\n${plan_example_list[i]}\n\n`;
|
|
32546
32510
|
}
|
|
32547
32511
|
return PLAN_SYSTEM_TEMPLATE.replace("{name}", config$1.name)
|
|
32548
32512
|
.replace("{task_description}", task_description)
|
|
@@ -35326,6 +35290,7 @@ You are {name}, an autonomous AI agent for {agent} agent.
|
|
|
35326
35290
|
</nodes>
|
|
35327
35291
|
</root>
|
|
35328
35292
|
|
|
35293
|
+
For maximum efficiency, whenever you need to perform multiple independent operations, invoke all relevant tools simultaneously rather than sequentially.
|
|
35329
35294
|
The output language should follow the language corresponding to the user's task.
|
|
35330
35295
|
`;
|
|
35331
35296
|
const HUMAN_PROMPT = `
|
|
@@ -35346,7 +35311,7 @@ const FOR_EACH_NODE = `
|
|
|
35346
35311
|
</forEach>`;
|
|
35347
35312
|
const FOR_EACH_PROMPT = `
|
|
35348
35313
|
* forEach node
|
|
35349
|
-
repetitive tasks, when executing
|
|
35314
|
+
For repetitive tasks, when executing a forEach node, the \`${TOOL_NAME$6}\` tool must be used. Loop tasks support parallel tool calls, and during parallel execution, this tool needs to be called interspersed throughout the process.
|
|
35350
35315
|
`;
|
|
35351
35316
|
const WATCH_NODE = `
|
|
35352
35317
|
<!-- monitor task node, the loop attribute specifies whether to listen in a loop or listen once -->
|
|
@@ -35514,7 +35479,7 @@ class Agent {
|
|
|
35514
35479
|
let context = agentContext.context;
|
|
35515
35480
|
let user_messages = [];
|
|
35516
35481
|
let toolResults = [];
|
|
35517
|
-
results = removeDuplicateToolUse(results);
|
|
35482
|
+
// results = memory.removeDuplicateToolUse(results);
|
|
35518
35483
|
if (results.length == 0) {
|
|
35519
35484
|
return null;
|
|
35520
35485
|
}
|
|
@@ -36038,7 +36003,7 @@ This is a computer GUI interface, observe the execution through screenshots, and
|
|
|
36038
36003
|
return [
|
|
36039
36004
|
{
|
|
36040
36005
|
name: "typing",
|
|
36041
|
-
description: "
|
|
36006
|
+
description: "Simulates keyboard typing to input text into the currently focused application or text field on the computer.",
|
|
36042
36007
|
parameters: {
|
|
36043
36008
|
type: "object",
|
|
36044
36009
|
properties: {
|
|
@@ -36055,27 +36020,27 @@ This is a computer GUI interface, observe the execution through screenshots, and
|
|
|
36055
36020
|
},
|
|
36056
36021
|
{
|
|
36057
36022
|
name: "click",
|
|
36058
|
-
description: "
|
|
36023
|
+
description: "Simulates mouse clicking at an absolute screen position (x, y) on the computer.",
|
|
36059
36024
|
parameters: {
|
|
36060
36025
|
type: "object",
|
|
36061
36026
|
properties: {
|
|
36062
36027
|
x: {
|
|
36063
36028
|
type: "number",
|
|
36064
|
-
description: "X coordinate",
|
|
36029
|
+
description: "Absolute X coordinate on the screen where the mouse will click",
|
|
36065
36030
|
},
|
|
36066
36031
|
y: {
|
|
36067
36032
|
type: "number",
|
|
36068
|
-
description: "Y coordinate",
|
|
36033
|
+
description: "Absolute Y coordinate on the screen where the mouse will click",
|
|
36069
36034
|
},
|
|
36070
36035
|
num_clicks: {
|
|
36071
36036
|
type: "number",
|
|
36072
|
-
description: "Number of
|
|
36037
|
+
description: "Number of times to click at the position",
|
|
36073
36038
|
enum: [1, 2, 3],
|
|
36074
36039
|
default: 1,
|
|
36075
36040
|
},
|
|
36076
36041
|
button: {
|
|
36077
36042
|
type: "string",
|
|
36078
|
-
description: "
|
|
36043
|
+
description: "Which mouse button to click",
|
|
36079
36044
|
enum: ["left", "right", "middle"],
|
|
36080
36045
|
default: "left",
|
|
36081
36046
|
},
|
|
@@ -36088,17 +36053,17 @@ This is a computer GUI interface, observe the execution through screenshots, and
|
|
|
36088
36053
|
},
|
|
36089
36054
|
{
|
|
36090
36055
|
name: "move_to",
|
|
36091
|
-
description: "
|
|
36056
|
+
description: "Moves the mouse cursor to the specified screen coordinates.",
|
|
36092
36057
|
parameters: {
|
|
36093
36058
|
type: "object",
|
|
36094
36059
|
properties: {
|
|
36095
36060
|
x: {
|
|
36096
36061
|
type: "number",
|
|
36097
|
-
description: "X coordinate",
|
|
36062
|
+
description: "Absolute X coordinate on the screen",
|
|
36098
36063
|
},
|
|
36099
36064
|
y: {
|
|
36100
36065
|
type: "number",
|
|
36101
|
-
description: "Y coordinate",
|
|
36066
|
+
description: "Absolute Y coordinate on the screen",
|
|
36102
36067
|
},
|
|
36103
36068
|
},
|
|
36104
36069
|
required: ["x", "y"],
|
|
@@ -36109,7 +36074,7 @@ This is a computer GUI interface, observe the execution through screenshots, and
|
|
|
36109
36074
|
},
|
|
36110
36075
|
{
|
|
36111
36076
|
name: "scroll",
|
|
36112
|
-
description: "Scroll the mouse wheel at current
|
|
36077
|
+
description: "Scroll the mouse wheel vertically at the current pointer location.",
|
|
36113
36078
|
parameters: {
|
|
36114
36079
|
type: "object",
|
|
36115
36080
|
properties: {
|
|
@@ -36135,13 +36100,13 @@ This is a computer GUI interface, observe the execution through screenshots, and
|
|
|
36135
36100
|
},
|
|
36136
36101
|
{
|
|
36137
36102
|
name: "press",
|
|
36138
|
-
description: "
|
|
36103
|
+
description: "Simulate pressing and releasing a specific keyboard key",
|
|
36139
36104
|
parameters: {
|
|
36140
36105
|
type: "object",
|
|
36141
36106
|
properties: {
|
|
36142
36107
|
key: {
|
|
36143
36108
|
type: "string",
|
|
36144
|
-
description: "
|
|
36109
|
+
description: "The keyboard key",
|
|
36145
36110
|
enum: keyboardKeys,
|
|
36146
36111
|
},
|
|
36147
36112
|
},
|
|
@@ -36153,13 +36118,13 @@ This is a computer GUI interface, observe the execution through screenshots, and
|
|
|
36153
36118
|
},
|
|
36154
36119
|
{
|
|
36155
36120
|
name: "hotkey",
|
|
36156
|
-
description: "
|
|
36121
|
+
description: "Simulate pressing one or more keyboard keys, including combinations.",
|
|
36157
36122
|
parameters: {
|
|
36158
36123
|
type: "object",
|
|
36159
36124
|
properties: {
|
|
36160
36125
|
keys: {
|
|
36161
36126
|
type: "string",
|
|
36162
|
-
description: "
|
|
36127
|
+
description: "A single key or a combination of keys to press. For combinations, use '+' to join keys.",
|
|
36163
36128
|
enum: keyboardKeys,
|
|
36164
36129
|
},
|
|
36165
36130
|
},
|
|
@@ -36171,25 +36136,25 @@ This is a computer GUI interface, observe the execution through screenshots, and
|
|
|
36171
36136
|
},
|
|
36172
36137
|
{
|
|
36173
36138
|
name: "drag_and_drop",
|
|
36174
|
-
description: "
|
|
36139
|
+
description: "Performs a mouse drag-and-drop operation from a starting point to a target point on the screen.",
|
|
36175
36140
|
parameters: {
|
|
36176
36141
|
type: "object",
|
|
36177
36142
|
properties: {
|
|
36178
36143
|
x1: {
|
|
36179
36144
|
type: "number",
|
|
36180
|
-
description: "
|
|
36145
|
+
description: "Absolute X coordinate of the starting point (in pixels).",
|
|
36181
36146
|
},
|
|
36182
36147
|
y1: {
|
|
36183
36148
|
type: "number",
|
|
36184
|
-
description: "
|
|
36149
|
+
description: "Absolute Y coordinate of the starting point (in pixels).",
|
|
36185
36150
|
},
|
|
36186
36151
|
x2: {
|
|
36187
36152
|
type: "number",
|
|
36188
|
-
description: "
|
|
36153
|
+
description: "Absolute X coordinate of the ending (target) point (in pixels).",
|
|
36189
36154
|
},
|
|
36190
36155
|
y2: {
|
|
36191
36156
|
type: "number",
|
|
36192
|
-
description: "
|
|
36157
|
+
description: "Absolute Y coordinate of the ending (target) point (in pixels).",
|
|
36193
36158
|
},
|
|
36194
36159
|
},
|
|
36195
36160
|
required: ["x1", "y1", "x2", "y2"],
|
|
@@ -36201,13 +36166,13 @@ This is a computer GUI interface, observe the execution through screenshots, and
|
|
|
36201
36166
|
{
|
|
36202
36167
|
name: "wait",
|
|
36203
36168
|
noPlan: true,
|
|
36204
|
-
description: "Wait for specified duration",
|
|
36169
|
+
description: "Wait/pause execution for a specified duration. Use this tool when you need to wait for data loading, or introduce delays between operations.",
|
|
36205
36170
|
parameters: {
|
|
36206
36171
|
type: "object",
|
|
36207
36172
|
properties: {
|
|
36208
36173
|
duration: {
|
|
36209
36174
|
type: "number",
|
|
36210
|
-
description: "
|
|
36175
|
+
description: "Wait duration in milliseconds",
|
|
36211
36176
|
default: 500,
|
|
36212
36177
|
minimum: 200,
|
|
36213
36178
|
maximum: 10000,
|
|
@@ -37177,6 +37142,8 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
37177
37142
|
* BROWSER OPERATION:
|
|
37178
37143
|
- 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
|
|
37179
37144
|
- 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
|
|
37145
|
+
* Parallelism:
|
|
37146
|
+
- When operating multiple independent steps, they should be executed in parallel as much as possible. For example, when filling out multiple form fields, they should be filled in parallel as much as possible to improve efficiency, rather than operating step by step.
|
|
37180
37147
|
* 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
37148
|
`;
|
|
37182
37149
|
const _tools_ = [];
|
|
@@ -37296,13 +37263,13 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
37296
37263
|
return [
|
|
37297
37264
|
{
|
|
37298
37265
|
name: "navigate_to",
|
|
37299
|
-
description: "Navigate to a specific
|
|
37266
|
+
description: "Navigate to a specific URL in the browser. Use this tool when you need to visit a webpage or change the current page location.",
|
|
37300
37267
|
parameters: {
|
|
37301
37268
|
type: "object",
|
|
37302
37269
|
properties: {
|
|
37303
37270
|
url: {
|
|
37304
37271
|
type: "string",
|
|
37305
|
-
description: "The
|
|
37272
|
+
description: "The complete URL to navigate to",
|
|
37306
37273
|
},
|
|
37307
37274
|
},
|
|
37308
37275
|
required: ["url"],
|
|
@@ -37313,7 +37280,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
37313
37280
|
},
|
|
37314
37281
|
{
|
|
37315
37282
|
name: "current_page",
|
|
37316
|
-
description: "Get the
|
|
37283
|
+
description: "Get the currently active webpage information, return tabId, URL and title",
|
|
37317
37284
|
parameters: {
|
|
37318
37285
|
type: "object",
|
|
37319
37286
|
properties: {},
|
|
@@ -37324,7 +37291,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
37324
37291
|
},
|
|
37325
37292
|
{
|
|
37326
37293
|
name: "go_back",
|
|
37327
|
-
description: "
|
|
37294
|
+
description: "Go back to the previous page in browser history",
|
|
37328
37295
|
parameters: {
|
|
37329
37296
|
type: "object",
|
|
37330
37297
|
properties: {},
|
|
@@ -37335,7 +37302,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
37335
37302
|
},
|
|
37336
37303
|
{
|
|
37337
37304
|
name: "input_text",
|
|
37338
|
-
description: "
|
|
37305
|
+
description: "Inputs text into a element by first clicking to focus the element, then clearing any existing text and typing the new text. Optionally presses Enter after input completion.",
|
|
37339
37306
|
parameters: {
|
|
37340
37307
|
type: "object",
|
|
37341
37308
|
properties: {
|
|
@@ -37418,7 +37385,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
37418
37385
|
},
|
|
37419
37386
|
{
|
|
37420
37387
|
name: "hover_to_element",
|
|
37421
|
-
description: "
|
|
37388
|
+
description: "Hover the mouse over an element, use it when you need to hover to display more interactive information",
|
|
37422
37389
|
parameters: {
|
|
37423
37390
|
type: "object",
|
|
37424
37391
|
properties: {
|
|
@@ -37435,7 +37402,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
37435
37402
|
},
|
|
37436
37403
|
{
|
|
37437
37404
|
name: "extract_page_content",
|
|
37438
|
-
description: "
|
|
37405
|
+
description: "Extracts all content from the current webpage, including text and image links. Please use this tool when you need to retrieve webpage content.",
|
|
37439
37406
|
parameters: {
|
|
37440
37407
|
type: "object",
|
|
37441
37408
|
properties: {},
|
|
@@ -37484,7 +37451,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
37484
37451
|
},
|
|
37485
37452
|
{
|
|
37486
37453
|
name: "get_all_tabs",
|
|
37487
|
-
description: "Get all tabs of the current browser",
|
|
37454
|
+
description: "Get all tabs of the current browser, returns the tabId, URL, and title of all tab pages",
|
|
37488
37455
|
parameters: {
|
|
37489
37456
|
type: "object",
|
|
37490
37457
|
properties: {},
|
|
@@ -37495,7 +37462,7 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
37495
37462
|
},
|
|
37496
37463
|
{
|
|
37497
37464
|
name: "switch_tab",
|
|
37498
|
-
description: "Switch to the specified tab
|
|
37465
|
+
description: "Switch to the specified tab (based on tabId)",
|
|
37499
37466
|
parameters: {
|
|
37500
37467
|
type: "object",
|
|
37501
37468
|
properties: {
|
|
@@ -37513,13 +37480,13 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
37513
37480
|
{
|
|
37514
37481
|
name: "wait",
|
|
37515
37482
|
noPlan: true,
|
|
37516
|
-
description: "Wait for specified duration",
|
|
37483
|
+
description: "Wait/pause execution for a specified duration. Use this tool when you need to wait for data loading, page rendering, or introduce delays between operations.",
|
|
37517
37484
|
parameters: {
|
|
37518
37485
|
type: "object",
|
|
37519
37486
|
properties: {
|
|
37520
37487
|
duration: {
|
|
37521
37488
|
type: "number",
|
|
37522
|
-
description: "
|
|
37489
|
+
description: "Wait duration in milliseconds",
|
|
37523
37490
|
default: 500,
|
|
37524
37491
|
minimum: 200,
|
|
37525
37492
|
maximum: 10000,
|