@jarvis-agent/core 0.1.5 → 0.1.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.
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- const config$1 = {
1
+ const defaultConfig = {
2
2
  name: "Eko",
3
3
  platform: "mac",
4
4
  maxReactNum: 500,
@@ -14,7 +14,18 @@ const config$1 = {
14
14
  parallelToolCalls: true,
15
15
  expertMode: false,
16
16
  expertModeTodoLoopNum: 10,
17
+ streamFirstTimeout: 30000,
18
+ streamTokenTimeout: 180000,
17
19
  };
20
+ let config$1 = { ...defaultConfig };
21
+ function mergeGlobalConfig(userConfig) {
22
+ if (userConfig) {
23
+ config$1 = { ...defaultConfig, ...userConfig };
24
+ }
25
+ else {
26
+ config$1 = { ...defaultConfig };
27
+ }
28
+ }
18
29
 
19
30
  var LogLevel;
20
31
  (function (LogLevel) {
@@ -23926,6 +23937,7 @@ class Context {
23926
23937
  this.chain = chain;
23927
23938
  this.variables = new Map();
23928
23939
  this.controller = new AbortController();
23940
+ mergeGlobalConfig(config.globalConfig);
23929
23941
  }
23930
23942
  async checkAborted(noCheckPause) {
23931
23943
  if (this.controller.signal.aborted) {
@@ -29806,8 +29818,7 @@ async function compressAgentMessages(agentContext, messages, tools) {
29806
29818
  }
29807
29819
  async function doCompressAgentMessages(agentContext, messages, tools) {
29808
29820
  const ekoConfig = agentContext.context.config;
29809
- const rlm = new RetryLanguageModel(ekoConfig.llms, ekoConfig.compressLlms);
29810
- rlm.setContext(agentContext);
29821
+ const rlm = new RetryLanguageModel(ekoConfig.llms, ekoConfig.compressLlms, ekoConfig.globalConfig?.streamFirstTimeout, ekoConfig.globalConfig?.streamTokenTimeout, agentContext);
29811
29822
  // extract used tool
29812
29823
  const usedTools = extractUsedTool(messages, tools);
29813
29824
  const snapshotTool = new TaskSnapshotTool();
@@ -31225,8 +31236,7 @@ class Planner {
31225
31236
  }
31226
31237
  async doPlan(taskPrompt, messages, saveHistory, retryNum = 0) {
31227
31238
  const config = this.context.config;
31228
- const rlm = new RetryLanguageModel(config.llms, config.planLlms);
31229
- rlm.setContext(this.context);
31239
+ const rlm = new RetryLanguageModel(config.llms, config.planLlms, config.globalConfig?.streamFirstTimeout, config.globalConfig?.streamTokenTimeout, this.context);
31230
31240
  const request = {
31231
31241
  maxTokens: 8192,
31232
31242
  temperature: 0.7,
@@ -31683,8 +31693,7 @@ async function checkTaskReplan(agentContext) {
31683
31693
  if (!chain.planRequest || !chain.planResult) {
31684
31694
  return false;
31685
31695
  }
31686
- const rlm = new RetryLanguageModel(context.config.llms, context.config.planLlms);
31687
- rlm.setContext(agentContext);
31696
+ const rlm = new RetryLanguageModel(context.config.llms, context.config.planLlms, context.config.globalConfig?.streamFirstTimeout, context.config.globalConfig?.streamTokenTimeout, agentContext);
31688
31697
  const agentExecution = getAgentExecutionPrompt(agentContext);
31689
31698
  const prompt = `# Task Execution Status
31690
31699
  ${agentExecution}
@@ -32719,7 +32728,7 @@ class EkoDialogue {
32719
32728
  params.messageId = params.messageId ?? this.memory.genMessageId();
32720
32729
  await this.addUserMessage(params.user, params.messageId);
32721
32730
  }
32722
- const rlm = new RetryLanguageModel(this.config.llms, this.config.chatLlms);
32731
+ const rlm = new RetryLanguageModel(this.config.llms, this.config.chatLlms, this.config.globalConfig?.streamFirstTimeout, this.config.globalConfig?.streamTokenTimeout);
32723
32732
  for (let i = 0; i < 15; i++) {
32724
32733
  const messages = this.memory.buildMessages();
32725
32734
  const chatTools = [...this.buildInnerTools(params), ...this.tools];
@@ -33485,8 +33494,7 @@ request_help: Request assistance from the user; for instance, when an operation
33485
33494
  }
33486
33495
  try {
33487
33496
  let imageResult = (await screenshot.call(agentContext.agent, agentContext));
33488
- let rlm = new RetryLanguageModel(agentContext.context.config.llms, agentContext.agent.Llms);
33489
- rlm.setContext(agentContext);
33497
+ let rlm = new RetryLanguageModel(agentContext.context.config.llms, agentContext.agent.Llms, agentContext.context.config.globalConfig?.streamFirstTimeout, agentContext.context.config.globalConfig?.streamTokenTimeout, agentContext);
33490
33498
  let image = toImage(imageResult.imageBase64);
33491
33499
  let request = {
33492
33500
  messages: [
@@ -33734,8 +33742,7 @@ class WatchTriggerTool {
33734
33742
  const start = new Date().getTime();
33735
33743
  const timeout = (args.timeout || 5) * 60000;
33736
33744
  const frequency = Math.max(500, (args.frequency || 1) * 1000);
33737
- const rlm = new RetryLanguageModel(agentContext.context.config.llms, agentContext.agent.Llms);
33738
- rlm.setContext(agentContext);
33745
+ const rlm = new RetryLanguageModel(agentContext.context.config.llms, agentContext.agent.Llms, agentContext.context.config.globalConfig?.streamFirstTimeout, agentContext.context.config.globalConfig?.streamTokenTimeout, agentContext);
33739
33746
  while (new Date().getTime() - start < timeout) {
33740
33747
  await agentContext.context.checkAborted();
33741
33748
  await new Promise((resolve) => setTimeout(resolve, frequency));
@@ -34267,8 +34274,7 @@ class Agent {
34267
34274
  },
34268
34275
  ];
34269
34276
  agentContext.messages = messages;
34270
- const rlm = new RetryLanguageModel(context.config.llms, this.llms);
34271
- rlm.setContext(agentContext);
34277
+ const rlm = new RetryLanguageModel(context.config.llms, this.llms, context.config.globalConfig?.streamFirstTimeout, context.config.globalConfig?.streamTokenTimeout, agentContext);
34272
34278
  let agentTools = tools;
34273
34279
  while (loopNum < maxReactNum) {
34274
34280
  await context.checkAborted();