foliko 1.1.67 → 1.1.69

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.
Files changed (157) hide show
  1. package/.claude/settings.local.json +19 -10
  2. package/.dockerignore +45 -45
  3. package/.env.example +56 -56
  4. package/CLAUDE.md +2 -2
  5. package/README.md +13 -13
  6. package/SPEC.md +3 -3
  7. package/cli/src/commands/chat.js +2 -20
  8. package/cli/src/commands/list.js +7 -6
  9. package/cli/src/commands/plugin.js +3 -2
  10. package/cli/src/daemon.js +2 -2
  11. package/cli/src/ui/chat-ui-old.js +15 -4
  12. package/cli/src/ui/chat-ui.js +236 -203
  13. package/cli/src/ui/footer-bar.js +20 -46
  14. package/cli/src/ui/message-bubble.js +24 -2
  15. package/cli/src/ui/status-bar.js +177 -0
  16. package/cli/src/utils/config.js +29 -0
  17. package/cli/src/utils/plugin-config.js +1 -1
  18. package/docker-compose.yml +33 -33
  19. package/docs/features.md +120 -120
  20. package/docs/quick-reference.md +160 -160
  21. package/docs/user-manual.md +1391 -1391
  22. package/examples/ambient-example.js +2 -2
  23. package/examples/bootstrap.js +3 -3
  24. package/examples/test-chat.js +1 -1
  25. package/examples/test-reload.js +1 -1
  26. package/examples/test-telegram.js +1 -1
  27. package/examples/test-tg-bot.js +1 -1
  28. package/examples/test-tg-simple.js +2 -2
  29. package/examples/test-tg.js +1 -1
  30. package/examples/test-think.js +1 -1
  31. package/examples/test-weixin-feishu.js +3 -3
  32. package/package.json +3 -1
  33. package/plugins/ambient-agent/index.js +1 -1
  34. package/plugins/audit-plugin.js +84 -29
  35. package/plugins/coordinator-plugin.js +14 -12
  36. package/plugins/data-splitter-plugin.js +323 -0
  37. package/plugins/default-plugins.js +23 -12
  38. package/plugins/email/index.js +1 -1
  39. package/plugins/extension-executor-plugin.js +87 -9
  40. package/plugins/feishu-plugin.js +118 -16
  41. package/plugins/file-system-plugin.js +68 -50
  42. package/plugins/gate-trading.js +10 -10
  43. package/plugins/install-plugin.js +7 -7
  44. package/plugins/memory-plugin.js +9 -12
  45. package/plugins/plugin-manager-plugin.js +12 -14
  46. package/plugins/python-executor-plugin.js +1 -1
  47. package/plugins/python-plugin-loader.js +1 -1
  48. package/plugins/qq-plugin.js +151 -24
  49. package/plugins/rules-plugin.js +8 -8
  50. package/plugins/scheduler-plugin.js +24 -20
  51. package/plugins/session-plugin.js +313 -397
  52. package/plugins/storage-plugin.js +235 -175
  53. package/plugins/subagent-plugin.js +17 -13
  54. package/plugins/telegram-plugin.js +116 -17
  55. package/plugins/think-plugin.js +64 -60
  56. package/plugins/tools-plugin.js +8 -8
  57. package/plugins/web-plugin.js +2 -2
  58. package/plugins/weixin-plugin.js +107 -24
  59. package/skills/find-skills/AGENTS.md +2 -2
  60. package/skills/find-skills/SKILL.md +133 -133
  61. package/skills/foliko-dev/AGENTS.md +236 -236
  62. package/skills/foliko-dev/SKILL.md +19 -19
  63. package/skills/mcp-usage/SKILL.md +200 -200
  64. package/skills/plugin-guide/SKILL.md +4 -4
  65. package/skills/python-plugin-dev/SKILL.md +5 -5
  66. package/skills/skill-guide/SKILL.md +104 -6
  67. package/skills/subagent-guide/SKILL.md +237 -237
  68. package/skills/workflow-guide/SKILL.md +646 -646
  69. package/src/capabilities/skill-manager.js +124 -17
  70. package/src/capabilities/workflow-engine.js +3 -3
  71. package/src/core/agent-chat.js +72 -26
  72. package/src/core/agent.js +17 -27
  73. package/src/core/branch-summary-auto.js +206 -0
  74. package/src/core/chat-session.js +45 -169
  75. package/src/core/command-registry.js +200 -0
  76. package/src/core/constants.js +198 -0
  77. package/src/core/context-compressor.js +702 -326
  78. package/src/core/context-manager.js +0 -1
  79. package/src/core/enhanced-context-compressor.js +210 -0
  80. package/src/core/framework.js +260 -84
  81. package/src/core/jsonl-storage.js +253 -0
  82. package/src/core/plugin-base.js +7 -5
  83. package/src/core/plugin-manager.js +15 -10
  84. package/src/core/provider-registry.js +159 -0
  85. package/src/core/provider.js +2 -0
  86. package/src/core/session-entry.js +225 -0
  87. package/src/core/session-manager.js +701 -0
  88. package/src/core/storage-manager.js +494 -0
  89. package/src/core/sub-agent-config.js +1 -1
  90. package/src/core/subagent.js +16 -135
  91. package/src/core/token-counter.js +177 -58
  92. package/src/core/tool-executor.js +2 -70
  93. package/src/core/ui-extension-context.js +174 -0
  94. package/src/executors/mcp-executor.js +27 -16
  95. package/src/utils/chat-queue.js +11 -22
  96. package/src/utils/data-splitter.js +345 -0
  97. package/src/utils/logger.js +152 -180
  98. package/src/utils/message-validator.js +283 -0
  99. package/src/utils/plugin-helpers.js +2 -2
  100. package/src/utils/retry.js +168 -22
  101. package/website_v2/docs/api.html +1 -1
  102. package/website_v2/docs/configuration.html +2 -2
  103. package/website_v2/docs/plugin-development.html +4 -4
  104. package/website_v2/docs/project-structure.html +2 -2
  105. package/website_v2/docs/skill-development.html +2 -2
  106. package/website_v2/index.html +1 -1
  107. package/website_v2/styles/animations.css +7 -7
  108. package/.agent/agents/backend-dev.md +0 -102
  109. package/.agent/agents/data-analyst.md +0 -117
  110. package/.agent/agents/devops.md +0 -115
  111. package/.agent/agents/frontend-dev.md +0 -94
  112. package/.agent/agents/network-requester.md +0 -44
  113. package/.agent/agents/poster-designer.md +0 -52
  114. package/.agent/agents/product-manager.md +0 -85
  115. package/.agent/agents/qa-engineer.md +0 -100
  116. package/.agent/agents/security-engineer.md +0 -99
  117. package/.agent/agents/team-lead.md +0 -137
  118. package/.agent/agents/ui-designer.md +0 -116
  119. package/.agent/data/default.json +0 -58
  120. package/.agent/data/email/processed-emails.json +0 -1
  121. package/.agent/data/plugins-state.json +0 -199
  122. package/.agent/data/scheduler/tasks.json +0 -1
  123. package/.agent/data/web/web-config.json +0 -5
  124. package/.agent/data/weixin/images/file_1776188148383jpg +0 -0
  125. package/.agent/data/weixin/images/file_1776188458326.jpg +0 -0
  126. package/.agent/data/weixin/images/file_1776188689423.jpg +0 -0
  127. package/.agent/data/weixin/images/file_1776188813604.jpg +0 -0
  128. package/.agent/data/weixin/images/file_1776189097450.jpg +0 -0
  129. package/.agent/data/weixin/videos/file_1776188318431.mp4 +0 -0
  130. package/.agent/data/weixin.json +0 -6
  131. package/.agent/mcp_config.json +0 -14
  132. package/.agent/memory/user/mof6gk94-kneeuh.md +0 -9
  133. package/.agent/package.json +0 -8
  134. package/.agent/plugins/marknative/README.md +0 -134
  135. package/.agent/plugins/marknative/fonts/SegoeUI Emoji.ttf +0 -0
  136. package/.agent/plugins/marknative/fonts.zip +0 -0
  137. package/.agent/plugins/marknative/index.js +0 -256
  138. package/.agent/plugins/marknative/package.json +0 -12
  139. package/.agent/plugins/test-plugin.py +0 -99
  140. package/.agent/plugins.json +0 -14
  141. package/.agent/python-scripts/test_sample.py +0 -24
  142. package/.agent/sessions/cli_default.json +0 -247
  143. package/.agent/skills/agent-browser/SKILL.md +0 -311
  144. package/.agent/skills/agent-browser/TEST_PLAN.md +0 -200
  145. package/.agent/skills/sysinfo/SKILL.md +0 -38
  146. package/.agent/skills/sysinfo/system-info.sh +0 -130
  147. package/.agent/skills/workflow/SKILL.md +0 -324
  148. package/.agent/test-agent.js +0 -35
  149. package/.agent/weixin.json +0 -6
  150. package/.agent/workflows/email-digest.json +0 -50
  151. package/.agent/workflows/file-backup.json +0 -21
  152. package/.agent/workflows/get-ip-notify.json +0 -32
  153. package/.agent/workflows/news-aggregator.json +0 -93
  154. package/.agent/workflows/news-dashboard-v2.json +0 -94
  155. package/.agent/workflows/notification-batch.json +0 -32
  156. package/src/core/session-context.js +0 -346
  157. package/src/core/session-storage.js +0 -295
@@ -1,256 +0,0 @@
1
- const { z } = require('zod');
2
- const path = require('path');
3
- const fs = require('fs');
4
-
5
- module.exports = function (Plugin) {
6
- return class MarkNativePlugin extends Plugin {
7
- constructor(config = {}) {
8
- super();
9
- this.name = 'marknative';
10
- this.version = '1.0.1';
11
- this.description = 'Markdown 转图片插件 - 将 Markdown 转换为 PNG/SVG';
12
- this.priority = 10;
13
- this.marknative = null;
14
- this.checked = false;
15
- }
16
-
17
- async _ensureMarkNative() {
18
- if (this.checked) return;
19
- this.checked = true;
20
-
21
- this.marknative = await import('marknative');
22
- }
23
-
24
- tools = {
25
- marknative_render: {
26
- description: '将 Markdown 渲染为图片并保存到文件(返回文件路径)',
27
- inputSchema: z.object({
28
- markdown: z.string().describe('Markdown 内容'),
29
- outputPath: z.string().optional().describe('输出文件路径(如 output.png),不提供则自动生成'),
30
- format: z.enum(['png', 'svg']).optional().describe('输出格式:png 或 svg,默认 png'),
31
- theme: z.string().optional().describe('主题:default, github, solarized, sepia, rose, dark, nord, dracula, ocean, forest'),
32
- singlePage: z.boolean().optional().describe('是否渲染为单张图片(默认 false)'),
33
- codeTheme: z.string().optional().describe('代码高亮主题(如 github-dark, nord 等)'),
34
- }),
35
- execute: async (args) => {
36
- try {
37
- await this._ensureMarkNative();
38
-
39
- if (!this.marknative) {
40
- return {
41
- success: false,
42
- error: 'marknative 未安装。请运行: cd .agent/plugins/marknative && npm install'
43
- };
44
- }
45
-
46
- const { renderMarkdown } = this.marknative;
47
-
48
- const format = args.format || 'png';
49
- const options = {
50
- format,
51
- singlePage: args.singlePage || false
52
- };
53
-
54
- if (args.theme) options.theme = args.theme;
55
- if (args.codeTheme) options.codeHighlighting = { theme: args.codeTheme };
56
-
57
- const pages = await renderMarkdown(args.markdown, options);
58
-
59
- if (pages.length === 0) {
60
- return { success: false, error: '渲染失败,无输出' };
61
- }
62
-
63
- // 自动生成输出路径
64
- let basePath = args.outputPath;
65
- if (!basePath) {
66
- const timestamp = Date.now().toString(36);
67
- basePath = `output/markdown-${timestamp}.${format}`;
68
- }
69
-
70
- const dir = path.dirname(basePath);
71
- if (dir && dir !== '.' && !fs.existsSync(dir)) {
72
- fs.mkdirSync(dir, { recursive: true });
73
- }
74
-
75
- const files = [];
76
- for (let i = 0; i < pages.length; i++) {
77
- const page = pages[i];
78
- const filePath = pages.length === 1
79
- ? basePath
80
- : basePath.replace(/(\.[^.]+)$/, `-${String(i + 1).padStart(2, '0')}$1`);
81
-
82
- if (page.format === 'png') {
83
- fs.writeFileSync(filePath, page.data);
84
- } else {
85
- fs.writeFileSync(filePath, page.data, 'utf-8');
86
- }
87
- files.push(filePath);
88
- }
89
-
90
- return {
91
- success: true,
92
- files,
93
- pageCount: pages.length,
94
- message: pages.length === 1
95
- ? `图片已生成: ${files[0]}`
96
- : `已生成 ${pages.length} 页图片: ${files.join(', ')}`
97
- };
98
- } catch (error) {
99
- return { success: false, error: error.message };
100
- }
101
- },
102
- },
103
-
104
- marknative_render_to_file: {
105
- description: '将 Markdown 渲染为图片并保存到文件',
106
- inputSchema: z.object({
107
- markdown: z.string().describe('Markdown 内容'),
108
- outputPath: z.string().describe('输出文件路径(如 output.png)'),
109
- format: z.enum(['png', 'svg']).optional().describe('输出格式,默认根据文件扩展名'),
110
- theme: z.string().optional().describe('主题'),
111
- codeTheme: z.string().optional().describe('代码高亮主题'),
112
- }),
113
- execute: async (args) => {
114
- try {
115
- await this._ensureMarkNative();
116
-
117
- if (!this.marknative) {
118
- return {
119
- success: false,
120
- error: 'marknative 未安装。请运行: cd .agent/plugins/marknative && npm install'
121
- };
122
- }
123
-
124
- const { renderMarkdown } = this.marknative;
125
-
126
- const ext = path.extname(args.outputPath).toLowerCase();
127
- const format = args.format || (ext === '.svg' ? 'svg' : 'png');
128
-
129
- const options = { format };
130
- if (args.theme) options.theme = args.theme;
131
- if (args.codeTheme) options.codeHighlighting = { theme: args.codeTheme };
132
-
133
- const pages = await renderMarkdown(args.markdown, options);
134
-
135
- const dir = path.dirname(args.outputPath);
136
- if (dir && dir !== '.' && !fs.existsSync(dir)) {
137
- fs.mkdirSync(dir, { recursive: true });
138
- }
139
-
140
- const files = [];
141
- for (let i = 0; i < pages.length; i++) {
142
- const page = pages[i];
143
- const filePath = pages.length === 1
144
- ? args.outputPath
145
- : args.outputPath.replace(/(\.[^.]+)$/, `-${String(i + 1).padStart(2, '0')}$1`);
146
-
147
- if (page.format === 'png') {
148
- fs.writeFileSync(filePath, page.data);
149
- } else {
150
- fs.writeFileSync(filePath, page.data, 'utf-8');
151
- }
152
- files.push(filePath);
153
- }
154
-
155
- return {
156
- success: true,
157
- files,
158
- pageCount: pages.length,
159
- message: `已生成 ${pages.length} 页图片: ${files.join(', ')}`
160
- };
161
- } catch (error) {
162
- return { success: false, error: error.message };
163
- }
164
- },
165
- },
166
-
167
- marknative_preview: {
168
- description: '预览 Markdown 渲染效果(返回第一页 Base64)',
169
- inputSchema: z.object({
170
- markdown: z.string().describe('Markdown 内容'),
171
- theme: z.string().optional().describe('主题'),
172
- codeTheme: z.string().optional().describe('代码高亮主题'),
173
- }),
174
- execute: async (args) => {
175
- try {
176
- await this._ensureMarkNative();
177
-
178
- if (!this.marknative) {
179
- return {
180
- success: false,
181
- error: 'marknative 未安装。请运行: cd .agent/plugins/marknative && npm install'
182
- };
183
- }
184
-
185
- const { renderMarkdown } = this.marknative;
186
-
187
- const options = {
188
- format: 'png',
189
- singlePage: true
190
- };
191
-
192
- if (args.theme) options.theme = args.theme;
193
- if (args.codeTheme) options.codeHighlighting = { theme: args.codeTheme };
194
-
195
- const pages = await renderMarkdown(args.markdown, options);
196
-
197
- if (pages.length === 0) {
198
- return { success: false, error: '预览生成失败' };
199
- }
200
-
201
- return {
202
- success: true,
203
- preview: pages[0].data.toString('base64'),
204
- format: 'png'
205
- };
206
- } catch (error) {
207
- return { success: false, error: error.message };
208
- }
209
- },
210
- },
211
-
212
- marknative_get_themes: {
213
- description: '获取所有可用的主题列表',
214
- inputSchema: z.object({}),
215
- execute: async () => {
216
- return {
217
- success: true,
218
- themes: [
219
- { name: 'default', description: '默认主题(浅色)' },
220
- { name: 'github', description: 'GitHub 风格' },
221
- { name: 'solarized', description: 'Solarized 风格' },
222
- { name: 'sepia', description: '复古纸张风格' },
223
- { name: 'rose', description: '玫瑰粉风格' },
224
- { name: 'dark', description: '深色主题' },
225
- { name: 'nord', description: 'Nord 风格' },
226
- { name: 'dracula', description: 'Dracula 风格' },
227
- { name: 'ocean', description: '海洋风格' },
228
- { name: 'forest', description: '森林风格' }
229
- ],
230
- codeThemes: ['github-light', 'github-dark', 'nord', 'dracula', 'solarized-light', 'solarized-dark', 'monokai']
231
- };
232
- },
233
- },
234
-
235
- marknative_status: {
236
- description: '检查 marknative 插件状态',
237
- inputSchema: z.object({}),
238
- execute: async () => {
239
- await this._ensureMarkNative();
240
-
241
- return {
242
- success: true,
243
- available: this.marknative !== null,
244
- message: this.marknative ? 'marknative 已就绪' : 'marknative 未安装,请运行: cd .agent/plugins/marknative && npm install'
245
- };
246
- },
247
- },
248
- };
249
-
250
- install(framework) {
251
- return this;
252
- }
253
-
254
- uninstall(framework) {}
255
- };
256
- };
@@ -1,12 +0,0 @@
1
- {
2
- "name": "marknative-plugin",
3
- "version": "1.0.0",
4
- "description": "Markdown 转图片插件 - 将 Markdown 转换为 PNG/SVG",
5
- "main": "index.js",
6
- "keywords": ["markdown", "png", "svg", "image", "render", "foliko", "plugin"],
7
- "author": "",
8
- "license": "MIT",
9
- "dependencies": {
10
- "marknative": "^0.3.1"
11
- }
12
- }
@@ -1,99 +0,0 @@
1
- # .agent/plugins/test-plugin.py
2
-
3
- PLUGIN = {
4
- "name": "test-plugin",
5
- "version": "1.0.0",
6
- "description": "测试插件 - 提供基础测试功能"
7
- }
8
-
9
- TOOLS = [
10
- {
11
- "name": "hello",
12
- "description": "问候测试",
13
- "params": {"name": "string"}
14
- },
15
- {
16
- "name": "add",
17
- "description": "加法计算",
18
- "params": {"a": "number", "b": "number"}
19
- },
20
- {
21
- "name": "multiply",
22
- "description": "乘法计算",
23
- "params": {"a": "number", "b": "number"}
24
- },
25
- {
26
- "name": "reverse_text",
27
- "description": "反转文本",
28
- "params": {"text": "string"}
29
- },
30
- {
31
- "name": "palindrome_check",
32
- "description": "回文检测",
33
- "params": {"text": "string"}
34
- },
35
- {
36
- "name": "get_info",
37
- "description": "获取插件信息",
38
- "params": {}
39
- }
40
- ]
41
-
42
- # === 工具实现 ===
43
-
44
- def hello(params):
45
- """问候工具"""
46
- name = params.get("name", "World")
47
- return {"success": True, "result": f"Hello, {name}! 👋"}
48
-
49
-
50
- def add(params):
51
- """加法计算"""
52
- a = params.get("a", 0)
53
- b = params.get("b", 0)
54
- result = a + b
55
- return {"success": True, "result": result, "expression": f"{a} + {b} = {result}"}
56
-
57
-
58
- def multiply(params):
59
- """乘法计算"""
60
- a = params.get("a", 0)
61
- b = params.get("b", 0)
62
- result = a * b
63
- return {"success": True, "result": result, "expression": f"{a} × {b} = {result}"}
64
-
65
-
66
- def reverse_text(params):
67
- """反转文本"""
68
- text = params.get("text", "")
69
- reversed_text = text[::-1]
70
- return {"success": True, "original": text, "reversed": reversed_text}
71
-
72
-
73
- def palindrome_check(params):
74
- """回文检测"""
75
- import re
76
- text = params.get("text", "")
77
- # 清理:去除空格和标点,转小写
78
- cleaned = re.sub(r'[^a-zA-Z0-9\u4e00-\u9fa5]', '', text).lower()
79
- is_palindrome = cleaned == cleaned[::-1] and len(cleaned) > 0
80
- return {
81
- "success": True,
82
- "text": text,
83
- "is_palindrome": is_palindrome,
84
- "result": "是回文 ✓" if is_palindrome else "不是回文 ✗"
85
- }
86
-
87
-
88
- def get_info(params):
89
- """获取插件信息"""
90
- return {
91
- "success": True,
92
- "result": {
93
- "name": PLUGIN["name"],
94
- "version": PLUGIN["version"],
95
- "description": PLUGIN["description"],
96
- "tool_count": len(TOOLS),
97
- "tools": [tool["name"] for tool in TOOLS]
98
- }
99
- }
@@ -1,14 +0,0 @@
1
- {
2
- "email": {
3
- "enabled": true,
4
- "smtp": {
5
- "host": "smtp.gmail.com",
6
- "port": 587,
7
- "secure": false
8
- },
9
- "imap": {
10
- "host": "imap.gmail.com",
11
- "port": 993
12
- }
13
- }
14
- }
@@ -1,24 +0,0 @@
1
- """
2
- 测试模块 - 2026-04-02 02:52:12
3
- """
4
-
5
- import unittest
6
-
7
-
8
-
9
- class TestMath(unittest.TestCase):
10
- """TestMath 测试类"""
11
-
12
- def test_add(self):
13
- """测试用例: test_add"""
14
- # TODO: 实现测试逻辑
15
- self.assertTrue(True)
16
-
17
- def test_subtract(self):
18
- """测试用例: test_subtract"""
19
- # TODO: 实现测试逻辑
20
- self.assertTrue(True)
21
-
22
-
23
- if __name__ == "__main__":
24
- unittest.main()