foliko 2.0.24 → 2.0.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foliko",
3
- "version": "2.0.24",
3
+ "version": "2.0.26",
4
4
  "description": "简约的插件化 Agent 框架",
5
5
  "main": "src/index.js",
6
6
  "type": "commonjs",
@@ -22,7 +22,7 @@ class AIPlugin extends Plugin {
22
22
  model: config.model || 'deepseek-chat',
23
23
  apiKey: config.apiKey,
24
24
  baseURL: config.baseURL,
25
- maxSteps: config.maxSteps || 20,
25
+ maxSteps: config.maxSteps || 1000,
26
26
  maxOutputTokens: config.maxOutputTokens || parseInt(process.env.MAX_OUTPUT_TOKENS) || 8192,
27
27
  }
28
28
 
@@ -430,7 +430,7 @@ class FeishuPlugin extends Plugin {
430
430
  }
431
431
  } catch (err) {
432
432
  log.error(' Chat error:', err)
433
- await this._sendMessage(openId, `发生错误:${err.message}`, originalMsg)
433
+ //await this._sendMessage(openId, `发生错误:${err.message}`, originalMsg)
434
434
  } finally {
435
435
  this._pendingResponses.delete(openId)
436
436
  }
@@ -654,11 +654,11 @@ class QQPlugin extends Plugin {
654
654
  await agent.sendMessage(messageWithContext, { sessionId, priority: 1 })
655
655
  } catch (err) {
656
656
  log.error('Chat error:', err.message)
657
- if (msgType === 'group') {
658
- await this._sendGroupMessage(identifier, `发生错误:${err.message}`)
659
- } else {
660
- await this._sendMessage(identifier, `发生错误:${err.message}`)
661
- }
657
+ // if (msgType === 'group') {
658
+ // await this._sendGroupMessage(identifier, `发生错误:${err.message}`)
659
+ // } else {
660
+ // await this._sendMessage(identifier, `发生错误:${err.message}`)
661
+ // }
662
662
  } finally {
663
663
  }
664
664
  }
@@ -415,8 +415,8 @@ class TelegramPlugin extends Plugin {
415
415
  parse_mode: 'MarkdownV2'
416
416
  })
417
417
  } catch (err) {
418
- log.error(' Chat error:', err)
419
- await this._bot.editMessageText(escapeMarkdown(`❌ 发生错误:${err.message}`), {
418
+ log.error(' Chat error:', err)
419
+ //await this._bot.editMessageText(escapeMarkdown(`❌ 发生错误:${err.message}`), {
420
420
  chat_id: chatId,
421
421
  message_id: thinkingMsg.message_id
422
422
  })
@@ -631,7 +631,7 @@ class WeixinPlugin extends Plugin {
631
631
  await agent.sendMessage(text, { sessionId, priority: 1 })
632
632
  } catch (err) {
633
633
  log.error(' Chat error:', err.message)
634
- await this._sendMessageBatch(originalMsg, userId, `发生错误:${err.message}`, true)
634
+ //await this._sendMessageBatch(originalMsg, userId, `发生错误:${err.message}`, true)
635
635
  } finally {
636
636
  this.stopTypingInterval()
637
637
  }
package/src/agent/chat.js CHANGED
@@ -74,7 +74,7 @@ class AgentChatHandler extends EventEmitter {
74
74
  }
75
75
 
76
76
  this._systemPrompt = config.systemPrompt || 'You are a helpful assistant.';
77
- this._maxSteps = config.maxSteps || 20;
77
+ this._maxSteps = config.maxSteps || 1000;
78
78
 
79
79
  // 委托给新模块
80
80
  // ChatSession: 会话、消息、队列
@@ -737,7 +737,7 @@ class AgentChatHandler extends EventEmitter {
737
737
  const tools = this._getToolMap();
738
738
  const toolLoop = new ToolLoop({
739
739
  tools,
740
- maxSteps: this._maxSteps || 20,
740
+ maxSteps: this._maxSteps || 1000,
741
741
  prepareStep: this._createPrepareStep(),
742
742
  repairToolCall: this._repairToolCall.bind(this),
743
743
  abortSignal: framework.getAbortSignal?.(),
@@ -912,7 +912,7 @@ class AgentChatHandler extends EventEmitter {
912
912
 
913
913
  const toolLoop = new ToolLoop({
914
914
  tools,
915
- maxSteps: this._maxSteps || 20,
915
+ maxSteps: this._maxSteps || 1000,
916
916
  prepareStep: this._createPrepareStep(),
917
917
  repairToolCall: this._repairToolCall.bind(this),
918
918
  abortSignal: framework.getAbortSignal?.(),
package/src/agent/sub.js CHANGED
@@ -131,7 +131,7 @@ class SubAgent extends BaseAgent {
131
131
  }
132
132
 
133
133
  async chat(taskOrMessages, options = {}) {
134
- const maxSteps = options?.maxSteps || 30;
134
+ const maxSteps = options?.maxSteps || 1000;
135
135
  const maxRetries = options?.maxRetries ?? this.maxRetries;
136
136
  const retryDelay = options?.retryDelay ?? this.retryDelay;
137
137
  const client = this._getOpenAIClient();
@@ -19,7 +19,7 @@ class ToolLoop extends EventEmitter {
19
19
  constructor(config = {}) {
20
20
  super();
21
21
  this.tools = config.tools || {}; // { name => { execute, description } }
22
- this.maxSteps = config.maxSteps || 100000;
22
+ this.maxSteps = config.maxSteps || 1000;
23
23
  this.prepareStep = config.prepareStep || (async () => {});
24
24
  this.abortSignal = config.abortSignal || null;
25
25
  this._repairFn = config.repairToolCall || null;
@@ -54,7 +54,7 @@ const DEFAULT_MAX_MESSAGES_PER_SESSION = 1000;
54
54
  const KEEP_RECENT_MESSAGES = 50;
55
55
 
56
56
  /** 压缩消息数量阈值 */
57
- const COMPRESSION_MESSAGE_THRESHOLD = 500;
57
+ const COMPRESSION_MESSAGE_THRESHOLD = 300;
58
58
 
59
59
  /** 智能压缩启用 */
60
60
  const ENABLE_SMART_COMPRESS = true;