@eko-ai/eko 2.0.2-alpha.0 → 2.0.2-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.
- package/dist/agent/base.d.ts.map +1 -1
- package/dist/agent/browser/browser_base.d.ts +7 -0
- package/dist/agent/browser/browser_base.d.ts.map +1 -1
- package/dist/agent/browser/browser_labels.d.ts.map +1 -1
- package/dist/agent/browser/browser_screen.d.ts.map +1 -1
- package/dist/agent/computer.d.ts.map +1 -1
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/index.cjs.js +122 -42
- package/dist/index.esm.js +122 -42
- package/dist/llm/index.d.ts.map +1 -1
- package/package.json +1 -1
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":"AAIA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,UAAU,EAAa,MAAM,eAAe,CAAC;AACtD,OAAO,OAAO,EAAE,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAEL,qBAAqB,EAErB,uBAAuB,EACvB,2BAA2B,EAC3B,6BAA6B,EAC9B,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,UAAU,EAEX,MAAM,sBAAsB,CAAC;AAE9B,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;A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AAE,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;IAgB3E,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;CACF"}
|
|
@@ -24,6 +24,13 @@ export default abstract class BaseBrowserAgent extends Agent {
|
|
|
24
24
|
tabId?: string;
|
|
25
25
|
windowId?: string;
|
|
26
26
|
}>;
|
|
27
|
+
protected lastToolResult(messages: LanguageModelV1Prompt): {
|
|
28
|
+
id: string;
|
|
29
|
+
toolName: string;
|
|
30
|
+
args: unknown;
|
|
31
|
+
result: unknown;
|
|
32
|
+
isError?: boolean;
|
|
33
|
+
} | null;
|
|
27
34
|
protected abstract execute_script(agentContext: AgentContext, func: (...args: any[]) => void, args: any[]): Promise<any>;
|
|
28
35
|
protected execute_mcp_script(agentContext: AgentContext, script: string): Promise<string | number | Record<string, any> | undefined>;
|
|
29
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser_base.d.ts","sourceRoot":"","sources":["../../../src/agent/browser/browser_base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"browser_base.d.ts","sourceRoot":"","sources":["../../../src/agent/browser/browser_base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAA+B,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAc,UAAU,EAAE,MAAM,aAAa,CAAC;AAEnE,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,gBAAiB,SAAQ,KAAK;IAC1D,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,EAA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AC1B,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,EAC9B,IAAI,EAAE,GAAG,EAAE,GACV,OAAO,CAAC,GAAG,CAAC;cAEC,kBAAkB,CAChC,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;CAG9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser_labels.d.ts","sourceRoot":"","sources":["../../../src/agent/browser/browser_labels.ts"],"names":[],"mappings":"AACA,OAAO,gBAAgB,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAc,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,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;cAmCvD,UAAU,CACxB,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"browser_labels.d.ts","sourceRoot":"","sources":["../../../src/agent/browser/browser_labels.ts"],"names":[],"mappings":"AACA,OAAO,gBAAgB,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAc,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,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C1B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR,OAAO,CAAC,IAAI,CAAC;IAEhB,SAAS,CAAC,QAAQ,CAAC,KAAK,CACtB,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC;IAEhB,SAAS,CAAC,QAAQ,CAAC,MAAM,CACvB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC;IAEhB,SAAS,CAAC,QAAQ,CAAC,aAAa,CAC9B,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC;IAEhB,OAAO,CAAC,cAAc;cAwON,cAAc,CAC5B,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC,IAAI,CAAC;CAuCjB"}
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,GAAG,KAAK,GAAG,OAAO,CAAC;IACtC,WAAW,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,GAAG,KAAK,GAAG,OAAO,CAAC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,QAAA,MAAM,MAAM,EAAE,YAKb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare class Eko {
|
|
|
12
12
|
initContext(workflow: Workflow, contextParams?: Record<string, any>): Promise<Context>;
|
|
13
13
|
private doRunWorkflow;
|
|
14
14
|
getTask(taskId: string): Context | undefined;
|
|
15
|
+
getAllTaskId(): string[];
|
|
15
16
|
deleteTask(taskId: string): boolean;
|
|
16
17
|
abortTask(taskId: string): boolean;
|
|
17
18
|
addAgent(agent: Agent): void;
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKjC,qBAAa,GAAG;IACd,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,OAAO,CAAuB;gBAE1B,MAAM,EAAE,SAAS;IAKhB,QAAQ,CACnB,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,MAAiB,EACzB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAClC,OAAO,CAAC,QAAQ,CAAC;IAwBP,MAAM,CACjB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,QAAQ,CAAC;IAcP,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAkB3C,GAAG,CACd,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,MAAiB,EACzB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAClC,OAAO,CAAC,SAAS,CAAC;IAKR,WAAW,CACtB,QAAQ,EAAE,QAAQ,EAClB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,C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AAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAI5C,YAAY,IAAI,MAAM,EAAE;IAIxB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAInC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAUlC,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;CAIpC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -7,7 +7,8 @@ var buffer = require('buffer');
|
|
|
7
7
|
const config = {
|
|
8
8
|
name: "Fellou",
|
|
9
9
|
platform: "mac",
|
|
10
|
-
maxReactNum: 100
|
|
10
|
+
maxReactNum: 100,
|
|
11
|
+
maxTokens: 16000
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
var LogLevel;
|
|
@@ -12763,7 +12764,7 @@ class RetryLanguageModel {
|
|
|
12763
12764
|
constructor(llms, names, stream_first_timeout) {
|
|
12764
12765
|
this.llms = llms;
|
|
12765
12766
|
this.names = names || [];
|
|
12766
|
-
this.stream_first_timeout = stream_first_timeout ||
|
|
12767
|
+
this.stream_first_timeout = stream_first_timeout || 30000;
|
|
12767
12768
|
if (this.names.indexOf("default") == -1) {
|
|
12768
12769
|
this.names.push("default");
|
|
12769
12770
|
}
|
|
@@ -12777,7 +12778,7 @@ class RetryLanguageModel {
|
|
|
12777
12778
|
toolChoice: request.toolChoice,
|
|
12778
12779
|
},
|
|
12779
12780
|
prompt: request.messages,
|
|
12780
|
-
maxTokens: request.maxTokens,
|
|
12781
|
+
maxTokens: request.maxTokens || config.maxTokens,
|
|
12781
12782
|
temperature: request.temperature,
|
|
12782
12783
|
topP: request.topP,
|
|
12783
12784
|
topK: request.topK,
|
|
@@ -12800,6 +12801,9 @@ class RetryLanguageModel {
|
|
|
12800
12801
|
return result;
|
|
12801
12802
|
}
|
|
12802
12803
|
catch (e) {
|
|
12804
|
+
if (e?.name === "AbortError") {
|
|
12805
|
+
throw e;
|
|
12806
|
+
}
|
|
12803
12807
|
if (Log.isEnableInfo()) {
|
|
12804
12808
|
Log.info(`LLM nonstream request, name: ${name} => `, {
|
|
12805
12809
|
tools: options.mode?.tools,
|
|
@@ -12820,7 +12824,7 @@ class RetryLanguageModel {
|
|
|
12820
12824
|
toolChoice: request.toolChoice,
|
|
12821
12825
|
},
|
|
12822
12826
|
prompt: request.messages,
|
|
12823
|
-
maxTokens: request.maxTokens,
|
|
12827
|
+
maxTokens: request.maxTokens || config.maxTokens,
|
|
12824
12828
|
temperature: request.temperature,
|
|
12825
12829
|
topP: request.topP,
|
|
12826
12830
|
topK: request.topK,
|
|
@@ -12861,6 +12865,9 @@ class RetryLanguageModel {
|
|
|
12861
12865
|
return result;
|
|
12862
12866
|
}
|
|
12863
12867
|
catch (e) {
|
|
12868
|
+
if (e?.name === "AbortError") {
|
|
12869
|
+
throw e;
|
|
12870
|
+
}
|
|
12864
12871
|
if (Log.isEnableInfo()) {
|
|
12865
12872
|
Log.info(`LLM stream request, name: ${name} => `, {
|
|
12866
12873
|
tools: options.mode?.tools,
|
|
@@ -16250,7 +16257,7 @@ class Agent {
|
|
|
16250
16257
|
nodeId: agentContext.agentChain.agent.id,
|
|
16251
16258
|
environment: config.platform,
|
|
16252
16259
|
agent_name: agentContext.agent.Name,
|
|
16253
|
-
}
|
|
16260
|
+
},
|
|
16254
16261
|
});
|
|
16255
16262
|
},
|
|
16256
16263
|
};
|
|
@@ -16322,12 +16329,17 @@ class Agent {
|
|
|
16322
16329
|
else if (!isError && text.length == 0) {
|
|
16323
16330
|
text = "Successful";
|
|
16324
16331
|
}
|
|
16325
|
-
let
|
|
16332
|
+
let contentText = {
|
|
16333
|
+
type: "text",
|
|
16334
|
+
text: text,
|
|
16335
|
+
};
|
|
16336
|
+
let result = text;
|
|
16326
16337
|
if (text &&
|
|
16327
16338
|
((text.startsWith("{") && text.endsWith("}")) ||
|
|
16328
16339
|
(text.startsWith("[") && text.endsWith("]")))) {
|
|
16329
16340
|
try {
|
|
16330
16341
|
result = JSON.parse(text);
|
|
16342
|
+
contentText = null;
|
|
16331
16343
|
}
|
|
16332
16344
|
catch (e) { }
|
|
16333
16345
|
}
|
|
@@ -16336,6 +16348,7 @@ class Agent {
|
|
|
16336
16348
|
toolCallId: toolUse.toolCallId,
|
|
16337
16349
|
toolName: toolUse.toolName,
|
|
16338
16350
|
result: result,
|
|
16351
|
+
content: contentText ? [contentText] : undefined,
|
|
16339
16352
|
isError: isError,
|
|
16340
16353
|
};
|
|
16341
16354
|
}
|
|
@@ -16829,7 +16842,7 @@ class Planner {
|
|
|
16829
16842
|
];
|
|
16830
16843
|
}
|
|
16831
16844
|
let request = {
|
|
16832
|
-
maxTokens:
|
|
16845
|
+
maxTokens: 4096,
|
|
16833
16846
|
temperature: 0.7,
|
|
16834
16847
|
messages: messages,
|
|
16835
16848
|
abortSignal: this.context.controller.signal,
|
|
@@ -16933,7 +16946,7 @@ class Eko {
|
|
|
16933
16946
|
throw new Error("The task does not exist");
|
|
16934
16947
|
}
|
|
16935
16948
|
try {
|
|
16936
|
-
return this.doRunWorkflow(context);
|
|
16949
|
+
return await this.doRunWorkflow(context);
|
|
16937
16950
|
}
|
|
16938
16951
|
catch (e) {
|
|
16939
16952
|
return {
|
|
@@ -16998,6 +17011,9 @@ class Eko {
|
|
|
16998
17011
|
getTask(taskId) {
|
|
16999
17012
|
return this.taskMap.get(taskId);
|
|
17000
17013
|
}
|
|
17014
|
+
getAllTaskId() {
|
|
17015
|
+
return [...this.taskMap.keys()];
|
|
17016
|
+
}
|
|
17001
17017
|
deleteTask(taskId) {
|
|
17002
17018
|
return this.taskMap.delete(taskId);
|
|
17003
17019
|
}
|
|
@@ -17649,14 +17665,16 @@ class BaseComputerAgent extends Agent {
|
|
|
17649
17665
|
properties: {
|
|
17650
17666
|
duration: {
|
|
17651
17667
|
type: "number",
|
|
17652
|
-
description: "Duration in
|
|
17653
|
-
default:
|
|
17668
|
+
description: "Duration in millisecond",
|
|
17669
|
+
default: 500,
|
|
17670
|
+
minimum: 200,
|
|
17671
|
+
maximum: 2000,
|
|
17654
17672
|
},
|
|
17655
17673
|
},
|
|
17656
17674
|
required: ["duration"],
|
|
17657
17675
|
},
|
|
17658
17676
|
execute: async (args, agentContext) => {
|
|
17659
|
-
return await this.callInnerTool(() => sleep((args.duration ||
|
|
17677
|
+
return await this.callInnerTool(() => sleep((args.duration || 200)));
|
|
17660
17678
|
},
|
|
17661
17679
|
},
|
|
17662
17680
|
];
|
|
@@ -17700,10 +17718,13 @@ class BaseComputerAgent extends Agent {
|
|
|
17700
17718
|
|
|
17701
17719
|
class BaseBrowserAgent extends Agent {
|
|
17702
17720
|
async go_back(agentContext) {
|
|
17703
|
-
|
|
17704
|
-
|
|
17705
|
-
|
|
17706
|
-
|
|
17721
|
+
try {
|
|
17722
|
+
await this.execute_script(agentContext, () => {
|
|
17723
|
+
return window.navigation.back();
|
|
17724
|
+
}, []);
|
|
17725
|
+
await sleep(100);
|
|
17726
|
+
}
|
|
17727
|
+
catch (e) { }
|
|
17707
17728
|
}
|
|
17708
17729
|
async extract_content(agentContext) {
|
|
17709
17730
|
let content = await this.execute_script(agentContext, () => {
|
|
@@ -17739,7 +17760,7 @@ class BaseBrowserAgent extends Agent {
|
|
|
17739
17760
|
environment: "browser",
|
|
17740
17761
|
agent_name: agentContext.agent.Name,
|
|
17741
17762
|
browser_url: agentContext.variables.get("lastUrl"),
|
|
17742
|
-
}
|
|
17763
|
+
},
|
|
17743
17764
|
});
|
|
17744
17765
|
if (result.extInfo &&
|
|
17745
17766
|
result.extInfo["javascript"] &&
|
|
@@ -17779,6 +17800,42 @@ class BaseBrowserAgent extends Agent {
|
|
|
17779
17800
|
};
|
|
17780
17801
|
}, []);
|
|
17781
17802
|
}
|
|
17803
|
+
lastToolResult(messages) {
|
|
17804
|
+
let lastMessage = messages[messages.length - 1];
|
|
17805
|
+
if (lastMessage.role != "tool") {
|
|
17806
|
+
return null;
|
|
17807
|
+
}
|
|
17808
|
+
let toolResult = lastMessage.content.filter((t) => t.type == "tool-result")[0];
|
|
17809
|
+
if (!toolResult) {
|
|
17810
|
+
return null;
|
|
17811
|
+
}
|
|
17812
|
+
let result = toolResult.result;
|
|
17813
|
+
let isError = toolResult.isError;
|
|
17814
|
+
for (let i = messages.length - 2; i > 0; i--) {
|
|
17815
|
+
if (messages[i].role !== "assistant" ||
|
|
17816
|
+
typeof messages[i].content == "string") {
|
|
17817
|
+
continue;
|
|
17818
|
+
}
|
|
17819
|
+
for (let j = 0; j < messages[i].content.length; j++) {
|
|
17820
|
+
let content = messages[i].content[j];
|
|
17821
|
+
if (typeof content !== "string" && content.type !== "tool-call") {
|
|
17822
|
+
continue;
|
|
17823
|
+
}
|
|
17824
|
+
let toolUse = content;
|
|
17825
|
+
if (toolResult.toolCallId != toolUse.toolCallId) {
|
|
17826
|
+
continue;
|
|
17827
|
+
}
|
|
17828
|
+
return {
|
|
17829
|
+
id: toolResult.toolCallId,
|
|
17830
|
+
toolName: toolUse.toolName,
|
|
17831
|
+
args: toolUse.args,
|
|
17832
|
+
result,
|
|
17833
|
+
isError,
|
|
17834
|
+
};
|
|
17835
|
+
}
|
|
17836
|
+
}
|
|
17837
|
+
return null;
|
|
17838
|
+
}
|
|
17782
17839
|
async execute_mcp_script(agentContext, script) {
|
|
17783
17840
|
return;
|
|
17784
17841
|
}
|
|
@@ -17805,7 +17862,7 @@ function run_build_dom_tree() {
|
|
|
17805
17862
|
return window.clickable_elements[highlightIndex];
|
|
17806
17863
|
}
|
|
17807
17864
|
function remove_highlight() {
|
|
17808
|
-
let highlight = document.getElementById('
|
|
17865
|
+
let highlight = document.getElementById('eko-highlight-container');
|
|
17809
17866
|
if (highlight) {
|
|
17810
17867
|
highlight.remove();
|
|
17811
17868
|
}
|
|
@@ -17943,10 +18000,10 @@ function run_build_dom_tree() {
|
|
|
17943
18000
|
let highlightIndex = 0; // Reset highlight index
|
|
17944
18001
|
function highlightElement(element, index, parentIframe = null) {
|
|
17945
18002
|
// Create or get highlight container
|
|
17946
|
-
let container = document.getElementById('
|
|
18003
|
+
let container = document.getElementById('eko-highlight-container');
|
|
17947
18004
|
if (!container) {
|
|
17948
18005
|
container = document.createElement('div');
|
|
17949
|
-
container.id = '
|
|
18006
|
+
container.id = 'eko-highlight-container';
|
|
17950
18007
|
container.style.position = 'fixed';
|
|
17951
18008
|
container.style.pointerEvents = 'none';
|
|
17952
18009
|
container.style.top = '0';
|
|
@@ -17999,7 +18056,7 @@ function run_build_dom_tree() {
|
|
|
17999
18056
|
overlay.style.height = `${rect.height}px`;
|
|
18000
18057
|
// Create label
|
|
18001
18058
|
const label = document.createElement('div');
|
|
18002
|
-
label.className = '
|
|
18059
|
+
label.className = 'eko-highlight-label';
|
|
18003
18060
|
label.style.position = 'absolute';
|
|
18004
18061
|
label.style.background = baseColor;
|
|
18005
18062
|
label.style.color = 'white';
|
|
@@ -18033,7 +18090,7 @@ function run_build_dom_tree() {
|
|
|
18033
18090
|
container.appendChild(overlay);
|
|
18034
18091
|
container.appendChild(label);
|
|
18035
18092
|
// Store reference for cleanup
|
|
18036
|
-
element.setAttribute('
|
|
18093
|
+
element.setAttribute('eko-user-highlight-id', `eko-highlight-${index}`);
|
|
18037
18094
|
return index + 1;
|
|
18038
18095
|
}
|
|
18039
18096
|
// Helper function to generate XPath as a tree
|
|
@@ -18404,6 +18461,9 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
18404
18461
|
}
|
|
18405
18462
|
async input_text(agentContext, index, text, enter) {
|
|
18406
18463
|
await this.execute_script(agentContext, typing, [{ index, text, enter }]);
|
|
18464
|
+
if (enter) {
|
|
18465
|
+
await sleep(200);
|
|
18466
|
+
}
|
|
18407
18467
|
}
|
|
18408
18468
|
async click_element(agentContext, index, num_clicks, button) {
|
|
18409
18469
|
await this.execute_script(agentContext, do_click, [
|
|
@@ -18578,15 +18638,22 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
18578
18638
|
properties: {
|
|
18579
18639
|
amount: {
|
|
18580
18640
|
type: "number",
|
|
18581
|
-
description: "Scroll amount (
|
|
18582
|
-
minimum:
|
|
18641
|
+
description: "Scroll amount (up / down)",
|
|
18642
|
+
minimum: 1,
|
|
18583
18643
|
maximum: 10,
|
|
18584
18644
|
},
|
|
18645
|
+
direction: {
|
|
18646
|
+
type: "string",
|
|
18647
|
+
enum: ["up", "down"],
|
|
18648
|
+
},
|
|
18585
18649
|
},
|
|
18586
|
-
required: ["amount"],
|
|
18650
|
+
required: ["amount", "direction"],
|
|
18587
18651
|
},
|
|
18588
18652
|
execute: async (args, agentContext) => {
|
|
18589
|
-
return await this.callInnerTool(() =>
|
|
18653
|
+
return await this.callInnerTool(async () => {
|
|
18654
|
+
let amount = args.amount;
|
|
18655
|
+
await this.scroll_mouse_wheel(agentContext, args.direction == "up" ? -amount : amount);
|
|
18656
|
+
});
|
|
18590
18657
|
},
|
|
18591
18658
|
},
|
|
18592
18659
|
{
|
|
@@ -18625,22 +18692,23 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
18625
18692
|
properties: {
|
|
18626
18693
|
duration: {
|
|
18627
18694
|
type: "number",
|
|
18628
|
-
description: "Duration in
|
|
18629
|
-
default:
|
|
18695
|
+
description: "Duration in millisecond",
|
|
18696
|
+
default: 500,
|
|
18697
|
+
minimum: 200,
|
|
18698
|
+
maximum: 2000,
|
|
18630
18699
|
},
|
|
18631
18700
|
},
|
|
18632
18701
|
required: ["duration"],
|
|
18633
18702
|
},
|
|
18634
18703
|
execute: async (args, agentContext) => {
|
|
18635
|
-
return await this.callInnerTool(() => sleep((args.duration ||
|
|
18704
|
+
return await this.callInnerTool(() => sleep((args.duration || 200)));
|
|
18636
18705
|
},
|
|
18637
18706
|
},
|
|
18638
18707
|
];
|
|
18639
18708
|
}
|
|
18640
18709
|
async handleMessages(agentContext, messages) {
|
|
18641
|
-
let
|
|
18642
|
-
if (
|
|
18643
|
-
lastMessage.content.filter((t) => t.type == "tool-result").length > 0) {
|
|
18710
|
+
let lastTool = this.lastToolResult(messages);
|
|
18711
|
+
if (lastTool && lastTool.toolName !== "extract_content") {
|
|
18644
18712
|
await sleep(200);
|
|
18645
18713
|
let result = await this.screenshot_and_html(agentContext);
|
|
18646
18714
|
let image = toImage(result.imageBase64);
|
|
@@ -18698,6 +18766,10 @@ function typing(params) {
|
|
|
18698
18766
|
}
|
|
18699
18767
|
else {
|
|
18700
18768
|
input.value = text;
|
|
18769
|
+
if (input.__proto__) {
|
|
18770
|
+
let value_setter = Object.getOwnPropertyDescriptor(input.__proto__, "value")?.set;
|
|
18771
|
+
value_setter && value_setter.call(input, text);
|
|
18772
|
+
}
|
|
18701
18773
|
}
|
|
18702
18774
|
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
18703
18775
|
if (enter) {
|
|
@@ -18778,7 +18850,7 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
|
|
|
18778
18850
|
tools: _tools_,
|
|
18779
18851
|
llms: llms,
|
|
18780
18852
|
mcpClient: mcpClient,
|
|
18781
|
-
planDescription: "Browser operation agent, interact with the browser using the mouse and keyboard."
|
|
18853
|
+
planDescription: "Browser operation agent, interact with the browser using the mouse and keyboard.",
|
|
18782
18854
|
});
|
|
18783
18855
|
let init_tools = this.buildInitTools();
|
|
18784
18856
|
if (ext_tools && ext_tools.length > 0) {
|
|
@@ -18906,15 +18978,22 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
|
|
|
18906
18978
|
properties: {
|
|
18907
18979
|
amount: {
|
|
18908
18980
|
type: "number",
|
|
18909
|
-
description: "Scroll amount (
|
|
18910
|
-
minimum:
|
|
18981
|
+
description: "Scroll amount (up / down)",
|
|
18982
|
+
minimum: 1,
|
|
18911
18983
|
maximum: 10,
|
|
18912
18984
|
},
|
|
18985
|
+
direction: {
|
|
18986
|
+
type: "string",
|
|
18987
|
+
enum: ["up", "down"],
|
|
18988
|
+
},
|
|
18913
18989
|
},
|
|
18914
|
-
required: ["amount"],
|
|
18990
|
+
required: ["amount", "direction"],
|
|
18915
18991
|
},
|
|
18916
18992
|
execute: async (args, agentContext) => {
|
|
18917
|
-
return await this.callInnerTool(() =>
|
|
18993
|
+
return await this.callInnerTool(async () => {
|
|
18994
|
+
let amount = args.amount;
|
|
18995
|
+
await this.scroll(agentContext, args.direction == "up" ? -amount : amount);
|
|
18996
|
+
});
|
|
18918
18997
|
},
|
|
18919
18998
|
},
|
|
18920
18999
|
{
|
|
@@ -18983,22 +19062,23 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
|
|
|
18983
19062
|
properties: {
|
|
18984
19063
|
duration: {
|
|
18985
19064
|
type: "number",
|
|
18986
|
-
description: "Duration in
|
|
18987
|
-
default:
|
|
19065
|
+
description: "Duration in millisecond",
|
|
19066
|
+
default: 500,
|
|
19067
|
+
minimum: 200,
|
|
19068
|
+
maximum: 2000,
|
|
18988
19069
|
},
|
|
18989
19070
|
},
|
|
18990
19071
|
required: ["duration"],
|
|
18991
19072
|
},
|
|
18992
19073
|
execute: async (args, agentContext) => {
|
|
18993
|
-
return await this.callInnerTool(() => sleep((args.duration ||
|
|
19074
|
+
return await this.callInnerTool(() => sleep((args.duration || 200)));
|
|
18994
19075
|
},
|
|
18995
19076
|
},
|
|
18996
19077
|
];
|
|
18997
19078
|
}
|
|
18998
19079
|
async handleMessages(agentContext, messages) {
|
|
18999
|
-
let
|
|
19000
|
-
if (
|
|
19001
|
-
lastMessage.content.filter((t) => t.type == "tool-result").length > 0) {
|
|
19080
|
+
let lastTool = this.lastToolResult(messages);
|
|
19081
|
+
if (lastTool && lastTool.toolName !== "extract_content") {
|
|
19002
19082
|
await sleep(200);
|
|
19003
19083
|
let result = await this.screenshot(agentContext);
|
|
19004
19084
|
let image = toImage(result.imageBase64);
|
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const config = {
|
|
2
2
|
name: "Fellou",
|
|
3
3
|
platform: "mac",
|
|
4
|
-
maxReactNum: 100
|
|
4
|
+
maxReactNum: 100,
|
|
5
|
+
maxTokens: 16000
|
|
5
6
|
};
|
|
6
7
|
|
|
7
8
|
var LogLevel;
|
|
@@ -12728,7 +12729,7 @@ class RetryLanguageModel {
|
|
|
12728
12729
|
constructor(llms, names, stream_first_timeout) {
|
|
12729
12730
|
this.llms = llms;
|
|
12730
12731
|
this.names = names || [];
|
|
12731
|
-
this.stream_first_timeout = stream_first_timeout ||
|
|
12732
|
+
this.stream_first_timeout = stream_first_timeout || 30000;
|
|
12732
12733
|
if (this.names.indexOf("default") == -1) {
|
|
12733
12734
|
this.names.push("default");
|
|
12734
12735
|
}
|
|
@@ -12742,7 +12743,7 @@ class RetryLanguageModel {
|
|
|
12742
12743
|
toolChoice: request.toolChoice,
|
|
12743
12744
|
},
|
|
12744
12745
|
prompt: request.messages,
|
|
12745
|
-
maxTokens: request.maxTokens,
|
|
12746
|
+
maxTokens: request.maxTokens || config.maxTokens,
|
|
12746
12747
|
temperature: request.temperature,
|
|
12747
12748
|
topP: request.topP,
|
|
12748
12749
|
topK: request.topK,
|
|
@@ -12765,6 +12766,9 @@ class RetryLanguageModel {
|
|
|
12765
12766
|
return result;
|
|
12766
12767
|
}
|
|
12767
12768
|
catch (e) {
|
|
12769
|
+
if (e?.name === "AbortError") {
|
|
12770
|
+
throw e;
|
|
12771
|
+
}
|
|
12768
12772
|
if (Log.isEnableInfo()) {
|
|
12769
12773
|
Log.info(`LLM nonstream request, name: ${name} => `, {
|
|
12770
12774
|
tools: options.mode?.tools,
|
|
@@ -12785,7 +12789,7 @@ class RetryLanguageModel {
|
|
|
12785
12789
|
toolChoice: request.toolChoice,
|
|
12786
12790
|
},
|
|
12787
12791
|
prompt: request.messages,
|
|
12788
|
-
maxTokens: request.maxTokens,
|
|
12792
|
+
maxTokens: request.maxTokens || config.maxTokens,
|
|
12789
12793
|
temperature: request.temperature,
|
|
12790
12794
|
topP: request.topP,
|
|
12791
12795
|
topK: request.topK,
|
|
@@ -12826,6 +12830,9 @@ class RetryLanguageModel {
|
|
|
12826
12830
|
return result;
|
|
12827
12831
|
}
|
|
12828
12832
|
catch (e) {
|
|
12833
|
+
if (e?.name === "AbortError") {
|
|
12834
|
+
throw e;
|
|
12835
|
+
}
|
|
12829
12836
|
if (Log.isEnableInfo()) {
|
|
12830
12837
|
Log.info(`LLM stream request, name: ${name} => `, {
|
|
12831
12838
|
tools: options.mode?.tools,
|
|
@@ -16215,7 +16222,7 @@ class Agent {
|
|
|
16215
16222
|
nodeId: agentContext.agentChain.agent.id,
|
|
16216
16223
|
environment: config.platform,
|
|
16217
16224
|
agent_name: agentContext.agent.Name,
|
|
16218
|
-
}
|
|
16225
|
+
},
|
|
16219
16226
|
});
|
|
16220
16227
|
},
|
|
16221
16228
|
};
|
|
@@ -16287,12 +16294,17 @@ class Agent {
|
|
|
16287
16294
|
else if (!isError && text.length == 0) {
|
|
16288
16295
|
text = "Successful";
|
|
16289
16296
|
}
|
|
16290
|
-
let
|
|
16297
|
+
let contentText = {
|
|
16298
|
+
type: "text",
|
|
16299
|
+
text: text,
|
|
16300
|
+
};
|
|
16301
|
+
let result = text;
|
|
16291
16302
|
if (text &&
|
|
16292
16303
|
((text.startsWith("{") && text.endsWith("}")) ||
|
|
16293
16304
|
(text.startsWith("[") && text.endsWith("]")))) {
|
|
16294
16305
|
try {
|
|
16295
16306
|
result = JSON.parse(text);
|
|
16307
|
+
contentText = null;
|
|
16296
16308
|
}
|
|
16297
16309
|
catch (e) { }
|
|
16298
16310
|
}
|
|
@@ -16301,6 +16313,7 @@ class Agent {
|
|
|
16301
16313
|
toolCallId: toolUse.toolCallId,
|
|
16302
16314
|
toolName: toolUse.toolName,
|
|
16303
16315
|
result: result,
|
|
16316
|
+
content: contentText ? [contentText] : undefined,
|
|
16304
16317
|
isError: isError,
|
|
16305
16318
|
};
|
|
16306
16319
|
}
|
|
@@ -16794,7 +16807,7 @@ class Planner {
|
|
|
16794
16807
|
];
|
|
16795
16808
|
}
|
|
16796
16809
|
let request = {
|
|
16797
|
-
maxTokens:
|
|
16810
|
+
maxTokens: 4096,
|
|
16798
16811
|
temperature: 0.7,
|
|
16799
16812
|
messages: messages,
|
|
16800
16813
|
abortSignal: this.context.controller.signal,
|
|
@@ -16898,7 +16911,7 @@ class Eko {
|
|
|
16898
16911
|
throw new Error("The task does not exist");
|
|
16899
16912
|
}
|
|
16900
16913
|
try {
|
|
16901
|
-
return this.doRunWorkflow(context);
|
|
16914
|
+
return await this.doRunWorkflow(context);
|
|
16902
16915
|
}
|
|
16903
16916
|
catch (e) {
|
|
16904
16917
|
return {
|
|
@@ -16963,6 +16976,9 @@ class Eko {
|
|
|
16963
16976
|
getTask(taskId) {
|
|
16964
16977
|
return this.taskMap.get(taskId);
|
|
16965
16978
|
}
|
|
16979
|
+
getAllTaskId() {
|
|
16980
|
+
return [...this.taskMap.keys()];
|
|
16981
|
+
}
|
|
16966
16982
|
deleteTask(taskId) {
|
|
16967
16983
|
return this.taskMap.delete(taskId);
|
|
16968
16984
|
}
|
|
@@ -17614,14 +17630,16 @@ class BaseComputerAgent extends Agent {
|
|
|
17614
17630
|
properties: {
|
|
17615
17631
|
duration: {
|
|
17616
17632
|
type: "number",
|
|
17617
|
-
description: "Duration in
|
|
17618
|
-
default:
|
|
17633
|
+
description: "Duration in millisecond",
|
|
17634
|
+
default: 500,
|
|
17635
|
+
minimum: 200,
|
|
17636
|
+
maximum: 2000,
|
|
17619
17637
|
},
|
|
17620
17638
|
},
|
|
17621
17639
|
required: ["duration"],
|
|
17622
17640
|
},
|
|
17623
17641
|
execute: async (args, agentContext) => {
|
|
17624
|
-
return await this.callInnerTool(() => sleep((args.duration ||
|
|
17642
|
+
return await this.callInnerTool(() => sleep((args.duration || 200)));
|
|
17625
17643
|
},
|
|
17626
17644
|
},
|
|
17627
17645
|
];
|
|
@@ -17665,10 +17683,13 @@ class BaseComputerAgent extends Agent {
|
|
|
17665
17683
|
|
|
17666
17684
|
class BaseBrowserAgent extends Agent {
|
|
17667
17685
|
async go_back(agentContext) {
|
|
17668
|
-
|
|
17669
|
-
|
|
17670
|
-
|
|
17671
|
-
|
|
17686
|
+
try {
|
|
17687
|
+
await this.execute_script(agentContext, () => {
|
|
17688
|
+
return window.navigation.back();
|
|
17689
|
+
}, []);
|
|
17690
|
+
await sleep(100);
|
|
17691
|
+
}
|
|
17692
|
+
catch (e) { }
|
|
17672
17693
|
}
|
|
17673
17694
|
async extract_content(agentContext) {
|
|
17674
17695
|
let content = await this.execute_script(agentContext, () => {
|
|
@@ -17704,7 +17725,7 @@ class BaseBrowserAgent extends Agent {
|
|
|
17704
17725
|
environment: "browser",
|
|
17705
17726
|
agent_name: agentContext.agent.Name,
|
|
17706
17727
|
browser_url: agentContext.variables.get("lastUrl"),
|
|
17707
|
-
}
|
|
17728
|
+
},
|
|
17708
17729
|
});
|
|
17709
17730
|
if (result.extInfo &&
|
|
17710
17731
|
result.extInfo["javascript"] &&
|
|
@@ -17744,6 +17765,42 @@ class BaseBrowserAgent extends Agent {
|
|
|
17744
17765
|
};
|
|
17745
17766
|
}, []);
|
|
17746
17767
|
}
|
|
17768
|
+
lastToolResult(messages) {
|
|
17769
|
+
let lastMessage = messages[messages.length - 1];
|
|
17770
|
+
if (lastMessage.role != "tool") {
|
|
17771
|
+
return null;
|
|
17772
|
+
}
|
|
17773
|
+
let toolResult = lastMessage.content.filter((t) => t.type == "tool-result")[0];
|
|
17774
|
+
if (!toolResult) {
|
|
17775
|
+
return null;
|
|
17776
|
+
}
|
|
17777
|
+
let result = toolResult.result;
|
|
17778
|
+
let isError = toolResult.isError;
|
|
17779
|
+
for (let i = messages.length - 2; i > 0; i--) {
|
|
17780
|
+
if (messages[i].role !== "assistant" ||
|
|
17781
|
+
typeof messages[i].content == "string") {
|
|
17782
|
+
continue;
|
|
17783
|
+
}
|
|
17784
|
+
for (let j = 0; j < messages[i].content.length; j++) {
|
|
17785
|
+
let content = messages[i].content[j];
|
|
17786
|
+
if (typeof content !== "string" && content.type !== "tool-call") {
|
|
17787
|
+
continue;
|
|
17788
|
+
}
|
|
17789
|
+
let toolUse = content;
|
|
17790
|
+
if (toolResult.toolCallId != toolUse.toolCallId) {
|
|
17791
|
+
continue;
|
|
17792
|
+
}
|
|
17793
|
+
return {
|
|
17794
|
+
id: toolResult.toolCallId,
|
|
17795
|
+
toolName: toolUse.toolName,
|
|
17796
|
+
args: toolUse.args,
|
|
17797
|
+
result,
|
|
17798
|
+
isError,
|
|
17799
|
+
};
|
|
17800
|
+
}
|
|
17801
|
+
}
|
|
17802
|
+
return null;
|
|
17803
|
+
}
|
|
17747
17804
|
async execute_mcp_script(agentContext, script) {
|
|
17748
17805
|
return;
|
|
17749
17806
|
}
|
|
@@ -17770,7 +17827,7 @@ function run_build_dom_tree() {
|
|
|
17770
17827
|
return window.clickable_elements[highlightIndex];
|
|
17771
17828
|
}
|
|
17772
17829
|
function remove_highlight() {
|
|
17773
|
-
let highlight = document.getElementById('
|
|
17830
|
+
let highlight = document.getElementById('eko-highlight-container');
|
|
17774
17831
|
if (highlight) {
|
|
17775
17832
|
highlight.remove();
|
|
17776
17833
|
}
|
|
@@ -17908,10 +17965,10 @@ function run_build_dom_tree() {
|
|
|
17908
17965
|
let highlightIndex = 0; // Reset highlight index
|
|
17909
17966
|
function highlightElement(element, index, parentIframe = null) {
|
|
17910
17967
|
// Create or get highlight container
|
|
17911
|
-
let container = document.getElementById('
|
|
17968
|
+
let container = document.getElementById('eko-highlight-container');
|
|
17912
17969
|
if (!container) {
|
|
17913
17970
|
container = document.createElement('div');
|
|
17914
|
-
container.id = '
|
|
17971
|
+
container.id = 'eko-highlight-container';
|
|
17915
17972
|
container.style.position = 'fixed';
|
|
17916
17973
|
container.style.pointerEvents = 'none';
|
|
17917
17974
|
container.style.top = '0';
|
|
@@ -17964,7 +18021,7 @@ function run_build_dom_tree() {
|
|
|
17964
18021
|
overlay.style.height = `${rect.height}px`;
|
|
17965
18022
|
// Create label
|
|
17966
18023
|
const label = document.createElement('div');
|
|
17967
|
-
label.className = '
|
|
18024
|
+
label.className = 'eko-highlight-label';
|
|
17968
18025
|
label.style.position = 'absolute';
|
|
17969
18026
|
label.style.background = baseColor;
|
|
17970
18027
|
label.style.color = 'white';
|
|
@@ -17998,7 +18055,7 @@ function run_build_dom_tree() {
|
|
|
17998
18055
|
container.appendChild(overlay);
|
|
17999
18056
|
container.appendChild(label);
|
|
18000
18057
|
// Store reference for cleanup
|
|
18001
|
-
element.setAttribute('
|
|
18058
|
+
element.setAttribute('eko-user-highlight-id', `eko-highlight-${index}`);
|
|
18002
18059
|
return index + 1;
|
|
18003
18060
|
}
|
|
18004
18061
|
// Helper function to generate XPath as a tree
|
|
@@ -18369,6 +18426,9 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
18369
18426
|
}
|
|
18370
18427
|
async input_text(agentContext, index, text, enter) {
|
|
18371
18428
|
await this.execute_script(agentContext, typing, [{ index, text, enter }]);
|
|
18429
|
+
if (enter) {
|
|
18430
|
+
await sleep(200);
|
|
18431
|
+
}
|
|
18372
18432
|
}
|
|
18373
18433
|
async click_element(agentContext, index, num_clicks, button) {
|
|
18374
18434
|
await this.execute_script(agentContext, do_click, [
|
|
@@ -18543,15 +18603,22 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
18543
18603
|
properties: {
|
|
18544
18604
|
amount: {
|
|
18545
18605
|
type: "number",
|
|
18546
|
-
description: "Scroll amount (
|
|
18547
|
-
minimum:
|
|
18606
|
+
description: "Scroll amount (up / down)",
|
|
18607
|
+
minimum: 1,
|
|
18548
18608
|
maximum: 10,
|
|
18549
18609
|
},
|
|
18610
|
+
direction: {
|
|
18611
|
+
type: "string",
|
|
18612
|
+
enum: ["up", "down"],
|
|
18613
|
+
},
|
|
18550
18614
|
},
|
|
18551
|
-
required: ["amount"],
|
|
18615
|
+
required: ["amount", "direction"],
|
|
18552
18616
|
},
|
|
18553
18617
|
execute: async (args, agentContext) => {
|
|
18554
|
-
return await this.callInnerTool(() =>
|
|
18618
|
+
return await this.callInnerTool(async () => {
|
|
18619
|
+
let amount = args.amount;
|
|
18620
|
+
await this.scroll_mouse_wheel(agentContext, args.direction == "up" ? -amount : amount);
|
|
18621
|
+
});
|
|
18555
18622
|
},
|
|
18556
18623
|
},
|
|
18557
18624
|
{
|
|
@@ -18590,22 +18657,23 @@ class BaseBrowserLabelsAgent extends BaseBrowserAgent {
|
|
|
18590
18657
|
properties: {
|
|
18591
18658
|
duration: {
|
|
18592
18659
|
type: "number",
|
|
18593
|
-
description: "Duration in
|
|
18594
|
-
default:
|
|
18660
|
+
description: "Duration in millisecond",
|
|
18661
|
+
default: 500,
|
|
18662
|
+
minimum: 200,
|
|
18663
|
+
maximum: 2000,
|
|
18595
18664
|
},
|
|
18596
18665
|
},
|
|
18597
18666
|
required: ["duration"],
|
|
18598
18667
|
},
|
|
18599
18668
|
execute: async (args, agentContext) => {
|
|
18600
|
-
return await this.callInnerTool(() => sleep((args.duration ||
|
|
18669
|
+
return await this.callInnerTool(() => sleep((args.duration || 200)));
|
|
18601
18670
|
},
|
|
18602
18671
|
},
|
|
18603
18672
|
];
|
|
18604
18673
|
}
|
|
18605
18674
|
async handleMessages(agentContext, messages) {
|
|
18606
|
-
let
|
|
18607
|
-
if (
|
|
18608
|
-
lastMessage.content.filter((t) => t.type == "tool-result").length > 0) {
|
|
18675
|
+
let lastTool = this.lastToolResult(messages);
|
|
18676
|
+
if (lastTool && lastTool.toolName !== "extract_content") {
|
|
18609
18677
|
await sleep(200);
|
|
18610
18678
|
let result = await this.screenshot_and_html(agentContext);
|
|
18611
18679
|
let image = toImage(result.imageBase64);
|
|
@@ -18663,6 +18731,10 @@ function typing(params) {
|
|
|
18663
18731
|
}
|
|
18664
18732
|
else {
|
|
18665
18733
|
input.value = text;
|
|
18734
|
+
if (input.__proto__) {
|
|
18735
|
+
let value_setter = Object.getOwnPropertyDescriptor(input.__proto__, "value")?.set;
|
|
18736
|
+
value_setter && value_setter.call(input, text);
|
|
18737
|
+
}
|
|
18666
18738
|
}
|
|
18667
18739
|
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
18668
18740
|
if (enter) {
|
|
@@ -18743,7 +18815,7 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
|
|
|
18743
18815
|
tools: _tools_,
|
|
18744
18816
|
llms: llms,
|
|
18745
18817
|
mcpClient: mcpClient,
|
|
18746
|
-
planDescription: "Browser operation agent, interact with the browser using the mouse and keyboard."
|
|
18818
|
+
planDescription: "Browser operation agent, interact with the browser using the mouse and keyboard.",
|
|
18747
18819
|
});
|
|
18748
18820
|
let init_tools = this.buildInitTools();
|
|
18749
18821
|
if (ext_tools && ext_tools.length > 0) {
|
|
@@ -18871,15 +18943,22 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
|
|
|
18871
18943
|
properties: {
|
|
18872
18944
|
amount: {
|
|
18873
18945
|
type: "number",
|
|
18874
|
-
description: "Scroll amount (
|
|
18875
|
-
minimum:
|
|
18946
|
+
description: "Scroll amount (up / down)",
|
|
18947
|
+
minimum: 1,
|
|
18876
18948
|
maximum: 10,
|
|
18877
18949
|
},
|
|
18950
|
+
direction: {
|
|
18951
|
+
type: "string",
|
|
18952
|
+
enum: ["up", "down"],
|
|
18953
|
+
},
|
|
18878
18954
|
},
|
|
18879
|
-
required: ["amount"],
|
|
18955
|
+
required: ["amount", "direction"],
|
|
18880
18956
|
},
|
|
18881
18957
|
execute: async (args, agentContext) => {
|
|
18882
|
-
return await this.callInnerTool(() =>
|
|
18958
|
+
return await this.callInnerTool(async () => {
|
|
18959
|
+
let amount = args.amount;
|
|
18960
|
+
await this.scroll(agentContext, args.direction == "up" ? -amount : amount);
|
|
18961
|
+
});
|
|
18883
18962
|
},
|
|
18884
18963
|
},
|
|
18885
18964
|
{
|
|
@@ -18948,22 +19027,23 @@ class BaseBrowserScreenAgent extends BaseBrowserAgent {
|
|
|
18948
19027
|
properties: {
|
|
18949
19028
|
duration: {
|
|
18950
19029
|
type: "number",
|
|
18951
|
-
description: "Duration in
|
|
18952
|
-
default:
|
|
19030
|
+
description: "Duration in millisecond",
|
|
19031
|
+
default: 500,
|
|
19032
|
+
minimum: 200,
|
|
19033
|
+
maximum: 2000,
|
|
18953
19034
|
},
|
|
18954
19035
|
},
|
|
18955
19036
|
required: ["duration"],
|
|
18956
19037
|
},
|
|
18957
19038
|
execute: async (args, agentContext) => {
|
|
18958
|
-
return await this.callInnerTool(() => sleep((args.duration ||
|
|
19039
|
+
return await this.callInnerTool(() => sleep((args.duration || 200)));
|
|
18959
19040
|
},
|
|
18960
19041
|
},
|
|
18961
19042
|
];
|
|
18962
19043
|
}
|
|
18963
19044
|
async handleMessages(agentContext, messages) {
|
|
18964
|
-
let
|
|
18965
|
-
if (
|
|
18966
|
-
lastMessage.content.filter((t) => t.type == "tool-result").length > 0) {
|
|
19045
|
+
let lastTool = this.lastToolResult(messages);
|
|
19046
|
+
if (lastTool && lastTool.toolName !== "extract_content") {
|
|
18967
19047
|
await sleep(200);
|
|
18968
19048
|
let result = await this.screenshot(agentContext);
|
|
18969
19049
|
let image = toImage(result.imageBase64);
|
package/dist/llm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/llm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,0BAA0B,EAE3B,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/llm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,0BAA0B,EAE3B,MAAM,kBAAkB,CAAC;AAQ1B,OAAO,EACL,cAAc,EACd,UAAU,EACV,IAAI,EACJ,YAAY,EACb,MAAM,oBAAoB,CAAC;AAE5B,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,IAAI,CAAO;IACnB,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,oBAAoB,CAAS;gBAEzB,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,oBAAoB,CAAC,EAAE,MAAM;IASjE,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC;IAkBlD,UAAU,CACd,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,cAAc,CAAC;IAgCpB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;IAkBtD,QAAQ,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,YAAY,CAAC;IAsD1E,OAAO,CAAC,MAAM;IAoCd,OAAO,CAAC,aAAa;CA0BtB"}
|