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.
- package/.claude/settings.local.json +19 -10
- package/.dockerignore +45 -45
- package/.env.example +56 -56
- package/CLAUDE.md +2 -2
- package/README.md +13 -13
- package/SPEC.md +3 -3
- package/cli/src/commands/chat.js +2 -20
- package/cli/src/commands/list.js +7 -6
- package/cli/src/commands/plugin.js +3 -2
- package/cli/src/daemon.js +2 -2
- package/cli/src/ui/chat-ui-old.js +15 -4
- package/cli/src/ui/chat-ui.js +152 -38
- package/cli/src/ui/footer-bar.js +13 -14
- package/cli/src/utils/config.js +29 -0
- package/cli/src/utils/plugin-config.js +1 -1
- package/docker-compose.yml +33 -33
- package/docs/features.md +120 -120
- package/docs/quick-reference.md +160 -160
- package/docs/user-manual.md +1391 -1391
- package/examples/ambient-example.js +2 -2
- package/examples/bootstrap.js +3 -3
- package/examples/test-chat.js +1 -1
- package/examples/test-reload.js +1 -1
- package/examples/test-telegram.js +1 -1
- package/examples/test-tg-bot.js +1 -1
- package/examples/test-tg-simple.js +2 -2
- package/examples/test-tg.js +1 -1
- package/examples/test-think.js +1 -1
- package/examples/test-weixin-feishu.js +3 -3
- package/package.json +3 -1
- package/plugins/ambient-agent/index.js +1 -1
- package/plugins/audit-plugin.js +75 -24
- package/plugins/default-plugins.js +21 -11
- package/plugins/email/index.js +1 -1
- package/plugins/extension-executor-plugin.js +85 -7
- package/plugins/feishu-plugin.js +118 -16
- package/plugins/install-plugin.js +4 -4
- package/plugins/memory-plugin.js +1 -1
- package/plugins/plugin-manager-plugin.js +3 -3
- package/plugins/python-executor-plugin.js +1 -1
- package/plugins/python-plugin-loader.js +1 -1
- package/plugins/qq-plugin.js +143 -16
- package/plugins/rules-plugin.js +1 -1
- package/plugins/scheduler-plugin.js +2 -2
- package/plugins/session-plugin.js +309 -393
- package/plugins/storage-plugin.js +235 -176
- package/plugins/subagent-plugin.js +4 -4
- package/plugins/telegram-plugin.js +116 -17
- package/plugins/think-plugin.js +1 -1
- package/plugins/web-plugin.js +2 -2
- package/plugins/weixin-plugin.js +102 -19
- package/skills/find-skills/AGENTS.md +2 -2
- package/skills/find-skills/SKILL.md +133 -133
- package/skills/foliko-dev/AGENTS.md +236 -236
- package/skills/foliko-dev/SKILL.md +19 -19
- package/skills/mcp-usage/SKILL.md +200 -200
- package/skills/plugin-guide/SKILL.md +4 -4
- package/skills/python-plugin-dev/SKILL.md +5 -5
- package/skills/skill-guide/SKILL.md +104 -6
- package/skills/subagent-guide/SKILL.md +237 -237
- package/skills/workflow-guide/SKILL.md +646 -646
- package/src/capabilities/skill-manager.js +101 -2
- package/src/capabilities/workflow-engine.js +1 -1
- package/src/core/agent-chat.js +17 -14
- package/src/core/branch-summary-auto.js +206 -0
- package/src/core/chat-session.js +38 -8
- package/src/core/command-registry.js +200 -0
- package/src/core/constants.js +11 -11
- package/src/core/context-compressor.js +700 -149
- package/src/core/context-manager.js +0 -1
- package/src/core/enhanced-context-compressor.js +210 -0
- package/src/core/framework.js +140 -83
- package/src/core/jsonl-storage.js +253 -0
- package/src/core/plugin-manager.js +15 -10
- package/src/core/provider-registry.js +159 -0
- package/src/core/provider.js +2 -0
- package/src/core/session-entry.js +225 -0
- package/src/core/session-manager.js +701 -0
- package/src/core/storage-manager.js +494 -0
- package/src/core/sub-agent-config.js +1 -1
- package/src/core/token-counter.js +177 -58
- package/src/core/ui-extension-context.js +174 -0
- package/src/executors/mcp-executor.js +15 -6
- package/src/utils/logger.js +152 -180
- package/src/utils/plugin-helpers.js +2 -2
- package/website_v2/docs/api.html +1 -1
- package/website_v2/docs/configuration.html +2 -2
- package/website_v2/docs/plugin-development.html +4 -4
- package/website_v2/docs/project-structure.html +2 -2
- package/website_v2/docs/skill-development.html +2 -2
- package/website_v2/index.html +1 -1
- package/website_v2/styles/animations.css +7 -7
- package/.agent/agents/backend-dev.md +0 -102
- package/.agent/agents/data-analyst.md +0 -117
- package/.agent/agents/devops.md +0 -115
- package/.agent/agents/frontend-dev.md +0 -94
- package/.agent/agents/network-requester.md +0 -44
- package/.agent/agents/poster-designer.md +0 -52
- package/.agent/agents/product-manager.md +0 -85
- package/.agent/agents/qa-engineer.md +0 -100
- package/.agent/agents/security-engineer.md +0 -99
- package/.agent/agents/team-lead.md +0 -137
- package/.agent/agents/ui-designer.md +0 -116
- package/.agent/data/default.json +0 -58
- package/.agent/data/email/processed-emails.json +0 -1
- package/.agent/data/plugins-state.json +0 -207
- package/.agent/data/scheduler/tasks.json +0 -1
- package/.agent/data/web/web-config.json +0 -5
- package/.agent/data/weixin/images/file_1776188148383jpg +0 -0
- package/.agent/data/weixin/images/file_1776188458326.jpg +0 -0
- package/.agent/data/weixin/images/file_1776188689423.jpg +0 -0
- package/.agent/data/weixin/images/file_1776188813604.jpg +0 -0
- package/.agent/data/weixin/images/file_1776189097450.jpg +0 -0
- package/.agent/data/weixin/videos/file_1776188318431.mp4 +0 -0
- package/.agent/data/weixin.json +0 -6
- package/.agent/mcp_config.json +0 -14
- package/.agent/memory/user/mof6gk94-kneeuh.md +0 -9
- package/.agent/package.json +0 -8
- package/.agent/plugins/marknative/README.md +0 -134
- package/.agent/plugins/marknative/fonts/SegoeUI Emoji.ttf +0 -0
- package/.agent/plugins/marknative/fonts.zip +0 -0
- package/.agent/plugins/marknative/index.js +0 -256
- package/.agent/plugins/marknative/package.json +0 -12
- package/.agent/plugins/test-plugin.py +0 -99
- package/.agent/plugins.json +0 -14
- package/.agent/python-scripts/test_sample.py +0 -24
- package/.agent/sessions/cli_default.json +0 -4121
- package/.agent/skills/agent-browser/SKILL.md +0 -311
- package/.agent/skills/agent-browser/TEST_PLAN.md +0 -200
- package/.agent/skills/sysinfo/SKILL.md +0 -38
- package/.agent/skills/sysinfo/system-info.sh +0 -130
- package/.agent/skills/workflow/SKILL.md +0 -324
- package/.agent/test-agent.js +0 -35
- package/.agent/weixin.json +0 -6
- package/.agent/workflows/email-digest.json +0 -50
- package/.agent/workflows/file-backup.json +0 -21
- package/.agent/workflows/get-ip-notify.json +0 -32
- package/.agent/workflows/news-aggregator.json +0 -93
- package/.agent/workflows/news-dashboard-v2.json +0 -94
- package/.agent/workflows/notification-batch.json +0 -32
- package/src/core/session-context.js +0 -346
- package/src/core/session-storage.js +0 -295
package/docs/quick-reference.md
CHANGED
|
@@ -1,160 +1,160 @@
|
|
|
1
|
-
# Foliko 快速参考
|
|
2
|
-
|
|
3
|
-
## 启动框架
|
|
4
|
-
|
|
5
|
-
```javascript
|
|
6
|
-
const framework = new Framework({ debug: false });
|
|
7
|
-
await framework.bootstrap({
|
|
8
|
-
agentDir: './.
|
|
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
|
-
- 用户插件:`.
|
|
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
|
-
插件配置自动保存到 `.
|
|
154
|
-
|
|
155
|
-
| 文件 | 用途 |
|
|
156
|
-
| --------------------------------- | ------------------- |
|
|
157
|
-
| `.
|
|
158
|
-
| `.
|
|
159
|
-
| `.
|
|
160
|
-
| `.
|
|
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 接收的文档 |
|