foliko 2.0.4 → 2.0.6
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 +4 -1
- package/.cli_default_systemPrompt.md +291 -0
- package/CLAUDE.md +3 -0
- package/README.md +20 -3
- package/docs/architecture.md +34 -2
- package/docs/extensions.md +199 -0
- package/docs/migration.md +100 -0
- package/docs/public-api.md +1180 -6
- package/docs/usage.md +122 -30
- package/package.json +1 -1
- package/plugins/core/audit/index.js +1 -1
- package/plugins/core/default/bootstrap.js +65 -19
- package/plugins/core/python-loader/index.js +43 -25
- package/plugins/core/skill-manager/PROMPT.md +6 -0
- package/plugins/core/skill-manager/index.js +538 -93
- package/plugins/core/sub-agent/PROMPT.md +10 -0
- package/plugins/core/sub-agent/index.js +36 -3
- package/plugins/core/think/index.js +1 -0
- package/plugins/core/workflow/index.js +106 -22
- package/plugins/executors/data-splitter/PROMPT.md +13 -0
- package/plugins/executors/data-splitter/index.js +5 -4
- package/plugins/executors/extension/extension-registry.js +145 -0
- package/plugins/executors/extension/index.js +405 -437
- package/plugins/executors/extension/prompt-builder.js +359 -0
- package/plugins/executors/extension/skill-helper.js +143 -0
- package/plugins/messaging/feishu/index.js +5 -3
- package/plugins/messaging/qq/index.js +6 -4
- package/plugins/messaging/telegram/index.js +6 -3
- package/plugins/messaging/weixin/index.js +5 -3
- package/plugins/tools/PROMPT.md +26 -0
- package/plugins/tools/index.js +6 -5
- package/skills/foliko/AGENTS.md +196 -43
- package/skills/foliko/SKILL.md +157 -28
- package/skills/mcp/SKILL.md +77 -118
- package/skills/plugins/SKILL.md +89 -3
- package/skills/python/SKILL.md +57 -39
- package/skills/skill-guide/SKILL.md +42 -34
- package/skills/workflows/SKILL.md +224 -9
- package/skills/workflows/workflow-troubleshooting/SKILL.md +221 -281
- package/src/agent/chat.js +48 -27
- package/src/agent/main.js +34 -13
- package/src/agent/prompt-registry.js +133 -87
- package/src/agent/prompts/PROMPT.md +3 -0
- package/src/agent/sub.js +1 -1
- package/src/cli/ui/chat-ui-old.js +5 -2
- package/src/cli/ui/chat-ui.js +5 -2
- package/src/common/constants.js +12 -0
- package/src/common/error-capture.js +91 -0
- package/src/common/logger.js +2 -2
- package/src/context/compressor.js +6 -2
- package/src/executors/mcp-executor.js +105 -125
- package/src/framework/framework.js +632 -6
- package/src/index.js +4 -0
- package/src/plugin/base.js +913 -10
- package/src/plugin/manager.js +29 -8
- package/src/tool/schema.js +32 -9
- package/tests/core/plugin-prompts.test.js +13 -13
- package/tests/core/prompt-registry.test.js +59 -51
- package/website/index.html +821 -0
package/docs/migration.md
CHANGED
|
@@ -55,3 +55,103 @@
|
|
|
55
55
|
|------|------|
|
|
56
56
|
| `_setReady()` | 标记框架就绪并触发 `framework:ready` 事件 |
|
|
57
57
|
| `isEnabled(name)` | 代理到 `pluginManager.isEnabled()` |
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 扩展调用统一重构(v2.x → v3.x)
|
|
62
|
+
|
|
63
|
+
### 背景
|
|
64
|
+
|
|
65
|
+
之前 MCP 工具调用有自己的 `mcp_call` / `mcp_tool_schema`,Skill 命令使用 `args.command: "<string>"` 字符串模式,与其他扩展的 Zod 结构化参数风格不一致。本次重构统一了所有"非 AI SDK 直调"的工具调用方式。
|
|
66
|
+
|
|
67
|
+
### 旧 → 新对照
|
|
68
|
+
|
|
69
|
+
#### 1. MCP 工具调用
|
|
70
|
+
|
|
71
|
+
| 旧方式 | 新方式 |
|
|
72
|
+
|---|---|
|
|
73
|
+
| `mcp_call({ server, tool, args_json: '{"x":"y"}' })` | `ext_call({ plugin: "mcp:<server>", tool, args: { x: "y" } })` |
|
|
74
|
+
| `mcp_tool_schema({ server, tool })` | `ext_skill({ plugin: "mcp:<server>" })` |
|
|
75
|
+
| 工具名带前缀:`designmd_search_design_kits` | 原始 MCP 名:`search_design_kits` |
|
|
76
|
+
|
|
77
|
+
**移除的工具**:`mcp_call`、`mcp_tool_schema`(不再注册)
|
|
78
|
+
|
|
79
|
+
#### 2. Skill 命令调用
|
|
80
|
+
|
|
81
|
+
Skill 命令通过 `skill:<name>` 命名空间调用:
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
ext_call({
|
|
85
|
+
plugin: "skill:my-skill", // skill:<name>
|
|
86
|
+
tool: "cmd", // 命令名(不是 <skill>:<cmd>)
|
|
87
|
+
args: { command: "-n x -v" }
|
|
88
|
+
})
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**要点**:
|
|
92
|
+
- 每个 skill 是独立扩展 `skill:<name>`
|
|
93
|
+
- 命令是该扩展下的 tool
|
|
94
|
+
- `args: { command: "..." }` 传命令行字符串
|
|
95
|
+
- Commander.js 解析后传给 handler
|
|
96
|
+
|
|
97
|
+
#### 3. ext_skill 返回内容
|
|
98
|
+
|
|
99
|
+
`ext_skill({ plugin })` 通用返回(普通扩展):
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
#### `<tool_name>`
|
|
103
|
+
|
|
104
|
+
<description>
|
|
105
|
+
|
|
106
|
+
**参数:**
|
|
107
|
+
- field
|
|
108
|
+
- Type
|
|
109
|
+
- ...
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`ext_skill({ plugin: "skill:<name>" })` 增强返回:
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
# Skill: <name>
|
|
116
|
+
|
|
117
|
+
**<description>**
|
|
118
|
+
|
|
119
|
+
## 技能说明
|
|
120
|
+
|
|
121
|
+
<SKILL.md 内容(剥掉 frontmatter)>
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## 调用规则
|
|
126
|
+
|
|
127
|
+
> 通过 `ext_call({ plugin: "skill:<name>", tool: "<command>", args: {...} })` 调用
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## 可用命令
|
|
132
|
+
|
|
133
|
+
### `<command>`
|
|
134
|
+
|
|
135
|
+
<description>
|
|
136
|
+
|
|
137
|
+
**参数:**
|
|
138
|
+
- ...
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### 内部变更
|
|
142
|
+
|
|
143
|
+
- `plugins/executors/extension/prompt-builder.js`:MCP 特殊处理移除,所有扩展统一通过 `zodSchemaToMarkdown` 渲染
|
|
144
|
+
- `plugins/executors/extension/skill-helper.js`:按 `skill:<name>` 命名空间迭代
|
|
145
|
+
- `src/plugin/base.js`:`Plugin` 基类新增 `skill` accessor(`register`/`get`/`has`/`remove`/`list`/`details`/`listOwned`/`execute`)
|
|
146
|
+
- `src/tool/schema.js`:`jsonSchemaToZod` 重构,避免嵌套 `Optional` 包装
|
|
147
|
+
|
|
148
|
+
### Plugin 基类新增 accessor
|
|
149
|
+
|
|
150
|
+
| Accessor | 用途 |
|
|
151
|
+
|---|---|
|
|
152
|
+
| `this.skill.register(name, content, metadata, options)` | 程序化注册技能 |
|
|
153
|
+
| `this.skill.get(name)` / `this.skill.has(name)` | 查询 |
|
|
154
|
+
| `this.skill.details(name)` | 结构化详情 |
|
|
155
|
+
| `this.skill.list()` / `this.skill.listOwned()` | 列表 |
|
|
156
|
+
| `this.skill.remove(name)` | 删除 |
|
|
157
|
+
| `this.skill.execute('<skill>:<cmd>', args)` | 直接执行 |
|