foliko 2.0.25 → 2.0.27

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.25",
3
+ "version": "2.0.27",
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
 
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;
@@ -51,10 +51,10 @@ const DEFAULT_MAX_MESSAGES_PER_SESSION = 1000;
51
51
  // ============================================================================
52
52
 
53
53
  /** 保留最近的 N 条消息 */
54
- const KEEP_RECENT_MESSAGES = 50;
54
+ const KEEP_RECENT_MESSAGES = 30;
55
55
 
56
56
  /** 压缩消息数量阈值 */
57
- const COMPRESSION_MESSAGE_THRESHOLD = 300;
57
+ const COMPRESSION_MESSAGE_THRESHOLD = 200;
58
58
 
59
59
  /** 智能压缩启用 */
60
60
  const ENABLE_SMART_COMPRESS = true;