foliko 1.1.87 → 1.1.88
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
package/plugins/feishu-plugin.js
CHANGED
|
@@ -239,7 +239,7 @@ class FeishuPlugin extends Plugin {
|
|
|
239
239
|
const result = await this._framework.executeTool('ext_call', {
|
|
240
240
|
plugin: 'skill',
|
|
241
241
|
tool: skillCmd,
|
|
242
|
-
args: { args }
|
|
242
|
+
args: { command: args }
|
|
243
243
|
})
|
|
244
244
|
if (result.success !== false) {
|
|
245
245
|
await this._sendMessage(openId, `✅ ${result.data || result}`, originalMsg)
|
package/plugins/qq-plugin.js
CHANGED
|
@@ -729,7 +729,7 @@ class QQPlugin extends Plugin {
|
|
|
729
729
|
const result = await this._framework.executeTool('ext_call', {
|
|
730
730
|
plugin: 'skill',
|
|
731
731
|
tool: skillCmd,
|
|
732
|
-
args: { args }
|
|
732
|
+
args: { command: args }
|
|
733
733
|
})
|
|
734
734
|
if (result.success !== false) {
|
|
735
735
|
await this._sendMessage(openid, `✅ ${result.data || result}`)
|
|
@@ -353,7 +353,7 @@ class TelegramPlugin extends Plugin {
|
|
|
353
353
|
const result = await this._framework.executeTool('ext_call', {
|
|
354
354
|
plugin: 'skill',
|
|
355
355
|
tool: skillCmd,
|
|
356
|
-
args: { args }
|
|
356
|
+
args: { command: args }
|
|
357
357
|
})
|
|
358
358
|
if (result.success !== false) {
|
|
359
359
|
await this._sendMessage(chatId, `✅ ${result.data || result}`, msg.message_id)
|
|
@@ -174,6 +174,51 @@ module.exports = [
|
|
|
174
174
|
| Telegram | 发送 `/skillname:cmdname` |
|
|
175
175
|
| QQ | 发送 `/skillname:cmdname` |
|
|
176
176
|
|
|
177
|
+
### ext_call 调用格式
|
|
178
|
+
|
|
179
|
+
当需要通过 AI 调用 skill 命令时,使用 `ext_call` 工具:
|
|
180
|
+
|
|
181
|
+
```javascript
|
|
182
|
+
ext_call({
|
|
183
|
+
plugin: "skill",
|
|
184
|
+
tool: "<skillname>:<commandname>",
|
|
185
|
+
args: { command: "<命令行>" }
|
|
186
|
+
});
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**参数说明:**
|
|
190
|
+
|
|
191
|
+
| 参数 | 类型 | 说明 |
|
|
192
|
+
|------|------|------|
|
|
193
|
+
| `plugin` | string | 固定为 `"skill"` |
|
|
194
|
+
| `tool` | string | 格式为 `<技能名>:<命令名>`,如 `test-skill:greet` |
|
|
195
|
+
| `args.command` | string | 命令行参数字符串 |
|
|
196
|
+
|
|
197
|
+
**示例:**
|
|
198
|
+
|
|
199
|
+
```javascript
|
|
200
|
+
// 调用 test-skill 的 greet 命令,无参数
|
|
201
|
+
ext_call({
|
|
202
|
+
plugin: "skill",
|
|
203
|
+
tool: "test-skill:greet",
|
|
204
|
+
args: { command: "" }
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
// 调用 test-skill 的 greet 命令,带参数
|
|
208
|
+
ext_call({
|
|
209
|
+
plugin: "skill",
|
|
210
|
+
tool: "test-skill:greet",
|
|
211
|
+
args: { command: "Alice" }
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
// 调用 test-skill 的 echo 命令
|
|
215
|
+
ext_call({
|
|
216
|
+
plugin: "skill",
|
|
217
|
+
tool: "test-skill:echo",
|
|
218
|
+
args: { command: "Hello World" }
|
|
219
|
+
});
|
|
220
|
+
```
|
|
221
|
+
|
|
177
222
|
### 使用流程
|
|
178
223
|
|
|
179
224
|
1. **查看可用命令**:发送 `/help` 或 `/start` 查看帮助,其中列出所有技能命令
|
|
@@ -336,6 +381,51 @@ module.exports = [
|
|
|
336
381
|
| Telegram | 发送 `/skillname:cmdname` |
|
|
337
382
|
| QQ | 发送 `/skillname:cmdname` |
|
|
338
383
|
|
|
384
|
+
### ext_call 调用格式
|
|
385
|
+
|
|
386
|
+
当需要通过 AI 调用 skill 命令时,使用 `ext_call` 工具:
|
|
387
|
+
|
|
388
|
+
```javascript
|
|
389
|
+
ext_call({
|
|
390
|
+
plugin: "skill",
|
|
391
|
+
tool: "<skillname>:<commandname>",
|
|
392
|
+
args: { command: "<命令行>" }
|
|
393
|
+
});
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
**参数说明:**
|
|
397
|
+
|
|
398
|
+
| 参数 | 类型 | 说明 |
|
|
399
|
+
|------|------|------|
|
|
400
|
+
| `plugin` | string | 固定为 `"skill"` |
|
|
401
|
+
| `tool` | string | 格式为 `<技能名>:<命令名>`,如 `test-skill:greet` |
|
|
402
|
+
| `args.command` | string | 命令行参数字符串 |
|
|
403
|
+
|
|
404
|
+
**示例:**
|
|
405
|
+
|
|
406
|
+
```javascript
|
|
407
|
+
// 调用 test-skill 的 greet 命令,无参数
|
|
408
|
+
ext_call({
|
|
409
|
+
plugin: "skill",
|
|
410
|
+
tool: "test-skill:greet",
|
|
411
|
+
args: { command: "" }
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
// 调用 test-skill 的 greet 命令,带参数
|
|
415
|
+
ext_call({
|
|
416
|
+
plugin: "skill",
|
|
417
|
+
tool: "test-skill:greet",
|
|
418
|
+
args: { command: "Alice" }
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
// 调用 test-skill 的 echo 命令
|
|
422
|
+
ext_call({
|
|
423
|
+
plugin: "skill",
|
|
424
|
+
tool: "test-skill:echo",
|
|
425
|
+
args: { command: "Hello World" }
|
|
426
|
+
});
|
|
427
|
+
```
|
|
428
|
+
|
|
339
429
|
### 使用流程
|
|
340
430
|
|
|
341
431
|
1. **查看可用命令**:发送 `/help` 或 `/start` 查看帮助,其中列出所有技能命令
|
package/src/core/agent-chat.js
CHANGED
|
@@ -475,7 +475,7 @@ class AgentChatHandler extends EventEmitter {
|
|
|
475
475
|
if (!this._aiClient) {
|
|
476
476
|
throw new Error('AI client not configured.');
|
|
477
477
|
}
|
|
478
|
-
|
|
478
|
+
this._validateToolCalls(messages);
|
|
479
479
|
const systemPrompt = framework.getSystemPrompt();
|
|
480
480
|
//await fs.promises.writeFile(`.${sessionId}_systemPrompt.md`, systemPrompt); // 调试用:保存系统提示词
|
|
481
481
|
const tools = this._getAITools(aiTool);
|
|
@@ -580,7 +580,7 @@ class AgentChatHandler extends EventEmitter {
|
|
|
580
580
|
usage: usageData,
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
|
-
|
|
583
|
+
this._validateToolCalls(messages);
|
|
584
584
|
// yield usage 数据,让 UI 层能直接获取
|
|
585
585
|
yield {
|
|
586
586
|
type: 'usage',
|
|
@@ -658,7 +658,7 @@ class AgentChatHandler extends EventEmitter {
|
|
|
658
658
|
if (this._thinkingMode) {
|
|
659
659
|
delete apiOptions.temperature;
|
|
660
660
|
}
|
|
661
|
-
|
|
661
|
+
this._validateToolCalls(messages);
|
|
662
662
|
const agent = new ToolLoopAgent({
|
|
663
663
|
model: this._aiClient,
|
|
664
664
|
instructions: systemPrompt,
|
|
@@ -699,7 +699,7 @@ class AgentChatHandler extends EventEmitter {
|
|
|
699
699
|
messages.push(...result.response.messages);
|
|
700
700
|
const userMsg = messages[messages.length - result.response.messages.length - 1];
|
|
701
701
|
this.emit('message', { content: result.text, sessionId: sessionId, userMessage: userMsg });
|
|
702
|
-
|
|
702
|
+
this._validateToolCalls(messages);
|
|
703
703
|
return {
|
|
704
704
|
success: true,
|
|
705
705
|
message: cleanResponse(result.text || ''),
|