foliko 1.1.68 → 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 (142) 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 +152 -38
  13. package/cli/src/ui/footer-bar.js +13 -14
  14. package/cli/src/utils/config.js +29 -0
  15. package/cli/src/utils/plugin-config.js +1 -1
  16. package/docker-compose.yml +33 -33
  17. package/docs/features.md +120 -120
  18. package/docs/quick-reference.md +160 -160
  19. package/docs/user-manual.md +1391 -1391
  20. package/examples/ambient-example.js +2 -2
  21. package/examples/bootstrap.js +3 -3
  22. package/examples/test-chat.js +1 -1
  23. package/examples/test-reload.js +1 -1
  24. package/examples/test-telegram.js +1 -1
  25. package/examples/test-tg-bot.js +1 -1
  26. package/examples/test-tg-simple.js +2 -2
  27. package/examples/test-tg.js +1 -1
  28. package/examples/test-think.js +1 -1
  29. package/examples/test-weixin-feishu.js +3 -3
  30. package/package.json +3 -1
  31. package/plugins/ambient-agent/index.js +1 -1
  32. package/plugins/audit-plugin.js +75 -24
  33. package/plugins/default-plugins.js +21 -11
  34. package/plugins/email/index.js +1 -1
  35. package/plugins/extension-executor-plugin.js +85 -7
  36. package/plugins/feishu-plugin.js +118 -16
  37. package/plugins/install-plugin.js +4 -4
  38. package/plugins/memory-plugin.js +1 -1
  39. package/plugins/plugin-manager-plugin.js +3 -3
  40. package/plugins/python-executor-plugin.js +1 -1
  41. package/plugins/python-plugin-loader.js +1 -1
  42. package/plugins/qq-plugin.js +143 -16
  43. package/plugins/rules-plugin.js +1 -1
  44. package/plugins/scheduler-plugin.js +2 -2
  45. package/plugins/session-plugin.js +309 -393
  46. package/plugins/storage-plugin.js +235 -176
  47. package/plugins/subagent-plugin.js +4 -4
  48. package/plugins/telegram-plugin.js +116 -17
  49. package/plugins/think-plugin.js +1 -1
  50. package/plugins/web-plugin.js +2 -2
  51. package/plugins/weixin-plugin.js +102 -19
  52. package/skills/find-skills/AGENTS.md +2 -2
  53. package/skills/find-skills/SKILL.md +133 -133
  54. package/skills/foliko-dev/AGENTS.md +236 -236
  55. package/skills/foliko-dev/SKILL.md +19 -19
  56. package/skills/mcp-usage/SKILL.md +200 -200
  57. package/skills/plugin-guide/SKILL.md +4 -4
  58. package/skills/python-plugin-dev/SKILL.md +5 -5
  59. package/skills/skill-guide/SKILL.md +104 -6
  60. package/skills/subagent-guide/SKILL.md +237 -237
  61. package/skills/workflow-guide/SKILL.md +646 -646
  62. package/src/capabilities/skill-manager.js +101 -2
  63. package/src/capabilities/workflow-engine.js +1 -1
  64. package/src/core/agent-chat.js +17 -14
  65. package/src/core/branch-summary-auto.js +206 -0
  66. package/src/core/chat-session.js +38 -8
  67. package/src/core/command-registry.js +200 -0
  68. package/src/core/constants.js +11 -11
  69. package/src/core/context-compressor.js +700 -149
  70. package/src/core/context-manager.js +0 -1
  71. package/src/core/enhanced-context-compressor.js +210 -0
  72. package/src/core/framework.js +140 -83
  73. package/src/core/jsonl-storage.js +253 -0
  74. package/src/core/plugin-manager.js +15 -10
  75. package/src/core/provider-registry.js +159 -0
  76. package/src/core/provider.js +2 -0
  77. package/src/core/session-entry.js +225 -0
  78. package/src/core/session-manager.js +701 -0
  79. package/src/core/storage-manager.js +494 -0
  80. package/src/core/sub-agent-config.js +1 -1
  81. package/src/core/token-counter.js +177 -58
  82. package/src/core/ui-extension-context.js +174 -0
  83. package/src/executors/mcp-executor.js +15 -6
  84. package/src/utils/logger.js +152 -180
  85. package/src/utils/plugin-helpers.js +2 -2
  86. package/website_v2/docs/api.html +1 -1
  87. package/website_v2/docs/configuration.html +2 -2
  88. package/website_v2/docs/plugin-development.html +4 -4
  89. package/website_v2/docs/project-structure.html +2 -2
  90. package/website_v2/docs/skill-development.html +2 -2
  91. package/website_v2/index.html +1 -1
  92. package/website_v2/styles/animations.css +7 -7
  93. package/.agent/agents/backend-dev.md +0 -102
  94. package/.agent/agents/data-analyst.md +0 -117
  95. package/.agent/agents/devops.md +0 -115
  96. package/.agent/agents/frontend-dev.md +0 -94
  97. package/.agent/agents/network-requester.md +0 -44
  98. package/.agent/agents/poster-designer.md +0 -52
  99. package/.agent/agents/product-manager.md +0 -85
  100. package/.agent/agents/qa-engineer.md +0 -100
  101. package/.agent/agents/security-engineer.md +0 -99
  102. package/.agent/agents/team-lead.md +0 -137
  103. package/.agent/agents/ui-designer.md +0 -116
  104. package/.agent/data/default.json +0 -58
  105. package/.agent/data/email/processed-emails.json +0 -1
  106. package/.agent/data/plugins-state.json +0 -207
  107. package/.agent/data/scheduler/tasks.json +0 -1
  108. package/.agent/data/web/web-config.json +0 -5
  109. package/.agent/data/weixin/images/file_1776188148383jpg +0 -0
  110. package/.agent/data/weixin/images/file_1776188458326.jpg +0 -0
  111. package/.agent/data/weixin/images/file_1776188689423.jpg +0 -0
  112. package/.agent/data/weixin/images/file_1776188813604.jpg +0 -0
  113. package/.agent/data/weixin/images/file_1776189097450.jpg +0 -0
  114. package/.agent/data/weixin/videos/file_1776188318431.mp4 +0 -0
  115. package/.agent/data/weixin.json +0 -6
  116. package/.agent/mcp_config.json +0 -14
  117. package/.agent/memory/user/mof6gk94-kneeuh.md +0 -9
  118. package/.agent/package.json +0 -8
  119. package/.agent/plugins/marknative/README.md +0 -134
  120. package/.agent/plugins/marknative/fonts/SegoeUI Emoji.ttf +0 -0
  121. package/.agent/plugins/marknative/fonts.zip +0 -0
  122. package/.agent/plugins/marknative/index.js +0 -256
  123. package/.agent/plugins/marknative/package.json +0 -12
  124. package/.agent/plugins/test-plugin.py +0 -99
  125. package/.agent/plugins.json +0 -14
  126. package/.agent/python-scripts/test_sample.py +0 -24
  127. package/.agent/sessions/cli_default.json +0 -4121
  128. package/.agent/skills/agent-browser/SKILL.md +0 -311
  129. package/.agent/skills/agent-browser/TEST_PLAN.md +0 -200
  130. package/.agent/skills/sysinfo/SKILL.md +0 -38
  131. package/.agent/skills/sysinfo/system-info.sh +0 -130
  132. package/.agent/skills/workflow/SKILL.md +0 -324
  133. package/.agent/test-agent.js +0 -35
  134. package/.agent/weixin.json +0 -6
  135. package/.agent/workflows/email-digest.json +0 -50
  136. package/.agent/workflows/file-backup.json +0 -21
  137. package/.agent/workflows/get-ip-notify.json +0 -32
  138. package/.agent/workflows/news-aggregator.json +0 -93
  139. package/.agent/workflows/news-dashboard-v2.json +0 -94
  140. package/.agent/workflows/notification-batch.json +0 -32
  141. package/src/core/session-context.js +0 -346
  142. package/src/core/session-storage.js +0 -295
@@ -1,160 +1,160 @@
1
- # Foliko 快速参考
2
-
3
- ## 启动框架
4
-
5
- ```javascript
6
- const framework = new Framework({ debug: false });
7
- await framework.bootstrap({
8
- agentDir: './.agent',
9
- aiConfig: { provider: 'deepseek', model: 'deepseek-chat', apiKey: '...' },
10
- });
11
- ```
12
-
13
- ## 创建 Agent
14
-
15
- ```javascript
16
- const agent = framework.createAgent({
17
- name: 'MyAgent',
18
- systemPrompt: '你是一个有帮助的助手。',
19
- });
20
- ```
21
-
22
- ## 发送消息
23
-
24
- ```javascript
25
- // 流式
26
- for await (const chunk of agent.chatStream('你好')) {
27
- if (chunk.type === 'text') process.stdout.write(chunk.text);
28
- }
29
-
30
- // 非流式
31
- const result = await agent.chat('你好');
32
- ```
33
-
34
- ## 常用工具
35
-
36
- | 工具 | 用途 |
37
- | ---------------------- | ------------ |
38
- | `list_tools` | 列出所有工具 |
39
- | `loadSkill` | 加载技能 |
40
- | `reload_plugins` | 重载插件 |
41
- | `read_file` | 读取文件 |
42
- | `write_file` | 写入文件 |
43
- | `execute_command` | 执行命令 |
44
- | `schedule_once` | 定时任务 |
45
- | `think_now` | 主动思考 |
46
- | `email_send` | 发送邮件 |
47
- | `email_read` | 读取邮件 |
48
- | `enable_plugin` | 启用插件 |
49
- | `disable_plugin` | 禁用插件 |
50
- | `update_plugin_config` | 更新插件配置 |
51
-
52
- ## 插件位置
53
-
54
- - 内置插件:`plugins/`
55
- - 用户插件:`.agent/plugins/`
56
-
57
- ## 插件管理
58
-
59
- ```javascript
60
- // 重启插件
61
- await framework.executeTool('reload_plugins', {});
62
- await framework.executeTool('reload_plugins', { pluginName: 'telegram' });
63
-
64
- // 启用/禁用插件
65
- await framework.executeTool('enable_plugin', { name: 'telegram' });
66
- await framework.executeTool('disable_plugin', { name: 'telegram' });
67
-
68
- // 更新插件配置(持久化)
69
- await framework.executeTool('update_plugin_config', {
70
- name: 'telegram',
71
- config: { allowedChats: ['123'], groupMode: true },
72
- });
73
- await framework.executeTool('get_plugin_config', { name: 'telegram' });
74
- ```
75
-
76
- ## 事件监听
77
-
78
- ```javascript
79
- // Framework 事件
80
- framework.on('framework:ready', (fw) => {});
81
- framework.on('plugin:loaded', (plugin) => {});
82
- framework.on('tool:registered', (tool) => {});
83
-
84
- // Agent 事件
85
- agent.on('status', ({ status }) => {}); // idle/busy/error
86
- agent.on('chunk', (chunk) => {}); // 流式输出
87
- agent.on('tool-call', ({ name, args }) => {});
88
- agent.on('tool-result', ({ name, result }) => {});
89
-
90
- // 子 Agent 事件
91
- agent.on('subagent:chat:start', (data) => {});
92
- agent.on('subagent:chat:end', (data) => {});
93
- agent.on('subagent:error', (data) => {});
94
- ```
95
-
96
- ## 子 Agent 注册
97
-
98
- ```javascript
99
- const { tool } = require('ai')
100
- const { z } = require('zod')
101
-
102
- // 方式1:配置 agents 数组自动注册
103
- class MyPlugin extends Plugin {
104
- agents = [
105
- {
106
- name: 'code-agent',
107
- role: '代码专家',
108
- tools: {
109
- compile: tool({
110
- description: '编译',
111
- parameters: z.object({ language: z.string(), code: z.string() }),
112
- execute: async (args) => ({ success: true })
113
- })
114
- },
115
- parentTools: ['read_file', 'write_file']
116
- }
117
- ]
118
- }
119
-
120
- // 方式2:手动调用
121
- this.registerSubAgent({ name: 'code-agent', role: '代码专家', tools: {...}, parentTools: [...] })
122
- ```
123
-
124
- ## 系统提示中的部分
125
-
126
- ```
127
- 【可用工具】
128
- - tool1: 描述
129
- - tool2: 描述
130
-
131
- 【可用技能】
132
- - skill1: 描述
133
- - skill2: 描述
134
-
135
- 【子 Agent 分配规则】
136
- - code-agent: 代码专家
137
-
138
- 【系统能力】
139
- - ai: AI 对话能力
140
- - storage: 存储
141
- ```
142
-
143
- ## 状态管理
144
-
145
- ```javascript
146
- agent.getStatus(); // 'idle' | 'busy' | 'error'
147
- agent.resetStatus(); // 重置状态
148
- agent.clearHistory(); // 清空历史
149
- ```
150
-
151
- ## 配置持久化
152
-
153
- 插件配置自动保存到 `.agent/data/plugins-state.json`
154
-
155
- | 文件 | 用途 |
156
- | --------------------------------- | ------------------- |
157
- | `.agent/data/plugins-state.json` | 插件启用状态和配置 |
158
- | `.agent/data/storage.json` | 键值存储数据 |
159
- | `.agent/data/telegram_images/` | Telegram 接收的图片 |
160
- | `.agent/data/telegram_documents/` | Telegram 接收的文档 |
1
+ # Foliko 快速参考
2
+
3
+ ## 启动框架
4
+
5
+ ```javascript
6
+ const framework = new Framework({ debug: false });
7
+ await framework.bootstrap({
8
+ agentDir: './.foliko',
9
+ aiConfig: { provider: 'deepseek', model: 'deepseek-chat', apiKey: '...' },
10
+ });
11
+ ```
12
+
13
+ ## 创建 Agent
14
+
15
+ ```javascript
16
+ const agent = framework.createAgent({
17
+ name: 'MyAgent',
18
+ systemPrompt: '你是一个有帮助的助手。',
19
+ });
20
+ ```
21
+
22
+ ## 发送消息
23
+
24
+ ```javascript
25
+ // 流式
26
+ for await (const chunk of agent.chatStream('你好')) {
27
+ if (chunk.type === 'text') process.stdout.write(chunk.text);
28
+ }
29
+
30
+ // 非流式
31
+ const result = await agent.chat('你好');
32
+ ```
33
+
34
+ ## 常用工具
35
+
36
+ | 工具 | 用途 |
37
+ | ---------------------- | ------------ |
38
+ | `list_tools` | 列出所有工具 |
39
+ | `loadSkill` | 加载技能 |
40
+ | `reload_plugins` | 重载插件 |
41
+ | `read_file` | 读取文件 |
42
+ | `write_file` | 写入文件 |
43
+ | `execute_command` | 执行命令 |
44
+ | `schedule_once` | 定时任务 |
45
+ | `think_now` | 主动思考 |
46
+ | `email_send` | 发送邮件 |
47
+ | `email_read` | 读取邮件 |
48
+ | `enable_plugin` | 启用插件 |
49
+ | `disable_plugin` | 禁用插件 |
50
+ | `update_plugin_config` | 更新插件配置 |
51
+
52
+ ## 插件位置
53
+
54
+ - 内置插件:`plugins/`
55
+ - 用户插件:`.foliko/plugins/`
56
+
57
+ ## 插件管理
58
+
59
+ ```javascript
60
+ // 重启插件
61
+ await framework.executeTool('reload_plugins', {});
62
+ await framework.executeTool('reload_plugins', { pluginName: 'telegram' });
63
+
64
+ // 启用/禁用插件
65
+ await framework.executeTool('enable_plugin', { name: 'telegram' });
66
+ await framework.executeTool('disable_plugin', { name: 'telegram' });
67
+
68
+ // 更新插件配置(持久化)
69
+ await framework.executeTool('update_plugin_config', {
70
+ name: 'telegram',
71
+ config: { allowedChats: ['123'], groupMode: true },
72
+ });
73
+ await framework.executeTool('get_plugin_config', { name: 'telegram' });
74
+ ```
75
+
76
+ ## 事件监听
77
+
78
+ ```javascript
79
+ // Framework 事件
80
+ framework.on('framework:ready', (fw) => {});
81
+ framework.on('plugin:loaded', (plugin) => {});
82
+ framework.on('tool:registered', (tool) => {});
83
+
84
+ // Agent 事件
85
+ agent.on('status', ({ status }) => {}); // idle/busy/error
86
+ agent.on('chunk', (chunk) => {}); // 流式输出
87
+ agent.on('tool-call', ({ name, args }) => {});
88
+ agent.on('tool-result', ({ name, result }) => {});
89
+
90
+ // 子 Agent 事件
91
+ agent.on('subagent:chat:start', (data) => {});
92
+ agent.on('subagent:chat:end', (data) => {});
93
+ agent.on('subagent:error', (data) => {});
94
+ ```
95
+
96
+ ## 子 Agent 注册
97
+
98
+ ```javascript
99
+ const { tool } = require('ai')
100
+ const { z } = require('zod')
101
+
102
+ // 方式1:配置 agents 数组自动注册
103
+ class MyPlugin extends Plugin {
104
+ agents = [
105
+ {
106
+ name: 'code-agent',
107
+ role: '代码专家',
108
+ tools: {
109
+ compile: tool({
110
+ description: '编译',
111
+ parameters: z.object({ language: z.string(), code: z.string() }),
112
+ execute: async (args) => ({ success: true })
113
+ })
114
+ },
115
+ parentTools: ['read_file', 'write_file']
116
+ }
117
+ ]
118
+ }
119
+
120
+ // 方式2:手动调用
121
+ this.registerSubAgent({ name: 'code-agent', role: '代码专家', tools: {...}, parentTools: [...] })
122
+ ```
123
+
124
+ ## 系统提示中的部分
125
+
126
+ ```
127
+ 【可用工具】
128
+ - tool1: 描述
129
+ - tool2: 描述
130
+
131
+ 【可用技能】
132
+ - skill1: 描述
133
+ - skill2: 描述
134
+
135
+ 【子 Agent 分配规则】
136
+ - code-agent: 代码专家
137
+
138
+ 【系统能力】
139
+ - ai: AI 对话能力
140
+ - storage: 存储
141
+ ```
142
+
143
+ ## 状态管理
144
+
145
+ ```javascript
146
+ agent.getStatus(); // 'idle' | 'busy' | 'error'
147
+ agent.resetStatus(); // 重置状态
148
+ agent.clearHistory(); // 清空历史
149
+ ```
150
+
151
+ ## 配置持久化
152
+
153
+ 插件配置自动保存到 `.foliko/data/plugins-state.json`
154
+
155
+ | 文件 | 用途 |
156
+ | --------------------------------- | ------------------- |
157
+ | `.foliko/data/plugins-state.json` | 插件启用状态和配置 |
158
+ | `.foliko/data/storage.json` | 键值存储数据 |
159
+ | `.foliko/data/telegram_images/` | Telegram 接收的图片 |
160
+ | `.foliko/data/telegram_documents/` | Telegram 接收的文档 |