foliko 1.1.71 → 1.1.73
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/.cli_default_systemPrompt.md +242 -0
- package/.dockerignore +45 -45
- package/.env.example +56 -56
- package/cli/src/ui/chat-ui.js +15 -13
- package/docker-compose.yml +33 -33
- package/docs/features.md +120 -120
- package/docs/quick-reference.md +160 -160
- package/package.json +1 -1
- package/plugins/extension-executor-plugin.js +19 -45
- package/skills/find-skills/SKILL.md +133 -133
- package/skills/foliko-dev/AGENTS.md +236 -236
- package/skills/mcp-usage/SKILL.md +200 -200
- package/skills/subagent-guide/SKILL.md +237 -237
- package/skills/workflow-guide/SKILL.md +646 -646
- package/src/capabilities/skill-manager.js +103 -9
- package/src/core/agent-chat.js +10 -0
- package/website_v2/styles/animations.css +7 -7
|
@@ -1,236 +1,236 @@
|
|
|
1
|
-
# AGENTS.md
|
|
2
|
-
|
|
3
|
-
This file provides guidance to AI coding agents on how to create plugins for the Foliko Framework system.
|
|
4
|
-
|
|
5
|
-
## Plugin File Location
|
|
6
|
-
|
|
7
|
-
### User Plugins: `.foliko/plugins/` (auto-loaded)
|
|
8
|
-
|
|
9
|
-
User plugins go in `.foliko/plugins/` and are **automatically loaded** on bootstrap.
|
|
10
|
-
|
|
11
|
-
**Recommended: Use folder structure for complex plugins**
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
项目目录/
|
|
15
|
-
└── .foliko/
|
|
16
|
-
└── plugins/
|
|
17
|
-
├── my-plugin/ ✅ folder structure (recommended)
|
|
18
|
-
│ ├── package.json # optional, main field specifies entry
|
|
19
|
-
│ ├── index.js # default entry point
|
|
20
|
-
│ └── node_modules/ # optional, plugin-private dependencies
|
|
21
|
-
├── another-plugin/ ✅ another folder plugin
|
|
22
|
-
│ └── index.js
|
|
23
|
-
└── legacy.js ✅ single-file still supported
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
**Why folder structure?**
|
|
27
|
-
|
|
28
|
-
- Supports `package.json` with `main` field for custom entry points
|
|
29
|
-
- Supports `node_modules` for plugin-private dependencies
|
|
30
|
-
- Better organization for complex plugins
|
|
31
|
-
|
|
32
|
-
### Built-in Plugins: `plugins/` (internal)
|
|
33
|
-
|
|
34
|
-
Built-in framework plugins are in `plugins/` directory.
|
|
35
|
-
|
|
36
|
-
## Plugin Export Formats
|
|
37
|
-
|
|
38
|
-
### Folder structure (recommended for `.foliko/plugins/`)
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
.foliko/plugins/my-plugin/
|
|
42
|
-
├── package.json # optional
|
|
43
|
-
└── index.js # entry point
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
```json
|
|
47
|
-
// package.json example
|
|
48
|
-
{
|
|
49
|
-
"name": "my-plugin",
|
|
50
|
-
"main": "index.js"
|
|
51
|
-
}
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
```javascript
|
|
55
|
-
// .foliko/plugins/my-plugin/index.js
|
|
56
|
-
module.exports = function (Plugin) {
|
|
57
|
-
return class MyPlugin extends Plugin {
|
|
58
|
-
constructor(config = {}) {
|
|
59
|
-
super();
|
|
60
|
-
this.name = 'my-plugin';
|
|
61
|
-
this.version = '1.0.0';
|
|
62
|
-
this.description = '我的插件';
|
|
63
|
-
this.priority = 10;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
install(framework) {
|
|
67
|
-
const { z } = require('zod');
|
|
68
|
-
framework.registerTool({
|
|
69
|
-
name: 'my_tool',
|
|
70
|
-
description: '工具描述',
|
|
71
|
-
inputSchema: z.object({
|
|
72
|
-
param: z.string().describe('参数描述'),
|
|
73
|
-
}),
|
|
74
|
-
execute: async (args, framework) => {
|
|
75
|
-
return { success: true, result: args.param };
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
return this;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
uninstall(framework) {
|
|
82
|
-
// cleanup
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### Single-file structure (still supported)
|
|
89
|
-
|
|
90
|
-
```javascript
|
|
91
|
-
// .foliko/plugins/my-plugin.js
|
|
92
|
-
module.exports = function (Plugin) {
|
|
93
|
-
return class MyPlugin extends Plugin {
|
|
94
|
-
// ... same as above
|
|
95
|
-
};
|
|
96
|
-
};
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
**Key points:**
|
|
100
|
-
|
|
101
|
-
- `Plugin` base class passed automatically by system (no require needed)
|
|
102
|
-
- Factory function returns plugin class
|
|
103
|
-
- Use `require('zod')` inside methods
|
|
104
|
-
- Folder takes priority over single-file if both exist with same name
|
|
105
|
-
|
|
106
|
-
### Traditional format for `plugins/` (built-in)
|
|
107
|
-
|
|
108
|
-
```javascript
|
|
109
|
-
// plugins/my-plugin.js
|
|
110
|
-
const { Plugin } = require('../src/core/plugin-base');
|
|
111
|
-
const { z } = require('zod');
|
|
112
|
-
|
|
113
|
-
class MyPlugin extends Plugin {
|
|
114
|
-
constructor(config = {}) {
|
|
115
|
-
super();
|
|
116
|
-
this.name = 'my-plugin';
|
|
117
|
-
this.version = '1.0.0';
|
|
118
|
-
this.description = '我的插件';
|
|
119
|
-
this.priority = 10;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
install(framework) {
|
|
123
|
-
framework.registerTool({
|
|
124
|
-
name: 'my_tool',
|
|
125
|
-
description: '工具描述',
|
|
126
|
-
inputSchema: z.object({
|
|
127
|
-
param: z.string().describe('参数描述'),
|
|
128
|
-
}),
|
|
129
|
-
execute: async (args, framework) => {
|
|
130
|
-
return { success: true, result: args.param };
|
|
131
|
-
},
|
|
132
|
-
});
|
|
133
|
-
return this;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
uninstall(framework) {}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
module.exports = { MyPlugin };
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
## Plugin Properties
|
|
143
|
-
|
|
144
|
-
| Property | Type | Required | Description |
|
|
145
|
-
| ------------- | ------ | -------- | ------------------------- |
|
|
146
|
-
| `name` | string | ✅ | Unique name |
|
|
147
|
-
| `version` | string | ❌ | Version, default '1.0.0' |
|
|
148
|
-
| `description` | string | ❌ | Description |
|
|
149
|
-
| `priority` | number | ❌ | Load priority, default 10 |
|
|
150
|
-
|
|
151
|
-
## Lifecycle Methods
|
|
152
|
-
|
|
153
|
-
| Method | Called When | Required |
|
|
154
|
-
| ---------------------- | ------------------ | ----------- |
|
|
155
|
-
| `install(framework)` | Plugin installed | ✅ |
|
|
156
|
-
| `start(framework)` | Plugin started | Recommended |
|
|
157
|
-
| `reload(framework)` | Hot reload | Optional |
|
|
158
|
-
| `uninstall(framework)` | Plugin uninstalled | Recommended |
|
|
159
|
-
|
|
160
|
-
## Tool Registration
|
|
161
|
-
|
|
162
|
-
In `install()` method, register tools using `framework.registerTool()`:
|
|
163
|
-
|
|
164
|
-
```javascript
|
|
165
|
-
install(framework) {
|
|
166
|
-
const { z } = require('zod')
|
|
167
|
-
framework.registerTool({
|
|
168
|
-
name: 'my_tool',
|
|
169
|
-
description: '工具描述',
|
|
170
|
-
inputSchema: z.object({
|
|
171
|
-
param: z.string().describe('参数描述')
|
|
172
|
-
}),
|
|
173
|
-
execute: async (args, framework) => {
|
|
174
|
-
return { success: true, result: args.param }
|
|
175
|
-
}
|
|
176
|
-
})
|
|
177
|
-
return this
|
|
178
|
-
}
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
## Framework Object
|
|
182
|
-
|
|
183
|
-
The framework object provides:
|
|
184
|
-
|
|
185
|
-
| Method | Description |
|
|
186
|
-
| ----------------------------------- | ------------------------------- |
|
|
187
|
-
| `framework.registerTool(tool)` | Register tool |
|
|
188
|
-
| `framework.getTools()` | Get all tools |
|
|
189
|
-
| `framework.executeTool(name, args)` | Execute tool |
|
|
190
|
-
| `framework.callTool(name, args)` | Call tool (for installing deps) |
|
|
191
|
-
| `framework.createAgent(config)` | Create Agent |
|
|
192
|
-
| `framework.reloadPlugin(name)` | Reload single plugin |
|
|
193
|
-
| `framework.reloadAllPlugins()` | Reload all plugins |
|
|
194
|
-
|
|
195
|
-
## Dependency Management
|
|
196
|
-
|
|
197
|
-
Use the `install` tool to install npm packages:
|
|
198
|
-
|
|
199
|
-
| Plugin Type | Install Location | Command |
|
|
200
|
-
| ---------------------- | ------------------------------------------ | ----------------------------------------------------------------- |
|
|
201
|
-
| **Folder plugin** | `.foliko/plugins/plugin-name/node_modules/` | `install({ package: "pkg", path: ".foliko/plugins/plugin-name" })` |
|
|
202
|
-
| **Single-file plugin** | `.foliko/node_modules/` | `install({ package: "pkg" })` |
|
|
203
|
-
|
|
204
|
-
```javascript
|
|
205
|
-
// Folder plugin - install to plugin directory
|
|
206
|
-
await framework.callTool('install', {
|
|
207
|
-
package: 'axios',
|
|
208
|
-
path: '.foliko/plugins/my-plugin',
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
// Single-file plugin - install to .foliko
|
|
212
|
-
await framework.callTool('install', {
|
|
213
|
-
package: 'zod',
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
// Install from package.json
|
|
217
|
-
await framework.callTool('install', {
|
|
218
|
-
file: './my-plugin/package.json',
|
|
219
|
-
path: '.foliko/plugins/my-plugin',
|
|
220
|
-
});
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
**When encountering `Cannot find module 'xxx'` error:**
|
|
224
|
-
|
|
225
|
-
1. Identify plugin directory
|
|
226
|
-
2. Call `install` tool with `path` parameter for folder plugins
|
|
227
|
-
3. Reload plugin
|
|
228
|
-
4. Report status to user
|
|
229
|
-
|
|
230
|
-
## Common Mistakes
|
|
231
|
-
|
|
232
|
-
1. ❌ Forgetting `install()` - tools won't be registered
|
|
233
|
-
2. ❌ Forgetting `return this` - chain calls will fail
|
|
234
|
-
3. ❌ Using `parameters` instead of `inputSchema`
|
|
235
|
-
4. ❌ Registering tools outside `install()`
|
|
236
|
-
5. ❌ Using same name for folder and file - folder takes priority, file will be ignored
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to AI coding agents on how to create plugins for the Foliko Framework system.
|
|
4
|
+
|
|
5
|
+
## Plugin File Location
|
|
6
|
+
|
|
7
|
+
### User Plugins: `.foliko/plugins/` (auto-loaded)
|
|
8
|
+
|
|
9
|
+
User plugins go in `.foliko/plugins/` and are **automatically loaded** on bootstrap.
|
|
10
|
+
|
|
11
|
+
**Recommended: Use folder structure for complex plugins**
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
项目目录/
|
|
15
|
+
└── .foliko/
|
|
16
|
+
└── plugins/
|
|
17
|
+
├── my-plugin/ ✅ folder structure (recommended)
|
|
18
|
+
│ ├── package.json # optional, main field specifies entry
|
|
19
|
+
│ ├── index.js # default entry point
|
|
20
|
+
│ └── node_modules/ # optional, plugin-private dependencies
|
|
21
|
+
├── another-plugin/ ✅ another folder plugin
|
|
22
|
+
│ └── index.js
|
|
23
|
+
└── legacy.js ✅ single-file still supported
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Why folder structure?**
|
|
27
|
+
|
|
28
|
+
- Supports `package.json` with `main` field for custom entry points
|
|
29
|
+
- Supports `node_modules` for plugin-private dependencies
|
|
30
|
+
- Better organization for complex plugins
|
|
31
|
+
|
|
32
|
+
### Built-in Plugins: `plugins/` (internal)
|
|
33
|
+
|
|
34
|
+
Built-in framework plugins are in `plugins/` directory.
|
|
35
|
+
|
|
36
|
+
## Plugin Export Formats
|
|
37
|
+
|
|
38
|
+
### Folder structure (recommended for `.foliko/plugins/`)
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
.foliko/plugins/my-plugin/
|
|
42
|
+
├── package.json # optional
|
|
43
|
+
└── index.js # entry point
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
// package.json example
|
|
48
|
+
{
|
|
49
|
+
"name": "my-plugin",
|
|
50
|
+
"main": "index.js"
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```javascript
|
|
55
|
+
// .foliko/plugins/my-plugin/index.js
|
|
56
|
+
module.exports = function (Plugin) {
|
|
57
|
+
return class MyPlugin extends Plugin {
|
|
58
|
+
constructor(config = {}) {
|
|
59
|
+
super();
|
|
60
|
+
this.name = 'my-plugin';
|
|
61
|
+
this.version = '1.0.0';
|
|
62
|
+
this.description = '我的插件';
|
|
63
|
+
this.priority = 10;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
install(framework) {
|
|
67
|
+
const { z } = require('zod');
|
|
68
|
+
framework.registerTool({
|
|
69
|
+
name: 'my_tool',
|
|
70
|
+
description: '工具描述',
|
|
71
|
+
inputSchema: z.object({
|
|
72
|
+
param: z.string().describe('参数描述'),
|
|
73
|
+
}),
|
|
74
|
+
execute: async (args, framework) => {
|
|
75
|
+
return { success: true, result: args.param };
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
uninstall(framework) {
|
|
82
|
+
// cleanup
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Single-file structure (still supported)
|
|
89
|
+
|
|
90
|
+
```javascript
|
|
91
|
+
// .foliko/plugins/my-plugin.js
|
|
92
|
+
module.exports = function (Plugin) {
|
|
93
|
+
return class MyPlugin extends Plugin {
|
|
94
|
+
// ... same as above
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Key points:**
|
|
100
|
+
|
|
101
|
+
- `Plugin` base class passed automatically by system (no require needed)
|
|
102
|
+
- Factory function returns plugin class
|
|
103
|
+
- Use `require('zod')` inside methods
|
|
104
|
+
- Folder takes priority over single-file if both exist with same name
|
|
105
|
+
|
|
106
|
+
### Traditional format for `plugins/` (built-in)
|
|
107
|
+
|
|
108
|
+
```javascript
|
|
109
|
+
// plugins/my-plugin.js
|
|
110
|
+
const { Plugin } = require('../src/core/plugin-base');
|
|
111
|
+
const { z } = require('zod');
|
|
112
|
+
|
|
113
|
+
class MyPlugin extends Plugin {
|
|
114
|
+
constructor(config = {}) {
|
|
115
|
+
super();
|
|
116
|
+
this.name = 'my-plugin';
|
|
117
|
+
this.version = '1.0.0';
|
|
118
|
+
this.description = '我的插件';
|
|
119
|
+
this.priority = 10;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
install(framework) {
|
|
123
|
+
framework.registerTool({
|
|
124
|
+
name: 'my_tool',
|
|
125
|
+
description: '工具描述',
|
|
126
|
+
inputSchema: z.object({
|
|
127
|
+
param: z.string().describe('参数描述'),
|
|
128
|
+
}),
|
|
129
|
+
execute: async (args, framework) => {
|
|
130
|
+
return { success: true, result: args.param };
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
uninstall(framework) {}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
module.exports = { MyPlugin };
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Plugin Properties
|
|
143
|
+
|
|
144
|
+
| Property | Type | Required | Description |
|
|
145
|
+
| ------------- | ------ | -------- | ------------------------- |
|
|
146
|
+
| `name` | string | ✅ | Unique name |
|
|
147
|
+
| `version` | string | ❌ | Version, default '1.0.0' |
|
|
148
|
+
| `description` | string | ❌ | Description |
|
|
149
|
+
| `priority` | number | ❌ | Load priority, default 10 |
|
|
150
|
+
|
|
151
|
+
## Lifecycle Methods
|
|
152
|
+
|
|
153
|
+
| Method | Called When | Required |
|
|
154
|
+
| ---------------------- | ------------------ | ----------- |
|
|
155
|
+
| `install(framework)` | Plugin installed | ✅ |
|
|
156
|
+
| `start(framework)` | Plugin started | Recommended |
|
|
157
|
+
| `reload(framework)` | Hot reload | Optional |
|
|
158
|
+
| `uninstall(framework)` | Plugin uninstalled | Recommended |
|
|
159
|
+
|
|
160
|
+
## Tool Registration
|
|
161
|
+
|
|
162
|
+
In `install()` method, register tools using `framework.registerTool()`:
|
|
163
|
+
|
|
164
|
+
```javascript
|
|
165
|
+
install(framework) {
|
|
166
|
+
const { z } = require('zod')
|
|
167
|
+
framework.registerTool({
|
|
168
|
+
name: 'my_tool',
|
|
169
|
+
description: '工具描述',
|
|
170
|
+
inputSchema: z.object({
|
|
171
|
+
param: z.string().describe('参数描述')
|
|
172
|
+
}),
|
|
173
|
+
execute: async (args, framework) => {
|
|
174
|
+
return { success: true, result: args.param }
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
return this
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Framework Object
|
|
182
|
+
|
|
183
|
+
The framework object provides:
|
|
184
|
+
|
|
185
|
+
| Method | Description |
|
|
186
|
+
| ----------------------------------- | ------------------------------- |
|
|
187
|
+
| `framework.registerTool(tool)` | Register tool |
|
|
188
|
+
| `framework.getTools()` | Get all tools |
|
|
189
|
+
| `framework.executeTool(name, args)` | Execute tool |
|
|
190
|
+
| `framework.callTool(name, args)` | Call tool (for installing deps) |
|
|
191
|
+
| `framework.createAgent(config)` | Create Agent |
|
|
192
|
+
| `framework.reloadPlugin(name)` | Reload single plugin |
|
|
193
|
+
| `framework.reloadAllPlugins()` | Reload all plugins |
|
|
194
|
+
|
|
195
|
+
## Dependency Management
|
|
196
|
+
|
|
197
|
+
Use the `install` tool to install npm packages:
|
|
198
|
+
|
|
199
|
+
| Plugin Type | Install Location | Command |
|
|
200
|
+
| ---------------------- | ------------------------------------------ | ----------------------------------------------------------------- |
|
|
201
|
+
| **Folder plugin** | `.foliko/plugins/plugin-name/node_modules/` | `install({ package: "pkg", path: ".foliko/plugins/plugin-name" })` |
|
|
202
|
+
| **Single-file plugin** | `.foliko/node_modules/` | `install({ package: "pkg" })` |
|
|
203
|
+
|
|
204
|
+
```javascript
|
|
205
|
+
// Folder plugin - install to plugin directory
|
|
206
|
+
await framework.callTool('install', {
|
|
207
|
+
package: 'axios',
|
|
208
|
+
path: '.foliko/plugins/my-plugin',
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
// Single-file plugin - install to .foliko
|
|
212
|
+
await framework.callTool('install', {
|
|
213
|
+
package: 'zod',
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
// Install from package.json
|
|
217
|
+
await framework.callTool('install', {
|
|
218
|
+
file: './my-plugin/package.json',
|
|
219
|
+
path: '.foliko/plugins/my-plugin',
|
|
220
|
+
});
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
**When encountering `Cannot find module 'xxx'` error:**
|
|
224
|
+
|
|
225
|
+
1. Identify plugin directory
|
|
226
|
+
2. Call `install` tool with `path` parameter for folder plugins
|
|
227
|
+
3. Reload plugin
|
|
228
|
+
4. Report status to user
|
|
229
|
+
|
|
230
|
+
## Common Mistakes
|
|
231
|
+
|
|
232
|
+
1. ❌ Forgetting `install()` - tools won't be registered
|
|
233
|
+
2. ❌ Forgetting `return this` - chain calls will fail
|
|
234
|
+
3. ❌ Using `parameters` instead of `inputSchema`
|
|
235
|
+
4. ❌ Registering tools outside `install()`
|
|
236
|
+
5. ❌ Using same name for folder and file - folder takes priority, file will be ignored
|