@eko-ai/eko 4.1.0 → 4.1.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/chat/chat-agent.d.ts +0 -1
- package/dist/chat/chat-agent.d.ts.map +1 -1
- package/dist/chat/tools/deep-action.d.ts.map +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/index.cjs +28 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +28 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/types/agent.types.d.ts +4 -0
- package/dist/types/agent.types.d.ts.map +1 -1
- package/dist/types/config.types.d.ts +1 -0
- package/dist/types/config.types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -6,6 +6,7 @@ const config$1 = {
|
|
|
6
6
|
maxOutputTokens: 16000,
|
|
7
7
|
maxRetryNum: 3,
|
|
8
8
|
agentParallel: false,
|
|
9
|
+
workflowConfirm: false,
|
|
9
10
|
compressThreshold: 80,
|
|
10
11
|
compressTokensThreshold: 80000,
|
|
11
12
|
largeTextLength: 8000,
|
|
@@ -44263,10 +44264,10 @@ class DeepActionTool {
|
|
|
44263
44264
|
const taskDescription = args.taskDescription;
|
|
44264
44265
|
const tabIds = args.tabIds;
|
|
44265
44266
|
const dependentVariables = args.dependentVariables;
|
|
44266
|
-
const
|
|
44267
|
+
const chatConfig = this.chatContext.getConfig();
|
|
44267
44268
|
const globalVariables = this.chatContext.getGlobalVariables();
|
|
44268
44269
|
const eko = new Eko({
|
|
44269
|
-
...
|
|
44270
|
+
...chatConfig,
|
|
44270
44271
|
callback: this.params.callback?.taskCallback,
|
|
44271
44272
|
}, chatId);
|
|
44272
44273
|
this.chatContext.addEko(messageId, eko);
|
|
@@ -44282,7 +44283,7 @@ class DeepActionTool {
|
|
|
44282
44283
|
}
|
|
44283
44284
|
const attachments = this.params.user
|
|
44284
44285
|
.filter((part) => part.type === "file")
|
|
44285
|
-
.filter((part) => part.data && part.data.length <
|
|
44286
|
+
.filter((part) => part.data && part.data.length < 1000)
|
|
44286
44287
|
.map((part) => {
|
|
44287
44288
|
return {
|
|
44288
44289
|
file_name: part.filename,
|
|
@@ -44302,7 +44303,30 @@ class DeepActionTool {
|
|
|
44302
44303
|
datetime: this.params.datetime || new Date().toLocaleString(),
|
|
44303
44304
|
});
|
|
44304
44305
|
const context = eko.getTask(messageId);
|
|
44305
|
-
|
|
44306
|
+
Log.info("==> workflow", workflow);
|
|
44307
|
+
if (config$1.workflowConfirm && this.params.callback?.taskCallback) {
|
|
44308
|
+
const result = await new Promise((resolve) => {
|
|
44309
|
+
this.params.callback.taskCallback?.onMessage({
|
|
44310
|
+
streamType: "agent",
|
|
44311
|
+
chatId: context.chatId,
|
|
44312
|
+
taskId: context.taskId,
|
|
44313
|
+
agentName: "",
|
|
44314
|
+
type: "workflow_confirm",
|
|
44315
|
+
workflow: workflow,
|
|
44316
|
+
resolve,
|
|
44317
|
+
});
|
|
44318
|
+
});
|
|
44319
|
+
if (result == "cancel") {
|
|
44320
|
+
return {
|
|
44321
|
+
content: [
|
|
44322
|
+
{
|
|
44323
|
+
type: "text",
|
|
44324
|
+
text: "User has canceled the execution.",
|
|
44325
|
+
},
|
|
44326
|
+
],
|
|
44327
|
+
};
|
|
44328
|
+
}
|
|
44329
|
+
}
|
|
44306
44330
|
const result = await eko.execute(messageId);
|
|
44307
44331
|
const variableNames = [];
|
|
44308
44332
|
if (context.variables && context.variables.size > 0) {
|
|
@@ -44515,9 +44539,6 @@ class ChatAgent {
|
|
|
44515
44539
|
global.chatMap.set(chatId, this.chatContext);
|
|
44516
44540
|
}
|
|
44517
44541
|
async chat(params) {
|
|
44518
|
-
return this.doChat(params, false);
|
|
44519
|
-
}
|
|
44520
|
-
async doChat(params, segmentedExecution) {
|
|
44521
44542
|
const runStartTime = Date.now();
|
|
44522
44543
|
let reactLoopNum = 0;
|
|
44523
44544
|
let errorInfo = null;
|