foliko 1.0.87 → 1.1.0
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/.agent/data/default.json +3 -108
- package/.agent/data/plugins-state.json +34 -1
- package/.agent/mcp_config.json +0 -1
- package/.agent/memory/core.md +1 -0
- package/.agent/memory/project/mnn93ogy-ypjn27.md +9 -0
- package/.agent/memory/project/mnn98fqy-5nhc1u.md +25 -0
- package/.agent/memory/user/mnm67t9m-x8rekk.md +9 -0
- package/.agent/memory/user/mnn5mmqh-w6aktx.md +11 -0
- package/.agent/memory/user/mnnbfhhn-dk1bd1.md +22 -0
- package/.agent/plugins/__pycache__/file_writer.cpython-312.pyc +0 -0
- package/.agent/plugins/poster-plugin/README.md +304 -0
- package/.agent/plugins/poster-plugin/fonts/PatuaOne-Regular.ttf +0 -0
- package/.agent/plugins/poster-plugin/fonts//345/276/256/350/275/257/351/233/205/351/273/221.ttf +0 -0
- package/.agent/plugins/poster-plugin/fonts//345/276/256/350/275/257/351/233/205/351/273/221/347/262/227/344/275/223.ttf +0 -0
- package/.agent/plugins/poster-plugin/index.js +13 -0
- package/.agent/plugins/poster-plugin/package.json +28 -0
- package/.agent/plugins/poster-plugin/src/canvas.js +161 -0
- package/.agent/plugins/poster-plugin/src/components/arrow.js +84 -0
- package/.agent/plugins/poster-plugin/src/components/avatar.js +71 -0
- package/.agent/plugins/poster-plugin/src/components/badge.js +85 -0
- package/.agent/plugins/poster-plugin/src/components/card.js +88 -0
- package/.agent/plugins/poster-plugin/src/components/chart.js +127 -0
- package/.agent/plugins/poster-plugin/src/components/chip.js +88 -0
- package/.agent/plugins/poster-plugin/src/components/columns.js +107 -0
- package/.agent/plugins/poster-plugin/src/components/cta.js +85 -0
- package/.agent/plugins/poster-plugin/src/components/divider.js +55 -0
- package/.agent/plugins/poster-plugin/src/components/feature.js +85 -0
- package/.agent/plugins/poster-plugin/src/components/featureGrid.js +112 -0
- package/.agent/plugins/poster-plugin/src/components/grid.js +118 -0
- package/.agent/plugins/poster-plugin/src/components/imageFrame.js +155 -0
- package/.agent/plugins/poster-plugin/src/components/index.js +62 -0
- package/.agent/plugins/poster-plugin/src/components/listItem.js +146 -0
- package/.agent/plugins/poster-plugin/src/components/notification.js +123 -0
- package/.agent/plugins/poster-plugin/src/components/progress.js +79 -0
- package/.agent/plugins/poster-plugin/src/components/progressCircle.js +117 -0
- package/.agent/plugins/poster-plugin/src/components/quote.js +97 -0
- package/.agent/plugins/poster-plugin/src/components/rating.js +85 -0
- package/.agent/plugins/poster-plugin/src/components/star.js +70 -0
- package/.agent/plugins/poster-plugin/src/components/statCard.js +105 -0
- package/.agent/plugins/poster-plugin/src/components/stepper.js +118 -0
- package/.agent/plugins/poster-plugin/src/components/table.js +159 -0
- package/.agent/plugins/poster-plugin/src/components/tagCloud.js +78 -0
- package/.agent/plugins/poster-plugin/src/components/timeline.js +105 -0
- package/.agent/plugins/poster-plugin/src/components/watermark.js +52 -0
- package/.agent/plugins/poster-plugin/src/composer.js +1904 -0
- package/.agent/plugins/poster-plugin/src/elements/artText.js +60 -0
- package/.agent/plugins/poster-plugin/src/elements/background.js +52 -0
- package/.agent/plugins/poster-plugin/src/elements/circle.js +31 -0
- package/.agent/plugins/poster-plugin/src/elements/image.js +71 -0
- package/.agent/plugins/poster-plugin/src/elements/index.js +26 -0
- package/.agent/plugins/poster-plugin/src/elements/line.js +23 -0
- package/.agent/plugins/poster-plugin/src/elements/polygon.js +32 -0
- package/.agent/plugins/poster-plugin/src/elements/rectangle.js +32 -0
- package/.agent/plugins/poster-plugin/src/elements/svg.js +92 -0
- package/.agent/plugins/poster-plugin/src/elements/text.js +38 -0
- package/.agent/plugins/poster-plugin/src/fonts.js +118 -0
- package/.agent/plugins/poster-plugin/src/index.js +1659 -0
- package/.agent/plugins/poster-plugin/src/presets.js +36 -0
- package/.agent/plugins/poster-plugin/src/templates/business.js +60 -0
- package/.agent/plugins/poster-plugin/src/templates/gradient.js +64 -0
- package/.agent/plugins/poster-plugin/src/templates/index.js +43 -0
- package/.agent/plugins/poster-plugin/src/templates/modern.js +69 -0
- package/.agent/plugins/poster-plugin/src/templates/simple.js +58 -0
- package/.agent/plugins/poster-plugin/src/templates/social.js +62 -0
- package/.agent/plugins/poster-plugin/src/templates/tech.js +84 -0
- package/.agent/sessions/cli_default.json +24265 -0
- package/.agent/weixin.json +6 -0
- package/.claude/settings.local.json +5 -8
- package/CLAUDE.md +144 -108
- package/docs/CONTEXT_DESIGN.md +1596 -0
- package/examples/test-concurrent-chat.js +60 -60
- package/output/beef-love-poster.png +0 -0
- package/package.json +2 -2
- package/plugins/default-plugins.js +2 -1
- package/plugins/extension-executor-plugin.js +11 -0
- package/plugins/memory-plugin.js +984 -0
- package/plugins/session-plugin.js +57 -1
- package/plugins/weixin-plugin.js +24 -22
- package/skills/poster-guide/SKILL.md +743 -0
- package/skills/python-plugin-dev/SKILL.md +238 -238
- package/skills/skill-guide/SKILL.md +130 -108
- package/src/capabilities/skill-manager.js +99 -0
- package/src/core/agent-chat.js +538 -138
- package/src/core/agent-context.js +188 -0
- package/src/core/agent.js +6 -2
- package/src/core/context-manager.js +283 -0
- package/src/core/framework.js +264 -3
- package/src/core/plugin-manager.js +79 -2
- package/src/core/request-context.js +98 -0
- package/src/core/session-context.js +341 -0
- package/src/core/session-storage.js +274 -0
- package/src/executors/mcp-executor.js +2 -2
- package/src/utils/index.js +239 -67
- package/src/utils/plugin-helpers.js +17 -0
- package//346/265/267/346/212/245/346/217/222/344/273/266.md +621 -0
- package/.agent/plugins/__pycache__/test_plugin.cpython-312.pyc +0 -0
- package/.agent/plugins/temp-repo/LICENSE +0 -201
- package/.agent/plugins/temp-repo/puppeteer-plugin/README.md +0 -147
- package/.agent/plugins/temp-repo/puppeteer-plugin/index.js +0 -1418
- package/.agent/plugins/temp-repo/puppeteer-plugin/package.json +0 -9
- package/.agent/plugins/test_plugin.py +0 -304
- package/examples/test-chat-debug.js +0 -102
- package/examples/test-chat-result.js +0 -76
- package/examples/test-chat-stream-diff.js +0 -63
|
@@ -1,108 +1,130 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: skill-guide
|
|
3
|
-
description: 技能安装与开发指南。当用户询问"如何添加技能"、"自定义技能"、"安装技能"时立即调用。
|
|
4
|
-
allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# 技能(Skill)安装与开发指南
|
|
8
|
-
|
|
9
|
-
## 概述
|
|
10
|
-
|
|
11
|
-
技能(Skill)是 Agent 的扩展能力模块,存放在 `.agent/skills/` 目录下。
|
|
12
|
-
|
|
13
|
-
## 技能存放位置
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
#
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
SKILL.md
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
##
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
1
|
+
---
|
|
2
|
+
name: skill-guide
|
|
3
|
+
description: 技能安装与开发指南。当用户询问"如何添加技能"、"自定义技能"、"安装技能"时立即调用。
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 技能(Skill)安装与开发指南
|
|
8
|
+
|
|
9
|
+
## 概述
|
|
10
|
+
|
|
11
|
+
技能(Skill)是 Agent 的扩展能力模块,存放在 `.agent/skills/` 目录下。
|
|
12
|
+
|
|
13
|
+
## 技能存放位置
|
|
14
|
+
|
|
15
|
+
### 方式一:.agent/skills/ 目录
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
项目目录/
|
|
19
|
+
└── .agent/
|
|
20
|
+
└── skills/
|
|
21
|
+
└── my-skill/ # 技能文件夹
|
|
22
|
+
├── SKILL.md # 必需,技能定义文件
|
|
23
|
+
└── ... # 其他资源文件(可选)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 方式二:插件目录下
|
|
27
|
+
|
|
28
|
+
插件目录下的 `SKILL.md` 也会被自动加载为技能:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
项目目录/
|
|
32
|
+
└── .agent/
|
|
33
|
+
└── plugins/
|
|
34
|
+
└── my-plugin/ # 插件文件夹
|
|
35
|
+
├── index.js # 插件入口文件
|
|
36
|
+
├── SKILL.md # 可选,技能定义文件(自动加载)
|
|
37
|
+
└── ...
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**规则:**
|
|
41
|
+
|
|
42
|
+
- 插件目录下的 `SKILL.md` 会被自动发现并加载为技能
|
|
43
|
+
- 技能名称与插件名称相同
|
|
44
|
+
- 插件启用/重载时会自动更新关联的技能
|
|
45
|
+
|
|
46
|
+
## SKILL.md 格式
|
|
47
|
+
|
|
48
|
+
每个技能必须包含 `SKILL.md` 文件,使用 YAML frontmatter 定义元数据:
|
|
49
|
+
|
|
50
|
+
```yaml
|
|
51
|
+
---
|
|
52
|
+
name: my-skill # 技能名称(必需,唯一标识)
|
|
53
|
+
description: 这是一个自定义技能的描述。当用户说"..."时调用此技能。(必需)
|
|
54
|
+
allowed-tools: Read, Write, Edit, Glob, Grep, Bash # 可选,允许使用的工具列表
|
|
55
|
+
license: MIT # 可选,许可证
|
|
56
|
+
compatibility: v1.0.0 # 可选,兼容版本
|
|
57
|
+
---
|
|
58
|
+
# 技能标题
|
|
59
|
+
|
|
60
|
+
这里是技能的详细说明内容,可以使用 Markdown 格式。
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### frontmatter 字段说明
|
|
64
|
+
|
|
65
|
+
| 字段 | 必需 | 说明 |
|
|
66
|
+
| --------------- | ---- | ------------------------------------------------ |
|
|
67
|
+
| `name` | 是 | 技能唯一标识,字母、数字、下划线、横杠,1-64字符 |
|
|
68
|
+
| `description` | 是 | 技能描述,当用户意图匹配时会被调用 |
|
|
69
|
+
| `allowed-tools` | 否 | 允许使用的工具列表,逗号分隔 |
|
|
70
|
+
| `license` | 否 | 许可证类型 |
|
|
71
|
+
| `compatibility` | 否 | 兼容的框架版本 |
|
|
72
|
+
|
|
73
|
+
### 正文格式
|
|
74
|
+
|
|
75
|
+
frontmatter 之后是技能的正文内容,支持 Markdown 格式,包含:
|
|
76
|
+
|
|
77
|
+
- 详细的功能说明
|
|
78
|
+
- 使用示例
|
|
79
|
+
- 最佳实践
|
|
80
|
+
- 注意事项
|
|
81
|
+
|
|
82
|
+
## 创建自定义技能
|
|
83
|
+
|
|
84
|
+
1. 在 `.agent/skills/` 下创建技能文件夹
|
|
85
|
+
2. 创建 `SKILL.md` 文件,包含完整的 frontmatter
|
|
86
|
+
3. 在正文中详细描述技能的功能和使用方法
|
|
87
|
+
4. 调用 `reloadSkills` 工具重载所有技能
|
|
88
|
+
|
|
89
|
+
## 技能重载
|
|
90
|
+
|
|
91
|
+
创建或修改技能后,需要调用 `reloadSkills` 工具重载:
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"tool": "reloadSkills",
|
|
96
|
+
"args": {}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## 示例:创建天气查询技能
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
.agent/skills/weather/
|
|
104
|
+
└── SKILL.md
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
SKILL.md 内容:
|
|
108
|
+
|
|
109
|
+
```yaml
|
|
110
|
+
---
|
|
111
|
+
name: weather
|
|
112
|
+
description: 查询天气信息。当用户说"天气怎么样"、"今天多少度"时调用。
|
|
113
|
+
allowed-tools: Bash, Read
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
# 天气查询技能
|
|
117
|
+
|
|
118
|
+
## 功能
|
|
119
|
+
|
|
120
|
+
查询指定城市的天气信息。
|
|
121
|
+
|
|
122
|
+
## 使用方式
|
|
123
|
+
|
|
124
|
+
用户发送 "北京天气" 或 "今天上海多少度"
|
|
125
|
+
|
|
126
|
+
## 注意事项
|
|
127
|
+
|
|
128
|
+
- 使用免费的天气 API
|
|
129
|
+
- 响应需要简洁明了
|
|
130
|
+
```
|
|
@@ -286,6 +286,7 @@ class SkillManagerPlugin extends Plugin {
|
|
|
286
286
|
|
|
287
287
|
let totalLoaded = 0;
|
|
288
288
|
|
|
289
|
+
// 1. 扫描 skillsDirs
|
|
289
290
|
for (const skillsDir of this._skillsDirs) {
|
|
290
291
|
const resolvedDir = path.resolve(process.cwd(), skillsDir);
|
|
291
292
|
|
|
@@ -322,10 +323,108 @@ class SkillManagerPlugin extends Plugin {
|
|
|
322
323
|
}
|
|
323
324
|
}
|
|
324
325
|
|
|
326
|
+
// 2. 扫描插件目录下的 SKILL.md
|
|
327
|
+
this._loadSkillsFromPlugins();
|
|
328
|
+
|
|
325
329
|
log.info(` Loaded ${this._skills.size} skills`);
|
|
326
330
|
this._loaded = true;
|
|
327
331
|
}
|
|
328
332
|
|
|
333
|
+
/**
|
|
334
|
+
* 从已加载插件的目录中扫描 SKILL.md 并加载为技能
|
|
335
|
+
*/
|
|
336
|
+
_loadSkillsFromPlugins() {
|
|
337
|
+
if (!this._framework) return;
|
|
338
|
+
|
|
339
|
+
try {
|
|
340
|
+
// 获取所有已注册插件的 sourcePath
|
|
341
|
+
const pluginManager = this._framework.pluginManager;
|
|
342
|
+
const plugins = pluginManager._plugins || new Map();
|
|
343
|
+
|
|
344
|
+
for (const [pluginName, entry] of plugins) {
|
|
345
|
+
const sourcePath = entry.sourcePath;
|
|
346
|
+
if (!sourcePath) continue;
|
|
347
|
+
|
|
348
|
+
// 获取插件所在目录
|
|
349
|
+
const pluginDir = path.dirname(sourcePath);
|
|
350
|
+
|
|
351
|
+
// 检查插件目录下是否有 SKILL.md(尝试大小写)
|
|
352
|
+
let skillMdPath = path.join(pluginDir, 'SKILL.md');
|
|
353
|
+
if (!fs.existsSync(skillMdPath)) {
|
|
354
|
+
skillMdPath = path.join(pluginDir, 'SKILL.MD');
|
|
355
|
+
}
|
|
356
|
+
if (!fs.existsSync(skillMdPath)) {
|
|
357
|
+
// 使用 _findSkillMarkdown 递归查找
|
|
358
|
+
const found = this._findSkillMarkdown(pluginDir);
|
|
359
|
+
if (found) {
|
|
360
|
+
skillMdPath = found;
|
|
361
|
+
} else {
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// 使用插件名作为 skill 名(如果已存在则跳过)
|
|
367
|
+
const skillName = pluginName;
|
|
368
|
+
if (this._skills.has(skillName)) {
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
try {
|
|
373
|
+
this._loadSkillFromFile(skillName, skillMdPath, pluginDir);
|
|
374
|
+
log.info(` Loaded skill from plugin '${pluginName}': ${skillName}`);
|
|
375
|
+
} catch (err) {
|
|
376
|
+
log.warn(` Failed to load skill from plugin '${pluginName}':`, err.message);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
} catch (err) {
|
|
380
|
+
log.warn('Failed to scan plugins for skills:', err.message);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* 从文件加载技能(用于插件目录的 SKILL.md)
|
|
386
|
+
* @param {string} name - 技能名称
|
|
387
|
+
* @param {string} filePath - SKILL.md 文件路径
|
|
388
|
+
* @param {string} baseDir - 技能基础目录
|
|
389
|
+
*/
|
|
390
|
+
_loadSkillFromFile(name, filePath, baseDir) {
|
|
391
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
392
|
+
const frontmatter = parseFrontmatter(content);
|
|
393
|
+
|
|
394
|
+
if (!frontmatter) {
|
|
395
|
+
throw new Error('No valid frontmatter found');
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const metadata = new SkillMetadata({
|
|
399
|
+
name: frontmatter.name || name,
|
|
400
|
+
description: frontmatter.description || '',
|
|
401
|
+
license: frontmatter.license,
|
|
402
|
+
compatibility: frontmatter.compatibility,
|
|
403
|
+
metadata: frontmatter.metadata || {},
|
|
404
|
+
allowedTools: frontmatter['allowed-tools'] || [],
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
const skill = new Skill(metadata, stripFrontmatter(content));
|
|
408
|
+
skill.install(this._framework);
|
|
409
|
+
|
|
410
|
+
// 扫描 references 子目录
|
|
411
|
+
const references = this._scanReferences(baseDir);
|
|
412
|
+
|
|
413
|
+
// 扫描 scripts 子目录
|
|
414
|
+
const scripts = this._scanScripts(baseDir);
|
|
415
|
+
|
|
416
|
+
this._skills.set(name, {
|
|
417
|
+
name,
|
|
418
|
+
metadata,
|
|
419
|
+
content: skill.content,
|
|
420
|
+
instance: skill,
|
|
421
|
+
path: baseDir,
|
|
422
|
+
references,
|
|
423
|
+
scripts,
|
|
424
|
+
fromPlugin: true, // 标记为来自插件
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
|
|
329
428
|
/**
|
|
330
429
|
* 递归查找 SKILL.md 或 AGENTS.md(支持多层嵌套目录)
|
|
331
430
|
* @param {string} dir - 要搜索的目录
|