@eko-ai/eko 2.1.7-alpha.5 → 2.1.7-alpha.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../src/agent/llm.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAGL,cAAc,EACd,aAAa,EAEd,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,EAErB,uBAAuB,EACvB,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,kBAAkB,CAAC;AAE1B,wBAAsB,YAAY,CAChC,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,kBAAkB,EACvB,QAAQ,EAAE,qBAAqB,EAC/B,KAAK,EAAE,2BAA2B,EAAE,EACpC,UAAU,CAAC,EAAE,OAAO,EACpB,UAAU,CAAC,EAAE,yBAAyB,EACtC,KAAK,CAAC,EAAE,OAAO,EACf,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa,GACxC,OAAO,CAAC,KAAK,CAAC,uBAAuB,GAAG,2BAA2B,CAAC,CAAC,CA0TvE"}
1
+ {"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../src/agent/llm.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAGL,cAAc,EACd,aAAa,EAEd,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,EAErB,uBAAuB,EACvB,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,kBAAkB,CAAC;AAE1B,wBAAsB,YAAY,CAChC,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,kBAAkB,EACvB,QAAQ,EAAE,qBAAqB,EAC/B,KAAK,EAAE,2BAA2B,EAAE,EACpC,UAAU,CAAC,EAAE,OAAO,EACpB,UAAU,CAAC,EAAE,yBAAyB,EACtC,KAAK,CAAC,EAAE,OAAO,EACf,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa,GACxC,OAAO,CAAC,KAAK,CAAC,uBAAuB,GAAG,2BAA2B,CAAC,CAAC,CA2TvE"}
@@ -4,8 +4,8 @@ export declare class Planner {
4
4
  private taskId;
5
5
  private context;
6
6
  constructor(context: Context, taskId: string);
7
- plan(taskPrompt: string): Promise<Workflow>;
8
- replan(taskPrompt: string): Promise<Workflow>;
7
+ plan(taskPrompt: string, saveHistory?: boolean): Promise<Workflow>;
8
+ replan(taskPrompt: string, saveHistory?: boolean): Promise<Workflow>;
9
9
  private doPlan;
10
10
  }
11
11
  //# sourceMappingURL=plan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/core/plan.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,WAAW,CAAC;AAGhC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAQ/C,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAU;gBAEb,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;IAKtC,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAyB3C,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;YAoBrC,MAAM;CAsFrB"}
1
+ {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/core/plan.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,WAAW,CAAC;AAGhC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAQ/C,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAU;gBAEb,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;IAKtC,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,GAAE,OAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IAyBxE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,GAAE,OAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;YAoBlE,MAAM;CAsFrB"}
package/dist/index.cjs.js CHANGED
@@ -17173,10 +17173,11 @@ class TaskSnapshotTool {
17173
17173
  }
17174
17174
 
17175
17175
  async function callAgentLLM(agentContext, rlm, messages, tools, noCompress, toolChoice, retry, callback) {
17176
+ await agentContext.context.checkAborted();
17176
17177
  if (messages.length >= config.compressThreshold && !noCompress) {
17177
17178
  await compressAgentMessages(agentContext, rlm, messages, tools);
17178
17179
  }
17179
- if (!toolChoice && callback) {
17180
+ if (!toolChoice) {
17180
17181
  // Append user dialogue
17181
17182
  appendUserConversation(agentContext, messages);
17182
17183
  }
@@ -17430,23 +17431,11 @@ function appendUserConversation(agentContext, messages) {
17430
17431
  .splice(0, agentContext.context.conversation.length)
17431
17432
  .filter((s) => !!s);
17432
17433
  if (userPrompts.length > 0) {
17433
- const lastMessage = messages[messages.length - 1];
17434
- if (lastMessage.role == "user") {
17435
- for (let i = 0; i < userPrompts.length; i++) {
17436
- lastMessage.content.push({
17437
- type: "text",
17438
- text: userPrompts[i],
17439
- });
17440
- }
17441
- }
17442
- else {
17443
- messages.push({
17444
- role: "user",
17445
- content: userPrompts.map((s) => {
17446
- return { type: "text", text: s };
17447
- }),
17448
- });
17449
- }
17434
+ const prompt = "The user is intervening in the current task. Please replan and execute according to the following instructions:\n" + userPrompts.map(s => `- ${s.trim()}`).join("\n");
17435
+ messages.push({
17436
+ role: "user",
17437
+ content: [{ type: "text", text: prompt }],
17438
+ });
17450
17439
  }
17451
17440
  }
17452
17441
 
@@ -18965,7 +18954,7 @@ class Planner {
18965
18954
  this.context = context;
18966
18955
  this.taskId = taskId;
18967
18956
  }
18968
- async plan(taskPrompt) {
18957
+ async plan(taskPrompt, saveHistory = true) {
18969
18958
  const messages = [
18970
18959
  {
18971
18960
  role: "system",
@@ -18982,9 +18971,9 @@ class Planner {
18982
18971
  ],
18983
18972
  },
18984
18973
  ];
18985
- return await this.doPlan(taskPrompt, messages, true);
18974
+ return await this.doPlan(taskPrompt, messages, saveHistory);
18986
18975
  }
18987
- async replan(taskPrompt) {
18976
+ async replan(taskPrompt, saveHistory = true) {
18988
18977
  const chain = this.context.chain;
18989
18978
  if (chain.planRequest && chain.planResult) {
18990
18979
  const messages = [
@@ -18998,10 +18987,10 @@ class Planner {
18998
18987
  content: [{ type: "text", text: taskPrompt }],
18999
18988
  },
19000
18989
  ];
19001
- return await this.doPlan(taskPrompt, messages, true);
18990
+ return await this.doPlan(taskPrompt, messages, saveHistory);
19002
18991
  }
19003
18992
  else {
19004
- return this.plan(taskPrompt);
18993
+ return this.plan(taskPrompt, saveHistory);
19005
18994
  }
19006
18995
  }
19007
18996
  async doPlan(taskPrompt, messages, saveHistory) {