foliko 1.0.50 → 1.0.51

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.
@@ -117,7 +117,10 @@
117
117
  "Bash(curl -s -X POST \"http://localhost:3000/webhook/075s5s2umn4smn4f\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"test\":\"data\"}' 2>&1)",
118
118
  "Bash(curl -s http://localhost:3000/api/hello 2>&1)",
119
119
  "Bash(curl -v -X POST \"http://localhost:3000/webhook/075s5s2umn4smn4f\" \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"test\":\"data\"}' 2>&1 | head -30)",
120
- "Bash(cd D:/code/vb-agent && timeout 30 node test-compression.js 2>&1)"
120
+ "Bash(cd D:/code/vb-agent && timeout 30 node test-compression.js 2>&1)",
121
+ "Bash(cd D:/code/vb-agent && node -c src/core/agent-chat.js 2>&1)",
122
+ "Bash(cd D:/code/vb-agent && node -e \"require\\('./src/core/agent-chat.js'\\); console.log\\('模块加载成功'\\)\" 2>&1)",
123
+ "Bash(cd D:/code/vb-agent && node -e \"require\\('./src/core/agent.js'\\); console.log\\('Agent 加载成功'\\)\" 2>&1)"
121
124
  ]
122
125
  }
123
126
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foliko",
3
- "version": "1.0.50",
3
+ "version": "1.0.51",
4
4
  "description": "简约的插件化 Agent 框架",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -176,21 +176,15 @@ ${conversationText}
176
176
  总结要求:
177
177
  1. 提取用户的主要需求和意图
178
178
  2. 保留关键的技术细节或决策
179
- 3. 不要超过 500
179
+ 3. 不要超过 1000
180
180
  4. 用中文回复`
181
181
 
182
- // 使用 AI 生成摘要
183
- const { ToolLoopAgent } = await this._importAI()
184
- const agent = new ToolLoopAgent({
185
- model: this._aiClient,
186
- instructions: '你是一个对话总结助手。请根据用户提供的对话生成简洁的摘要。',
187
- tools: []
188
- })
189
-
190
- const result = await agent.generate({
182
+ // 直接使用已配置的 AI 客户端生成摘要(复用主 Agent 的配置)
183
+ const result = await this._aiClient.generate({
191
184
  messages: [
192
185
  { role: 'user', content: summarizePrompt }
193
- ]
186
+ ],
187
+ ...this.providerOptions
194
188
  })
195
189
 
196
190
  return result.text || '(总结生成失败)'
package/src/core/agent.js CHANGED
@@ -270,7 +270,12 @@ class Agent extends EventEmitter {
270
270
  provider: this.provider,
271
271
  apiKey: this.apiKey,
272
272
  baseURL: this.baseURL,
273
- providerOptions: this.providerOptions
273
+ providerOptions: this.providerOptions,
274
+ // 上下文压缩配置
275
+ maxContextTokens: this.config.maxContextTokens,
276
+ compressionThreshold: this.config.compressionThreshold,
277
+ keepRecentMessages: this.config.keepRecentMessages,
278
+ enableSmartCompress: this.config.enableSmartCompress
274
279
  })
275
280
 
276
281
  if (aiClient) {